AG903ライブラリリファレンス
内容インデックスホーム
前へ上へ次へ
sspmgr.h

SSP Manager Header

SSP Manager提供ヘッダ。 

SSP Manager使用時にincludeして下さい。 

none

AXELL CORPORATION

2017_02_22 初版 

2017_10_26 Ver2.0 

2025_03_06 [SDK3.7] SSPライブラリにSPIモードでの送受信アクセス機能を追加 (#5662) 

2025_03_06 [SDK3.7] SSPライブラリにDMAによる送受信関数を追加 (#5780)

1: 11: 12: 16: 17: #ifndef _SSPMGR_H_ 18: #define _SSPMGR_H_ 19: 20: 21: #include <stdint.h> 22: #include "lib_common/AG903_common.h" 23: 24: #ifdef __cplusplus 25: extern "C" { 26: #endif 27: 28: 29: #define AG903_SSP_TXQUE_NUM (8) 30: 31: 32: #define AG903_SSP_RXQUE_NUM (8) 33: 34: 35: #define AG903_SSP_TXFIFO_THRESHOLD (8) 36: 37: 38: #define AG903_SSP_RXFIFO_THRESHOLD (1) 39: 40: 41: enum _AG903_SspPolarityType { 42: AG903_SSP_POL_POSITIVE = 0, 43: AG903_SSP_POL_NEGATIVE, 44: AG903_SSP_POL_TYPENUM, 45: }; 46: 47: 48: enum _AG903_SspFirstbitType { 49: AG903_SSP_FIRSTBIT_MSB = 0, 50: AG903_SSP_FIRSTBIT_LSB, 51: AG903_SSP_FIRSTBIT_TYPENUM, 52: }; 53: 54: 55: enum _AG903_SspSpiClkMode { 56: AG903_SSP_SPICLK_MODE0 = 0, 57: AG903_SSP_SPICLK_MODE1, 58: AG903_SSP_SPICLK_MODE2, 59: AG903_SSP_SPICLK_MODE3, 60: AG903_SSP_SPICLK_MODENUM, 61: }; 62: 63: 64: enum _AG903_SspJustifiedType { 65: AG903_SSP_LEFT_JUSTIFIED = 0, 68: }; 69: 70: 75: }; 76: 77: 90: typedef uint32_t AG903_SSPMgrHandle; 91: 92: 103: typedef void (*AG903_SSPMgrClbk)(AG903_SSPMgrHandle* handle, uint32_t event); 104: 105: 109: typedef struct _AG903_SSPMgrSspParam{ 110: uint16_t clkdiv; 111: uint8_t wordlen; 112: uint8_t slave; 113: } AG903_SSPMgrSspParam; 114: 115: 124: typedef struct _AG903_SSPMgrSpiParam{ 125: uint16_t clkdiv; 126: uint8_t wordlen; 127: uint8_t polarity; 128: uint8_t firstbit; 129: uint8_t sclktype; 130: uint8_t slave; 131: uint8_t flash; 132: } AG903_SSPMgrSpiParam; 133: 134: 143: typedef struct _AG903_SSPMgrI2sParam{ 144: uint16_t clkdiv; 145: uint8_t wordlen; 146: uint8_t mono; 147: uint8_t polarity; 148: uint8_t firstbit; 149: uint8_t padlen; 150: uint8_t justified; 151: uint8_t slave; 152: uint8_t reserve[3]; 153: } AG903_SSPMgrI2sParam; 154: 155: 158: typedef struct _AG903_SSPMgrSpdifParam{ 159: uint8_t datalen; 160: uint8_t validity; 161: uint8_t reserve[2]; 162: } AG903_SSPMgrSpdifParam; 163: 164: 165: typedef struct _AG903_SSPMgrSpdifCbit{ 166: uint8_t status[5]; 167: uint8_t reserve[3]; 168: } AG903_SSPMgrSpdifCbit; 169: 170: 171: typedef struct _AG903_SSPMgrSpdifUbit{ 172: uint32_t userbit[12]; 173: } AG903_SSPMgrSpdifUbit; 174: 175: 176: typedef struct _AG903_SSPMgrQueStatus{ 177: uint32_t txremain; 178: uint32_t received; 179: uint32_t txquecnt; 180: uint32_t rxquecnt; 181: } AG903_SSPMgrQueStatus; 182: 183: 187: uint8_t rxfifo_num; 188: uint8_t busy; 189: uint8_t txfifo_notfull; 190: uint8_t rxfifo_full; 191: uint8_t reserve[3]; 192: } AG903_SSPMgrStatus; 193: 194: 195: int32_t AG903_SSPMgrInit(uint8_t ch); 196: int32_t AG903_SSPMgrGetHandle(uint8_t ch, AG903_SSPMgrHandle** handle); 197: int32_t AG903_SSPMgrReleaseHandle(AG903_SSPMgrHandle* handle); 198: int32_t AG903_SSPMgrSetCallback(AG903_SSPMgrHandle* handle, AG903_SSPMgrClbk clbk); 199: int32_t AG903_SSPMgrSetSspMode(AG903_SSPMgrHandle* handle, AG903_SSPMgrSspParam* param); 200: int32_t AG903_SSPMgrSetSpiMode(AG903_SSPMgrHandle* handle, AG903_SSPMgrSpiParam* param); 201: int32_t AG903_SSPMgrSetI2sMode(AG903_SSPMgrHandle* handle, AG903_SSPMgrI2sParam* param); 202: int32_t AG903_SSPMgrSetSpdifMode(AG903_SSPMgrHandle* handle, AG903_SSPMgrSpdifParam* param); 203: int32_t AG903_SSPMgrSetSpdifCbit(AG903_SSPMgrHandle* handle, AG903_SSPMgrSpdifCbit* cbit); 204: int32_t AG903_SSPMgrSetSpdifUbit(AG903_SSPMgrHandle* handle, uint8_t offset, uint32_t ubit); 205: int32_t AG903_SSPMgrSetSpdifUbitALL(AG903_SSPMgrHandle* handle, AG903_SSPMgrSpdifUbit* ubit); 206: int32_t AG903_SSPMgrSetSendBuf(AG903_SSPMgrHandle* handle, uint8_t* buf, uint32_t size); 207: int32_t AG903_SSPMgrSetReceiveBuf(AG903_SSPMgrHandle* handle, uint8_t* buf, uint32_t size); 208: int32_t AG903_SSPMgrEnableDmaMode(AG903_SSPMgrHandle* handle, uint8_t mode); 209: int32_t AG903_SSPMgrDisableDmaMode(AG903_SSPMgrHandle* handle); 210: int32_t AG903_SSPMgrEnableTransfer(AG903_SSPMgrHandle* handle); 211: int32_t AG903_SSPMgrDisableTransfer(AG903_SSPMgrHandle* handle); 212: 213: int32_t AG903_SSPMgrSpiSend(AG903_SSPMgrHandle* handle, const void* buf, uint32_t num); 214: int32_t AG903_SSPMgrSpiReceive(AG903_SSPMgrHandle* handle, void* buf, uint32_t num); 215: int32_t AG903_SSPMgrSpiSendReceive(AG903_SSPMgrHandle* handle, const void* tx_buf, uint32_t tx_num, void *rx_buf, uint32_t rx_num); 216: int32_t AG903_SSPMgrSpiSendDma(AG903_SSPMgrHandle* handle, const void* buf, uint32_t num); 217: int32_t AG903_SSPMgrSpiReceiveDma(AG903_SSPMgrHandle* handle, void* buf, uint32_t num); 218: int32_t AG903_SSPMgrSpiSendReceiveDma(AG903_SSPMgrHandle* handle, const void* tx_buf, uint32_t tx_num, void *rx_buf, uint32_t rx_num); 219: int32_t AG903_SSPMgrSpiEnableTransfer(AG903_SSPMgrHandle* handle); 220: int32_t AG903_SSPMgrSpiDisableTransfer(AG903_SSPMgrHandle* handle); 221: 222: int32_t AG903_SSPMgrAttachTxDma(AG903_SSPMgrHandle* handle, uint8_t dma_ch, uint8_t dma_if); 223: int32_t AG903_SSPMgrAttachRxDma(AG903_SSPMgrHandle* handle, uint8_t dma_ch, uint8_t dma_if); 224: int32_t AG903_SSPMgrDetachTxDma(AG903_SSPMgrHandle* handle); 225: int32_t AG903_SSPMgrDetachRxDma(AG903_SSPMgrHandle* handle); 226: int32_t AG903_SSPMgrSetTxDmaBeat(AG903_SSPMgrHandle* handle, uint8_t beat); 227: int32_t AG903_SSPMgrSetRxDmaBeat(AG903_SSPMgrHandle* handle, uint8_t beat); 228: int32_t AG903_SSPMgrSendDma(AG903_SSPMgrHandle* handle, const uint8_t* buf, uint32_t size); 229: int32_t AG903_SSPMgrReceiveDma(AG903_SSPMgrHandle* handle, uint8_t* buf, uint32_t size); 230: 231: int32_t AG903_SSPMgrGetStatus(AG903_SSPMgrHandle* handle, AG903_SSPMgrStatus* status); 232: int32_t AG903_SSPMgrClearTxQue(AG903_SSPMgrHandle* handle); 233: int32_t AG903_SSPMgrClearRxQue(AG903_SSPMgrHandle* handle); 234: int32_t AG903_SSPMgrGetQueStatus(AG903_SSPMgrHandle* handle, AG903_SSPMgrQueStatus* status); 235: int32_t AG903_SSPMgrClearTxFifo(AG903_SSPMgrHandle* handle); 236: int32_t AG903_SSPMgrClearRxFifo(AG903_SSPMgrHandle* handle); 237: int32_t AG903_SSPMgrSetTxFifoThreshold(AG903_SSPMgrHandle* handle, uint8_t threshold); 238: int32_t AG903_SSPMgrSetRxFifoThreshold(AG903_SSPMgrHandle* handle, uint8_t threshold); 239: int32_t AG903_SSPMgrReset(AG903_SSPMgrHandle* handle); 240: 241: #ifdef __cplusplus 242: } 243: #endif 244: #endif
 
名前 
説明 
 
MSB/LSB 
 
FS信号パルス幅(TDM用) 
 
パディングタイプ 
 
極性 
 
SPIクロックモード 
名前 
説明 
イベント検出ビット (オーバーラン) 
イベント検出ビット (受信完了) 
イベント検出ビット (送信完了) 
イベント検出ビット (アンダーラン) 
受信FIFO Treshold 
受信キュー数 
送信FIFO Treshold 
送信キュー数 
 
名前 
説明 
 
I2S設定パラメータ
clkdiv の最小値は「4」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
mono は true=mono動作、false=stereo動作 です。
polarity は右から指定します。 _AG903_SspPolarityType
firstbit は右から指定します。 _AG903_SspFirstbitType
padlen は0埋めのPaddingサイズを指定します。
justified は右から指定します。 _AG903_SspJustifiedType
slave は true=Slave動作、false=Master動作 です。 
 
キュー状態 
 
S/PDIF Cビット 
 
S/PDIF設定パラメータ
datalen はオーディオデータ長を設定します。設定可能な値は、16,20,24です。
validity は true=オーディオデータ有効、false=オーディオデータ無効 です。 
 
S/PDIF Uビット 
 
SPI設定パラメータ
clkdiv の最小値は「2」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
polarity は右から指定します。 _AG903_SspPolarityType
firstbit は右から指定します。 _AG903_SspFirstbitType
sclktype は右から指定します。 _AG903_SspSpiClkMode
slave は true=Slave動作、false=Master動作 です。
flash は SPIフラッシュ特化モードでアクセスするとき1、その他のとき0です。
 
 
SSP設定パラメータ
clkdiv の最小値は「4」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
slave は true=Slave動作、false=Master動作 です。 
 
ステータス
SSPnSSPStatus の内容になります。詳細は『AX51903仕様書』を参照して下さい。 
 
I2S設定パラメータ
clkdiv の最小値は「4」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
mono は true=mono動作、false=stereo動作 です。
polarity は右から指定します。 _AG903_SspPolarityType
firstbit は右から指定します。 _AG903_SspFirstbitType
padlen は0埋めのPaddingサイズを指定します。
justified は右から指定します。 _AG903_SspJustifiedType
slave は true=Slave動作、false=Master動作 です。 
 
キュー状態 
 
S/PDIF Cビット 
 
S/PDIF設定パラメータ
datalen はオーディオデータ長を設定します。設定可能な値は、16,20,24です。
validity は true=オーディオデータ有効、false=オーディオデータ無効 です。 
 
S/PDIF Uビット 
 
SPI設定パラメータ
clkdiv の最小値は「2」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
polarity は右から指定します。 _AG903_SspPolarityType
firstbit は右から指定します。 _AG903_SspFirstbitType
sclktype は右から指定します。 _AG903_SspSpiClkMode
slave は true=Slave動作、false=Master動作 です。
flash は SPIフラッシュ特化モードでアクセスするとき1、その他のとき0です。
 
 
SSP設定パラメータ
clkdiv の最小値は「4」で奇数指定は不可です。またSlave動作時は設定無効です。
wordlen は伝送データのWord長をbit単位で設定します。
slave は true=Slave動作、false=Master動作 です。 
 
ステータス
SSPnSSPStatus の内容になります。詳細は『AX51903仕様書』を参照して下さい。 
名前 
説明 
コールバック関数の型。
handleはSSPハンドル、eventはイベント検出ビット(下表参照)。
 
SSPハンドル 
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.