diff options
author | Keith Packard <keithp@keithp.com> | 2010-11-26 16:14:15 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-12-22 20:39:40 -0800 |
commit | 07213dc34fa20470a4b36a327a83d75b0f010ebb (patch) | |
tree | a85d444ab7d2ccf01153c15e6fb2adf8473b602f /src/ao.h | |
parent | b62580855c5144f5bc7e0172289bce08814d9472 (diff) |
altos: clean up radio abort paths. Share radio code.
Instead of aborting the DMA and radio operation and expecting that to
be handled reasonably by the radio receiving task, rewrite things so
that the abort function just wakes the receiving task while that
terminates the DMA and cleans up the radio.
This eliminates all kinds of nasty bugs dealing with radio abort
smashing the radio registers at the wrong time, or interrupting a
radio transmission.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao.h')
-rw-r--r-- | src/ao.h | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -391,14 +391,10 @@ ao_cmd_init(void); * ao_dma.c */ -/* Allocate a DMA channel. the 'done' parameter will be set - * when the dma is finished or aborted and will be used to - * wakeup any waiters +/* Allocate a DMA channel. the 'done' parameter will be set when the + * dma is finished and will be used to wakeup any waiters */ -#define AO_DMA_DONE 1 -#define AO_DMA_ABORTED 2 - uint8_t ao_dma_alloc(__xdata uint8_t * done); @@ -838,6 +834,15 @@ struct ao_telemetry { struct ao_gps_tracking_data gps_tracking; }; +/* + * ao_radio_recv tacks on rssi and status bytes + */ +struct ao_telemetry_recv { + struct ao_telemetry telemetry; + int8_t rssi; + uint8_t status; +}; + /* Set delay between telemetry reports (0 to disable) */ #define AO_TELEMETRY_INTERVAL_PAD AO_MS_TO_TICKS(1000) @@ -880,22 +885,16 @@ void ao_radio_set_rdf(void); void -ao_radio_send(__xdata struct ao_telemetry *telemetry) __reentrant; - -struct ao_radio_recv { - struct ao_telemetry telemetry; - int8_t rssi; - uint8_t status; -}; +ao_radio_send(__xdata void *data, uint8_t size) __reentrant; uint8_t -ao_radio_recv(__xdata struct ao_radio_recv *recv) __reentrant; +ao_radio_recv(__xdata void *data, uint8_t size) __reentrant; void -ao_radio_rdf(int ms); +ao_radio_recv_abort(void); void -ao_radio_abort(void); +ao_radio_rdf(int ms); void ao_radio_rdf_abort(void); |