Skip to content
Snippets Groups Projects
Commit ad509803 authored by Daniel Newbrook's avatar Daniel Newbrook
Browse files

Testing Interrupt Not yet working

parent c2b315e0
Branches
Tags
1 merge request!2Feat dma350 merge into main
...@@ -119,8 +119,14 @@ module nanosoc_ss_dma #( ...@@ -119,8 +119,14 @@ module nanosoc_ss_dma #(
//------------------------------- //-------------------------------
//DMA Controller 0 Instantiation //DMA Controller 0 Instantiation
//------------------------------- //-------------------------------
wire DMAC_1_PSEL_IN; wire DMAC_1_PSEL_IN;
assign DMAC_1_PSEL_IN = DMAC_1_PSEL | DMAC_1_PSEL_HI; assign DMAC_1_PSEL_IN = DMAC_1_PSEL | DMAC_1_PSEL_HI;
// DMA Status Tie-off signals
assign DMAC_0_DMA_DONE = {DMAC_0_CHANNEL_NUM{1'b0}};
assign DMAC_0_DMA_ERR = 1'b0;
sldma350_ahb #( sldma350_ahb #(
.SYS_ADDR_W (SYS_ADDR_W), .SYS_ADDR_W (SYS_ADDR_W),
.SYS_DATA_W (SYS_DATA_W), .SYS_DATA_W (SYS_DATA_W),
......
...@@ -52,6 +52,12 @@ uint32_t LinkCmd[6]; ...@@ -52,6 +52,12 @@ uint32_t LinkCmd[6];
// Variable to store the address of the above array // Variable to store the address of the above array
uintptr_t LinkCmd_adr = (uintptr_t) LinkCmd; uintptr_t LinkCmd_adr = (uintptr_t) LinkCmd;
volatile int dma_done_irq_occurred;
volatile int dma_done_irq_expected;
volatile int dma_error_irq_occurred;
volatile int dma_error_irq_expected;
void delay(void);
void SystemInitialization(void); void SystemInitialization(void);
int main(void) { int main(void) {
...@@ -376,6 +382,33 @@ int main(void) { ...@@ -376,6 +382,33 @@ int main(void) {
} }
printf("---STARTING 1D Command Tests With interrupts---\n");
printf("Test BURST with 1D basic commands from COPY_ADDR_SRC to COPY_ADDR_DST...\n");
for (uint32_t ch=0; ch < ch_num; ch++) {
//
// Write all settings to the DMA registers
AdaChannelInit(ch_settings, ch_srcattr, ch_desattr, ch, SECURE);
Ada1DIncrCommand(command_base, command_1d_incr, ch, SECURE);
SetAdaWrapRegs(command_1d_wrap, ch, SECURE);
AdaSetIntEn(ch_irqs, ch, SECURE);
printf("DMA %d configured. Starting the transfer.\n", ch);
dma_done_irq_expected = 1;
dma_done_irq_occurred = 0;
NVIC_ClearPendingIRQ(DMA_IRQn);
NVIC_EnableIRQ(DMA_IRQn);
// Start DMA operation and wait for done IRQ
AdaEnable(ch, SECURE);
__WFI();
uint8_t ch_enabled = 1;
while (ch_enabled == 1) {
ch_enabled = AdaGetEnable(ch, SECURE);
}
printf("DMA transfer finished\n");
}
UartEndSimulation(); UartEndSimulation();
return 0; return 0;
} }
...@@ -435,3 +468,20 @@ unsigned int address_test_read(unsigned int addr) ...@@ -435,3 +468,20 @@ unsigned int address_test_read(unsigned int addr)
); );
} }
#endif #endif
void DMA_Handler(void){
// Check the source of the interrupt and clear interrupts
printf("DMA Interrupted \n")
AdaStatType ST = AdaReadStatus(ch, NON_SECURE);
if (ST.STAT_DONE == 1) {
AdaClearChDone(ch, NON_SECURE);
} else if (ST.STAT_ERR == 1) {
AdaClearChError(ch, NON_SECURE);
} else if (ST.STAT_DISABLED == 1) {
AdaClearChDisabled(ch, NON_SECURE);
} else if (ST.STAT_STOPPED == 1) {
AdaClearChStopped(ch, NON_SECURE);
} else {
printf("Unknown IRQ on CH%d!\n", ch);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment