资源简介
代码的功能是将数据写入指定页面后再读出,并通过串口发送。代码已测试,可以直接使用。注:本例子是根据协议栈的提供的代码进行整理、改编的,如有不足之处,请各位大神指定!谢谢!
代码片段和文件信息
#include
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef char BYTE;
#define st(x) do { x } while (__LINE__ == -1)
#define HAL_DMA_SET_ADDR_DESC0( a ) \
st( \
DMA0CFGH = (uchar)( (uint)(a) >> 8 ); \
DMA0CFGL = (uchar)( (uint)(a) & 0xFF ); \
)
#define HAL_DMA_SET_ADDR_DESC1234( a ) \
st( \
DMA1CFGH = (uchar)( (uint)(a) >> 8 ); \
DMA1CFGL = (uchar)( (uint)(a) & 0xFF ); \
)
#define HAL_DMA_GET_DESC0() &dmaCh0
#define HAL_DMA_GET_DESC1234( a ) (dmaCh1234+((a)-1))
#define HAL_DMA_ARM_CH( ch ) DMAARM = (0x01 << (ch))
#define HAL_DMA_CH_ARMED( ch ) (DMAARM & (0x01 << (ch)))
#define HAL_DMA_ABORT_CH( ch ) DMAARM = (0x80 | (0x01 << (ch)))
#define HAL_DMA_MAN_TRIGGER( ch ) DMAREQ = (0x01 << (ch))
#define HAL_DMA_START_CH( ch ) HAL_DMA_MAN_TRIGGER( (ch) )
#define HAL_DMA_CLEAR_IRQ( ch ) DMAIRQ = ~( 1 << (ch) )
#define HAL_DMA_CHECK_IRQ( ch ) (DMAIRQ & ( 1 << (ch) ))
// Macro for quickly setting the source address of a DMA structure.
#define HAL_DMA_SET_SOURCE( pDesc src ) \
st( \
pDesc->srcAddrH = (uchar)((uint)(src) >> 8); \
pDesc->srcAddrL = (uchar)( (uint)(src) & 0xFF ); \
)
// Macro for quickly setting the destination address of a DMA structure.
#define HAL_DMA_SET_DEST( pDesc dst ) \
st( \
pDesc->dstAddrH = (uchar)((uint)(dst) >> 8); \
pDesc->dstAddrL = (uchar)( (uint)(dst) & 0xFF ); \
)
// Macro for quickly setting the number of bytes to be transferred by the DMA
// max length is 0x1FFF.
#define HAL_DMA_SET_LEN( pDesc len ) \
st( \
pDesc->xferLenL = (uchar)( (uint)(len) & 0xFF); \
pDesc->xferLenV &= ~HAL_DMA_LEN_H; \
pDesc->xferLenV |= (uchar)((uint)(len) >> 8); \
)
#define HAL_DMA_GET_LEN( pDesc ) \
(((uint)(pDesc->xferLenV & HAL_DMA_LEN_H) << 8) | pDesc->xferLenL)
#define HAL_DMA_SET_VLEN( pDesc vMode ) \
st( \
pDesc->xferLenV &= ~HAL_DMA_LEN_V; \
pDesc->xferLenV |= (vMode << 5); \
)
#define HAL_DMA_SET_WORD_SIZE( pDesc xSz ) \
st( \
pDesc->ctrlA &= ~HAL_DMA_WORD_SIZE; \
pDesc->ctrlA |= (xSz << 7); \
)
#define HAL_DMA_SET_TRIG_MODE( pDesc tMode ) \
st( \
pDesc->ctrlA &= ~HAL_DMA_TRIG_MODE; \
pDesc->ctrlA |= (tMode << 5); \
)
#define HAL_DMA_GET_TRIG_MODE( pDesc ) ((pDesc->ctrlA >> 5) & 0x3)
#define HAL_DMA_SET_TRIG_SRC( pDesc tSrc ) \
st( \
pDesc->ctrlA &= ~HAL_DMA_TRIG_SRC; \
pDesc->ctrlA |= tSrc; \
)
#define HAL_DMA_SET_SRC_INC( pDesc srcInc ) \
st( \
pDesc->ctrlB &= ~HAL_DMA_SRC_INC; \
pDesc->ctrlB |= (srcInc << 6); \
)
#define HAL_DMA_SET_DST_INC( pDesc dstInc ) \
st( \
pDesc->ctrlB &= ~HAL_DMA_DST_INC; \
pDesc->ctrlB |= (dstInc << 4); \
)
#define HAL_DMA_SET_IRQ( pDesc enable ) \
st( \
pDesc->ctrlB &= ~HAL_DMA_IRQ_MASK; \
pDes
- 上一篇:最小的HTTP服务器
- 下一篇:Qt的pro文件转VS的工程文件
相关资源
- CC2530 的 ZigBee 的温度监控系统 课程设
- mapinfo三扇区图层制作插件GCI-CDMAtool
- 传感技术中的无线传感网中一种基于
- CDMA2000网络优化实习手册
- CC2530特殊功能寄存器
- STM32F4 硬件I2C 使用DMA
- 官方3dmax病毒查杀.rar
- cc2530 zigbee通讯程序
- cc1110 TDMA代码
-
VIA Telecom CBP5.5/5.6 CDMA ba
seband Proces - windows下perl模块编译文件:dmake
- echarts上各个省的3DMap以及地图上加柱
- MAX修改器动画导入UNITY
- CC2530原理图元件库.zip
- 3dmaxAO插件
- cc2530 Uart1
- ZigBee CC2530,基础实验的代码汇集
- CC2530单片机ADXL345的i2C程序
- testcase.rar
- TI Z-Stack中的OSAL纯净版
- ZigBee CC2530 12864液晶串行程序
- CC2530产生随机数修正版
- BH1750 for CC2530
- 3dmax 2012破解文件
- STM32 多串口DMA传输透传带DEBUG输出代码
- ddmac黑苹果安装写入硬盘工具
- 捏脸软件插件 for 3dmax
- (IDMAllProductsKeygenv3.6)keygen.rar
- CC2530与HC-SR04超声波模块通信
- 打散多维材质的脚本
评论
共有 条评论