lib/iec_types.h
changeset 282 871edf12fe64
parent 256 101c7f148b9a
child 741 cdce312be3c4
equal deleted inserted replaced
281:686fa44e3832 282:871edf12fe64
     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 typedef struct {
    34 #if !defined __timespec_defined && !defined __time_t_defined
       
    35 # define __timespec_defined     1
       
    36 
       
    37 struct timespec
       
    38   {
       
    39     long int tv_sec;            /* Seconds.  */
    33     long int tv_sec;            /* Seconds.  */
    40     long int tv_nsec;           /* Nanoseconds.  */
    34     long int tv_nsec;           /* Nanoseconds.  */
    41   };
    35 }__attribute__((packed)) IEC_TIMESPEC;
    42 
    36 
    43 #endif
    37 typedef IEC_TIMESPEC IEC_TIME;
    44 
    38 typedef IEC_TIMESPEC IEC_DATE;
    45 typedef struct timespec IEC_TIME;
    39 typedef IEC_TIMESPEC IEC_DT;
    46 typedef struct timespec IEC_DATE;
    40 typedef IEC_TIMESPEC IEC_TOD;
    47 typedef struct timespec IEC_DT;
       
    48 typedef struct timespec IEC_TOD;
       
    49 
    41 
    50 #ifndef STR_MAX_LEN
    42 #ifndef STR_MAX_LEN
    51 #define STR_MAX_LEN 126
    43 #define STR_MAX_LEN 126
    52 #endif
    44 #endif
    53 
    45 
    57 
    49 
    58 typedef STR_LEN_TYPE __strlen_t;
    50 typedef STR_LEN_TYPE __strlen_t;
    59 typedef struct {
    51 typedef struct {
    60     __strlen_t len;
    52     __strlen_t len;
    61     uint8_t body[STR_MAX_LEN];
    53     uint8_t body[STR_MAX_LEN];
    62 } IEC_STRING;
    54 } __attribute__((packed)) IEC_STRING;
    63 
    55 
    64 #endif /*IEC_TYPES_H*/
    56 #endif /*IEC_TYPES_H*/