summaryrefslogtreecommitdiff
path: root/src-avr/ao.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-12 04:41:19 -0700
committerKeith Packard <keithp@keithp.com>2011-08-12 04:41:19 -0700
commitb3ba69f3eda0d07d7f2fc0922556a011c95d7951 (patch)
treeb648004575edcf3a0a4cf6c600f47bd06d45d8b5 /src-avr/ao.h
parentb6083ce00867051d4d513b91519cad6e4a91f07b (diff)
altos-avr: Completely replace the spi slave code
Turns out the AVR we're using sucks at doing SPI slave. To get it running at a reasonable data rate, I had to completely gut the 'sensible' code and run everything from the ISR with interrupts disabled. Even with this, the maximum SPI clock rate is somewhere around 200kHz. That's due to the singled buffered nature of the transmit queue, the amount of time available between finishing one byte and starting the next is very very small. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src-avr/ao.h')
-rw-r--r--src-avr/ao.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src-avr/ao.h b/src-avr/ao.h
index c548c618..fb3612d4 100644
--- a/src-avr/ao.h
+++ b/src-avr/ao.h
@@ -201,7 +201,7 @@ struct ao_adc {
* ao_adc.c
*/
-#define AO_ADC_RING 16
+#define AO_ADC_RING 8
#define ao_adc_ring_next(n) (((n) + 1) & (AO_ADC_RING - 1))
#define ao_adc_ring_prev(n) (((n) - 1) & (AO_ADC_RING - 1))
@@ -1343,6 +1343,7 @@ struct ao_fifo {
(f).remove = ((f).remove + 1) & (AO_FIFO_SIZE-1); \
} while(0)
+#define ao_fifo_reset(f) ((f).insert = (f).remove = 0)
#define ao_fifo_full(f) ((((f).insert + 1) & (AO_FIFO_SIZE-1)) == (f).remove)
#define ao_fifo_empty(f) ((f).insert == (f).remove)
@@ -1423,13 +1424,16 @@ ao_debug_init(void);
/* ao_spi_slave.c */
-void
+int
ao_spi_slave_read(uint8_t *data, int len);
-void
+int
ao_spi_slave_write(uint8_t *data, int len);
void
+ao_spi_slave_debug(void);
+
+void
ao_spi_slave_init(void);
/* ao_companion.c */