etisserant@137: #ifndef IEC_TYPES_H etisserant@137: #define IEC_TYPES_H etisserant@137: etisserant@59: #include etisserant@59: #include etisserant@59: #include etisserant@59: etisserant@59: /*********************/ etisserant@59: /* IEC Types defs */ etisserant@59: /*********************/ etisserant@59: etisserant@59: typedef uint8_t IEC_BOOL; etisserant@59: etisserant@59: typedef int8_t IEC_SINT; etisserant@59: typedef int16_t IEC_INT; etisserant@59: typedef int32_t IEC_DINT; etisserant@59: typedef int64_t IEC_LINT; etisserant@59: etisserant@59: typedef uint8_t IEC_USINT; etisserant@59: typedef uint16_t IEC_UINT; etisserant@59: typedef uint32_t IEC_UDINT; etisserant@59: typedef uint64_t IEC_ULINT; etisserant@59: etisserant@59: typedef uint8_t IEC_BYTE; etisserant@59: typedef uint16_t IEC_WORD; etisserant@59: typedef uint32_t IEC_DWORD; etisserant@59: typedef uint64_t IEC_LWORD; etisserant@59: etisserant@59: typedef float IEC_REAL; etisserant@59: typedef double IEC_LREAL; etisserant@59: mjsousa@900: /* WARNING: When editing the definition of IEC_TIMESPEC, take note that mjsousa@900: * if the order of the two elements 'tv_sec' and 'tv_nsec' is changed, then the macros mjsousa@900: * __time_to_timespec() and __tod_to_timespec() will need to be changed accordingly. mjsousa@900: * (these macros may be found in iec_std_lib.h) mjsousa@900: */ Edouard@254: typedef struct { etisserant@59: long int tv_sec; /* Seconds. */ etisserant@59: long int tv_nsec; /* Nanoseconds. */ msousa@742: } /* __attribute__((packed)) */ IEC_TIMESPEC; /* packed is gcc specific! */ etisserant@59: Edouard@254: typedef IEC_TIMESPEC IEC_TIME; Edouard@254: typedef IEC_TIMESPEC IEC_DATE; Edouard@254: typedef IEC_TIMESPEC IEC_DT; Edouard@254: typedef IEC_TIMESPEC IEC_TOD; etisserant@59: etisserant@161: #ifndef STR_MAX_LEN lbessard@170: #define STR_MAX_LEN 126 etisserant@161: #endif etisserant@161: etisserant@161: #ifndef STR_LEN_TYPE etisserant@163: #define STR_LEN_TYPE int8_t etisserant@161: #endif etisserant@161: Edouard@818: #define __INIT_REAL 0 Edouard@818: #define __INIT_LREAL 0 Edouard@818: #define __INIT_SINT 0 Edouard@818: #define __INIT_INT 0 Edouard@818: #define __INIT_DINT 0 Edouard@818: #define __INIT_LINT 0 Edouard@818: #define __INIT_USINT 0 Edouard@818: #define __INIT_UINT 0 Edouard@818: #define __INIT_UDINT 0 Edouard@818: #define __INIT_ULINT 0 Edouard@818: #define __INIT_TIME (TIME){0,0} Edouard@818: #define __INIT_BOOL 0 Edouard@818: #define __INIT_BYTE 0 Edouard@818: #define __INIT_WORD 0 Edouard@818: #define __INIT_DWORD 0 Edouard@818: #define __INIT_LWORD 0 Edouard@818: #define __INIT_STRING (STRING){0,""} Edouard@818: //#define __INIT_WSTRING Edouard@818: #define __INIT_DATE (DATE){0,0} Edouard@818: #define __INIT_TOD (TOD){0,0} Edouard@818: #define __INIT_DT (DT){0,0} Edouard@818: etisserant@161: typedef STR_LEN_TYPE __strlen_t; etisserant@59: typedef struct { etisserant@59: __strlen_t len; etisserant@59: uint8_t body[STR_MAX_LEN]; msousa@742: } /* __attribute__((packed)) */ IEC_STRING; /* packed is gcc specific! */ etisserant@59: etisserant@137: #endif /*IEC_TYPES_H*/