# HG changeset patch # User Mychaela Falconia # Date 1583390316 0 # Node ID 24d7d7875ee995932fb2820ec981969a5c621417 # Parent 20feaf83c661f80b23af38fa40946659c7172f2f frbl/reconst/command.c: first function reconstructed diff -r 20feaf83c661 -r 24d7d7875ee9 frbl/reconst/Makefile --- a/frbl/reconst/Makefile Thu Mar 05 05:01:14 2020 +0000 +++ b/frbl/reconst/Makefile Thu Mar 05 06:38:36 2020 +0000 @@ -1,7 +1,7 @@ CFLAGS= -mn -mt -mw -me -pw2 CPPFLAGS=-DTOOL_CHOICE=0 -D_TMS470 -I. -Iinc -OBJS= boot.obj convert.obj -DISASM= boot.disasm convert.disasm +OBJS= boot.obj command.obj convert.obj +DISASM= boot.disasm command.disasm convert.disasm all: ${OBJS} ${DISASM} diff -r 20feaf83c661 -r 24d7d7875ee9 frbl/reconst/command.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/frbl/reconst/command.c Thu Mar 05 06:38:36 2020 +0000 @@ -0,0 +1,82 @@ +#include "main/sys_types.h" +#include "command.h" + +long +com_analyze_request(SYS_UWORD8 *request_received, t_com_request *request) +{ + SYS_WORD32 sp8; + long sp12 = COM_SUCCESS; + SYS_UWORD32 sp16, sp20; + SYS_UWORD8 sp24; + SYS_UWORD16 *sp28; + SYS_UWORD16 sp32, sp34, sp36, sp38, sp40, sp42, sp44, sp46; + + sp20 = *request_received++; + COM_COMMAND_WORD(request) = *request_received++; + sp16 = 1; + switch (COM_COMMAND_WORD(request)) { + case COM_READ_PARAMETERS: /* 0x26 */ + sp16 += 2; + sp34 = *request_received++; + sp32 = *request_received++; + COM_READ_PARAMS_OFFSET(request) = (sp34 << 8) + sp32; + sp16 += 1; + sp24 = *request_received++; + COM_NUMBER_OF_PARAMS_READ(request) = sp24; + if (sp24 > COM_MAX_NUMBER_OF_16BITS_DATA) + sp12 = COM_PARAMETER_ERROR; + break; + case COM_WRITE_PARAMETERS: /* 0x7a */ + sp16 += 2; + sp34 = *request_received++; + sp32 = *request_received++; + COM_WRITTEN_PARAMS_OFFSET(request) = (sp34 << 8) + sp32; + sp16 += 1; + sp24 = *request_received++; + COM_NUMBER_OF_PARAMS_WRITTEN(request) = sp24; + if (sp24 > COM_MAX_NUMBER_OF_16BITS_DATA) { + sp12 = COM_PARAMETER_ERROR; + break; + } + sp28 = COM_WRITTEN_PARAMS_LIST_ADDRESS(request); + for (sp8 = 0; sp8 < sp24; sp8++) { + sp38 = *request_received++; + sp36 = *request_received++; + *sp28++ = (sp38 << 8) + sp36; + sp16 += 2; + } + break; + case COM_SEND_RUN_ADDRESS: /* 0x11e */ + sp16 += 2; + sp40 = *request_received++; + sp42 = *request_received++; + COM_ADDRESS_MSB(request) = (sp40 << 8) + sp42; + sp16 += 2; + sp44 = *request_received++; + sp46 = *request_received++; + COM_ADDRESS_LSB(request) = (sp44 << 8) + sp46; + break; + case COM_GET_MONITOR_ID: + case COM_GET_FLASH_ID: + case COM_GET_CHIP_ID: + case COM_GET_BOARD_ID: + case COM_ERASE_FLASH: + case COM_WRITE_DATA: + case COM_START_APPLICATION: + case COM_LOAD_APPLICATION: + break; + default: + sp12 = COM_COMMAND_UNKNOWN; + } + if (sp20 != sp16) + sp12 = COM_PARAMETER_ERROR; + return sp12; +} + +long +com_build_confirmation(t_com_confirmation *confirmation, + SYS_UWORD8 *confirmation_to_send) +{ + + +}