AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: int32_t AG903_UARTMgrGetReceiveData(AG903_UARTMgrHandle* handle, uint8_t* buf, uint32_t size) 2: { 3: int32_t result; 4: int32_t cnt; 5: uint8_t ch; 6: uint8_t loop; 7: uint8_t stat; 8: 9: result = UARTMgr_CheckHandle(handle, &ch); 10: if(AG903_ENONE != result) { 11: return -AG903_EINVAL; 12: } 13: if( (NULL == buf) || (0 >= size) ){ 14: return -AG903_EINVAL; 15: } 16: 17: cnt = 0; 18: for(loop=0; loop<AG903_UART_FIFO_SIZE; loop++) { 19: AG903_UARTPrmGetLineStatus(ch, &stat); 20: if(0 == (AG903_UART_LSR_DATARDY_BIT&stat)) { 21: break; 22: } 23: AG903_UARTPrmGetReceiveData(ch, buf); 24: buf++; 25: cnt++; 26: if(size <= (uint32_t)cnt) { 27: break; 28: } 29: } 30: 31: return cnt; 32: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.