for DISCO-F769NI based on BD_SD_DISCO_F746NG library by Roy Krikke
Dependents: DISCO-F769NI_several_example DISCO-F769NI_BD_SD_Card_Control
Diff: SDBlockDeviceDISCOF769NI.h
- Revision:
- 1:0d436ebd49be
- Parent:
- 0:c0eba637f7c7
--- a/SDBlockDeviceDISCOF769NI.h Sat Apr 07 02:06:27 2018 +0000 +++ b/SDBlockDeviceDISCOF769NI.h Thu Jul 25 19:39:05 2019 +0000 @@ -19,8 +19,8 @@ https://os.mbed.com/users/roykrikke/code/BD_SD_DISCO_F746NG/ https://os.mbed.com/users/roykrikke/ - Modified by K.Arai / JH1PJL April 5th, 2018 - + Modified by K.Arai / JH1PJL July 22nd, 2019 + All of following keywords are changed F746NG -> F769NI 32746g -> 32f769i @@ -181,6 +181,56 @@ */ virtual bd_size_t size() const; +//--------- July 23rd, 2019 + + /** Convenience function for checking block read validity + * + * @param addr Address of block to begin reading from + * @param size Size to read in bytes + * @return True if read is valid for underlying block device + */ + virtual bool is_valid_read(bd_addr_t addr, bd_size_t size) const + { + return (addr % get_read_size() == 0 && + size % get_read_size() == 0 && + addr + size <= this->size()); + } + + /** Convenience function for checking block program validity + * + * @param addr Address of block to begin writing to + * @param size Size to write in bytes + * @return True if program is valid for underlying block device + */ + virtual bool is_valid_program(bd_addr_t addr, bd_size_t size) const + { + return (addr % get_program_size() == 0 && + size % get_program_size() == 0 && + addr + size <= this->size()); + } + + /** Convenience function for checking block erase validity + * + * @param addr Address of block to begin erasing + * @param size Size to erase in bytes + * @return True if erase is valid for underlying block device + */ + virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const + { + return 1;// Dummy implementation -> Please modify yourself in the future + } + + /** Get the BlockDevice class type. + * + * @return A string represent the BlockDevice class type. + */ + virtual const char *get_type() const + { + return "microSD"; + } + +//---------- + private: uint8_t _card_type; bd_size_t _read_size; @@ -195,12 +245,14 @@ bool _is_initialized; virtual void - lock () { + lock () + { _mutex.lock(); } virtual void - unlock() { + unlock() + { _mutex.unlock (); }