- Main Page
- Modules
- Data Structures
- Files

Functions
I2S Functions
I2S

## Functions
CSL_I2sHandle | I2S_open (I2S_Instance i2sInstNum, I2S_OpMode opMode, I2S_ChanType chType)
CSL_Status | I2S_setup (CSL_I2sHandle i2sHandle, I2S_Config *i2sHwConfig)
CSL_Status | I2S_close (CSL_I2sHandle i2sHandle)
CSL_Status | I2S_read (CSL_I2sHandle i2sHandle, Uint16 *readBuff, Uint16 buffLen)
CSL_Status | I2S_write (CSL_I2sHandle i2sHandle, Uint16 *writeBuff, Uint16 buffLen)
CSL_Status | I2S_reset (CSL_I2sHandle hI2S)
CSL_Status | I2S_transEnable (CSL_I2sHandle i2sHandle, Uint16 enableBit)

## Function Documentation

CSL_Status I2S_close | ( | CSL_I2sHandle | hI2s | ) |

===========================================================================
I2S_close

Description
This function closes the specified handle to I2S.

Arguments

                i2sHandle          Handle to the I2S

Return Value CSL_Status

- CSL_SOK - Close successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
None

Post Condition
None

Modifies
None

Example

                CSL_I2sHandle   hI2S;
                CSL_status   status;

                status = I2S_close(hI2S);

===========================================================================

References CSL_I2sObj::configured, CSL_I2sObj::hwRegs, I2S_INSTANCE0, I2S_INSTANCE1, I2S_INSTANCE2, I2S_INSTANCE3, I2S_InstanceNum, I2S_INVALID, and CSL_I2sObj::i2sNum.

CSL_I2sHandle I2S_open | ( | I2S_Instance | i2sInstNum,
|  | I2S_OpMode | opMode,
|  | I2S_ChanType | chType
| ) |  |

===========================================================================
I2S_open

Description
This function returns the handle to the I2S instance. This handle is passed to all other CSL APIs.

Arguments

                i2sInstNum	Instance number to open.
                opMode		Mode of operation (intrrupt/Polling/DMA)
    			chType		Channel Type (Stereo/Mono)

Return Value CSL_I2sHandle
Valid I2S handle will be returned if handler value is not equal to NULL.

Pre Condition

Post Condition
1. The status is returned in the status variable. If status returned is

- NULL - InValid I2S handle is returned
  2. CSL_DMA_ChannelObj object structure is populated

Modifies
1. CSL_I2sObj I2S object structure
2.

Example

                I2S_Instance		 i2sInstNum;
                I2S_OpMode		     opMode;
                I2S_ChanType 	     chType;
                ...

                hI2S = I2S_open(I2S_Instance	i2sInstNum,
    					   		I2S_OpMode		opMode,
    					   		I2S_ChanType 	chType);
                ...

===========================================================================

References CSL_I2sObj::chType, CSL_I2sObj::configured, CSL_I2sObj::firstRead, CSL_I2sObj::hwRegs, I2S_INSTANCE0, I2S_INSTANCE1, I2S_INSTANCE2, I2S_INSTANCE3, I2S_InstanceNum, I2S_INVALID, CSL_I2sObj::i2sNum, and CSL_I2sObj::opMode.

CSL_Status I2S_read | ( | CSL_I2sHandle | hI2s,
|  | Uint16 * | readBuff,
|  | Uint16 | buffLen
| ) |  |

===========================================================================
I2S_read

Description
This function Read data form specified device. This function introduces a delay during the first data receive operation. Data latency is calculated as per the I2S hardware specification. This delay is applicable only to polled mode operation. For interrupt mode this function should be called only after getting the receive interrupt from the I2S.

Arguments

                i2sHandle          Handle to the I2S
    			readBuff          Pointer to the read buffer.
    			buffLen           Maximum read buffer size.

Return Value CSL_Status

- CSL_SOK - Read successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
This function has to call after I2S_open function call.

Post Condition
SPI_close can be call after this function call.

Modifies
None

Example

                CSL_I2sHandle   hI2S;
    			Uint16          readBuff[size];
                Uint16          buffLen;
                CSL_status   status;

                status = I2S_read(hI2S, &readBuff, buffLen);

===========================================================================

References CSL_I2sObj::chType, CSL_I2S_LATENCY_2, CSL_I2S_LATENCY_3, CSL_I2S_LATENCY_5, CSL_I2S_LATENCY_6, CSL_I2sObj::datapack, DMA_INTERRUPT, DMA_POLLED, CSL_I2sObj::firstRead, CSL_I2sObj::fsDiv, fsError, CSL_I2sObj::hwRegs, I2S_CHAN_STEREO, I2S_DATAPACK_ENABLE, I2S_FSDIV8, I2S_INTERRUPT, I2S_LOOPBACK_ENABLE, I2S_POLLED, I2S_WORDLEN_10, I2S_WORDLEN_12, I2S_WORDLEN_14, I2S_WORDLEN_16, I2S_WORDLEN_18, I2S_WORDLEN_20, I2S_WORDLEN_24, I2S_WORDLEN_32, I2S_WORDLEN_8, CSL_I2sObj::loopBackMode, CSL_I2sObj::opMode, ouError, and CSL_I2sObj::wordLen.

CSL_Status I2S_reset | ( | CSL_I2sHandle | hI2s | ) |

===========================================================================
I2S_reset

Description
This function Reset control and hardware specific register.

Arguments

                i2sHandle         Handle to the I2S

Return Value CSL_Status

- CSL_SOK - Reset successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
This function should call after the I2S_config call.

Post Condition
I2S_close function can be call after this function call.

Modifies
None

Example

                CSL_I2sHandle   hI2S;
                CSL_status   status;

                status = I2S_reset(hI2S);

===========================================================================

References CSL_I2sObj::hwRegs.

CSL_Status I2S_setup | ( | CSL_I2sHandle | hI2s,
|  | I2S_Config * | i2sHwConfig
| ) |  |

===========================================================================
I2S_setup

Description
It configures the I2S Controller registers of particular handle as per the values passed in the I2S config structure.

Arguments

                i2sHandle       Handle to the I2S.
                i2sHwConfig     Pointer to I2S Config structure.

Return Value CSL_Status

- CSL_SOK - Hardware setup successful
- CSL_ESYS_BADHANDLE - Invalid handle
- CSL_ESYS_INVPARAMS - Congig Parameter is invalid.

Pre Condition
I2S_open has to call, before calling I2S_setup

Post Condition
None

Modifies
1. I2S registers will be updated as per config parameter
2. CSL_I2sObj Object will be updated to store some info as passed config parameter.

Example

                CSL_I2sHandle   hI2S;
                I2S_Config      hwConfig;
                Int16           status;

                status = I2S_setup(hI2S, &hwConfig);
                ...

===========================================================================

References CSL_I2sObj::chType, I2S_Config::clkDiv, I2S_Config::clkPol, CSL_I2sObj::configured, I2S_Config::datadelay, I2S_Config::datapack, CSL_I2sObj::datapack, I2S_Config::dataType, I2S_Config::FError, I2S_Config::fsDiv, CSL_I2sObj::fsDiv, I2S_Config::fsPol, CSL_I2sObj::hwRegs, I2S_CHAN_MONO, I2S_SLAVE, I2S_Config::i2sMode, I2S_Config::loopBackMode, CSL_I2sObj::loopBackMode, I2S_Config::OuError, I2S_Config::signext, I2S_Config::wordLen, and CSL_I2sObj::wordLen.

CSL_Status I2S_transEnable | ( | CSL_I2sHandle | hI2s,
|  | Uint16 | enableBit
| ) |  |

===========================================================================
I2S_transEnable

Description
This function Enable or Disable transmission/receive bit

Arguments

                i2sHandle         Handle to the I2S

Return Value CSL_Status

- CSL_SOK - Reset successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
This fuction calls before read/write function to enable transnission

Post Condition
This fuction calls before read/write function to disable transnission

Modifies
None

Example

                CSL_I2sHandle   hI2S;
    			Uint16			enableBit
                CSL_status   	status;

                status = I2S_transEnable(CSL_I2sHandle	i2sHandle,
                						Uint16 enableBit);

===========================================================================

References CSL_I2sObj::firstRead, and CSL_I2sObj::hwRegs.

CSL_Status I2S_write | ( | CSL_I2sHandle | hI2s,
|  | Uint16 * | writeBuff,
|  | Uint16 | buffLen
| ) |  |

===========================================================================
I2S_write

Description
This function Write data to specified device.

Arguments

                i2sHandle         Handle to the I2S
    			writeBuff         Pointer to the write buffer.
    			buffLen           Maximum read buffer size.

Return Value CSL_Status

- CSL_SOK - Write successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
This function has to call after I2S_open function call.

Post Condition
SPI_close can be call after this function call.

Modifies
None

Example

                CSL_I2sHandle   hI2S;
    			Uint16          writeBuff[size];
                Uint16          buffLen;
                CSL_status   status;

                status = I2S_write(hI2S, &writeBuff, buffLen);

===========================================================================

References CSL_I2sObj::chType, DMA_INTERRUPT, DMA_POLLED, fsError, CSL_I2sObj::hwRegs, I2S_CHAN_STEREO, I2S_INTERRUPT, CSL_I2sObj::opMode, and ouError.