Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DRV_I2S_BaudSet(DRV_HANDLE handle, uint32_t spiClock, uint32_t baud)
- /* Clock System Service Configuration Options*/
- #define SYS_CLK_FREQ 200000000ul
- #define SYS_CLK_BUS_PERIPHERAL_1 100000000ul
- #define SYS_CLK_BUS_PERIPHERAL_2 100000000ul
- #define SYS_CLK_BUS_PERIPHERAL_3 100000000ul
- #define SYS_CLK_BUS_PERIPHERAL_4 100000000ul
- #define SYS_CLK_BUS_PERIPHERAL_5 100000000ul
- #define SYS_CLK_BUS_PERIPHERAL_7 200000000ul
- #define SYS_CLK_BUS_PERIPHERAL_8 100000000ul
- #define SYS_CLK_BUS_REFERENCE_1 4096000ul
- #define SYS_CLK_CONFIG_PRIMARY_XTAL 24000000ul
- #define SYS_CLK_CONFIG_SECONDARY_XTAL 32768ul
- spiClock = SYS_CLK_BUS_REFERENCE_1;
- switch(appVoiceRecordLoopData.state)
- {
- case APP_VOICE_RECORD_LOOP_STATES_CODEC_OPEN:
- {
- /* A client opens the driver object to get an Handle */
- appVoiceRecordLoopData.codecClient.handle = DRV_I2S_Open(DRV_I2S_INDEX_0,
- DRV_IO_INTENT_READ | DRV_IO_INTENT_EXCLUSIVE);
- if(appVoiceRecordLoopData.codecClient.handle != DRV_HANDLE_INVALID)
- {
- // Sets the baud rate to a new value as below
- //The baud to be set.
- baud = 64000; <======Need to change this!!!
- clock = 4096000ul;
- DRV_I2S_BaudSet(appVoiceRecordLoopData.codecClient.handle, clock, baud);
- appVoiceRecordLoopData.state = APP_VOICE_RECORD_LOOP_STATES_CODEC_SET_BUFFER_HANDLER;
- }
- else
- {
- /* Got an Invalid Handle. Wait for CODEC to Initialize */
- ;
- }
- }
- break;
- /* Set a handler for the audio buffer completion event */
- case APP_VOICE_RECORD_LOOP_STATES_CODEC_SET_BUFFER_HANDLER:
- {
- DRV_I2S_BufferEventHandlerSet(appVoiceRecordLoopData.codecClient.handle,
- appVoiceRecordLoopData.codecClient.bufferEventHandler,
- appVoiceRecordLoopData.codecClient.context);
- appVoiceRecordLoopData.state = APP_VOICE_RECORD_LOOP_STATES_CODEC_ADD_FIRST_BUFFER_READ;
- }
- break;
- case APP_VOICE_RECORD_LOOP_STATES_CODEC_ADD_FIRST_BUFFER_READ:
- {
- /* Initiate the first Read Request */
- DRV_I2S_BufferAddRead(appVoiceRecordLoopData.codecClient.handle,
- &appVoiceRecordLoopData.codecClient.writeReadBufHandle,
- appVoiceRecordLoopData.codecClient.rxbufferObject,
- appVoiceRecordLoopData.codecClient.bufferSize);
- if(DRV_I2S_BUFFER_HANDLE_INVALID != appVoiceRecordLoopData.codecClient.writeReadBufHandle)
- {
- appVoiceRecordLoopData.state = APP_VOICE_RECORD_LOOP_STATES_CODEC_WAIT_FOR_BUFFER_COMPLETE;
- }
- }
- break;
- /* Audio data request under process */
- case APP_VOICE_RECORD_LOOP_STATES_CODEC_WAIT_FOR_BUFFER_COMPLETE:
- {
- ; /*Do nothing*/
- }
- break;
Add Comment
Please, Sign In to add comment