|
@@ -13,6 +13,17 @@ static u8 _write_success = 0;
|
|
|
static int _write_position = 0;
|
|
static int _write_position = 0;
|
|
|
static shark_timer_t _reboot_timer = {.handler = _reboot_timer_handler,};
|
|
static shark_timer_t _reboot_timer = {.handler = _reboot_timer_handler,};
|
|
|
|
|
|
|
|
|
|
+void iap_read_chip_id(can_frame_t *frame)
|
|
|
|
|
+{
|
|
|
|
|
+ u8 buff[24];
|
|
|
|
|
+ u8 len;
|
|
|
|
|
+
|
|
|
|
|
+ buff[0] = buff[1] = 0x00;
|
|
|
|
|
+ len = shark_read_chip_id(buff + 2) + 2;
|
|
|
|
|
+
|
|
|
|
|
+ protocol_send_bms_info(frame->head.can_addr, frame->key, buff, len);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void process_iap_message(can_frame_t *frame, int len){
|
|
void process_iap_message(can_frame_t *frame, int len){
|
|
|
uint8_t *data = NULL;
|
|
uint8_t *data = NULL;
|
|
|
int data_len = 0;
|
|
int data_len = 0;
|
|
@@ -58,7 +69,11 @@ void process_iap_message(can_frame_t *frame, int len){
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case CAN_KEY_IAP_STAT:
|
|
case CAN_KEY_IAP_STAT:
|
|
|
- protocol_send_ack(frame->head.can_addr, frame->key, 0);
|
|
|
|
|
|
|
+ if (len > 0 && frame->data[0] == 0x01) {
|
|
|
|
|
+ iap_read_chip_id(frame);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ protocol_send_ack(frame->head.can_addr, frame->key, 0);
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case CAN_EEY_IAP_READ_STRING:
|
|
case CAN_EEY_IAP_READ_STRING:
|
|
|
iap_read_string(frame);
|
|
iap_read_string(frame);
|
|
@@ -129,7 +144,6 @@ void iap_read_string(can_frame_t *frame)
|
|
|
protocol_send_bms_info(frame->head.can_addr, frame->key, buff, len + 4);
|
|
protocol_send_bms_info(frame->head.can_addr, frame->key, buff, len + 4);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
static int iap_check_image(uint8_t *data, int len) {
|
|
static int iap_check_image(uint8_t *data, int len) {
|
|
|
uint32_t size, checksum;
|
|
uint32_t size, checksum;
|
|
|
size = shark_decode_u24(data);
|
|
size = shark_decode_u24(data);
|