mbed support for LPC4088 Display Module

Dependencies:   DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src

Dependents:   emptyProgram

Fork of DMSupport by Embedded Artists

Revision:
22:1a58a518435c
Child:
28:8ae20cb0b943
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Bios/BiosLoader.h	Fri Jan 16 11:13:39 2015 +0100
@@ -0,0 +1,78 @@
+/*
+ *  Copyright 2014 Embedded Artists AB
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#ifndef BIOSLOADER_H
+#define BIOSLOADER_H
+
+#include "mbed.h"
+#include "DMBoard.h"
+#include "BiosDisplay.h"
+#include "BiosTouch.h"
+#include "bios.h"
+
+/**
+ * Unpacks and prepares the BIOS code.
+ */
+class BiosLoader {
+public:
+    
+    /** Get the only instance of the BiosLoader
+     *
+     *  @returns The BIOS
+     */
+    static BiosLoader& instance()
+    {
+        static BiosLoader singleton;
+        return singleton;
+    }
+  
+
+    bool isKnownSPIFIMemory(uint8_t mfgr, uint8_t devType, uint8_t devID, uint32_t memSize, uint32_t* eraseBlockSize);
+    
+    friend class BiosDisplay;
+    friend class BiosTouch;
+    friend class DMBoard;
+
+private:
+
+    bool _initialized;
+
+    bios_header_t _bios;
+    void* _biosData;
+    uint8_t* _conf;
+    uint32_t _confSize;
+
+    explicit BiosLoader();
+    // hide copy constructor
+    BiosLoader(const BiosLoader&);
+    // hide assign operator
+    BiosLoader& operator=(const BiosLoader&);
+    ~BiosLoader();
+
+    /** Loads, verifies and prepares the BIOS
+     *
+     *  @returns
+     *       Ok on success
+     *       An error code on failure
+     */
+    DMBoard::BoardError init();
+    DMBoard::BoardError readBIOS(uint8_t** data, uint32_t* size);
+    DMBoard::BoardError params(bios_header_t** header, void** instanceData);
+    
+    void resetI2C();
+};
+
+#endif /* BIOSLOADER_H */