rtdef.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __RT_DEF_H__
  2. #define __RT_DEF_H__
  3. #include "stdio.h"
  4. /* RT-Thread basic data type definitions */
  5. #ifndef RT_USING_ARCH_DATA_TYPE
  6. typedef int8_t rt_int8_t; /**< 8bit integer type */
  7. typedef int16_t rt_int16_t; /**< 16bit integer type */
  8. typedef int32_t rt_int32_t; /**< 32bit integer type */
  9. typedef uint8_t rt_uint8_t; /**< 8bit unsigned integer type */
  10. typedef uint16_t rt_uint16_t; /**< 16bit unsigned integer type */
  11. typedef uint32_t rt_uint32_t; /**< 32bit unsigned integer type */
  12. #ifdef ARCH_CPU_64BIT
  13. typedef signed long rt_int64_t; /**< 64bit integer type */
  14. typedef unsigned long rt_uint64_t; /**< 64bit unsigned integer type */
  15. #else
  16. typedef int64_t rt_int64_t; /**< 64bit integer type */
  17. typedef uint64_t rt_uint64_t; /**< 64bit unsigned integer type */
  18. #endif
  19. #endif
  20. typedef int rt_bool_t; /**< boolean type */
  21. typedef long rt_base_t; /**< Nbit CPU related date type */
  22. typedef unsigned long rt_ubase_t; /**< Nbit unsigned CPU related data type */
  23. typedef rt_base_t rt_err_t; /**< Type for error number */
  24. typedef rt_uint32_t rt_time_t; /**< Type for time stamp */
  25. typedef rt_uint32_t rt_tick_t; /**< Type for tick count */
  26. typedef rt_base_t rt_flag_t; /**< Type for flags */
  27. typedef rt_ubase_t rt_size_t; /**< Type for size number */
  28. typedef rt_ubase_t rt_dev_t; /**< Type for device */
  29. typedef rt_base_t rt_off_t; /**< Type for offset */
  30. /* RT-Thread error code definitions */
  31. #define RT_EOK 0 /**< There is no error */
  32. #define RT_ERROR 1 /**< A generic error happens */
  33. #define RT_ETIMEOUT 2 /**< Timed out */
  34. #define RT_EFULL 3 /**< The resource is full */
  35. #define RT_EEMPTY 4 /**< The resource is empty */
  36. #define RT_ENOMEM 5 /**< No memory */
  37. #define RT_ENOSYS 6 /**< No system */
  38. #define RT_EBUSY 7 /**< Busy */
  39. #define RT_EIO 8 /**< IO error */
  40. #define RT_EINTR 9 /**< Interrupted system call */
  41. #define RT_EINVAL 10 /**< Invalid argument */
  42. #define rt_inline static __inline
  43. #endif