FreeCalypso > hg > freecalypso-tools
comparison target-utils/simagent/spenh.c @ 786:b761029f9c03
simagent: spenh command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Mar 2021 22:41:33 +0000 |
parents | 8196bba46318 |
children |
comparison
equal
deleted
inserted
replaced
785:56506e9165bc | 786:b761029f9c03 |
---|---|
1 #include <sys/types.h> | 1 #include <sys/types.h> |
2 #include <strings.h> | 2 #include <strings.h> |
3 #include "types.h" | 3 #include "types.h" |
4 #include "simregs.h" | 4 #include "simregs.h" |
5 | 5 |
6 extern int sim_if_state; | |
6 extern u16 conf1_reg; | 7 extern u16 conf1_reg; |
8 | |
9 const u8 pts_for_spenh[4] = {0xFF, 0x10, 0x94, 0x7B}; | |
10 | |
11 void | |
12 cmd_spenh() | |
13 { | |
14 int rc; | |
15 unsigned count; | |
16 | |
17 if (sim_if_state != 2) { | |
18 printf("ERROR: SIM interface is not up\n"); | |
19 return; | |
20 } | |
21 if (conf1_reg & SIM_CONF1_ETU) { | |
22 printf("ERROR: speed enhancement is already on\n"); | |
23 return; | |
24 } | |
25 rc = flush_rx_fifo(); | |
26 if (rc < 0) | |
27 return; | |
28 rc = send_to_sim(pts_for_spenh, 4); | |
29 if (rc < 0) | |
30 return; | |
31 for (count = 0; count < 4; count++) { | |
32 rc = rx_sim_byte_hl(); | |
33 if (rc < 0) | |
34 return; | |
35 if (rc != pts_for_spenh[count]) { | |
36 printf("ERROR: PTS response does not match request\n"); | |
37 return; | |
38 } | |
39 } | |
40 SIMREGS.conf1 = conf1_reg |= SIM_CONF1_ETU; | |
41 } | |
7 | 42 |
8 void | 43 void |
9 cmd_set_spenh(argbulk) | 44 cmd_set_spenh(argbulk) |
10 char *argbulk; | 45 char *argbulk; |
11 { | 46 { |