From: batt Date: Thu, 3 Jun 2010 15:47:52 +0000 (+0000) Subject: Add support for 24XX1024 memories, fix some warnings. X-Git-Tag: 2.5.0~25 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6b7ec5ad0ef104a471ca77e2ded66f686e23150a;p=bertos.git Add support for 24XX1024 memories, fix some warnings. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3892 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/eeprom.c b/bertos/drv/eeprom.c index 6149dbf3..3b364f06 100644 --- a/bertos/drv/eeprom.c +++ b/bertos/drv/eeprom.c @@ -38,9 +38,6 @@ #include "eeprom.h" -#warning TODO:Test and complete this module for arm platform. -#if !CPU_ARM - #include // MIN() #include #include // MOD_CHECK() @@ -94,6 +91,13 @@ static const EepromInfo mem_info[] = .blk_size = 0x80, .e2_size = 0x10000, }, + { + /* 24XX1024 */ + .has_dev_addr = true, + .blk_size = 0x100, + .e2_size = 0x20000, + }, + /* Add other memories here */ }; @@ -117,7 +121,7 @@ static size_t eeprom_writeRaw(struct KFile *_fd, const void *buf, size_t size) STATIC_ASSERT(countof(addr_buf) <= sizeof(e2addr_t)); /* clamp size to memory limit (otherwise may roll back) */ - ASSERT(_fd->seek_pos + size <= (kfile_off_t)_fd->size); + ASSERT(_fd->seek_pos + (kfile_off_t)size <= (kfile_off_t)_fd->size); size = MIN((kfile_off_t)size, _fd->size - _fd->seek_pos); if (mem_info[fd->type].has_dev_addr) @@ -217,7 +221,7 @@ static size_t eeprom_read(struct KFile *_fd, void *_buf, size_t size) STATIC_ASSERT(countof(addr_buf) <= sizeof(e2addr_t)); /* clamp size to memory limit (otherwise may roll back) */ - ASSERT(_fd->seek_pos + size <= (kfile_off_t)_fd->size); + ASSERT(_fd->seek_pos + (kfile_off_t)size <= (kfile_off_t)_fd->size); size = MIN((kfile_off_t)size, _fd->size - _fd->seek_pos); e2dev_addr_t dev_addr; diff --git a/bertos/drv/eeprom.h b/bertos/drv/eeprom.h index d2a09b17..995919ae 100644 --- a/bertos/drv/eeprom.h +++ b/bertos/drv/eeprom.h @@ -56,6 +56,7 @@ typedef enum EepromType EEPROM_24XX16, EEPROM_24XX256, EEPROM_24XX512, + EEPROM_24XX1024, EEPROM_CNT, } EepromType;