for DISCO-F469NI based on BD_SD_DISCO_F746NG library by Roy Krikke
Dependents: DISCO-F469NI_BD_SD_Card_Control USBDevice_microSD_RW_F469NI DISCO-F469NI_BD_SD_Card_Control
Fork of BD_SD_DISCO_F769NI by
Revision 2:0caded8d2a98, committed 2019-07-25
- Comitter:
- kenjiArai
- Date:
- Thu Jul 25 23:29:40 2019 +0000
- Parent:
- 1:d01aa82597cb
- Commit message:
- modified is_valid_read(), is_valid_program(), is_valid_erase and get_type() functions
Changed in this revision
SDBlockDeviceDISCOF469NI.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r d01aa82597cb -r 0caded8d2a98 SDBlockDeviceDISCOF469NI.h --- a/SDBlockDeviceDISCOF469NI.h Mon Apr 30 05:14:47 2018 +0000 +++ b/SDBlockDeviceDISCOF469NI.h Thu Jul 25 23:29:40 2019 +0000 @@ -19,7 +19,7 @@ https://os.mbed.com/users/roykrikke/code/BD_SD_DISCO_F746NG/ https://os.mbed.com/users/roykrikke/ - Modified by K.Arai / JH1PJL April 25th, 2018 + Modified by K.Arai / JH1PJL July 22nd, 2019 All of following keywords are changed F746NG -> F469NI @@ -181,6 +181,55 @@ */ virtual bd_size_t size() const; +//--------- July 26th, 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;