AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
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.