mimo tx work-in-progress
[debian/gnuradio] / usrp2 / firmware / lib / bsm12.h
index 8649f1176bb4210de7cce2fe033229fd4af428d0..b8e576b791f33bece8638a2898ce803baeab8829 100644 (file)
@@ -19,7 +19,8 @@
 #ifndef INCLUDED_BSM12_H
 #define INCLUDED_BSM12_H
 
-#include <dbsm.h>
+#include "dbsm.h"
+#include "memory_map.h"
 
 /*!
  * buffer state machine: 1 input to two outputs
@@ -37,7 +38,7 @@ typedef struct _bsm12 bsm12_t;
  * \param sm           the state machine
  * \param buf_this     the index of the buffer to inspect and/or pass on
  *
- * Returns -1, 0 or 1.  If it returns zero, it means that the s/w
+ * Returns -1, 0 or 1.  If it returns -1, it means that the s/w
  * handled that packet, and that it should NOT be passed on to one of
  * the buffer endpoints.  0 indicates the first endpoint, 1 the second endpoint.
  */
@@ -49,19 +50,21 @@ typedef int (*bsm12_inspector_t)(bsm12_t *sm, int buf_this);
  */
 struct _bsm12
 {
-  uint8_t        buf0;      // This machine uses buf0, buf0+1 and buf0+2.  buf0 % 4 == 0.
+  uint8_t        buf0;  // This machine uses buf0, buf0+1 and buf0+2.  buf0 % 4 == 0.
   uint8_t        running;
-  uint8_t        rx_idle;
-  uint8_t        tx_idle[2];
+  int8_t         rx_state;     // -1, 0, 1, 2  which buffer we're receiving into
+  int8_t         tx_state[2];  // -1, 0, 1, 2  which buffer we're sending from
   buf_cmd_args_t  recv_args;
   buf_cmd_args_t  send_args[2];
   bsm12_inspector_t inspect;
+  int            last_line_adj;
   uint32_t       bps_error;
   uint32_t       bps_done;
   uint32_t       bps_error_or_done;
+  uint8_t        next_buf[NBUFFERS];
   uint32_t       precomputed_receive_to_buf_ctrl_word[3];
-  uint32_t       precomputed_send_from_buf_ctrl_word[4][2];  // really only 3, not 4 (easier addr comp)
-  int            last_line_adj;
+  uint32_t       precomputed_send_from_buf_ctrl_word[4][2];  // really only 3, not 4 
+                                                              //   (easier addr comp)
 };
 
 void bsm12_init(bsm12_t *sm, int buf0,