unsigned char netv_read_data_flow_table_v2(unsigned int offset, unsigned char mem_type, unsigned char *buffer, unsigned int size) { unsigned int i = 0; unsigned char success = 1; switch (mem_type) { case NETV_REQUEST_RAM: if (offset + size <= DATA_FLOW_TABLE_SIZE) { asm volatile("di"); //disable interrupts for (i = offset; i < (offset + size); i++) { buffer[i - offset] = DATA_FLOW_TABLE[i]; } asm volatile("ei"); //Enable interrupts success = 1; } else { //memory out of bound success = 0; } break; case NETV_REQUEST_EEPROM: if (offset + size <= DATA_FLOW_TABLE_SIZE) { asm volatile("di"); //disable interrupts for (i = offset; i < (offset + size); i++) { buffer[i - offset] = netv_read_eeprom(i); } asm volatile("ei"); //Enable interrupts success = 1; } else {
////////////////////////////////////////////////////////////////////// // netv_send_im_alive ////////////////////////////////////////////////////////////////////// // // Description: Send a I'M Alive can message // // Input: netv_addr (Address read in the EEPROM at 0XFE) // Output: NONE // Input/Output: NONE // Returned value: NONE // ////////////////////////////////////////////////////////////////////// void netv_send_im_alive(unsigned char netv_addr) { NETV_MESSAGE msg; int i = 0; msg.msg_priority = 0x00; msg.msg_type = NETV_TYPE_EVENTS; msg.msg_cmd = NETV_EVENTS_CMD_ALIVE; msg.msg_dest = netv_addr; msg.msg_eeprom_ram = NETV_REQUEST_EEPROM; msg.msg_read_write = NETV_REQUEST_READ; msg.msg_data_length = 8; //Protocol version 2 for (i = 0; i < 8; i++) { msg.msg_data[i] = netv_read_eeprom(i); } //make sure we are returning the right netv_addr msg.msg_data[2] = netv_addr; msg.msg_remote = 0; netv_send_message(&msg); }