uCOS-iii 中定义的一些常量
uCOS-iii 中定义的一些常量
uCOS-iii 中有许多宏定义的量,这些量不需要全部记住是什么意思,因为在阅读代码的时候可以选中变量或宏定义然后右键查看定义,就可以知道它代表的什么意思。但是如果知道什么样的变量是大概是什么含义,这样会在阅读代码的时候很流畅。这是我第一天阅读代码的时候遇到的一些宏定义:
第一种是yes和no类型的:常用的TRUE,YES,ENABLE,ACTIVE,VALID,ON,SET,OK都是1的意思,反之则是0:
#define DEF_FALSE 0u
#define DEF_TRUE 1u #define DEF_NO 0u
#define DEF_YES 1u #define DEF_DISABLED 0u
#define DEF_ENABLED 1u #define DEF_INACTIVE 0u
#define DEF_ACTIVE 1u #define DEF_INVALID 0u
#define DEF_VALID 1u #define DEF_OFF 0u
#define DEF_ON 1u #define DEF_CLR 0u
#define DEF_SET 1u #define DEF_FAIL 0u
#define DEF_OK 1u
第二种是常用的数字的定义。例如DEF_BIT_XX的意思就是二进制的一个1后面有XX个零,例如DEF_BIT_00代表1后面一个0,那就是1,也就是0x01u,而DEF_BIT_07就是1后面7个0,也就是二进制的10000000,这就是十六进制的0x80u。
#define DEF_BIT_00 0x01u
#define DEF_BIT_01 0x02u
#define DEF_BIT_02 0x04u
#define DEF_BIT_03 0x08u
#define DEF_BIT_04 0x10u
#define DEF_BIT_05 0x20u
#define DEF_BIT_06 0x40u
#define DEF_BIT_07 0x80u #define DEF_BIT_08 0x0100u
#define DEF_BIT_09 0x0200u
#define DEF_BIT_10 0x0400u
#define DEF_BIT_11 0x0800u
#define DEF_BIT_12 0x1000u
#define DEF_BIT_13 0x2000u
#define DEF_BIT_14 0x4000u
#define DEF_BIT_15 0x8000u #define DEF_BIT_16 0x00010000u
#define DEF_BIT_17 0x00020000u
#define DEF_BIT_18 0x00040000u
#define DEF_BIT_19 0x00080000u
#define DEF_BIT_20 0x00100000u
#define DEF_BIT_21 0x00200000u
#define DEF_BIT_22 0x00400000u
#define DEF_BIT_23 0x00800000u #define DEF_BIT_24 0x01000000u
#define DEF_BIT_25 0x02000000u
#define DEF_BIT_26 0x04000000u
#define DEF_BIT_27 0x08000000u
#define DEF_BIT_28 0x10000000u
#define DEF_BIT_29 0x20000000u
#define DEF_BIT_30 0x40000000u
#define DEF_BIT_31 0x80000000u
/*$PAGE*/
#define DEF_BIT_32 0x0000000100000000u
#define DEF_BIT_33 0x0000000200000000u
#define DEF_BIT_34 0x0000000400000000u
#define DEF_BIT_35 0x0000000800000000u
#define DEF_BIT_36 0x0000001000000000u
#define DEF_BIT_37 0x0000002000000000u
#define DEF_BIT_38 0x0000004000000000u
#define DEF_BIT_39 0x0000008000000000u #define DEF_BIT_40 0x0000010000000000u
#define DEF_BIT_41 0x0000020000000000u
#define DEF_BIT_42 0x0000040000000000u
#define DEF_BIT_43 0x0000080000000000u
#define DEF_BIT_44 0x0000100000000000u
#define DEF_BIT_45 0x0000200000000000u
#define DEF_BIT_46 0x0000400000000000u
#define DEF_BIT_47 0x0000800000000000u #define DEF_BIT_48 0x0001000000000000u
#define DEF_BIT_49 0x0002000000000000u
#define DEF_BIT_50 0x0004000000000000u
#define DEF_BIT_51 0x0008000000000000u
#define DEF_BIT_52 0x0010000000000000u
#define DEF_BIT_53 0x0020000000000000u
#define DEF_BIT_54 0x0040000000000000u
#define DEF_BIT_55 0x0080000000000000u #define DEF_BIT_56 0x0100000000000000u
#define DEF_BIT_57 0x0200000000000000u
#define DEF_BIT_58 0x0400000000000000u
#define DEF_BIT_59 0x0800000000000000u
#define DEF_BIT_60 0x1000000000000000u
#define DEF_BIT_61 0x2000000000000000u
#define DEF_BIT_62 0x4000000000000000u
#define DEF_BIT_63 0x8000000000000000u
uCOS-iii 中定义的一些常量的更多相关文章
- ucos  III中任务之间的数据通信和任务划分
		
1. 如果将关系密切(比如两个任务之间需要经常收发数据)的若干功能分别用不同的任务来实现,则需要进行大量的任务之间数据通信和同步通信,这系统来说是一个很大的负担.因此应该将关系密切的若干功能组合成一个 ...
 - 在php中定义常量时,const与define的区别?
		
问]在php中定义常量时,const与define的区别? [答]使用const使得代码简单易读,const本身就是一个语言结构,而define是一个函数.另外const在编译时要比define快很 ...
 - 在C++中定义常量的两种方法的比较
		
常量是定以后,在程序运行中不能被改变的标识符.C++中定义常量可以用#define .const 这两种方法.例如:#define PRICE 10 //定义单价常量10const int PRICE ...
 - PHP中定义常量的几种方式与区别
		
[问]在php中定义常量时,const与define的区别? [答]使用const使得代码简单易读,const本身就是一个语言结构,而define是一个函数.另外const在编译时要比define快很 ...
 - java如何引入接口中定义的常量
		
接口 (A.java) : package config; public interface A { String PROJECT_ROOT_DIR = System.getProperty(&quo ...
 - Java中定义常量方法及建议(Class/Interface)
		
Class定义常量方法(推荐方法) //final修饰符 public final class Constants { //私有构造方法 private Constants() {} public s ...
 - PHP中定义常量
		
PHP中定义常量的方式如下: define(常量名,常量值); //定义常量PUBLISHER define('PUBLISHER', "O'Reilly & Associates& ...
 - 【mybatis】mybatis使用java实体中定义的常量,或静态方法
		
mybatis使用java实体中定义的常量 示例代码: <select id="findDealerInfo" parameterType="com.pisen.c ...
 - PHP:在class中定义常量注意事项
		
一.不能在成员函数中定义常量,否则会引发诡异地语法错误 syntax error, unexpected 'CONST' (T_CONST) 示例 /* 错误的方式 */ class A { publ ...
 
随机推荐
- 用python计算md5,sha1,crc32
			
Linux下计算md5sum,sha1sum,crc: 命令 输出 $md5sum hello f19dd746bc6ab0f0155808c388be8ff0 hello $sha1sum hel ...
 - Dev之ChartControl控件(二)— 绘制多重坐标图形
			
有时针对一个ChartControl控件可能要设置多个Y轴,进行显示: 以下举个例子:如在一个Chart中显示多个指标项如图: 首先,读取数据,并对左边的Y轴最大和最小值进行设定 IndexSerie ...
 - Json解析要点
			
解析Json时,昨天遇到了新的问题,之前都是解析的数组,不是数组的用类来做. 这是Json串; {"status":"00001","ver" ...
 - JavaBean-- 设置和取得属性
			
<jsp:setProperty>标签一共有4种使用方法: 自动匹配:<jsp:setProperty name="实例化对象的名称(id)" property= ...
 - 对比C#中==与equal方法
			
C#中equal与==的区别 收藏 对于值类型,如果对象的值相等,则相等运算符 (==) 返回 true,否则返回 false.对于string 以外的引用类型,如果两个对象引用同一个对象,则 == ...
 - C++读取excel特定行列中的数据
			
可以通过COM API调用才是正解,不过需要编写COM接口类,Excel对象库的接口太多了……不过可以用工具自动生成. 我最近也在用VC操作Excel,在VC中可以这样做,在任何一个cpp文件中加入下 ...
 - 直接拿来用!最火的iOS开源项目(一)
			
直接拿来用!最火的iOS开源项目(一) 发表于2013-06-05 10:17| 39373次阅读| 来源CSDN| 100 条评论| 作者唐小引 iOS开源项目GitHub移动开发最受欢迎的开源项目 ...
 - Android中的自定义Adapter(继承自BaseAdapter)——与系统Adapter的调用方法一致——含ViewHolder显示效率的优化(转)
			
Android中很多地方使用的是适配器(Adapter)机制,那我们就要好好把这个Adapter利用起来,并且用出自己的特色,来符合我们自行设计的需要喽~~~ 下面先上一个例子,是使用ViewHold ...
 - ZOJ 3699 Dakar Rally(贪心)
			
这是一道贪心题,他的贪心思想很容易想明白,我们保证油箱里的油始终是最便宜的我们最后的花费就能是最少的.实现方法就是:比如现在在i点,我们看邮箱满载能最远到达哪里,不妨设最远到达j,(j >= i ...
 - BNUOJ 6038 - Reaux! Sham! Beaux!(模拟)
			
这是一个水模拟,但是因为图片看不清,手打比较烧脑,我们错了好多次才过 #include<stdio.h> #include<iostream> #include<stri ...