mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Revision:
161:2cc1468da177
Parent:
149:156823d33999
--- a/targets/TARGET_NUVOTON/TARGET_M451/dma_api.c	Tue Mar 14 16:40:56 2017 +0000
+++ b/targets/TARGET_NUVOTON/TARGET_M451/dma_api.c	Thu Mar 30 13:45:57 2017 +0100
@@ -111,6 +111,11 @@
     NVIC_EnableIRQ(dma_modinit.irq_n);
 }
 
+PDMA_T *dma_modbase(void)
+{
+    return (PDMA_T *) NU_MODBASE(dma_modinit.modname);
+}
+
 static void pdma_vec(void)
 {
     uint32_t intsts = PDMA_GET_INT_STATUS();
@@ -165,7 +170,7 @@
         PDMA->INTSTS = reqto;
         
         while (reqto) {
-            int chn_id = nu_ctz(reqto) >> PDMA_INTSTS_REQTOFn_Pos;
+            int chn_id = nu_ctz(reqto) - PDMA_INTSTS_REQTOFn_Pos;
             if (dma_chn_mask & (1 << chn_id)) {
                 struct nu_dma_chn_s *dma_chn = dma_chn_arr + chn_id;
                 if (dma_chn->handler && (dma_chn->event & DMA_EVENT_TIMEOUT)) {