|
#ifndef __Use_RD_LPC213X_H_
#define __Use_RD_LPC213X_H_
/**************************************************************
* 函数库说明:ARM LPC213x系列操作辅助函数库 *
* 版本: v1.0 *
* 平台: LPC213X系列 *
* 作者: 傻孩子 *
* 日期: 2006年3月30日 *
* 修改: 傻孩子 *
* 修改日期: 2006年3月30日 *
* *
* [说明] *
* 1、支持端口位操作。 *
**************************************************************/
/************************
* 结 构 体 定 义 *
************************/
/*----------------------*
* 8位变量位映射 *
*----------------------*/
typedef struct BYTE_BIT
{
unsigned BIT0:1;
unsigned BIT1:1;
unsigned BIT2:1;
unsigned BIT3:1;
unsigned BIT4:1;
unsigned BIT5:1;
unsigned BIT6:1;
unsigned BIT7:1;
}BYTEBIT;
/*----------------------*
* 16位变量位映射 *
*----------------------*/
typedef struct WORD_BIT
{
unsigned BIT0:1;
unsigned BIT1:1;
unsigned BIT2:1;
unsigned BIT3:1;
unsigned BIT4:1;
unsigned BIT5:1;
unsigned BIT6:1;
unsigned BIT7:1;
unsigned BIT8:1;
unsigned BIT9:1;
unsigned BIT10:1;
unsigned BIT11:1;
unsigned BIT12:1;
unsigned BIT13:1;
unsigned BIT14:1;
unsigned BIT15:1;
}WORDBIT;
/*----------------------*
* 32位变量位映射 *
*----------------------*/
typedef struct DWORD_BIT
{
unsigned BIT0:1;
unsigned BIT1:1;
unsigned BIT2:1;
unsigned BIT3:1;
unsigned BIT4:1;
unsigned BIT5:1;
unsigned BIT6:1;
unsigned BIT7:1;
unsigned BIT8:1;
unsigned BIT9:1;
unsigned BIT10:1;
unsigned BIT11:1;
unsigned BIT12:1;
unsigned BIT13:1;
unsigned BIT14:1;
unsigned BIT15:1;
unsigned BIT16:1;
unsigned BIT17:1;
unsigned BIT18:1;
unsigned BIT19:1;
unsigned BIT20:1;
unsigned BIT21:1;
unsigned BIT22:1;
unsigned BIT23:1;
unsigned BIT24:1;
unsigned BIT25:1;
unsigned BIT26:1;
unsigned BIT27:1;
unsigned BIT28:1;
unsigned BIT29:1;
unsigned BIT30:1;
unsigned BIT31:1;
}DWORDBIT;
/*----------------------*
* 32位变量4分映射 *
*----------------------*/
typedef struct DWORD_DIV4
{
unsigned BYTEA:8;
unsigned BYTEB:8;
unsigned BYTEC:8;
unsigned BYTED:8;
}DWORDPORT8;
typedef struct DWORD_DIV2
{
unsigned WORDA:16;
unsigned WORDB:16;
}DWORDPORT16;
/*----------------------*
* 16位变量2分映射 *
*----------------------*/
typedef struct WORD_DIV2
{
unsigned BYTEA:8;
unsigned BYTEB:8;
}WORDPORT8;
/*----------------------*
* 8位变量2分映射 *
*----------------------*/
typedef struct BYTE_DIV2
{
unsigned BYTEL:4;
unsigned BYTEH:4;
}WORDHBYTE;
/************************
* 系 统 宏 定 义 *
************************/
/*----------------------*
* 系统常数宏定义 *
*----------------------*/
/************************
* 动 作 宏 定 义 *
************************/
# define P0 (*((volatile DWORDBIT *)0xE0028000))
# define DIR0 (*((volatile DWORDBIT *)0xE0028008))
# define P1 (*((volatile DWORDBIT *)0xE0028010))
# define DIR1 (*((volatile DWORDBIT *)0xE0028018))
# define PORT0 (*((volatile DWORDPORT8 *)0xE0028000))
# define PORT1 (*((volatile DWORDPORT8 *)0xE0028010))
# define WPORT0 (*((volatile DWORDPORT16 *)0xE0028000))
# define WPORT1 (*((volatile DWORDPORT16 *)0xE0028010))
# define PORT0A PORT0.BYTEA
# define PORT0B PORT0.BYTEB
# define PORT0C PORT0.BYTEC
# define PORT0D PORT0.BYTED
# define PORT1A PORT1.BYTEA
# define PORT1B PORT1.BYTEB
# define PORT1C PORT1.BYTEC
# define PORT1D PORT1.BYTED
# define WPORTA WPORT0.WORDA
# define WPORTB WPORT0.WORDB
# define WPORTC WPORT1.WORDA
# define WPORTD WPORT1.WORDB
# define P00 P0.BIT0
# define P01 P0.BIT1
# define P02 P0.BIT2
# define P03 P0.BIT3
# define P04 P0.BIT4
# define P05 P0.BIT5
# define P06 P0.BIT6
# define P07 P0.BIT7
# define P08 P0.BIT8
# define P09 P0.BIT9
# define P010 P0.BIT10
# define P011 P0.BIT11
# define P012 P0.BIT12
# define P013 P0.BIT13
# define P014 P0.BIT14
# define P015 P0.BIT15
# define P016 P0.BIT16
# define P017 P0.BIT17
# define P018 P0.BIT18
# define P019 P0.BIT19
# define P020 P0.BIT20
# define P021 P0.BIT21
# define P022 P0.BIT22
# define P023 P0.BIT23
# define P024 P0.BIT24
# define P025 P0.BIT25
# define P026 P0.BIT26
# define P027 P0.BIT27
# define P028 P0.BIT28
# define P029 P0.BIT29
# define P030 P0.BIT30
# define P031 P0.BIT31
# define P10 P1.BIT0
# define P11 P1.BIT1
# define P12 P1.BIT2
# define P13 P1.BIT3
# define P14 P1.BIT4
# define P15 P1.BIT5
# define P16 P1.BIT6
# define P17 P1.BIT7
# define P18 P1.BIT8
# define P19 P1.BIT9
# define P110 P1.BIT10
# define P111 P1.BIT11
# define P112 P1.BIT12
# define P113 P1.BIT13
# define P114 P1.BIT14
# define P115 P1.BIT15
# define P116 P1.BIT16
# define P117 P1.BIT17
# define P118 P1.BIT18
# define P119 P1.BIT19
# define P120 P1.BIT20
# define P121 P1.BIT21
# define P122 P1.BIT22
# define P123 P1.BIT23
# define P124 P1.BIT24
# define P125 P1.BIT25
# define P126 P1.BIT26
# define P127 P1.BIT27
# define P128 P1.BIT28
# define P129 P1.BIT29
# define P130 P1.BIT30
# define P131 P1.BIT31
# define DIR00 DIR0.BIT0
# define DIR01 DIR0.BIT1
# define DIR02 DIR0.BIT2
# define DIR03 DIR0.BIT3
# define DIR04 DIR0.BIT4
# define DIR05 DIR0.BIT5
# define DIR06 DIR0.BIT6
# define DIR07 DIR0.BIT7
# define DIR08 DIR0.BIT8
# define DIR09 DIR0.BIT9
# define DIR010 DIR0.BIT10
# define DIR011 DIR0.BIT11
# define DIR012 DIR0.BIT12
# define DIR013 DIR0.BIT13
# define DIR014 DIR0.BIT14
# define DIR015 DIR0.BIT15
# define DIR016 DIR0.BIT16
# define DIR017 DIR0.BIT17
# define DIR018 DIR0.BIT18
# define DIR019 DIR0.BIT19
# define DIR020 DIR0.BIT20
# define DIR021 DIR0.BIT21
# define DIR022 DIR0.BIT22
# define DIR023 DIR0.BIT23
# define DIR024 DIR0.BIT24
# define DIR025 DIR0.BIT25
# define DIR026 DIR0.BIT26
# define DIR027 DIR0.BIT27
# define DIR028 DIR0.BIT28
# define DIR029 DIR0.BIT29
# define DIR030 DIR0.BIT30
# define DIR031 DIR0.BIT31
# define DIR10 DIR1.BIT0
# define DIR11 DIR1.BIT1
# define DIR12 DIR1.BIT2
# define DIR13 DIR1.BIT3
# define DIR14 DIR1.BIT4
# define DIR15 DIR1.BIT5
# define DIR16 DIR1.BIT6
# define DIR17 DIR1.BIT7
# define DIR18 DIR1.BIT8
# define DIR19 DIR1.BIT9
# define DIR110 DIR1.BIT10
# define DIR111 DIR1.BIT11
# define DIR112 DIR1.BIT12
# define DIR113 DIR1.BIT13
# define DIR114 DIR1.BIT14
# define DIR115 DIR1.BIT15
# define DIR116 DIR1.BIT16
# define DIR117 DIR1.BIT17
# define DIR118 DIR1.BIT18
# define DIR119 DIR1.BIT19
# define DIR120 DIR1.BIT20
# define DIR121 DIR1.BIT21
# define DIR122 DIR1.BIT22
# define DIR123 DIR1.BIT23
# define DIR124 DIR1.BIT24
# define DIR125 DIR1.BIT25
# define DIR126 DIR1.BIT26
# define DIR127 DIR1.BIT27
# define DIR128 DIR1.BIT28
# define DIR129 DIR1.BIT29
# define DIR130 DIR1.BIT30
# define DIR131 DIR1.BIT31
#endif
-----此内容被Gorgon Meducer于2006-04-02,18:10:57编辑过 |
|