lib/iec_types.h
changeset 254 28bd86c56793
parent 212 8c9ec7d37d3a
child 256 101c7f148b9a
equal deleted inserted replaced
253:18988de676ac 254:28bd86c56793
     1 #ifndef IEC_TYPES_H
     1 #ifndef IEC_TYPES_H
     2 #define IEC_TYPES_H
     2 #define IEC_TYPES_H
     3 
     3 
     4 #include <limits.h>
     4 #include <limits.h>
     5 #include <float.h>
     5 #include <float.h>
     6 #include <time.h>
       
     7 #include <stdint.h>
     6 #include <stdint.h>
     8 
     7 
     9 /*********************/
     8 /*********************/
    10 /*  IEC Types defs   */
     9 /*  IEC Types defs   */
    11 /*********************/
    10 /*********************/
    28 typedef uint64_t   IEC_LWORD;
    27 typedef uint64_t   IEC_LWORD;
    29 
    28 
    30 typedef float    IEC_REAL;
    29 typedef float    IEC_REAL;
    31 typedef double   IEC_LREAL;
    30 typedef double   IEC_LREAL;
    32 
    31 
    33 
    32 #pragma pack(push,1)
    34 #if !defined __timespec_defined && !defined __time_t_defined
    33 typedef struct {
    35 # define __timespec_defined     1
       
    36 
       
    37 struct timespec
       
    38   {
       
    39     long int tv_sec;            /* Seconds.  */
    34     long int tv_sec;            /* Seconds.  */
    40     long int tv_nsec;           /* Nanoseconds.  */
    35     long int tv_nsec;           /* Nanoseconds.  */
    41   };
    36 }IEC_TIMESPEC;
       
    37 #pragma pack(pop)
    42 
    38 
    43 #endif
    39 typedef IEC_TIMESPEC IEC_TIME;
    44 
    40 typedef IEC_TIMESPEC IEC_DATE;
    45 typedef struct timespec IEC_TIME;
    41 typedef IEC_TIMESPEC IEC_DT;
    46 typedef struct timespec IEC_DATE;
    42 typedef IEC_TIMESPEC IEC_TOD;
    47 typedef struct timespec IEC_DT;
       
    48 typedef struct timespec IEC_TOD;
       
    49 
    43 
    50 #ifndef STR_MAX_LEN
    44 #ifndef STR_MAX_LEN
    51 #define STR_MAX_LEN 126
    45 #define STR_MAX_LEN 126
    52 #endif
    46 #endif
    53 
    47 
    54 #ifndef STR_LEN_TYPE
    48 #ifndef STR_LEN_TYPE
    55 #define STR_LEN_TYPE int8_t
    49 #define STR_LEN_TYPE int8_t
    56 #endif
    50 #endif
    57 
    51 
    58 typedef STR_LEN_TYPE __strlen_t;
    52 typedef STR_LEN_TYPE __strlen_t;
       
    53 #pragma pack(push,1)
    59 typedef struct {
    54 typedef struct {
    60     __strlen_t len;
    55     __strlen_t len;
    61     uint8_t body[STR_MAX_LEN];
    56     uint8_t body[STR_MAX_LEN];
    62 } IEC_STRING;
    57 } IEC_STRING;
       
    58 #pragma pack(pop)
    63 
    59 
    64 #endif /*IEC_TYPES_H*/
    60 #endif /*IEC_TYPES_H*/