AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: int32_t AG903_SSPMgrSetSendBuf(AG903_SSPMgrHandle* handle, uint8_t* buf, uint32_t size) 2: { 3: AG903_SSPMgrQue que; 4: int32_t retval = AG903_ENONE; 5: uint32_t status; 6: uint32_t div; 7: uint8_t enable; 8: uint8_t ch; 9: uint8_t entry; 10: uint8_t threshold; 11: 12: retval = SSPMgr_CheckHandle(handle, &ch); 13: if(AG903_ENONE != retval) { 14: return -AG903_EINVAL; 15: } 16: if((NULL == buf) || (0 >= size)) { 17: return -AG903_EINVAL; 18: } 19: if(0 != SspChStat[ch].dma) { 20: return -AG903_EPERM; 21: } 22: 23: div = SspChStat[ch].wordlen / 8; 24: if(0 != (SspChStat[ch].wordlen%8)) { 25: div++; 26: } 27: 28: do { 29: que.size = size*div; 30: que.buf = buf; 31: retval = SSPMgr_SetTxQue(ch, &que); 32: if(AG903_ENONE != retval) { 33: break; 34: } 35: 36: if(AG903_SSP_ENABLE_SEND & SspChStat[ch].pio) { 37: break; 38: } 39: 40: retval = SSPMgr_SetTxData(ch, true); 41: if(AG903_ENONE != retval) { 42: break; 43: } 44: AG903_SSPPrmGetTxFifoEntry(ch, &entry); 45: if(AG903_SSP_TXFIFO_THRESHOLD >= entry) { 46: threshold = 1; 47: } 48: else { 49: threshold = AG903_SSP_TXFIFO_THRESHOLD; 50: } 51: SspChStat[ch].pio |= AG903_SSP_ENABLE_SEND; 52: AG903_SSPPrmSetTxFifoThreshold(ch, threshold); 53: AG903_SSPPrmCheckEnable(ch, &enable); 54: if(0 == enable) { 55: AG903_SSPPrmGetIntStatus(ch, &status); 56: } 57: else { 58: AG903_SSPPrmEnableTxInt(ch); 59: } 60: }while(0); 61: 62: return retval; 63: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.