|
|
@ -120,11 +120,16 @@ void EEPROMService::detect_online() { |
|
|
|
if (i2c_ping_state[0x50] && i2c_ping_state[0x51] && i2c_ping_state[0x52]) { |
|
|
|
m_nowonline = &m_subdevice_p24c16; |
|
|
|
change_is_online_flag(true); |
|
|
|
m_writeunlock = false; |
|
|
|
ZLOGI(TAG, "detect eerpom p24c16"); |
|
|
|
} else if (!i2c_ping_state[0x50] && i2c_ping_state[0x53] && i2c_ping_state[0x57]) { |
|
|
|
m_nowonline = &m_subdevice_m24lrxxe; |
|
|
|
change_is_online_flag(true); |
|
|
|
ZLOGI(TAG, "detect eerpom m24lrxxe"); |
|
|
|
m_writeunlock = false; |
|
|
|
ZLOGI(TAG, "detect eerpom M24LR16E"); //
|
|
|
|
// uint32_t rdbak = 0;
|
|
|
|
// m_subdevice_m24lrxxe.readCfgReg(2332, &rdbak);
|
|
|
|
// ZLOGI(TAG, "m24lrxxe cfg reg: %08x", rdbak);
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
@ -150,7 +155,12 @@ int32_t EEPROMService::a8000_idcard_reader_read_raw(int32_t index, uint8_t* data |
|
|
|
} |
|
|
|
|
|
|
|
int32_t EEPROMService::a8000_idcard_write_raw(int32_t add, uint8_t* data, int32_t len) { |
|
|
|
zlock_guard guard(m_mutex); |
|
|
|
if (!m_nowonline) return err::kdevice_offline; |
|
|
|
if (!m_writeunlock) return err::killegal_operation; |
|
|
|
|
|
|
|
ZLOGI(TAG, "write: 0x%08x, %d", add, len); |
|
|
|
m_nowonline->write(add, (uint8_t*)&data, len); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -161,6 +171,7 @@ int32_t EEPROMService::a8000_idcard_erase() { |
|
|
|
|
|
|
|
int32_t EEPROMService::a8000_idcard_earse_unlock() { |
|
|
|
ZLOGI(TAG, "a8000_idcard_earse_unlock"); |
|
|
|
m_writeunlock = true; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -200,7 +211,7 @@ void EEPROMService::write_test_data_rom(ZI_EEPROM* rom) { |
|
|
|
uint32_t readdata = 0; |
|
|
|
for (uint16_t i = 0; i < 2 * 1024;) { |
|
|
|
int32_t wlen = 4; |
|
|
|
rom->write(i, (uint8_t*)&data, &wlen); |
|
|
|
rom->write(i, (uint8_t*)&data, wlen); |
|
|
|
rom->read(i, (uint8_t*)&readdata, &wlen); |
|
|
|
|
|
|
|
ZLOGI(TAG, "off:%x w:%d,r:%d", i, data, readdata); |
|
|
|