123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- #ifndef __LPC_TYPES_H
- #define __LPC_TYPES_H
- #include <stdint.h>
-
- typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
- typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
- #define PARAM_SETSTATE(State) ((State==RESET) || (State==SET))
- typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
- #define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE))
- typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
- typedef enum
- {
- NONE_BLOCKING = 0,
- BLOCKING,
- } TRANSFER_BLOCK_Type;
- typedef void (*PFV)();
- typedef int32_t(*PFI)();
- #undef _BIT
- #define _BIT(n) (1<<n)
- #undef _SBF
- #define _SBF(f,v) (v<<f)
- #undef _BITMASK
- #define _BITMASK(field_width) ( _BIT(field_width) - 1)
- #ifndef NULL
- #define NULL ((void*) 0)
- #endif
- #define NELEMENTS(array) (sizeof (array) / sizeof (array[0]))
- #define STATIC static
- #define EXTERN extern
- #define MAX(a, b) (((a) > (b)) ? (a) : (b))
- #define MIN(a, b) (((a) < (b)) ? (a) : (b))
- typedef char CHAR;
- typedef uint8_t UNS_8;
- typedef int8_t INT_8;
- typedef uint16_t UNS_16;
- typedef int16_t INT_16;
- typedef uint32_t UNS_32;
- typedef int32_t INT_32;
- typedef int64_t INT_64;
- typedef uint64_t UNS_64;
- typedef Bool BOOL_32;
- typedef Bool BOOL_16;
- typedef Bool BOOL_8;
- #endif
|