comparison target-utils/simagent/tx.c @ 780:8a94593fb7ef

simagent: Tx delays reduced in spenh mode
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Mar 2021 19:53:07 +0000
parents 3ba64341137b
children 289733ff272b
comparison
equal deleted inserted replaced
779:8196bba46318 780:8a94593fb7ef
9 9
10 send_to_sim(bytes, count) 10 send_to_sim(bytes, count)
11 u8 *bytes; 11 u8 *bytes;
12 unsigned count; 12 unsigned count;
13 { 13 {
14 unsigned n, timeout; 14 unsigned n, timeout, delay;
15 15
16 if (conf1_reg & SIM_CONF1_ETU)
17 delay = 6000;
18 else
19 delay = 30000;
16 SIMREGS.conf1 = conf1_reg |= SIM_CONF1_TXRX; 20 SIMREGS.conf1 = conf1_reg |= SIM_CONF1_TXRX;
17 if (count == 1) 21 if (count == 1)
18 wait_ARM_cycles(30000); 22 wait_ARM_cycles(delay);
19 (void) SIMREGS.it; 23 (void) SIMREGS.it;
20 for (n = 0; ; ) { 24 for (n = 0; ; ) {
21 SIMREGS.dtx = bytes[n++]; 25 SIMREGS.dtx = bytes[n++];
22 if (n == count) { 26 if (n == count) {
23 SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_TXRX; 27 SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_TXRX;
24 return(0); 28 return(0);
25 } 29 }
26 wait_ARM_cycles(30000); 30 wait_ARM_cycles(delay);
27 for (timeout = 12000; timeout; timeout--) 31 for (timeout = 12000; timeout; timeout--)
28 if (SIMREGS.it & SIM_IT_ITTX) 32 if (SIMREGS.it & SIM_IT_ITTX)
29 break; 33 break;
30 if (!timeout) { 34 if (!timeout) {
31 printf("ERROR: SIM interface Tx timeout on byte %u\n", 35 printf("ERROR: SIM interface Tx timeout on byte %u\n",