C kerdes
Fuzesi Arnold
arnold.fuzesi.lista at gmail.com
Wed Mar 21 22:12:37 CET 2007
full optimalizacio, eredmenye:
#define EE_CHECKSUM(srcstruct) ee_checksum( ((uchar __eeprom*) &srcstruct),
sizeof(srcstruct)-1)
/******************************************************************************/
uint ee_checksum(uchar __eeprom* data, uint length)
{
uint checksum = 0;
do{
checksum+=(*data++);
}
while(--length);
return checksum;
}
/******************************************************************************/
typedef struct{
blabla
uchar ee_checksum
} FW;
volatile __eeprom FW ee_fw;
ez nem mukodik:
if(ee_fw.checksum!=EE_CHECKSUM(ee_fw)){
blabla
}
ez mukodik:
if(ee_fw.checksum!=(uchar)EE_CHECKSUM(ee_fw)){
blabla
}
Ezt most hirtelen nem ertem....vki erti?
Most vagy az ee_fw.checksum-ot kellene castolnia magatol uint-re, vagy az
ee_checksumot castolni uchar-ra..
A.
More information about the Elektro
mailing list