diff options
| author | Keith Packard <keithp@keithp.com> | 2012-10-24 22:35:32 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-10-25 00:07:14 -0700 |
| commit | e80fa6de4ccc5c4851eab9fb941f9282d2e3eb16 (patch) | |
| tree | 716c76a2a0aae0ade116f1c9d959d68fedeb112a /src/drivers/ao_btm.c | |
| parent | b119e19604aa557a40e848c60d98a67b5f259bbd (diff) | |
altos: Replace __critical usage with ao_arch_critical as needed
sdcc offers __critical as a machine-independent way to block
interrupts, but as gcc doesn't, we need to use a compiler-independent
construct instead. ao_arch_critical has been around since the AVR
port, but some old __critical usages remained.
This fixes a bunch of random hangs when communicating with MM over USB
or the radio as the various stdio loops were running without
interrupts blocked between the test and the sleep.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_btm.c')
| -rw-r--r-- | src/drivers/ao_btm.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c index f193ac8e..f3816047 100644 --- a/src/drivers/ao_btm.c +++ b/src/drivers/ao_btm.c @@ -312,18 +312,20 @@ __xdata struct ao_task ao_btm_task; #endif void -ao_btm_check_link() __critical +ao_btm_check_link() { - /* Check the pin and configure the interrupt detector to wait for the - * pin to flip the other way - */ - if (BT_LINK_PIN) { - ao_btm_connected = 0; - PICTL |= BT_PICTL_ICON; - } else { - ao_btm_connected = 1; - PICTL &= ~BT_PICTL_ICON; - } + ao_arch_critical( + /* Check the pin and configure the interrupt detector to wait for the + * pin to flip the other way + */ + if (BT_LINK_PIN) { + ao_btm_connected = 0; + PICTL |= BT_PICTL_ICON; + } else { + ao_btm_connected = 1; + PICTL &= ~BT_PICTL_ICON; + } + ); } void |
