What sense_page.c and sense_map.c share: the SENSE set-up's checks and its taking, and the map's own helpers the SENSE page calls.
More...
#include <stdbool.h>
#include <stdint.h>
#include "sense_page.h"
Go to the source code of this file.
|
| static int64_t | div_round (int64_t a, int64_t d) |
| | a / d to the nearest, halves away from zero; d positive.
|
| static uint16_t | reg_i16 (int64_t v) |
| | A signed register: two's complement, held to -32767 .. 32767.
|
| static uint16_t | reg_u16 (int64_t v) |
| | An unsigned register, held to 0 .. 65535.
|
| uint8_t | sense_cfg_check (const sense_page_t *p, const uint16_t *next, const outputs_t *o, uint64_t taken) |
| | A SENSE set-up next (LINK_SN_CONFIG_COUNT registers) judged as a write is: values, pins, addresses and channels; 0 or the refusal.
|
| void | sense_cfg_take (sense_page_t *p, const uint16_t *next) |
| | next in force: the generation moves, and every reading of the set-up before it goes (sense_page_forget()).
|
| void | sense_page_forget (sense_page_t *p) |
| | Every register core 1 fills, on both pages and the map's, cleared.
|
| bool | sense_map_on_addr (const uint16_t *map, uint16_t addr) |
| | Whether the map map fits an INA3221 at addr.
|
| bool | sense_map_watches (const sense_page_t *p) |
| | Whether a channel the map reads watches an output channel or a programming port: the map in force's LINK_CAP_SERVO_SENSE.
|
| void | sense_limit_judge (sense_page_t *p, const sense_snap_t *s) |
| | Core 1's counts of windows over each channel's limit in s into OVER and OVER_COUNT: what each gained since the last snapshot taken.
|
| void | sense_map_cfg (const uint16_t *map, sense_i3221_cfg_t *out) |
| | The map's kept registers as the schedule's INA3221 set-up.
|
| void | sense_map_publish (sense_page_t *p, const sense_snap_t *s) |
| | The snapshot's per-part state into SENSE_MAP's read-only registers, and every channel's window into SENSE_WIN_A and SENSE_WIN_B.
|
What sense_page.c and sense_map.c share: the SENSE set-up's checks and its taking, and the map's own helpers the SENSE page calls.
Not for any other module.
SPDX-License-Identifier: MIT
◆ div_round()
| int64_t div_round |
( |
int64_t | a, |
|
|
int64_t | d ) |
|
inlinestatic |
a / d to the nearest, halves away from zero; d positive.
- Parameters
-
| a | The dividend. |
| d | The divisor, positive. |
- Returns
- a / d, rounded to the nearest, halves away from zero.
◆ reg_i16()
| uint16_t reg_i16 |
( |
int64_t | v | ) |
|
|
inlinestatic |
A signed register: two's complement, held to -32767 .. 32767.
- Parameters
-
| v | The value in register units. |
- Returns
- The value held to -32767 to 32767, as two's complement.
◆ reg_u16()
| uint16_t reg_u16 |
( |
int64_t | v | ) |
|
|
inlinestatic |
An unsigned register, held to 0 .. 65535.
- Parameters
-
| v | The value in register units. |
- Returns
- The value held to 0 to 65535.
◆ sense_cfg_check()
| uint8_t sense_cfg_check |
( |
const sense_page_t * | p, |
|
|
const uint16_t * | next, |
|
|
const outputs_t * | o, |
|
|
uint64_t | taken ) |
A SENSE set-up next (LINK_SN_CONFIG_COUNT registers) judged as a write is: values, pins, addresses and channels; 0 or the refusal.
Not the bank's state: the caller asks that.
- Parameters
-
| p | The page. |
| next | The set-up to judge, LINK_SN_CONFIG_COUNT registers. |
| o | The outputs model. |
| taken | Bit n: pin n is held by another page. |
- Returns
- 0, or LINK_NACK_BAD_VALUE for a refused set-up.
◆ sense_cfg_take()
| void sense_cfg_take |
( |
sense_page_t * | p, |
|
|
const uint16_t * | next ) |
next in force: the generation moves, and every reading of the set-up before it goes (sense_page_forget()).
- Parameters
-
| p | The page. |
| next | The set-up, LINK_SN_CONFIG_COUNT registers. |
◆ sense_limit_judge()
Core 1's counts of windows over each channel's limit in s into OVER and OVER_COUNT: what each gained since the last snapshot taken.
- Parameters
-
| p | The page. |
| s | The snapshot. |
◆ sense_map_cfg()
The map's kept registers as the schedule's INA3221 set-up.
- Parameters
-
| map | The map's registers. |
| out | Receives the INA3221 set-up of the schedule. |
◆ sense_map_on_addr()
| bool sense_map_on_addr |
( |
const uint16_t * | map, |
|
|
uint16_t | addr ) |
Whether the map map fits an INA3221 at addr.
- Parameters
-
| map | The map's registers. |
| addr | The INA3221 address. |
- Returns
- true when the map fits an INA3221 at addr.
◆ sense_map_publish()
The snapshot's per-part state into SENSE_MAP's read-only registers, and every channel's window into SENSE_WIN_A and SENSE_WIN_B.
- Parameters
-
| p | The page, updated in place. |
| s | The snapshot. |
◆ sense_map_watches()
Whether a channel the map reads watches an output channel or a programming port: the map in force's LINK_CAP_SERVO_SENSE.
- Parameters
-
- Returns
- true when a channel the map reads watches an output channel or a programming port.
◆ sense_page_forget()
Every register core 1 fills, on both pages and the map's, cleared.
- Parameters
-