Daiki Kato / mbed-dev_tmp

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
dkato
Date:
Tue Apr 26 02:02:58 2016 +0000
Parent:
107:52cd7fbf6629
Commit message:
bugfixs

Changed in this revision

targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/objects.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/objects.h	Mon Apr 25 07:50:52 2016 +0000
+++ b/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/objects.h	Tue Apr 26 02:02:58 2016 +0000
@@ -41,6 +41,7 @@
 struct spi_s {
     struct st_rspi *spi;
     uint32_t       bits;
+    int            index;
 };
 
 struct gpio_irq_s {
--- a/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c	Mon Apr 25 07:50:52 2016 +0000
+++ b/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c	Tue Apr 26 02:02:58 2016 +0000
@@ -321,7 +321,10 @@
         spi_async_read(obj);
     } else {
         if (obj->rx_buff.buffer && obj->tx_buff.buffer && obj->tx_buff.pos < obj->tx_buff.length) {
-            spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
+            spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
+            if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
+                spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
+            }
             spi_irqs_set(obj, 0);
             spi_data[obj->spi.index].async_obj = NULL;
             ((void (*)())spi_data[obj->spi.index].async_callback)();
@@ -331,7 +334,10 @@
     }
     if (obj->tx_buff.buffer) {
         if (obj->tx_buff.pos == obj->tx_buff.length) {
-            spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
+            spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
+            if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
+                spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
+            }
             spi_irqs_set(obj, 0);
             spi_data[obj->spi.index].async_obj = NULL;
             ((void (*)())spi_data[obj->spi.index].async_callback)();
@@ -340,7 +346,10 @@
         }
     } else {
         if (obj->rx_buff.pos == obj->rx_buff.length) {
-            spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
+            spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
+            if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
+                spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
+            }
             spi_irqs_set(obj, 0);
             spi_data[obj->spi.index].async_obj = NULL;
             ((void (*)())spi_data[obj->spi.index].async_callback)();