X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Feeprom.c;h=83688b782c6216dbd64eaaf6f3412c8b119b0a24;hb=ebd302f4820855188df16ee8422a947751bf2c50;hp=6f0f8b59a96e6737e940d2a89ed5cce01337f2ec;hpb=3248e1ab5f9aed70aa84ceae205e893dec79c875;p=bertos.git diff --git a/bertos/drv/eeprom.c b/bertos/drv/eeprom.c index 6f0f8b59..83688b78 100644 --- a/bertos/drv/eeprom.c +++ b/bertos/drv/eeprom.c @@ -41,8 +41,8 @@ #include "eeprom.h" #warning TODO:Test and complete this module for arm platform. +#if !CPU_ARM -#if 0 #include // MIN() #include #include // MOD_CHECK() @@ -102,7 +102,7 @@ STATIC_ASSERT(countof(mem_info) == EEPROM_CNT); */ static size_t eeprom_writeRaw(struct KFile *_fd, const void *buf, size_t size) { - Eeprom *fd = EEPROM(_fd); + Eeprom *fd = EEPROM_CAST(_fd); e2dev_addr_t dev_addr; uint8_t addr_buf[2]; uint8_t addr_len; @@ -114,7 +114,7 @@ static size_t eeprom_writeRaw(struct KFile *_fd, const void *buf, size_t size) /* clamp size to memory limit (otherwise may roll back) */ ASSERT(_fd->seek_pos + size <= (kfile_off_t)_fd->size); - size = MIN((kfile_size_t)size, _fd->size - _fd->seek_pos); + size = MIN((kfile_off_t)size, _fd->size - _fd->seek_pos); if (mem_info[fd->type].has_dev_addr) { @@ -175,7 +175,7 @@ static size_t eeprom_writeRaw(struct KFile *_fd, const void *buf, size_t size) */ static size_t eeprom_writeVerify(struct KFile *_fd, const void *_buf, size_t size) { - Eeprom *fd = EEPROM(_fd); + Eeprom *fd = EEPROM_CAST(_fd); int retries = 5; size_t wr_len; @@ -204,7 +204,7 @@ static size_t eeprom_writeVerify(struct KFile *_fd, const void *_buf, size_t siz */ static size_t eeprom_read(struct KFile *_fd, void *_buf, size_t size) { - Eeprom *fd = EEPROM(_fd); + Eeprom *fd = EEPROM_CAST(_fd); uint8_t addr_buf[2]; uint8_t addr_len; size_t rd_len = 0; @@ -214,7 +214,7 @@ static size_t eeprom_read(struct KFile *_fd, void *_buf, size_t size) /* clamp size to memory limit (otherwise may roll back) */ ASSERT(_fd->seek_pos + size <= (kfile_off_t)_fd->size); - size = MIN((kfile_size_t)size, _fd->size - _fd->seek_pos); + size = MIN((kfile_off_t)size, _fd->size - _fd->seek_pos); e2dev_addr_t dev_addr; if (mem_info[fd->type].has_dev_addr) @@ -243,7 +243,7 @@ static size_t eeprom_read(struct KFile *_fd, void *_buf, size_t size) while (size--) { /* - * The last byte read does not has an ACK + * The last byte read does not have an ACK * to stop communication. */ int c = twi_get(size); @@ -388,3 +388,5 @@ void eeprom_init(Eeprom *fd, EepromType type, e2dev_addr_t addr, bool verify) fd->fd.seek = kfile_genericSeek; } + +#endif