add __NOPs to stop dodgy busy-wait loops being optimised out0

Really need to get on top of these
main-solar-only
Richard Meadows 2016-08-12 22:27:35 +01:00
rodzic 0948a84e08
commit 73d18dc2ad
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -1143,7 +1143,7 @@ void gps_init(void)
/* ---- GPS Configuration ---- */
/* We need to wait for the GPS 32kHz clock to start (~300ms). TODO: more robust method for this */
for (int i = 0; i < 300*1000; i++);
for (int i = 0; i < 300*1000; i++) { __NOP(); }
/* Close any currently running session. Doesn't do anything unless debugging */
//osp_reset_initialise(); /* hopefully don't need this now */
@ -1164,7 +1164,7 @@ void gps_reinit(void)
/* Wait for about 3 seconds, kicking the watchdog along the way. TODO: more robust method for this */
for (int j = 0; j < 10; j++) {
for (int i = 0; i < 300*1000; i++);
for (int i = 0; i < 300*1000; i++) { __NOP(); }
kick_the_watchdog();
}

Wyświetl plik

@ -145,7 +145,7 @@ void _si_trx_transfer(int tx_count, int rx_count, uint8_t *data)
*/
do {
for (int i = 0; i < 200; i++); /* Approx. 20µS */
for (int i = 0; i < 200; i++) { __NOP(); } /* Approx. 20µS */
_si_trx_cs_enable();
/* Issue READ_CMD_BUFF */
@ -547,7 +547,7 @@ void si_trx_reset(uint8_t modulation_type, struct si_frequency_configuration* fc
/* We expect to already be shutdown */
_si_trx_sdn_enable(); /* active high shutdown = reset */
for (int i = 0; i < 15; i++); /* a few microseconds */
for (int i = 0; i < 15; i++) { __NOP(); } /* a few microseconds */
_si_trx_sdn_disable(); /* booting. expected to take 15ms */

Wyświetl plik

@ -224,9 +224,9 @@ void WDT_Handler(void)
/* Wait for the external watchdog to kill us */
while (1) {
led_on();
for (int i = 0; i < 25*1000; i++);
for (int i = 0; i < 25*1000; i++) { __NOP(); }
led_off();
for (int i = 0; i < 25*1000; i++);
for (int i = 0; i < 25*1000; i++) { __NOP(); }
/**
* Whilst this is generally bad practice in this system we have an