A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Tue Feb 17 10:41:48 2015 +0100
Parent:
30:a97015441bb4
Child:
32:fa8d2c7da38d
Commit message:
- Added function get current BIOS version
- Added function to allocate consequtive frame buffers
- Removed printouts that slowed down the touch controller
- Replaced wait_ms with Thread::wait in MCIFileSystem
- Changed CardDetect pin for MCIFileSystem
- Added (but disabled) extra pins for measurements
- Updated the DM_USBHost library (see version history there for changes)
- Updated EthernetInterface library to get TARGET_LPC4088_DM support
- Updated to latest versions of mbed, mbed-rpc, mbed-rtos and USBDevice libs

Changed in this revision

Bios/BiosLoader.cpp Show annotated file Show diff for this revision Revisions of this file
Bios/BiosLoader.h Show annotated file Show diff for this revision Revisions of this file
DM_USBHost.lib Show annotated file Show diff for this revision Revisions of this file
Display/BiosDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
Display/BiosDisplay.h Show annotated file Show diff for this revision Revisions of this file
Display/BiosTouch.cpp Show annotated file Show diff for this revision Revisions of this file
Display/Display.h Show annotated file Show diff for this revision Revisions of this file
EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
FileSystems/MCIFileSystem.cpp Show annotated file Show diff for this revision Revisions of this file
FileSystems/MCIFileSystem.h Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
dm_board_config.h.txt Show annotated file Show diff for this revision Revisions of this file
mbed-rpc.lib Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
meas.h Show annotated file Show diff for this revision Revisions of this file
--- a/Bios/BiosLoader.cpp	Mon Jan 26 15:24:15 2015 +0100
+++ b/Bios/BiosLoader.cpp	Tue Feb 17 10:41:48 2015 +0100
@@ -108,7 +108,8 @@
     _initialized(false),
     _biosData(NULL),
     _conf(NULL),
-    _confSize(0)
+    _confSize(0),
+    _stats(0)
 {
 }
 
@@ -183,6 +184,7 @@
     // Bios header has been verified and seems ok
     *data = _conf;
     *size = _confSize;
+    _stats = fh.version;
     err = DMBoard::Ok;
   } while (false);
   
@@ -353,8 +355,14 @@
 
 void BiosLoader::handleI2CInterrupt()
 {
-  SET_MEAS_PIN_2();
   _bios.i2cIRQHandler(_biosData);
-  CLR_MEAS_PIN_2();
 }
 
+void BiosLoader::getBiosStats(uint8_t& type, uint8_t& major, uint8_t& minor, uint8_t& rev)
+{
+  type  = (_stats >> 24) & 0xff;
+  major = (_stats >> 16) & 0xff;
+  minor = (_stats >>  8) & 0xff;
+  rev   = (_stats >>  0) & 0xff;
+}
+
--- a/Bios/BiosLoader.h	Mon Jan 26 15:24:15 2015 +0100
+++ b/Bios/BiosLoader.h	Tue Feb 17 10:41:48 2015 +0100
@@ -44,6 +44,8 @@
     bool isKnownSPIFIMemory(uint8_t mfgr, uint8_t devType, uint8_t devID, uint32_t memSize, uint32_t* eraseBlockSize);
     void handleI2CInterrupt();    
 
+    void getBiosStats(uint8_t& type, uint8_t& major, uint8_t& minor, uint8_t& rev);
+
     friend class BiosDisplay;
     friend class BiosTouch;
     friend class DMBoard;
@@ -56,6 +58,7 @@
     void* _biosData;
     uint8_t* _conf;
     uint32_t _confSize;
+    uint32_t _stats;
 
     explicit BiosLoader();
     // hide copy constructor
--- a/DM_USBHost.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/DM_USBHost.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/embeddedartists/code/DM_USBHost/#ffec1f271b7c
+http://developer.mbed.org/users/embeddedartists/code/DM_USBHost/#9a462d032742
--- a/Display/BiosDisplay.cpp	Mon Jan 26 15:24:15 2015 +0100
+++ b/Display/BiosDisplay.cpp	Tue Feb 17 10:41:48 2015 +0100
@@ -164,6 +164,14 @@
   return NULL;
 }
 
+void* BiosDisplay::allocateFramebuffers(uint32_t num, Display::Resolution res)
+{
+  if (_initialized && num>0) {
+    return malloc(fbSize()*num);
+  }
+  return NULL;
+}
+
 void BiosDisplay::setFramebuffer(void* buff)
 {
   LPC_LCD->UPBASE = (uint32_t)buff;
--- a/Display/BiosDisplay.h	Mon Jan 26 15:24:15 2015 +0100
+++ b/Display/BiosDisplay.h	Tue Feb 17 10:41:48 2015 +0100
@@ -61,6 +61,7 @@
     virtual void setFramebuffer(void* buff);
     virtual void* swapFramebuffer(void* buff);
     virtual void* allocateFramebuffer(Resolution res=Resolution_16bit_rgb565);
+    virtual void* allocateFramebuffers(uint32_t num=1, Resolution res=Resolution_16bit_rgb565);
 
 private:
 
--- a/Display/BiosTouch.cpp	Mon Jan 26 15:24:15 2015 +0100
+++ b/Display/BiosTouch.cpp	Tue Feb 17 10:41:48 2015 +0100
@@ -124,31 +124,29 @@
   }
   memset(_latest, 0, _points*sizeof(touch_coordinate_t));
   while(true) {
-    SET_MEAS_PIN_1();
     osEvent evt = _mailbox.get(osWaitForever);
-    CLR_MEAS_PIN_1();
     if (evt.status == osEventMail) {
       touch_mail_t* mail = (touch_mail_t*)evt.value.p;
       memcpy(_latest, mail->touch, mail->num * sizeof(touch_coordinate_t));
       _mailbox.free(mail);
       _dbgRemoved++;
-      if (_points == 1) {
-        log->printf("{%3d,%3d,%d} at %u/%u, with %u lost\n", 
-                    _latest[0].x,
-                    _latest[0].y,
-                    _latest[0].z,
-                    _dbgRemoved, _dbgAdded,
-                    _lostData);
-      } else {
-        log->printf("{%d,%d,%d,%d,%d} at %u/%u, with %u lost\n", 
-                    _latest[0].z,
-                    _latest[1].z,
-                    _latest[2].z,
-                    _latest[3].z,
-                    _latest[4].z,
-                    _dbgRemoved, _dbgAdded,
-                    _lostData);
-      }
+      //if (_points == 1) {
+      //  log->printf("{%3d,%3d,%d} at %u/%u, with %u lost\n", 
+      //              _latest[0].x,
+      //              _latest[0].y,
+      //              _latest[0].z,
+      //              _dbgRemoved, _dbgAdded,
+      //              _lostData);
+      //} else {
+      //  log->printf("{%d,%d,%d,%d,%d} at %u/%u, with %u lost\n", 
+      //              _latest[0].z,
+      //              _latest[1].z,
+      //              _latest[2].z,
+      //              _latest[3].z,
+      //              _latest[4].z,
+      //              _dbgRemoved, _dbgAdded,
+      //              _lostData);
+      //}
     } else {
       log->printf("got non-mail event: 0x%x\n", evt.status);
       continue;
@@ -177,14 +175,11 @@
 
 void TouchHandler::handleTouchInterrupt()
 {
-  SET_MEAS_PIN_2();
   _bios->touchIrqHandler(_biosData);
-  CLR_MEAS_PIN_2();
 }
 
 void TouchHandler::handleNewData(touch_coordinate_t* coord, int num)
 {
-  SET_MEAS_PIN_4();
   touch_mail_t* mail = _mailbox.alloc(0);
   if (mail == NULL) {
     //DMBoard::instance().logger()->printf("Lost touch event\n");
@@ -195,7 +190,6 @@
     memcpy(&mail->touch, coord, mail->num*sizeof(touch_coordinate_t));
     _mailbox.put(mail);
   }
-  CLR_MEAS_PIN_4();
 }
 
 void TouchHandler::changeTouchInterrupt(bool enable, touch_irq_trigger_t trigger)
--- a/Display/Display.h	Mon Jan 26 15:24:15 2015 +0100
+++ b/Display/Display.h	Tue Feb 17 10:41:48 2015 +0100
@@ -133,9 +133,26 @@
      *
      * Free the allocated memory when done using the free() function.
      *
+     *  @param res the resolution (default is the one that the display is using)
      *  @returns a new framebuffer or NULL if out of memory 
      */
     virtual void* allocateFramebuffer(Resolution res=Resolution_16bit_rgb565) = 0;
+    
+    /** Allocate enough memory for one or more consequtive framebuffers
+     *
+     * This function is a to make it easier to allocate memory for framebuffers
+     * as the number of bytes needed depends on width, height and bytes per pixel.
+     *
+     * Free the allocated memory when done using the free() function.
+     *
+     * Use the default parameters to get one framebuffer for the display's current
+     * resolution.
+     *
+     *  @param num the number of framebuffers, should be >= 1
+     *  @param res the resolution (default is the one that the display is using)
+     *  @returns new framebuffers or NULL if out of memory 
+     */
+    virtual void* allocateFramebuffers(uint32_t num=1, Resolution res=Resolution_16bit_rgb565) = 0;
 };
 
 #endif
--- a/EthernetInterface.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/EthernetInterface.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#d1ccbed7687a
+http://mbed.org/users/mbed_official/code/EthernetInterface/#65b0d840274c
--- a/FileSystems/MCIFileSystem.cpp	Mon Jan 26 15:24:15 2015 +0100
+++ b/FileSystems/MCIFileSystem.cpp	Tue Feb 17 10:41:48 2015 +0100
@@ -20,6 +20,7 @@
 
 #include "MCIFileSystem.h"
 #include "mbed_debug.h"
+#include "rtos.h"
 
 #include "diskio.h" //STA_* defines
 #include "gpdma.h"
@@ -34,7 +35,7 @@
 
 #define DATA_TIMER_VALUE_R           (SDC_TRAN_CLOCK_RATE / 4)    // 250ms
 #define DATA_TIMER_VALUE_W           (SDC_TRAN_CLOCK_RATE)    // 1000ms
-#define ACQUIRE_DELAY       (0.100f)      /*!< inter-command acquire oper condition delay in seconds */
+#define ACQUIRE_DELAY       (100)      /*!< inter-command acquire oper condition delay in milliseconds */
 
 #define SYSCTL_CLOCK_SDC    (1<<28)
 
@@ -827,7 +828,7 @@
     return Ret;
   }
 
-  wait(ACQUIRE_DELAY);
+  Thread::wait(ACQUIRE_DELAY);
 
   /* Send interface operation condiftion */
   Ret = mci_SendIfCond();
@@ -860,7 +861,7 @@
       uint32_t OCR;
       /* Enter to Open Drain mode */
       mci_PowerControl(PowerOn, SDC_PWR_OPENDRAIN);
-      wait(ACQUIRE_DELAY);
+      Thread::wait(ACQUIRE_DELAY);
       Ret = mci_SendOpCond(&OCR);
       if (Ret != SDC_RET_OK) {
         return Ret;
@@ -1494,10 +1495,7 @@
 
 void MCIFileSystem::mci_WriteDelay() const
 {
-//  volatile uint8_t i;
-//  for ( i = 0; i < 0x10; i++ ) {  /* delay 3MCLK + 2PCLK  */
-//  }
-  wait(0.00001f); /* delay 10 us */
+  wait_us(10);
 }
 
 MCIFileSystem::ReturnCode MCIFileSystem::mci_SendCmd(uint32_t Command, uint32_t Arg, uint32_t timeout) const
--- a/FileSystems/MCIFileSystem.h	Mon Jan 26 15:24:15 2015 +0100
+++ b/FileSystems/MCIFileSystem.h	Tue Feb 17 10:41:48 2015 +0100
@@ -55,7 +55,7 @@
      * @param name The name used to access the virtual filesystem
      * @param cd   The pin connected to the CardDetect line
      */
-    MCIFileSystem(const char* name, PinName cd = p38);
+    MCIFileSystem(const char* name, PinName cd = P4_16);
 
     virtual ~MCIFileSystem();
 
--- a/USBDevice.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/USBDevice.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#dfe51ad5cacf
+http://mbed.org/users/mbed_official/code/USBDevice/#0ca6eeb54b97
--- a/dm_board_config.h.txt	Mon Jan 26 15:24:15 2015 +0100
+++ b/dm_board_config.h.txt	Tue Feb 17 10:41:48 2015 +0100
@@ -33,5 +33,6 @@
 // #define DM_BOARD_ENABLE_MEASSURING_PINS
 // #define DM_BOARD_BIOS_DEVELOPMENT
 #define DM_BOARD_USE_REGISTRY
+#define DM_BOARD_USE_BUILTIN_IMAGES
 
 #endif
--- a/mbed-rpc.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/mbed-rpc.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rpc/#2a26fd6a2b36
+http://mbed.org/users/mbed_official/code/mbed-rpc/#fece2d5e8d96
--- a/mbed-rtos.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/mbed-rtos.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#13a25134ac60
+http://mbed.org/users/mbed_official/code/mbed-rtos/#83e169389a69
--- a/mbed-src.lib	Mon Jan 26 15:24:15 2015 +0100
+++ b/mbed-src.lib	Tue Feb 17 10:41:48 2015 +0100
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-src/#8a0b45cd594f
+http://mbed.org/users/mbed_official/code/mbed-src/#5831be29b0ad
--- a/meas.h	Mon Jan 26 15:24:15 2015 +0100
+++ b/meas.h	Tue Feb 17 10:41:48 2015 +0100
@@ -28,6 +28,10 @@
  * Typedefs and defines
  *****************************************************************************/
 
+// Enable extra measuring pins, at the expense of peripheral access.
+// For example MEAS pins 5-9 will prevent use of UART4/SPI2 and some timers.
+//#define EXTRA_PINS
+
 // Internal macros, don't use directly
 #if defined(DM_BOARD_ENABLE_MEASSURING_PINS)
   #define _INTERNAL_SET_MEAS_PIN(__port, __pin)    ((LPC_GPIO ## __port)->SET = (1UL << (__pin)))
@@ -53,6 +57,43 @@
 #define SET_MEAS_PIN_4()     _INTERNAL_SET_MEAS_PIN(1, 19)
 #define CLR_MEAS_PIN_4()     _INTERNAL_CLR_MEAS_PIN(1, 19)
 
+#ifdef EXTRA_PINS
+    // Manipulates measurement pin 5 which is GPIO5[0], available on J10-15
+    #define SET_MEAS_PIN_5()     _INTERNAL_SET_MEAS_PIN(5, 0)
+    #define CLR_MEAS_PIN_5()     _INTERNAL_CLR_MEAS_PIN(5, 0)
+    
+    // Manipulates measurement pin 6 which is GPIO5[1], available on J10-16
+    #define SET_MEAS_PIN_6()     _INTERNAL_SET_MEAS_PIN(5, 1)
+    #define CLR_MEAS_PIN_6()     _INTERNAL_CLR_MEAS_PIN(5, 1)
+    
+    // Manipulates measurement pin 7 which is GPIO5[2], available on J10-17
+    #define SET_MEAS_PIN_7()     _INTERNAL_SET_MEAS_PIN(5, 2)
+    #define CLR_MEAS_PIN_7()     _INTERNAL_CLR_MEAS_PIN(5, 2)
+    
+    // Manipulates measurement pin 8 which is GPIO5[3], available on J10-18
+    #define SET_MEAS_PIN_8()     _INTERNAL_SET_MEAS_PIN(5, 3)
+    #define CLR_MEAS_PIN_8()     _INTERNAL_CLR_MEAS_PIN(5, 3)
+    
+    // Manipulates measurement pin 9 which is GPIO5[4], available on J10-19
+    #define SET_MEAS_PIN_9()     _INTERNAL_SET_MEAS_PIN(5, 4)
+    #define CLR_MEAS_PIN_9()     _INTERNAL_CLR_MEAS_PIN(5, 4)
+    
+    #define _INTERNAL_EXTRA_INIT_MEAS() do {\
+        LPC_IOCON->P5_0 &= ~0x7; \
+        LPC_IOCON->P5_1 &= ~0x7; \
+        LPC_IOCON->P5_2 &= ~0x7; \
+        LPC_IOCON->P5_3 &= ~0x7; \
+        LPC_IOCON->P5_4 &= ~0x7; \
+        LPC_GPIO5->DIR |= (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4); \
+        CLR_MEAS_PIN_5(); \
+        CLR_MEAS_PIN_6(); \
+        CLR_MEAS_PIN_7(); \
+        CLR_MEAS_PIN_8(); \
+        CLR_MEAS_PIN_9(); \
+      } while(0)
+#else
+    #define _INTERNAL_EXTRA_INIT_MEAS() do {} while(false)
+#endif
 
 #if defined(DM_BOARD_ENABLE_MEASSURING_PINS)
   #define _INTERNAL_INIT_MEAS() do {\
@@ -65,6 +106,7 @@
       CLR_MEAS_PIN_2(); \
       CLR_MEAS_PIN_3(); \
       CLR_MEAS_PIN_4(); \
+      _INTERNAL_EXTRA_INIT_MEAS(); \
     } while(0)
 #else
   #define _INTERNAL_INIT_MEAS()                    do {} while(0)