AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: int32_t AG903_SSPMgrSetSspMode(AG903_SSPMgrHandle* handle, AG903_SSPMgrSspParam* param) 2: { 3: AG903_SSPPrmCtrl ctrl = {0}; 4: int32_t retval = AG903_ENONE; 5: _Bool idle; 6: uint8_t ch; 7: 8: retval = SSPMgr_CheckHandle(handle, &ch); 9: if(AG903_ENONE != retval) { 10: return -AG903_EINVAL; 11: } 12: if(NULL == param) { 13: return -AG903_EINVAL; 14: } 15: if( (AG903_SSP_SDL_MAX < param->wordlen) || 16: (AG903_SSP_SSPDIV_MIN > param->clkdiv) || 17: (param->clkdiv & 0x01) ){ 18: return -AG903_EINVAL; 19: } 20: idle = SSPMgr_CheckIdle(ch); 21: if(true != idle) { 22: return -AG903_EBUSY; 23: } 24: 25: ctrl.format = AG903_SSP_FORMAT_SSP; 26: if(true == param->slave) { 27: ctrl.opm = AG903_SSP_OPM_SLAVE; 28: } 29: else { 30: ctrl.opm = AG903_SSP_OPM_MASTER; 31: } 32: ctrl.sdl = param->wordlen-1; 33: ctrl.sclk_div = (param->clkdiv>>1)-1; 34: 35: AG903_SSPPrmSetControl(ch, &ctrl); 36: 37: SspChStat[ch].format = AG903_SSP_FORMAT_SSP; 38: SspChStat[ch].wordlen = param->wordlen; 39: SspChStat[ch].slave = param->slave; 40: SspChStat[ch].tx_thod = AG903_SSP_TXFIFO_THRESHOLD; 41: SspChStat[ch].rx_thod = AG903_SSP_RXFIFO_THRESHOLD; 42: 43: return retval; 44: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.