|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The panel's half of SENSE_LIMIT (0x36, protocol 4.27): a current limit per INA3221 channel, and the channels whose 50ms window passed it. More...
Go to the source code of this file.
Data Structures | |
| struct | sense_limit_link_op_t |
| One exchange for the caller to make. More... | |
| struct | sense_limit_link_t |
| The service's state; zeroed by sense_limit_link_init(). More... | |
Macros | |
| #define | SENSE_LIMIT_LINK_SETTLE_MS 500u |
| A limit edit rests this long before it is written, ms. | |
| #define | SENSE_LIMIT_LINK_READ_MS 200u |
| OVER is read this often while a limit is held, ms. | |
| #define | SENSE_LIMIT_LINK_GAP_MS 5000u |
| At most one alert this often, ms. | |
| #define | SENSE_LIMIT_LINK_REPEAT_MS 30000u |
| A channel's alert again at most this often while it keeps passing, ms. | |
| #define | SENSE_LIMIT_LINK_ACK 0 |
| sense_limit_link_done()'s results besides a NACK's reason: the exchange answered, or not answered. | |
| #define | SENSE_LIMIT_LINK_NO_ANSWER (-1) |
| sense_limit_link_done()'s result for an exchange not answered. | |
Enumerations | |
| enum | sense_limit_link_op_kind_t { SENSE_LIMIT_LINK_OP_NONE = 0 , SENSE_LIMIT_LINK_OP_READ , SENSE_LIMIT_LINK_OP_WRITE , SENSE_LIMIT_LINK_OP_OVER } |
| The exchanges the page is served with. More... | |
| enum | sense_limit_link_ev_t { SENSE_LIMIT_LINK_EV_NONE = 0 , SENSE_LIMIT_LINK_EV_OVER , SENSE_LIMIT_LINK_EV_LOST , SENSE_LIMIT_LINK_EV_REFUSED } |
| What sense_limit_link_event() hands out. More... | |
| enum | sense_limit_st_t { SENSE_LIMIT_ST_UNKNOWN = 0 , SENSE_LIMIT_ST_HELD , SENSE_LIMIT_ST_PENDING , SENSE_LIMIT_ST_REFUSED , SENSE_LIMIT_ST_OLD } |
| What SETUP > SENSORS shows of the limits (sensors_rows_set_limits()). More... | |
Functions | |
| void | sense_limit_link_init (sense_limit_link_t *s) |
| Clears the service: no link, no limits asked. | |
| void | sense_limit_link_lost (sense_limit_link_t *s) |
| The link went: what was read is no longer the IOmcu's. | |
| void | sense_limit_link_came_up (sense_limit_link_t *s, uint16_t minor, uint32_t now_ms) |
| An IOmcu answered. | |
| void | sense_limit_link_want (sense_limit_link_t *s, const uint16_t *ma, uint32_t now_ms) |
| The limits SETUP > SENSORS asks. A change clears a refusal. | |
| bool | sense_limit_link_next (sense_limit_link_t *s, uint32_t now_ms, sense_limit_link_op_t *op) |
| The next exchange owed. | |
| void | sense_limit_link_done (sense_limit_link_t *s, int result, const uint16_t *regs, uint32_t now_ms) |
| How the exchange sense_limit_link_next() named went. | |
| sense_limit_link_ev_t | sense_limit_link_event (sense_limit_link_t *s, uint32_t now_ms, unsigned *ch, uint16_t *ma) |
| The next band alert. | |
| uint16_t | sense_limit_link_held_ma (const sense_limit_link_t *s, unsigned ch) |
| A channel's limit the page holds. | |
| sense_limit_st_t | sense_limit_link_status (const sense_limit_link_t *s) |
| What SETUP > SENSORS shows of the limits. | |
| uint16_t | sense_limit_link_unheld (const sense_limit_link_t *s) |
| The channels whose LIMIT row SETUP marks. | |
The panel's half of SENSE_LIMIT (0x36, protocol 4.27): a current limit per INA3221 channel, and the channels whose 50ms window passed it.
An alert only: a limit passed stops nothing and drives nothing.
What the band is told, at most one alert every SENSE_LIMIT_LINK_GAP_MS:
Pure C, no link of its own: the caller makes each exchange and reports how it went. Control task only.
SPDX-License-Identifier: MIT
What sense_limit_link_event() hands out.
| Enumerator | |
|---|---|
| SENSE_LIMIT_LINK_EV_OVER | channel *ch passed its limit |
| SENSE_LIMIT_LINK_EV_LOST | a channel passed; which was lost |
| SENSE_LIMIT_LINK_EV_REFUSED | the limits were refused |
| enum sense_limit_st_t |
What SETUP > SENSORS shows of the limits (sensors_rows_set_limits()).
| void sense_limit_link_came_up | ( | sense_limit_link_t * | s, |
| uint16_t | minor, | ||
| uint32_t | now_ms ) |
An IOmcu answered.
| s | the service; NULL does nothing. |
| minor | its protocol minor; below LINK_MINOR_SENSE_LIMIT (27) the page is sent nothing. |
| now_ms | the time, ms; a limit asked before rests from it. |
| void sense_limit_link_done | ( | sense_limit_link_t * | s, |
| int | result, | ||
| const uint16_t * | regs, | ||
| uint32_t | now_ms ) |
How the exchange sense_limit_link_next() named went.
| s | the service; NULL does nothing. |
| result | SENSE_LIMIT_LINK_ACK, a NACK's reason (LINK_NACK_*), or SENSE_LIMIT_LINK_NO_ANSWER. |
| regs | for an answered read, the registers it asked for; else NULL. |
| now_ms | the time, ms. |
| sense_limit_link_ev_t sense_limit_link_event | ( | sense_limit_link_t * | s, |
| uint32_t | now_ms, | ||
| unsigned * | ch, | ||
| uint16_t * | ma ) |
The next band alert.
| s | the service. |
| now_ms | the time, ms. |
| ch | for EV_OVER the channel, 0 to 11; may be NULL. |
| ma | for EV_OVER the limit the window was judged by, mA; may be NULL. |
s and while the last is younger than SENSE_LIMIT_LINK_GAP_MS. | uint16_t sense_limit_link_held_ma | ( | const sense_limit_link_t * | s, |
| unsigned | ch ) |
A channel's limit the page holds.
| s | the service. |
| ch | the channel, 0 to 11. |
ch out of range. | void sense_limit_link_init | ( | sense_limit_link_t * | s | ) |
Clears the service: no link, no limits asked.
| s | the service; NULL does nothing. |
| void sense_limit_link_lost | ( | sense_limit_link_t * | s | ) |
The link went: what was read is no longer the IOmcu's.
The limits asked stay, and OVER_COUNT as last read, for the link-up read.
| s | the service; NULL does nothing. |
| bool sense_limit_link_next | ( | sense_limit_link_t * | s, |
| uint32_t | now_ms, | ||
| sense_limit_link_op_t * | op ) |
The next exchange owed.
| s | the service. |
| now_ms | the time, ms. |
| op | where the exchange goes; zeroed for none. |
s or op. | sense_limit_st_t sense_limit_link_status | ( | const sense_limit_link_t * | s | ) |
What SETUP > SENSORS shows of the limits.
| s | the service. |
s. | uint16_t sense_limit_link_unheld | ( | const sense_limit_link_t * | s | ) |
The channels whose LIMIT row SETUP marks.
| s | the service. |
| void sense_limit_link_want | ( | sense_limit_link_t * | s, |
| const uint16_t * | ma, | ||
| uint32_t | now_ms ) |
The limits SETUP > SENSORS asks. A change clears a refusal.
| s | the service; NULL does nothing. |
| ma | LIMIT_MA[0] to [11], mA, 0 for none; above 32767 taken as
|
| now_ms | the time, ms; a change rests SENSE_LIMIT_LINK_SETTLE_MS from it. |