使用typedef定义数据结构体出现的错误问题
请问有识人士:
我使用typedef定义如下数据结构体,并编写以下程式,在IAR的编译环境中进行编译后出现了:Error: expression must have struct or union type 的提示。请有识人士指点其错误的原故……为盼!
// 定义数据结构体:
typedef struct
{
unsigned char SRCADDRH;
unsigned char SRCADDRL;
unsigned char DESTADDRH;
unsigned char DESTADDRL;
unsigned char VLEN : 3;
}DMA_DESC;
// 初始化I2S的发送配置:
void i2sStartTxDmaChan(DMA_DESC *i2sDmaTxDescr,unsigned short *i2sTxBuf,unsigned short i2sTxBufSize)
{
i2sDmaTxDescr.SRCADDRH = i2sTxBuf >>8; //Error: expression must have struct or union type
i2sDmaTxDescr.SRCADDRL = i2sTxBuf; ;//Error: expression must have struct or union type
i2sDmaTxDescr.LENH =(i2sTxBufSize >>8)&0xFF; //Error: expression must have struct or union type
i2sDmaTxDescr.LENL = i2sTxBufSize &0xFF; //Error: expression must have struct or union type
i2sDmaTxDescr.VLEN = 0x00; //Error: expression must have struct or union type
}