Subdirectory provided by Embedded Artists
Dependencies: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src
Dependents: lpc4088_displaymodule_hello_world_Sept_2018
Fork of DMSupport by
Bios/BiosLoader.h@22:1a58a518435c, 2015-01-16 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Jan 16 11:13:39 2015 +0100
- Revision:
- 22:1a58a518435c
- Child:
- 28:8ae20cb0b943
- Updated SPIFI code to allow BIOS to id chips not yet supported by DMSupport
- Updated QSPIFileSystem to be chip independant. Erase block info from SPIFI.cpp
- Split BiosDisplayAndTouch into BiosDisplay and BiosTouch
- Added BiosLoader with common functionallity
- Removed BIOS code from DMBoard
- Added first version of a touch listener
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 22:1a58a518435c | 1 | /* |
embeddedartists | 22:1a58a518435c | 2 | * Copyright 2014 Embedded Artists AB |
embeddedartists | 22:1a58a518435c | 3 | * |
embeddedartists | 22:1a58a518435c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 22:1a58a518435c | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 22:1a58a518435c | 6 | * You may obtain a copy of the License at |
embeddedartists | 22:1a58a518435c | 7 | * |
embeddedartists | 22:1a58a518435c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 22:1a58a518435c | 9 | * |
embeddedartists | 22:1a58a518435c | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 22:1a58a518435c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 22:1a58a518435c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 22:1a58a518435c | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 22:1a58a518435c | 14 | * limitations under the License. |
embeddedartists | 22:1a58a518435c | 15 | */ |
embeddedartists | 22:1a58a518435c | 16 | |
embeddedartists | 22:1a58a518435c | 17 | #ifndef BIOSLOADER_H |
embeddedartists | 22:1a58a518435c | 18 | #define BIOSLOADER_H |
embeddedartists | 22:1a58a518435c | 19 | |
embeddedartists | 22:1a58a518435c | 20 | #include "mbed.h" |
embeddedartists | 22:1a58a518435c | 21 | #include "DMBoard.h" |
embeddedartists | 22:1a58a518435c | 22 | #include "BiosDisplay.h" |
embeddedartists | 22:1a58a518435c | 23 | #include "BiosTouch.h" |
embeddedartists | 22:1a58a518435c | 24 | #include "bios.h" |
embeddedartists | 22:1a58a518435c | 25 | |
embeddedartists | 22:1a58a518435c | 26 | /** |
embeddedartists | 22:1a58a518435c | 27 | * Unpacks and prepares the BIOS code. |
embeddedartists | 22:1a58a518435c | 28 | */ |
embeddedartists | 22:1a58a518435c | 29 | class BiosLoader { |
embeddedartists | 22:1a58a518435c | 30 | public: |
embeddedartists | 22:1a58a518435c | 31 | |
embeddedartists | 22:1a58a518435c | 32 | /** Get the only instance of the BiosLoader |
embeddedartists | 22:1a58a518435c | 33 | * |
embeddedartists | 22:1a58a518435c | 34 | * @returns The BIOS |
embeddedartists | 22:1a58a518435c | 35 | */ |
embeddedartists | 22:1a58a518435c | 36 | static BiosLoader& instance() |
embeddedartists | 22:1a58a518435c | 37 | { |
embeddedartists | 22:1a58a518435c | 38 | static BiosLoader singleton; |
embeddedartists | 22:1a58a518435c | 39 | return singleton; |
embeddedartists | 22:1a58a518435c | 40 | } |
embeddedartists | 22:1a58a518435c | 41 | |
embeddedartists | 22:1a58a518435c | 42 | |
embeddedartists | 22:1a58a518435c | 43 | bool isKnownSPIFIMemory(uint8_t mfgr, uint8_t devType, uint8_t devID, uint32_t memSize, uint32_t* eraseBlockSize); |
embeddedartists | 22:1a58a518435c | 44 | |
embeddedartists | 22:1a58a518435c | 45 | friend class BiosDisplay; |
embeddedartists | 22:1a58a518435c | 46 | friend class BiosTouch; |
embeddedartists | 22:1a58a518435c | 47 | friend class DMBoard; |
embeddedartists | 22:1a58a518435c | 48 | |
embeddedartists | 22:1a58a518435c | 49 | private: |
embeddedartists | 22:1a58a518435c | 50 | |
embeddedartists | 22:1a58a518435c | 51 | bool _initialized; |
embeddedartists | 22:1a58a518435c | 52 | |
embeddedartists | 22:1a58a518435c | 53 | bios_header_t _bios; |
embeddedartists | 22:1a58a518435c | 54 | void* _biosData; |
embeddedartists | 22:1a58a518435c | 55 | uint8_t* _conf; |
embeddedartists | 22:1a58a518435c | 56 | uint32_t _confSize; |
embeddedartists | 22:1a58a518435c | 57 | |
embeddedartists | 22:1a58a518435c | 58 | explicit BiosLoader(); |
embeddedartists | 22:1a58a518435c | 59 | // hide copy constructor |
embeddedartists | 22:1a58a518435c | 60 | BiosLoader(const BiosLoader&); |
embeddedartists | 22:1a58a518435c | 61 | // hide assign operator |
embeddedartists | 22:1a58a518435c | 62 | BiosLoader& operator=(const BiosLoader&); |
embeddedartists | 22:1a58a518435c | 63 | ~BiosLoader(); |
embeddedartists | 22:1a58a518435c | 64 | |
embeddedartists | 22:1a58a518435c | 65 | /** Loads, verifies and prepares the BIOS |
embeddedartists | 22:1a58a518435c | 66 | * |
embeddedartists | 22:1a58a518435c | 67 | * @returns |
embeddedartists | 22:1a58a518435c | 68 | * Ok on success |
embeddedartists | 22:1a58a518435c | 69 | * An error code on failure |
embeddedartists | 22:1a58a518435c | 70 | */ |
embeddedartists | 22:1a58a518435c | 71 | DMBoard::BoardError init(); |
embeddedartists | 22:1a58a518435c | 72 | DMBoard::BoardError readBIOS(uint8_t** data, uint32_t* size); |
embeddedartists | 22:1a58a518435c | 73 | DMBoard::BoardError params(bios_header_t** header, void** instanceData); |
embeddedartists | 22:1a58a518435c | 74 | |
embeddedartists | 22:1a58a518435c | 75 | void resetI2C(); |
embeddedartists | 22:1a58a518435c | 76 | }; |
embeddedartists | 22:1a58a518435c | 77 | |
embeddedartists | 22:1a58a518435c | 78 | #endif /* BIOSLOADER_H */ |