rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
iomcu_bind.c File Reference

The binding prepared and taken whole (BIND, BIND_CFG, BIND_OUT), and the board's own pages: CATALOGUE, SHAPE, ARTWORK, ART_DATA and PADS; see iomcu.h for the other files. More...

#include <string.h>
#include "iomcu.h"
#include "iomcu_pins.h"
#include "link_artxfer.h"
#include "out_bind.h"
#include "out_stage.h"

Functions

void bind_cfg_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the BIND_CFG page.
uint8_t bind_cfg_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the BIND_CFG page.
void bind_out_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the BIND_OUT page.
uint8_t bind_out_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the BIND_OUT page.
static uint8_t stage_take_cfg (void *ctx, const uint16_t *next)
 Takes the staged CHAN_CFG page for a commit.
static uint8_t stage_take_slots (void *ctx, const uint16_t *next)
 Takes the staged OUTPUTS page for a commit.
static void stage_put_cfg (void *ctx, const uint16_t *prev)
 Puts the CHAN_CFG register values back and applies them to the silicon.
static void stage_keep (void *ctx)
 Asks for the committed configuration to be saved.
void bind_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the BIND page.
uint8_t bind_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the BIND page.
void catalogue_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the CATALOGUE page.
void shape_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SHAPE page.
void artwork_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the ARTWORK page.
void art_data_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the ART_DATA page.
uint8_t art_data_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the ART_DATA page.
void pads_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the PADS page.

Variables

out_stage_t s_stage
 A binding prepared and taken whole (protocol 4.10): BIND_CFG and BIND_OUT hold a CHAN_CFG and an OUTPUTS page that are not in force, and a write of BIND's COMMIT that names their CRC (cyclic redundancy check) puts both in force or neither.
static uint8_t s_stage_bound
 The slots the silicon had bound when a commit began, put back with the CHAN_CFG page when the commit's OUTPUTS page is refused.
static const out_stage_ops_t k_stage_ops
 The commit callbacks handed to out_stage_commit().
const uint8_t board_drawing_rp2350_can []
const uint16_t board_drawing_rp2350_can_width
const uint16_t board_drawing_rp2350_can_height
const uint32_t board_drawing_rp2350_can_bytes
const uint16_t board_drawing_rp2350_can_crc
const uint32_t board_drawing_rp2350_can_hash
static uint16_t s_art_block
 Which block the data page is answering with. Held here because the host says it in one transaction and reads it in the next: a block that advanced on being read would resend nothing after a reply went missing, and the panel would assemble a drawing with a hole in it.

Detailed Description

The binding prepared and taken whole (BIND, BIND_CFG, BIND_OUT), and the board's own pages: CATALOGUE, SHAPE, ARTWORK, ART_DATA and PADS; see iomcu.h for the other files.

SPDX-License-Identifier: MIT

Function Documentation

◆ art_data_read()

void art_data_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the ART_DATA page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ art_data_write()

uint8_t art_data_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the ART_DATA page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ artwork_read()

void artwork_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the ARTWORK page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ bind_cfg_read()

void bind_cfg_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the BIND_CFG page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ bind_cfg_write()

uint8_t bind_cfg_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the BIND_CFG page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ bind_out_read()

void bind_out_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the BIND_OUT page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ bind_out_write()

uint8_t bind_out_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the BIND_OUT page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ bind_read()

void bind_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the BIND page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ bind_write()

uint8_t bind_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the BIND page.

Parameters
ctxThe iomcu_state_t the page reads or writes.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ catalogue_read()

void catalogue_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the CATALOGUE page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ pads_read()

void pads_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the PADS page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ shape_read()

void shape_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SHAPE page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ stage_keep()

void stage_keep ( void * ctx)
static

Asks for the committed configuration to be saved.

Parameters
ctxThe iomcu_state_t to save.

◆ stage_put_cfg()

void stage_put_cfg ( void * ctx,
const uint16_t * prev )
static

Puts the CHAN_CFG register values back and applies them to the silicon.

Parameters
ctxThe iomcu_state_t to restore.
prevThe CHAN_CFG register values to put back.

◆ stage_take_cfg()

uint8_t stage_take_cfg ( void * ctx,
const uint16_t * next )
static

Takes the staged CHAN_CFG page for a commit.

Records the slots the silicon has bound, then calls chan_cfg_take().

Parameters
ctxThe iomcu_state_t the commit applies to.
nextThe staged CHAN_CFG register values.
Returns
0 to accept, or a link_nack_t to refuse.

◆ stage_take_slots()

uint8_t stage_take_slots ( void * ctx,
const uint16_t * next )
static

Takes the staged OUTPUTS page for a commit.

Parameters
ctxThe iomcu_state_t the commit applies to.
nextThe staged slot register values.
Returns
0 to accept, or a link_nack_t to refuse.

Variable Documentation

◆ k_stage_ops

const out_stage_ops_t k_stage_ops
static
Initial value:
= {
}
outputs_t s_outputs
Every output, behind one set of rules.
Definition main.c:93
static uint8_t stage_take_slots(void *ctx, const uint16_t *next)
Takes the staged OUTPUTS page for a commit.
Definition iomcu_bind.c:84
static uint8_t stage_take_cfg(void *ctx, const uint16_t *next)
Takes the staged CHAN_CFG page for a commit.
Definition iomcu_bind.c:71
static void stage_put_cfg(void *ctx, const uint16_t *prev)
Puts the CHAN_CFG register values back and applies them to the silicon.
Definition iomcu_bind.c:96
static void stage_keep(void *ctx)
Asks for the committed configuration to be saved.
Definition iomcu_bind.c:110

The commit callbacks handed to out_stage_commit().

◆ s_stage

out_stage_t s_stage

A binding prepared and taken whole (protocol 4.10): BIND_CFG and BIND_OUT hold a CHAN_CFG and an OUTPUTS page that are not in force, and a write of BIND's COMMIT that names their CRC (cyclic redundancy check) puts both in force or neither.

The binding BIND_CFG and BIND_OUT hold prepared; see iomcu_bind.c.

shared/outputs/out_stage.c decides; this is the glue to the two pages' own rules in iomcu_pages.c. Not kept in flash: it starts as the pages in force at boot.

A binding prepared and taken whole (protocol 4.10): BIND_CFG and BIND_OUT hold a CHAN_CFG and an OUTPUTS page that are not in force, and a write of BIND's COMMIT that names their CRC (cyclic redundancy check) puts both in force or neither.