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
Diff: FileSystems/MCIFileSystem.h
- Revision:
- 42:bbfe299d4a0c
- Parent:
- 38:420cdc281467
diff -r e06e764ff4fd -r bbfe299d4a0c FileSystems/MCIFileSystem.h --- a/FileSystems/MCIFileSystem.h Wed Oct 23 06:59:29 2019 +0000 +++ b/FileSystems/MCIFileSystem.h Mon Nov 04 14:32:50 2019 +0000 @@ -48,24 +48,27 @@ * } * @endcode */ -class MCIFileSystem : public FATFileSystem { +class MCIFileSystem : public BlockDevice { public: /** Create the File System for accessing an SD/MMC Card using MCI * - * @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 = P4_16); + MCIFileSystem(PinName cd = P4_16); virtual ~MCIFileSystem(); - virtual int disk_initialize(); - virtual int disk_status(); - virtual int disk_read(uint8_t * buffer, uint64_t block_number, uint8_t count); - virtual int disk_write(const uint8_t * buffer, uint64_t block_number, uint8_t count); - virtual int disk_sync(); - virtual uint64_t disk_sectors(); + virtual int init(); + virtual int deinit(); + + virtual int sync(); + virtual int read(void * buffer, bd_addr_t addr, bd_size_t size); + virtual int program(const void * buffer, bd_addr_t addr, bd_size_t size); + virtual bd_size_t get_read_size() const; + virtual bd_size_t get_program_size() const; + virtual bd_size_t size() const; + virtual const char *get_type() const; void mci_MCIIRQHandler(); void mci_DMAIRQHandler(); @@ -130,20 +133,20 @@ uint16_t rca; /*!< Relative address assigned to card */ uint32_t speed; /*!< Speed */ uint32_t block_len; /*!< Card sector size */ - uint32_t device_size; /*!< Device Size */ + bd_size_t device_size; /*!< Device Size */ uint32_t blocknr; /*!< Block Number */ uint32_t clk_rate; /*!< Clock rate */ } SDMMC_CARD_T; typedef enum { SDC_RET_OK = 0, - SDC_RET_CMD_FAILED = -1, - SDC_RET_BAD_PARAMETERS = -2, - SDC_RET_BUS_NOT_IDLE = -3, - SDC_RET_TIMEOUT = -4, - SDC_RET_ERR_STATE = -5, - SDC_RET_NOT_READY = -6, - SDC_RET_FAILED = -7, + SDC_RET_CMD_FAILED = -5001, + SDC_RET_BAD_PARAMETERS = -5002, + SDC_RET_BUS_NOT_IDLE = -5003, + SDC_RET_TIMEOUT = -5004, + SDC_RET_ERR_STATE = -5005, + SDC_RET_NOT_READY = -5006, + SDC_RET_FAILED = -5007, } ReturnCode; void initMCI(); @@ -192,8 +195,6 @@ ReturnCode _readBlocks(uint32_t card_type, uint32_t startBlock, uint32_t blockNum) const; ReturnCode _writeBlocks(uint32_t card_type, uint32_t startBlock, uint32_t blockNum) const; - - uint32_t _Stat; SDMMC_CARD_T _sdCardInfo; DigitalIn* _cardDetect; @@ -201,6 +202,9 @@ GPDMA::DMAChannels _eventDmaChannel; /*!< DMA Channel used for transfer data */ volatile bool _eventReceived; volatile bool _eventSuccess; + + uint32_t _init_ref_count; + bool _is_initialized; }; #endif