AT91CAP9 support

---------------------------------

read_dataflash() takes a signed char pointer as a parameter. Silence a
few warnings dues to incorrect parameter types in env_dataflash.c.

Signed-off-by: Stelian Pop <stelian@popies.net>
This commit is contained in:
Stelian Pop 2008-02-11 10:50:19 +00:00 committed by Peter Pearse
parent 64e8a06af6
commit 9604b6e53d

View file

@ -44,22 +44,22 @@ extern uchar default_environment[];
uchar env_get_char_spec (int index) uchar env_get_char_spec (int index)
{ {
uchar c; uchar c;
read_dataflash (CFG_ENV_ADDR+index+offsetof(env_t,data),1,&c); read_dataflash(CFG_ENV_ADDR + index + offsetof(env_t,data),
1, (char *)&c);
return (c); return (c);
} }
void env_relocate_spec (void) void env_relocate_spec (void)
{ {
read_dataflash (CFG_ENV_ADDR,CFG_ENV_SIZE,(uchar *)env_ptr); read_dataflash(CFG_ENV_ADDR, CFG_ENV_SIZE, (char *)env_ptr);
} }
int saveenv(void) int saveenv(void)
{ {
/* env must be copied to do not alter env structure in memory*/ /* env must be copied to do not alter env structure in memory*/
unsigned char temp[CFG_ENV_SIZE]; unsigned char temp[CFG_ENV_SIZE];
int i;
memcpy(temp, env_ptr, CFG_ENV_SIZE); memcpy(temp, env_ptr, CFG_ENV_SIZE);
return write_dataflash (CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE); return write_dataflash(CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE);
} }
/************************************************************************ /************************************************************************
@ -77,13 +77,14 @@ int env_init(void)
AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */ AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */
/* read old CRC */ /* read old CRC */
read_dataflash (CFG_ENV_ADDR+offsetof(env_t,crc),sizeof(ulong),&crc); read_dataflash(CFG_ENV_ADDR + offsetof(env_t, crc),
sizeof(ulong), (char *)&crc);
new = 0; new = 0;
len = ENV_SIZE; len = ENV_SIZE;
off = offsetof(env_t,data); off = offsetof(env_t,data);
while (len > 0) { while (len > 0) {
int n = (len > sizeof(buf)) ? sizeof(buf) : len; int n = (len > sizeof(buf)) ? sizeof(buf) : len;
read_dataflash (CFG_ENV_ADDR+off,n , buf); read_dataflash(CFG_ENV_ADDR + off, n, (char *)buf);
new = crc32 (new, buf, n); new = crc32 (new, buf, n);
len -= n; len -= n;
off += n; off += n;