FreeCalypso > hg > freecalypso-reveng
comparison frbl/reconst/command.c @ 321:24d7d7875ee9
frbl/reconst/command.c: first function reconstructed
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Mar 2020 06:38:36 +0000 |
parents | |
children | a4b6b4e389b9 |
comparison
equal
deleted
inserted
replaced
320:20feaf83c661 | 321:24d7d7875ee9 |
---|---|
1 #include "main/sys_types.h" | |
2 #include "command.h" | |
3 | |
4 long | |
5 com_analyze_request(SYS_UWORD8 *request_received, t_com_request *request) | |
6 { | |
7 SYS_WORD32 sp8; | |
8 long sp12 = COM_SUCCESS; | |
9 SYS_UWORD32 sp16, sp20; | |
10 SYS_UWORD8 sp24; | |
11 SYS_UWORD16 *sp28; | |
12 SYS_UWORD16 sp32, sp34, sp36, sp38, sp40, sp42, sp44, sp46; | |
13 | |
14 sp20 = *request_received++; | |
15 COM_COMMAND_WORD(request) = *request_received++; | |
16 sp16 = 1; | |
17 switch (COM_COMMAND_WORD(request)) { | |
18 case COM_READ_PARAMETERS: /* 0x26 */ | |
19 sp16 += 2; | |
20 sp34 = *request_received++; | |
21 sp32 = *request_received++; | |
22 COM_READ_PARAMS_OFFSET(request) = (sp34 << 8) + sp32; | |
23 sp16 += 1; | |
24 sp24 = *request_received++; | |
25 COM_NUMBER_OF_PARAMS_READ(request) = sp24; | |
26 if (sp24 > COM_MAX_NUMBER_OF_16BITS_DATA) | |
27 sp12 = COM_PARAMETER_ERROR; | |
28 break; | |
29 case COM_WRITE_PARAMETERS: /* 0x7a */ | |
30 sp16 += 2; | |
31 sp34 = *request_received++; | |
32 sp32 = *request_received++; | |
33 COM_WRITTEN_PARAMS_OFFSET(request) = (sp34 << 8) + sp32; | |
34 sp16 += 1; | |
35 sp24 = *request_received++; | |
36 COM_NUMBER_OF_PARAMS_WRITTEN(request) = sp24; | |
37 if (sp24 > COM_MAX_NUMBER_OF_16BITS_DATA) { | |
38 sp12 = COM_PARAMETER_ERROR; | |
39 break; | |
40 } | |
41 sp28 = COM_WRITTEN_PARAMS_LIST_ADDRESS(request); | |
42 for (sp8 = 0; sp8 < sp24; sp8++) { | |
43 sp38 = *request_received++; | |
44 sp36 = *request_received++; | |
45 *sp28++ = (sp38 << 8) + sp36; | |
46 sp16 += 2; | |
47 } | |
48 break; | |
49 case COM_SEND_RUN_ADDRESS: /* 0x11e */ | |
50 sp16 += 2; | |
51 sp40 = *request_received++; | |
52 sp42 = *request_received++; | |
53 COM_ADDRESS_MSB(request) = (sp40 << 8) + sp42; | |
54 sp16 += 2; | |
55 sp44 = *request_received++; | |
56 sp46 = *request_received++; | |
57 COM_ADDRESS_LSB(request) = (sp44 << 8) + sp46; | |
58 break; | |
59 case COM_GET_MONITOR_ID: | |
60 case COM_GET_FLASH_ID: | |
61 case COM_GET_CHIP_ID: | |
62 case COM_GET_BOARD_ID: | |
63 case COM_ERASE_FLASH: | |
64 case COM_WRITE_DATA: | |
65 case COM_START_APPLICATION: | |
66 case COM_LOAD_APPLICATION: | |
67 break; | |
68 default: | |
69 sp12 = COM_COMMAND_UNKNOWN; | |
70 } | |
71 if (sp20 != sp16) | |
72 sp12 = COM_PARAMETER_ERROR; | |
73 return sp12; | |
74 } | |
75 | |
76 long | |
77 com_build_confirmation(t_com_confirmation *confirmation, | |
78 SYS_UWORD8 *confirmation_to_send) | |
79 { | |
80 | |
81 | |
82 } |