Skip to content

Commit

Permalink
Update VSI to match the latest FVP
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertRostohar committed Sep 29, 2021
1 parent cc015b4 commit 5bb1b41
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 177 deletions.
17 changes: 10 additions & 7 deletions VSI/audio/driver/audio_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static AudioDrv_Event_t CB_Event = NULL;
/* Audio Input Interrupt Handler */
void AudioIn_Handler (void) {

AudioIn->IRQ = 0U; /* Clear IRQ */
AudioIn->IRQ.Clear = 0x00000001U;
__ISB();
__DSB();
if (CB_Event != NULL) {
Expand All @@ -49,7 +49,8 @@ int32_t AudioDrv_Initialize (AudioDrv_Event_t cb_event) {

AudioIn->Timer.Control = 0U;
AudioIn->DMA.Control = 0U;
AudioIn->IRQ = 0U;
AudioIn->IRQ.Clear = 0x00000001U;
AudioIn->IRQ.Enable = 0x00000001U;
AudioIn->CONTROL = 0U;

//NVIC_EnableIRQ(AudioIn_IRQn);
Expand All @@ -72,7 +73,8 @@ int32_t AudioDrv_Uninitialize (void) {

AudioIn->Timer.Control = 0U;
AudioIn->DMA.Control = 0U;
AudioIn->IRQ = 0U;
AudioIn->IRQ.Clear = 0x00000001U;
AudioIn->IRQ.Enable = 0x00000000U;
AudioIn->CONTROL = 0U;

Initialized = 0U;
Expand Down Expand Up @@ -160,6 +162,9 @@ int32_t AudioDrv_Control (uint32_t control) {
AudioIn->DMA.Control = 0U;
AudioIn->CONTROL = 0U;
} else if ((control & AUDIO_DRV_CONTROL_RX_ENABLE) != 0U) {
AudioIn->CONTROL = CONTROL_ENABLE_Msk;
AudioIn->DMA.Control = ARM_VSI_DMA_Direction_P2M |
ARM_VSI_DMA_Enable_Msk;
sample_size = AudioIn->CHANNELS * ((AudioIn->SAMPLE_BITS + 7U) / 8U);
sample_rate = AudioIn->SAMPLE_RATE;
if ((sample_size == 0U) || (sample_rate == 0U)) {
Expand All @@ -168,10 +173,8 @@ int32_t AudioDrv_Control (uint32_t control) {
block_size = AudioIn->DMA.BlockSize;
AudioIn->Timer.Interval = (1000000U * (block_size / sample_size)) / sample_rate;
}
AudioIn->DMA.Control = ARM_VSI_DMA_Direction_P2M |
ARM_VSI_DMA_Enable_Msk;
AudioIn->CONTROL = CONTROL_ENABLE_Msk;
AudioIn->Timer.Control = ARM_VSI_Timer_Trig_IRQ_Msk |
AudioIn->Timer.Control = ARM_VSI_Timer_Trig_DMA_Msk |
ARM_VSI_Timer_Trig_IRQ_Msk |
ARM_VSI_Timer_Periodic_Msk |
ARM_VSI_Timer_Run_Msk;
}
Expand Down
Loading

0 comments on commit 5bb1b41

Please sign in to comment.