为这个量的赋值非常隐蔽,本人找了好久才搞定,功夫不负有心人!!!
uint16 HalUARTWrite(uint8 port, uint8 *buf, uint16 len)
...
#if (HAL_UART_DMA == 1)
if (port == HAL_UART_PORT_0) return HalUARTWriteDMA(buf, len);
#endif
...
---->
static uint16 HalUARTWriteDMA(uint8 *buf, uint16 len)
{
uint16 cnt;
halIntState_t his;
uint8 txSel;
#if HAL_UART_DMA_TX_MAX < 256
uint8 txIdx;
#else
uint16 txIdx;
#endif
...
---->
#define HAL_UART_DMA_TX_MAX MT_UART_DEFAULT_MAX_TX_BUFF
---->
#if !defined( MT_UART_DEFAULT_MAX_TX_BUFF )
#define MT_UART_DEFAULT_MAX_TX_BUFF MT_UART_TX_BUFF_MAX
---->
#define MT_UART_TX_BUFF_MAX 128
****************************************************************
****************************************************************
uint16 HalUARTRead(uint8 port, uint8 *buf, uint16 len)
...
#if (HAL_UART_DMA == 1)
if (port == HAL_UART_PORT_0) return HalUARTReadDMA(buf, len);
#endif
...
---->
static uint16 HalUARTReadDMA(uint8 *buf, uint16 len)
{
uint16 cnt;
for (cnt = 0; cnt < len; cnt++)
{
if (!HAL_UART_DMA_NEW_RX_BYTE(dmaCfg.rxHead))
{
break;
}
*buf++ = HAL_UART_DMA_GET_RX_BYTE(dmaCfg.rxHead);
HAL_UART_DMA_CLR_RX_BYTE(dmaCfg.rxHead);
if (++(dmaCfg.rxHead) >= HAL_UART_DMA_RX_MAX)
{
dmaCfg.rxHead = 0;
}
}
PxOUT &= ~HAL_UART_Px_RTS; // Re-enable the flow on any read.
return cnt;
}
---->
#define HAL_UART_DMA_RX_MAX MT_UART_DEFAULT_MAX_RX_BUFF
---->
#define MT_UART_DEFAULT_MAX_RX_BUFF MT_UART_RX_BUFF_MAX
---->
#define MT_UART_RX_BUFF_MAX 128
結論:
在串口互發中定義的是128.。
deebug20140307
ccnu
阅读(2080) | 评论(0) | 转发(0) |