mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-03-03 14:06:49 +01:00
This lays the groundwork for implementing timed operations (#86). The M0 can be configured to automatically change modes when its byte count reaches a specific value. Checking the counter against the threshold and dispatching to the next mode is handled by a new `jump_next_mode` macro, which replaces the unconditional branches back to the start of the TX and RX loops. Making this change work requires some rearrangement of the code, such that the destinations of all conditional branch instructions are within reach. These branch instructions (`b[cond] label`) have a range of -256 to +254 bytes from the current program counter. For this reason, the TX shortfall handling is moved earlier in the file, and branches in the idle loop are restructured to use an unconditional branch to rx_start, which is furthest away. The additional code for switching modes adds 9 cycles to the normal RX path, and 10 to the TX path (the difference is because the dispatch in `jump_next_mode` is optimised for the longer RX path).