annotate frbl/reconst/command.c @ 325:7df08926a4e7

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