AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: int32_t AG903_SSPMgrSpiEnableTransfer(AG903_SSPMgrHandle* handle) 2: { 3: int32_t retval = AG903_ENONE; 4: AG903_SSPPrmIntCtrl* ictrl; 5: AG903_SSPPrmCtrl2* ctrl2; 6: uint8_t ch; 7: uint8_t cs; 8: 9: retval = SSPMgr_CheckHandle(handle, &ch); 10: if(AG903_ENONE != retval) { 11: return -AG903_EINVAL; 12: } 13: 14: if (AG903_SSP_FORMAT_SPI != SspChStat[ch].format) { 15: return -AG903_EPERM; 16: } 17: 18: if (0 != SSPMgr_IsSpiFlashLike(ch)) { 19: cs = (AG903_SSP_POL_NEGATIVE==SspSpiParam[ch].polarity) ? 0 : 1; 20: } else { 21: cs = 0; 22: } 23: 24: ictrl = &SspRegStat[ch].ictrl; 25: ictrl->tfthod = SspChStat[ch].tx_thod; 26: ictrl->rfthod = SspChStat[ch].rx_thod; 27: ictrl->tfdmaen = 0; 28: ictrl->rfdmaen = 0; 29: ictrl->tfthien = 0; 30: ictrl->rfthien = 0; 31: ictrl->tfurien = 0; 32: ictrl->rforien = 0; 33: AG903_SSPPrmSetIntControl(ch, ictrl); 34: 35: ctrl2 = &SspRegStat[ch].ctrl2; 36: ctrl2->fsos = 0; 37: ctrl2->fs = cs; 38: ctrl2->txen = 0; 39: ctrl2->rxen = 0; 40: ctrl2->ssprst = 0; 41: ctrl2->txfclr = 1; 42: ctrl2->rxfclr = 1; 43: ctrl2->txdoe = 0; 44: ctrl2->sspen = 1; 45: AG903_SSPPrmSetControl2(ch, ctrl2); 46: ctrl2->txfclr = 0; 47: ctrl2->rxfclr = 0; 48: 49: return retval; 50: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.