• RTT常用数据类型


    RTT常用数据类型定义在rtdef.h中

    /* RT-Thread basic data type definitions */
    typedef signed   char                   rt_int8_t;      /**<  8bit integer type */
    typedef signed   short                  rt_int16_t;     /**< 16bit integer type */
    typedef signed   long                   rt_int32_t;     /**< 32bit integer type */
    typedef unsigned char                   rt_uint8_t;     /**<  8bit unsigned integer type */
    typedef unsigned short                  rt_uint16_t;    /**< 16bit unsigned integer type */
    typedef unsigned long                   rt_uint32_t;    /**< 32bit unsigned integer type */
    typedef int                             rt_bool_t;      /**< boolean type */
    
    /* 32bit CPU */
    typedef long                            rt_base_t;      /**< Nbit CPU related date type */
    typedef unsigned long                   rt_ubase_t;     /**< Nbit unsigned CPU related data type */
    
    typedef rt_base_t                       rt_err_t;       /**< Type for error number */
    typedef rt_uint32_t                     rt_time_t;      /**< Type for time stamp */
    typedef rt_uint32_t                     rt_tick_t;      /**< Type for tick count */
    typedef rt_base_t                       rt_flag_t;      /**< Type for flags */
    typedef rt_ubase_t                      rt_size_t;      /**< Type for size number */
    typedef rt_ubase_t                      rt_dev_t;       /**< Type for device */
    typedef rt_base_t                       rt_off_t;       /**< Type for offset */
    
    /* boolean type definitions */
    #define RT_TRUE                         1               /**< boolean true  */
    #define RT_FALSE                        0               /**< boolean fails */
    /* RT-Thread error code definitions */
    #define RT_EOK                          0               /**< There is no error */
    #define RT_ERROR                        1               /**< A generic error happens */
    #define RT_ETIMEOUT                     2               /**< Timed out */
    #define RT_EFULL                        3               /**< The resource is full */
    #define RT_EEMPTY                       4               /**< The resource is empty */
    #define RT_ENOMEM                       5               /**< No memory */
    #define RT_ENOSYS                       6               /**< No system */
    #define RT_EBUSY                        7               /**< Busy */
    #define RT_EIO                          8               /**< IO error */

    现在感觉问题:类型带_t,容易与后续指针混淆,定义的后续实体变量指针都带_t,如:

    typedef struct rt_device *rt_device_t;

  • 相关阅读:
    CSS学习笔记 -- 组合选择符
    CSS学习笔记 -- Position(定位)
    CSS学习笔记 -- CSS 列表
    CSS学习笔记 -- 多重样式优先级深入概念
    CSS学习笔记 -- ID和Class
    HTML学习笔记 -- XHTML
    HTML学习笔记 -- 速查列表
    HTML学习笔记 -- <div> 和<span>
    HTML学习笔记 -- HTML <head>
    HTML学习笔记 -- HTML 中 href、src 区别
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/5459856.html
Copyright © 2020-2023  润新知