|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The IOmcu's own pages and the output pages: IDENTITY, STATUS, CONTROL, BENCH, CHANNELS, CHAN_CFG, OUTPUTS, SERVO and PROG, and the glue that makes the silicon agree with the bank. More...
#include <string.h>#include "iomcu.h"#include "sense_limit.h"#include "sense_map.h"#include "out_store.h"#include "outputs_pages.h"#include "pd_uart.h"#include "update_hw.h"Functions | |
| void | identity_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the IDENTITY page. | |
| void | control_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the CONTROL page. | |
| void | status_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the STATUS page. | |
| void | bench_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the BENCH page. | |
| void | save_outputs (const iomcu_state_t *s) |
| Asks for the output configuration to be saved. | |
| void | channels_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the CHANNELS page. | |
| uint8_t | channels_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the CHANNELS page. | |
| static bool | target_sync (void) |
| The tester's sweep pointed where the PROG page's TARGET says. | |
| static void | slots_rerate (void) |
| The slots bound now, at the rates they run at now. | |
| static uint8_t | ports_bind (void) |
| The programming ports' pins bound as the PROG page holds them: the TARGET port at the SERVO rate while it names one, every other port at PROG_PORT_RATE_HZ (prog_port_port_hz()). | |
| void | ports_apply (void) |
| Makes the programming ports' pins agree with the PROG page. | |
| void | hw_apply_only (uint8_t may_bind) |
Makes the silicon agree with the bank, binding only the slots in may_bind. | |
| void | hw_apply (void) |
| Makes the silicon agree with the bank, binding every slot. | |
| static bool | bank_armed (const iomcu_state_t *s) |
| Armed, or asked to arm by a frame served earlier in this pass. | |
| void | chan_cfg_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the CHAN_CFG page. | |
| uint8_t | chan_cfg_take (iomcu_state_t *s, const uint16_t *next, const uint16_t *slots, bool save) |
| Takes a whole CHAN_CFG page into force, when it passes the checks. | |
| uint8_t | chan_cfg_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the CHAN_CFG page. | |
| void | slots_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the OUTPUTS page. | |
| void | prog_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the PROG page. | |
| uint8_t | prog_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the PROG page. | |
| void | servo_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out) |
| Reads the SERVO page. | |
| uint8_t | servo_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the SERVO page. | |
| uint8_t | slots_take (iomcu_state_t *s, const uint16_t *next, bool save) |
| Takes a whole OUTPUTS page (slots) into force, when it passes the checks. | |
| uint8_t | slots_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the OUTPUTS page. | |
| uint8_t | control_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in) |
| Writes the CONTROL page. | |
The IOmcu's own pages and the output pages: IDENTITY, STATUS, CONTROL, BENCH, CHANNELS, CHAN_CFG, OUTPUTS, SERVO and PROG, and the glue that makes the silicon agree with the bank.
The rules are in shared/outputs and shared/safety; see iomcu.h for the other files.
SPDX-License-Identifier: MIT
|
static |
Armed, or asked to arm by a frame served earlier in this pass.
| s | The state whose CONTROL page holds the ARM register. |
| void bench_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the BENCH page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| void chan_cfg_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the CHAN_CFG page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t chan_cfg_take | ( | iomcu_state_t * | s, |
| const uint16_t * | next, | ||
| const uint16_t * | slots, | ||
| bool | save ) |
Takes a whole CHAN_CFG page into force, when it passes the checks.
| s | The state to update. |
| next | The new CHAN_CFG register values. |
| slots | The OUTPUTS page prepared beside next by a BIND commit, or NULL for a CHAN_CFG write. |
| save | True to save the configuration to flash. |
| uint8_t chan_cfg_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the CHAN_CFG page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void channels_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the CHANNELS page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t channels_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the CHANNELS page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void control_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the CONTROL page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t control_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the CONTROL page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void hw_apply_only | ( | uint8_t | may_bind | ) |
Makes the silicon agree with the bank, binding only the slots in may_bind.
| may_bind | Bit mask of the slots that may be bound. The others are released and left unbound. |
| void identity_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the IDENTITY page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
|
static |
The programming ports' pins bound as the PROG page holds them: the TARGET port at the SERVO rate while it names one, every other port at PROG_PORT_RATE_HZ (prog_port_port_hz()).
Never the pin the wire driver holds: it is the driver's until the KST or HITEC port gives it back, and the page keeps the port's pulse switch and target meanwhile. The pins the wire driver holds, as a mask of ports.
| void prog_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the PROG page.
| ctx | Unused. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t prog_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the PROG page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void save_outputs | ( | const iomcu_state_t * | s | ) |
Asks for the output configuration to be saved.
| s | The state whose output configuration is saved. |
| void servo_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the SERVO page.
| ctx | Unused. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t servo_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the SERVO page.
| ctx | Unused. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void slots_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the OUTPUTS page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t slots_take | ( | iomcu_state_t * | s, |
| const uint16_t * | next, | ||
| bool | save ) |
Takes a whole OUTPUTS page (slots) into force, when it passes the checks.
| s | The state to update. |
| next | The new slot register values. |
| save | True to save the configuration to flash. |
| uint8_t slots_write | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
Writes the OUTPUTS page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to write. |
| n | Number of registers to write. |
| in | The n register values to write. |
| void status_read | ( | void * | ctx, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
Reads the STATUS page.
| ctx | The iomcu_state_t the page reads or writes. |
| off | First register to read. |
| n | Number of registers to read. |
| out | Receives the n register values. |
|
static |
The tester's sweep pointed where the PROG page's TARGET says.
A change returns the SERVO page's rate to 0 (servo_page_target()); true when that moved the rate the slots run at, which then wants the slots bound again.