*
* \brief Driver for the 24xx16 and 24xx256 I2C EEPROMS (implementation)
*
- *
- * \version $Id$
* \author Stefano Fedrigo <aleph@develer.com>
* \author Bernie Innocenti <bernie@codewiz.org>
*/
#include "eeprom.h"
-#warning TODO:Test and complete this module for arm platform.
-#if !CPU_ARM
-
#include <cfg/macros.h> // MIN()
#include <cfg/debug.h>
#include <cfg/module.h> // MOD_CHECK()
*/
static const EepromInfo mem_info[] =
{
+ {
+ /* 24XX08 */
+ .has_dev_addr = false,
+ .blk_size = 0x10,
+ .e2_size = 0x400,
+ },
{
/* 24XX16 */
.has_dev_addr = false,
.blk_size = 0x80,
.e2_size = 0x10000,
},
+ {
+ /* 24XX1024 */
+ .has_dev_addr = true,
+ .blk_size = 0x100,
+ .e2_size = 0x20000,
+ },
+
/* Add other memories here */
};
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)
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;
rd_len++;
}
+ i2c_stop();
return rd_len;
}
fd->fd.seek = kfile_genericSeek;
}
-
-#endif