|
- #ifndef PLC_DEVICE_H
- #define PLC_DEVICE_H
-
- #include "plsr_address_map.h"
- #include "plsr_persistence.h"
- #include <stdint.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef enum
- {
- PLC_DEVICE_OK = 0,
- PLC_DEVICE_INVALID_ADDRESS,
- PLC_DEVICE_INVALID_ARGUMENT,
- PLC_DEVICE_NULL_POINTER,
- PLC_DEVICE_READ_ONLY,
- PLC_DEVICE_PERSISTENCE_ERROR,
- PLC_DEVICE_NOT_IMPLEMENTED,
- PLC_DEVICE_BUSY
- } PLC_DEVICE_RESULT;
-
- PLC_DEVICE_RESULT PlcDeviceInit(void);
-
- PLC_DEVICE_RESULT PlcDeviceReadHsd(uint16_t address, uint16_t *value);
- PLC_DEVICE_RESULT PlcDeviceWriteHsdConfig(uint16_t address, uint16_t value);
- PLC_DEVICE_RESULT PlcDevicePublishHsdRuntime(uint16_t address, uint16_t value);
- PLC_DEVICE_RESULT PlcDeviceReadHsdDword(uint16_t lowAddress, int32_t *value);
- PLC_DEVICE_RESULT PlcDevicePublishHsdDword(uint16_t lowAddress, int32_t value);
- PLC_DEVICE_RESULT PlcDeviceCheckpointHsd(void);
-
- PLC_DEVICE_RESULT PlcDeviceSetHsdCheckpointMeta(uint8_t positionValid,
- uint8_t lastBusy);
- uint8_t PlcDeviceGetRestoredHsdPositionValid(void);
- uint8_t PlcDeviceGetRestoredHsdLastBusy(void);
-
- PLC_DEVICE_RESULT PlcDeviceReadSfd(uint16_t address, uint16_t *value);
- PLC_DEVICE_RESULT PlcDeviceWriteSfd(uint16_t address, uint16_t value);
- PLC_DEVICE_RESULT PlcDeviceLoadSfd(void);
- PLC_DEVICE_RESULT PlcDeviceSaveSfd(void);
- PLC_DEVICE_RESULT PlcDeviceResetSfdDefaults(void);
-
- PLC_DEVICE_RESULT PlcDeviceReadSm(uint16_t address, uint8_t *state);
- PLC_DEVICE_RESULT PlcDeviceWriteSm(uint16_t address, uint8_t state);
- PLC_DEVICE_RESULT PlcDevicePublishSm(uint8_t axis,
- uint8_t pulseActive,
- uint8_t direction);
-
- PLC_DEVICE_RESULT PlcDeviceReadSd(uint16_t address, int32_t *value);
- PLC_DEVICE_RESULT PlcDeviceWriteSd(uint16_t address, int32_t value);
- PLC_DEVICE_RESULT PlcDevicePublishSd(uint8_t axis,
- uint8_t item,
- int32_t value);
-
- PLC_DEVICE_RESULT PlcDeviceGetEventAddress(uint8_t axis,
- uint16_t segmentNumber,
- uint16_t *eventAddress);
-
- uint8_t PlcDeviceIsHsdDirty(void);
- uint8_t PlcDeviceIsSfdDirty(void);
- PLSR_PERSISTENCE_RESULT PlcDeviceGetLastHsdLoadResult(void);
- PLSR_PERSISTENCE_RESULT PlcDeviceGetLastSfdLoadResult(void);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* PLC_DEVICE_H */
|