25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

87 satır
3.1 KiB

  1. #ifndef PLC_DEVICE_H
  2. #define PLC_DEVICE_H
  3. #include "plsr_address_map.h"
  4. #include "plsr_persistence.h"
  5. #include <stdint.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. typedef enum
  10. {
  11. PLC_DEVICE_OK = 0,
  12. PLC_DEVICE_INVALID_ADDRESS,
  13. PLC_DEVICE_INVALID_ARGUMENT,
  14. PLC_DEVICE_NULL_POINTER,
  15. PLC_DEVICE_READ_ONLY,
  16. PLC_DEVICE_PERSISTENCE_ERROR,
  17. PLC_DEVICE_NOT_IMPLEMENTED,
  18. PLC_DEVICE_BUSY
  19. } PLC_DEVICE_RESULT;
  20. typedef struct
  21. {
  22. uint32_t count;
  23. uint16_t lastReason;
  24. uint8_t pending;
  25. } PLC_DEVICE_EVENT_RECORD;
  26. PLC_DEVICE_RESULT PlcDeviceInit(void);
  27. PLC_DEVICE_RESULT PlcDeviceReadHsd(uint16_t address, uint16_t *value);
  28. PLC_DEVICE_RESULT PlcDeviceWriteHsdConfig(uint16_t address, uint16_t value);
  29. PLC_DEVICE_RESULT PlcDevicePublishHsdRuntime(uint16_t address, uint16_t value);
  30. PLC_DEVICE_RESULT PlcDeviceReadHsdDword(uint16_t lowAddress, int32_t *value);
  31. PLC_DEVICE_RESULT PlcDevicePublishHsdDword(uint16_t lowAddress, int32_t value);
  32. PLC_DEVICE_RESULT PlcDeviceCheckpointHsd(void);
  33. PLC_DEVICE_RESULT PlcDeviceSetHsdCheckpointMeta(uint8_t positionValid,
  34. uint8_t lastBusy);
  35. uint8_t PlcDeviceGetRestoredHsdPositionValid(void);
  36. uint8_t PlcDeviceGetRestoredHsdLastBusy(void);
  37. PLC_DEVICE_RESULT PlcDeviceReadSfd(uint16_t address, uint16_t *value);
  38. PLC_DEVICE_RESULT PlcDeviceWriteSfd(uint16_t address, uint16_t value);
  39. PLC_DEVICE_RESULT PlcDeviceLoadSfd(void);
  40. PLC_DEVICE_RESULT PlcDeviceSaveSfd(void);
  41. PLC_DEVICE_RESULT PlcDeviceResetSfdDefaults(void);
  42. PLC_DEVICE_RESULT PlcDeviceReadSm(uint16_t address, uint8_t *state);
  43. PLC_DEVICE_RESULT PlcDeviceWriteSm(uint16_t address, uint8_t state);
  44. PLC_DEVICE_RESULT PlcDevicePublishSm(uint8_t axis,
  45. uint8_t pulseActive,
  46. uint8_t direction);
  47. PLC_DEVICE_RESULT PlcDeviceReadSd(uint16_t address, int32_t *value);
  48. PLC_DEVICE_RESULT PlcDeviceWriteSd(uint16_t address, int32_t value);
  49. PLC_DEVICE_RESULT PlcDeviceReadSdDword(uint16_t lowAddress, int32_t *value);
  50. PLC_DEVICE_RESULT PlcDevicePublishSd(uint8_t axis,
  51. uint8_t item,
  52. int32_t value);
  53. PLC_DEVICE_RESULT PlcDevicePublishSdDword(uint8_t axis,
  54. uint8_t lowItem,
  55. int32_t value);
  56. PLC_DEVICE_RESULT PlcDeviceGetEventAddress(uint8_t axis,
  57. uint16_t segmentNumber,
  58. uint16_t *eventAddress);
  59. PLC_DEVICE_RESULT PlcDevicePublishEvent(uint8_t axis,
  60. uint16_t segmentNumber,
  61. uint16_t reason);
  62. PLC_DEVICE_RESULT PlcDeviceReadEvent(uint16_t eventAddress,
  63. PLC_DEVICE_EVENT_RECORD *record);
  64. PLC_DEVICE_RESULT PlcDeviceAcknowledgeEvent(uint16_t eventAddress);
  65. uint8_t PlcDeviceIsHsdDirty(void);
  66. uint8_t PlcDeviceIsSfdDirty(void);
  67. PLSR_PERSISTENCE_RESULT PlcDeviceGetLastHsdLoadResult(void);
  68. PLSR_PERSISTENCE_RESULT PlcDeviceGetLastSfdLoadResult(void);
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif /* PLC_DEVICE_H */