📄 boot_task.c
字号:
/*C*****************************************************************************
* FILE_NAME : bootloader.c
*----------------------------------------------------------------------------
* FILE_CREATED_BY : BERTHY JS
* FILE_CREATION_DATE: 16/05/00
*----------------------------------------------------------------------------
* FILE_PURPOSE:
*
******************************************************************************/
/*_____ I N C L U D E - F I L E S ____________________________________________*/
#include "config.h"
#include "can_lib.h"
#include "bootloader.h"
/*_____ P R I V A T E - F U N C T I O N S ____________________________________*/
extern void boot_manage_display (void);
extern void fct_calc_nb_byte (void);
extern void fct_load_data (Uchar nb_data);
/*_____ G L O B A L S ________________________________________________________*/
Uint16 address_start;
Uint16 address_end;
Uint16 size_bloc;
Uint16 nb_bloc;
Uint16 nb_octet_rest;
extern Uchar dlc_rx;
/*F****************************************************************************
* FUNCTION_NAME: boot_task
*----------------------------------------------------------------------------
* FUNCTION_AUTHOR: BERTHY J.S.
* FUNCTION_DATE :
*----------------------------------------------------------------------------
* FUNCTION_PURPOSE:
* This task managed all request from isp.
* If Some request are similar to user api call then used api_task.
* FUNCTION_INPUTS : void
* FUNCTION_OUTPUTS: void
******************************************************************************/
void boot_task(void)
{
unsigned char align;
if (f_new_protoc_command &&
(api_command == WAIT_COMMAND)&&
f_communication_open && !f_command_ongoing)
{
f_new_protoc_command = 0;
f_command_ongoing = 1;
switch(can_id - offset_id_copy)
{
/* CAN_ID_PROG_START (Only for isp)
* This command prepare information for flash prog.
* nb_octet_rest : nb of byte to program
* nb_bloc_128 : nb of full column latch
* size_bloc : size of the first bloc
*/
case CAN_ID_PROG_START:
{
f_command_ongoing = 0;
f_frame_to_send = 1;
can_ctrl = 0x00;
if (can_rx[0] == 0) /* Flash access */
{
f_flash_eeprom_area = 0;
}
else /* Eeprom access */
{
f_flash_eeprom_area = 1;
}
fct_calc_nb_byte();
align = FALSE;
/* nb_bloc = premier bloc + nb blocs complets */
/* size_bloc = nb octet ds premier bloc imcomplet: si align
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -