This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1000825] No SPI transaction for Atmel Dataflashcyg_dataflash_release


http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000825





--- Comment #1 from Stanislav Meduna <stano@meduna.org>  2009-09-23 15:27:40 ---
I have also changed the df_wait_ready_buf, as I can't afford to have the bus
locked while waiting for the program/erase operation to complete (the other
device on the bus needs to be serviced in much shorter time).

I am not quite sure whether the following is correct (needs also the original
patch), but I'm including it anyway:

 df_wait_ready_buf(cyg_dataflash_device_t *dev, cyg_uint8 buf_num)
 {
     df_status_t status;
+    cyg_spi_device *spi_dev = dev->spi_dev;

     if (CYG_DATAFLASH_STATE_IDLE == dev->state)
         return CYG_DATAFLASH_ERR_OK;
@@ -238,10 +480,19 @@
         // REMIND: this loop should have an timeout 
         // in case of device malfunction

-        do 
+      // XXX Stano: an access to a single dataflash is locked via
aquire/release,
+      // so the operations are guaranteed to be serialized.
+      // Do not take the whole bus while polling, there can be other devices
+      // that can't afford to wait until the operation completes
+        while (1) 
         {
             status = df_read_status(dev);
-        } while (0 == status.ready); 
+         if (0 != status.ready)
+            break;
+          cyg_spi_transaction_end(spi_dev);
+         HAL_DELAY_US(5);
+          cyg_spi_transaction_begin(spi_dev);
+        }

         dev->state    = CYG_DATAFLASH_STATE_IDLE;
         dev->busy_buf = DATA_BUF_NONE;


-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]