#ifndef __I2S_H
#define __I2S_H
#include "OB90A64U1.h"
uint32_t I2S_Open(OB_I2S_Type *pI2S, uint32_t MasterSlave, uint32_t SampleRate, uint32_t WordWidth, uint32_t AudioFormat, uint32_t DataFormat);

void I2S_Close(OB_I2S_Type *pI2S);
void I2S_Enable(OB_I2S_Type *pI2S);
void I2S_EnableInt(OB_I2S_Type *pI2S,  uint32_t InterruptEvent);
void I2S_DisableInt(OB_I2S_Type *pI2S,  uint32_t InterruptEvent);
uint32_t I2S_EnableMCLK(OB_I2S_Type *pI2S, uint32_t MclkClock);
uint32_t I2S_EnableMCLK(OB_I2S_Type *pI2S, uint32_t u32MclkClock);
uint32_t I2S_DisableMCLK(OB_I2S_Type *pI2S);

#define I2S_MODE_MASTER 0
#define I2S_MODE_Slave  1

#define I2S_FORMAT_I2S    0
#define I2S_FORMAT_MSB    1
#define I2S_FORMAT_PCM_A  2
#define I2S_FORMAT_PCM_B  3


#define I2S_MONO_STEREO 0
#define I2S_MONO_MONO   1

#define I2S_WIDTH_8BIT  0
#define I2S_WIDTH_16BIT 1
#define I2S_WIDTH_24BIT 2
#define I2S_WIDTH_32BIT 3

#define I2S_TXLEV_0 0
#define I2S_TXLEV_1 1
#define I2S_TXLEV_2 2
#define I2S_TXLEV_3 3
#define I2S_TXLEV_4 4
#define I2S_TXLEV_5 5
#define I2S_TXLEV_6 6
#define I2S_TXLEV_7 7

#define I2S_RXLEV_1 0
#define I2S_RXLEV_2 1
#define I2S_RXLEV_3 2
#define I2S_RXLEV_4 3
#define I2S_RXLEV_5 4
#define I2S_RXLEV_6 5
#define I2S_RXLEV_7 6
#define I2S_RXLEV_8 7

#define I2S_IE_RXUNIE (0x01 << 0 )
#define I2S_IE_RXOVIE (0x01 << 1 )
#define I2S_IE_RXTHIE (0x01 << 2 )
#define I2S_IE_TXUNIE (0x01 << 8 )
#define I2S_IE_TXOVIE (0x01 << 9 )
#define I2S_IE_TXTHIE (0x01 << 10)
#define I2S_IE_RZCIE  (0x01 << 11)
#define I2S_IE_LZCIE  (0x01 << 12)
#define I2S_IE_WDUDIE (0x01 << 24)
#define I2S_IE_WDOVIE (0x01 << 25)

#endif
