altos/stm32l: Add support for software-driven HW flow control
[fw/altos] / src / kernel / ao.h
index a794ba710e62d584d32ce57c5d131e85c379981d..6ed0299e2d707baa607a515394ab4f4eccb7988b 100644 (file)
@@ -820,6 +820,8 @@ struct ao_fifo {
 } while(0)
 
 #define ao_fifo_full(f)                ((((f).insert + 1) & (AO_FIFO_SIZE-1)) == (f).remove)
+#define ao_fifo_mostly(f)      ((((f).insert - (f).remove) & (AO_FIFO_SIZE-1)) >= (AO_FIFO_SIZE * 3 / 4))
+#define ao_fifo_barely(f)      ((((f).insert - (f).remove) & (AO_FIFO_SIZE-1)) >= (AO_FIFO_SIZE * 1 / 4))
 #define ao_fifo_empty(f)       ((f).insert == (f).remove)
 
 #if PACKET_HAS_MASTER || PACKET_HAS_SLAVE