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

The programmer's private seam between kst_prog.c, kst_prog_card.c and kst_prog_file.c: the wait and file-write kinds the state holds, and the helpers of kst_prog.c that the card part and the journal file part call. More...

#include <stdbool.h>
#include <stdint.h>
#include "kst_prog.h"

Go to the source code of this file.

Enumerations

enum  {
  W_NONE = 0 , W_SAVE , W_FILE , W_ANSWER ,
  W_OUTCOME
}
enum  { FILE_NONE = 0 , FILE_KEEP , FILE_JOURNAL }

Functions

bool kst_prog_same (const kst_image_t *a, const kst_image_t *b)
 Whether two images hold the same values.
unsigned kst_prog_lowest (uint64_t set)
 The index of the lowest field bit set in a set.
unsigned kst_prog_ones (uint64_t set)
 The number of field bits set in a set.
bool kst_prog_field_editable (kst_field_id_t id)
 Whether a field may be edited.
kst_field_set_t kst_prog_differ (const kst_image_t *a, const kst_image_t *b)
 The fields in which two images differ.
kst_rules_t kst_prog_hard_new (const kst_prog_t *p, const kst_image_t *target)
 The hard rules the target image breaks.
kst_rules_t kst_prog_soft_asks (const kst_prog_t *p, const kst_image_t *from, const kst_image_t *target)
 The soft rules an edit from one image to another asks about.
const kst_image_t * kst_prog_file_image (const kst_prog_t *p)
 The image the file before a write takes: the servo as the session found it.
kst_prog_msg_id_t kst_prog_say_reg (kst_prog_t *p, unsigned id, unsigned arg, unsigned reg)
 Sets the message with an argument and a register.
kst_prog_msg_id_t kst_prog_say (kst_prog_t *p, unsigned id, unsigned arg)
 Sets the message with an argument.
void kst_prog_send (kst_prog_t *p, const kst_link_request_t *req)
 Queues a command for the task that owns the link module.
void kst_prog_card_ask (kst_prog_t *p, kst_prog_card_op_t op, const char *name)
 Asks the card side for a save, a list or a load.
void kst_prog_write_go (kst_prog_t *p)
 Starts the write that is held: its journal, its file, then the request.
kst_prog_msg_id_t kst_prog_held_gate (const kst_prog_t *p)
 The start gate of the held write as it is now, the wait for its own files left out: the port in PROGRAMMING and idle, the port the write was held for, no STOP, the bench not ARMED and the switch on.
bool kst_prog_journal_classify (kst_prog_t *p)
 Classifies the held journal record against the servo read.
void kst_prog_not_started (kst_prog_t *p, unsigned id, unsigned arg)
 Ends a command that was not taken, with its message.
void kst_prog_load_take (kst_prog_t *p, const kst_image_t *target)
 Takes a loaded file's target into the draft.

Detailed Description

The programmer's private seam between kst_prog.c, kst_prog_card.c and kst_prog_file.c: the wait and file-write kinds the state holds, and the helpers of kst_prog.c that the card part and the journal file part call.

Nothing outside shared/bench includes this header; the programmer's interface is kst_prog.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ kst_prog_card_ask()

void kst_prog_card_ask ( kst_prog_t * p,
kst_prog_card_op_t op,
const char * name )

Asks the card side for a save, a list or a load.

Parameters
pThe programmer state.
opThe card operation.
nameThe file name, or NULL.

◆ kst_prog_differ()

kst_field_set_t kst_prog_differ ( const kst_image_t * a,
const kst_image_t * b )

The fields in which two images differ.

Parameters
aThe first image.
bThe second image.
Returns
The set of fields that differ.

◆ kst_prog_field_editable()

bool kst_prog_field_editable ( kst_field_id_t id)

Whether a field may be edited.

Parameters
idThe field.
Returns
true when the field may be edited.

◆ kst_prog_file_image()

const kst_image_t * kst_prog_file_image ( const kst_prog_t * p)

The image the file before a write takes: the servo as the session found it.

Parameters
pThe programmer state.
Returns
The image the file takes.

◆ kst_prog_hard_new()

kst_rules_t kst_prog_hard_new ( const kst_prog_t * p,
const kst_image_t * target )

The hard rules the target image breaks.

Parameters
pThe programmer state.
targetThe image to check.
Returns
The rules broken.

◆ kst_prog_held_gate()

kst_prog_msg_id_t kst_prog_held_gate ( const kst_prog_t * p)

The start gate of the held write as it is now, the wait for its own files left out: the port in PROGRAMMING and idle, the port the write was held for, no STOP, the bench not ARMED and the switch on.

Parameters
pThe programmer state.
Returns
KST_PROG_MSG_NONE when the write may go, else the message why not.

◆ kst_prog_journal_classify()

bool kst_prog_journal_classify ( kst_prog_t * p)

Classifies the held journal record against the servo read.

Parameters
pThe programmer state.
Returns
true when the record is another servo's.

◆ kst_prog_load_take()

void kst_prog_load_take ( kst_prog_t * p,
const kst_image_t * target )

Takes a loaded file's target into the draft.

Parameters
pThe programmer state.
targetThe file's target image.

◆ kst_prog_lowest()

unsigned kst_prog_lowest ( uint64_t set)

The index of the lowest field bit set in a set.

Parameters
setA set of fields, one bit each.
Returns
The index of the lowest bit set in set.

◆ kst_prog_not_started()

void kst_prog_not_started ( kst_prog_t * p,
unsigned id,
unsigned arg )

Ends a command that was not taken, with its message.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.

◆ kst_prog_ones()

unsigned kst_prog_ones ( uint64_t set)

The number of field bits set in a set.

Parameters
setA set of fields, one bit each.
Returns
The number of bits set in set.

◆ kst_prog_same()

bool kst_prog_same ( const kst_image_t * a,
const kst_image_t * b )

Whether two images hold the same values.

Parameters
aThe first image.
bThe second image.
Returns
true when they are equal.

◆ kst_prog_say()

kst_prog_msg_id_t kst_prog_say ( kst_prog_t * p,
unsigned id,
unsigned arg )

Sets the message with an argument.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.
Returns
The message id.

◆ kst_prog_say_reg()

kst_prog_msg_id_t kst_prog_say_reg ( kst_prog_t * p,
unsigned id,
unsigned arg,
unsigned reg )

Sets the message with an argument and a register.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.
regThe register the message names.
Returns
The message id.

◆ kst_prog_send()

void kst_prog_send ( kst_prog_t * p,
const kst_link_request_t * req )

Queues a command for the task that owns the link module.

Parameters
pThe programmer state.
reqThe request to send.

◆ kst_prog_soft_asks()

kst_rules_t kst_prog_soft_asks ( const kst_prog_t * p,
const kst_image_t * from,
const kst_image_t * target )

The soft rules an edit from one image to another asks about.

Parameters
pThe programmer state.
fromThe image before the edit.
targetThe image after the edit.
Returns
The soft rules the edit asks a confirmation for.

◆ kst_prog_write_go()

void kst_prog_write_go ( kst_prog_t * p)

Starts the write that is held: its journal, its file, then the request.

Parameters
pThe programmer state.