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@28:8ae20cb0b943, 2015-01-23 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Jan 23 17:31:56 2015 +0100
- Revision:
- 28:8ae20cb0b943
- Parent:
- 22:1a58a518435c
- Child:
- 31:d47cffcb0a3e
- BIOS API up to 0.2.0
- Moved I2C0 interrupt handling from BiosTouch to BiosLoader
- Added (or prepared for) ethernet MAC address reading from BIOS
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 | 28:8ae20cb0b943 | 43 | void getMacAddress(char mac[6]); |
embeddedartists | 22:1a58a518435c | 44 | bool isKnownSPIFIMemory(uint8_t mfgr, uint8_t devType, uint8_t devID, uint32_t memSize, uint32_t* eraseBlockSize); |
embeddedartists | 28:8ae20cb0b943 | 45 | void handleI2CInterrupt(); |
embeddedartists | 28:8ae20cb0b943 | 46 | |
embeddedartists | 22:1a58a518435c | 47 | friend class BiosDisplay; |
embeddedartists | 22:1a58a518435c | 48 | friend class BiosTouch; |
embeddedartists | 22:1a58a518435c | 49 | friend class DMBoard; |
embeddedartists | 22:1a58a518435c | 50 | |
embeddedartists | 22:1a58a518435c | 51 | private: |
embeddedartists | 22:1a58a518435c | 52 | |
embeddedartists | 22:1a58a518435c | 53 | bool _initialized; |
embeddedartists | 22:1a58a518435c | 54 | |
embeddedartists | 22:1a58a518435c | 55 | bios_header_t _bios; |
embeddedartists | 22:1a58a518435c | 56 | void* _biosData; |
embeddedartists | 22:1a58a518435c | 57 | uint8_t* _conf; |
embeddedartists | 22:1a58a518435c | 58 | uint32_t _confSize; |
embeddedartists | 22:1a58a518435c | 59 | |
embeddedartists | 22:1a58a518435c | 60 | explicit BiosLoader(); |
embeddedartists | 22:1a58a518435c | 61 | // hide copy constructor |
embeddedartists | 22:1a58a518435c | 62 | BiosLoader(const BiosLoader&); |
embeddedartists | 22:1a58a518435c | 63 | // hide assign operator |
embeddedartists | 22:1a58a518435c | 64 | BiosLoader& operator=(const BiosLoader&); |
embeddedartists | 22:1a58a518435c | 65 | ~BiosLoader(); |
embeddedartists | 22:1a58a518435c | 66 | |
embeddedartists | 22:1a58a518435c | 67 | /** Loads, verifies and prepares the BIOS |
embeddedartists | 22:1a58a518435c | 68 | * |
embeddedartists | 22:1a58a518435c | 69 | * @returns |
embeddedartists | 22:1a58a518435c | 70 | * Ok on success |
embeddedartists | 22:1a58a518435c | 71 | * An error code on failure |
embeddedartists | 22:1a58a518435c | 72 | */ |
embeddedartists | 22:1a58a518435c | 73 | DMBoard::BoardError init(); |
embeddedartists | 22:1a58a518435c | 74 | DMBoard::BoardError readBIOS(uint8_t** data, uint32_t* size); |
embeddedartists | 22:1a58a518435c | 75 | DMBoard::BoardError params(bios_header_t** header, void** instanceData); |
embeddedartists | 22:1a58a518435c | 76 | |
embeddedartists | 22:1a58a518435c | 77 | void resetI2C(); |
embeddedartists | 22:1a58a518435c | 78 | }; |
embeddedartists | 22:1a58a518435c | 79 | |
embeddedartists | 22:1a58a518435c | 80 | #endif /* BIOSLOADER_H */ |