AG903ライブラリリファレンス
内容インデックスホーム
前へ上へ次へ
AG903_UARTMgrReceive 関数

データ受信開始

Syntax
C++
int32_t AG903_UARTMgrReceive(AG903_UARTMgrHandle* handle, _Bool dma);
引数 
説明 
AG903_UARTMgrHandle* handle 
[in] UARTハンドル 
_Bool dma 
[in] DMAの使用有無 

データ受信結果

返値の詳細 
説明 
正常終了 
-AG903_EINVAL 
引数異常 
-AG903_EBUSY 
ハンドル使用中. 

データ受信開始の設定をします。 

DMA未使用はデータ受信でコールバックします 

DMA使用はエラー発生でコールバックします。

DMAを使用する場合は別途DMACの設定を行って下さい。

1: int32_t AG903_UARTMgrReceive(AG903_UARTMgrHandle* handle, _Bool dma) 2: { 3: int32_t retval = AG903_ENONE; 4: int32_t result; 5: uint32_t dismsk = 0; 6: uint8_t ch; 7: 8: result = UARTMgr_CheckHandle(handle, &ch); 9: if(AG903_ENONE != result) { 10: return -AG903_EINVAL; 11: } 12: 13: if( (AG903_UART_STAT_IDLE != UartChStat[ch].rcv.stat) || 14: ((true == UartChStat[ch].rs485) && (AG903_UART_STAT_IDLE != UartChStat[ch].snd.stat)) ){ 15: 16: return -AG903_EBUSY; 17: } 18: 19: UartChStat[ch].rcv.dma = dma; 20: UartChStat[ch].rcv.stat = AG903_UART_STAT_RECEIVE; 21: 22: if(UartHandleStat[ch].event & AG903_UART_RCVTIMEOUT_BIT) { 23: dismsk |= AG903_UART_DETECT_RTO_BIT; 24: } 25: if(UartHandleStat[ch].event & AG903_UART_CHARATIMEOUT_BIT) { 26: dismsk |= AG903_UART_DETECT_CTO_BIT; 27: } 28: if(0 != dismsk) { 29: AG903_UARTPrmDisableTimeoutIntMask(ch, dismsk); 30: AG903_UARTPrmEnableTimeoutDetect(ch); 31: } 32: 33: AG903_UARTPrmEnableInt(ch, (AG903_UART_IER_LINEST_BIT|AG903_UART_IER_DATARDY_BIT)); 34: 35: 36: return retval; 37: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.