|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bounded console formatters for the esp-hosted port bring-up app. More...
#include <stddef.h>#include <stdint.h>#include "c6_hosted.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_esp_hosted_pins.h"Go to the source code of this file.
Functions | |
| void | c6_hosted_puts (const char *text) |
| Write a NUL-terminated string to the board console. | |
| void | c6_hosted_put_u32 (uint32_t value) |
| Implementation of c6_hosted_put_u32() – reversed division loop. | |
| void | c6_hosted_put_i32 (int32_t value) |
| Implementation of c6_hosted_put_i32() – two's-complement magnitude. | |
| void | c6_hosted_put_hex (uint32_t value, uint8_t digits) |
| Emit a value as a fixed-width lower-case hexadecimal field. | |
| void | c6_hosted_print_gpio (const char *label, const void *gpio_port, int32_t gpio_pin) |
| Print an H_GPIO_*_Port / H_GPIO_*_Pin pair as one field. | |
| void | c6_hosted_print_pin (const char *label, ra8_esp_hosted_pin_t pin) |
| Implementation of c6_hosted_print_pin() – unpacks, then delegates. | |
Bounded console formatters for the esp-hosted port bring-up app.
Four tiny serialisers – string, unsigned decimal, signed decimal and hexadecimal – plus the two printers that turn a pin identity into a console field. They exist so the application can narrate itself without dragging newlib's printf (and its heap and reentrancy machinery) into a bare-metal image with no heap at all.
Every loop here is bounded by a constant from c6_hosted.h, which is what satisfies NASA Power of 10 Rule 2. Neither pin printer writes an EK-RA8D2 pin number: both decode whatever the port's pin table and the H_GPIO_* macro pairs resolve to at run time.
Definition in file c6_hosted_console.c.
| void c6_hosted_print_gpio | ( | const char * | label, |
| const void * | gpio_port, | ||
| int32_t | gpio_pin ) |
Print an H_GPIO_*_Port / H_GPIO_*_Pin pair as one field.
| [in] | label | Field name, printed verbatim; null prints nothing. |
| [in] | gpio_port | Opaque port handle – an index in pointer clothing, never dereferenced. |
| [in] | gpio_pin | Pin index, or negative when the signal is unwired. |
gpio_port and gpio_pin are the two halves of one macro pair. Definition at line 90 of file c6_hosted_console.c.
References c6_hosted_put_i32(), c6_hosted_put_u32(), and c6_hosted_puts().
Referenced by c6_hosted_print_pin(), and c6_hosted_print_pin_map().
| void c6_hosted_print_pin | ( | const char * | label, |
| ra8_esp_hosted_pin_t | pin ) |
Implementation of c6_hosted_print_pin() – unpacks, then delegates.
Print one packed board pin as <label>=port<n>.pin<n>.
Definition at line 104 of file c6_hosted_console.c.
References c6_hosted_print_gpio(), k_ra8_pin_none, pin, RA8_PIN_PIN, and RA8_PIN_PORT.
Referenced by c6_hosted_print_pin_map(), and c6_hosted_print_route().
| void c6_hosted_put_hex | ( | uint32_t | value, |
| uint8_t | digits ) |
Emit a value as a fixed-width lower-case hexadecimal field.
| [in] | value | Value to print. |
| [in] | digits | Field width, 1..k_c6_hosted_hex_digits; an out-of-range width prints nothing rather than overrunning the output array. |
digits is within 1..k_c6_hosted_hex_digits. digits characters were emitted, or none on a bad width. digits (NASA Rule 2). Definition at line 74 of file c6_hosted_console.c.
References k_c6_hosted_hex_alpha, k_c6_hosted_hex_bits, k_c6_hosted_hex_digits, k_c6_hosted_hex_mask, and ra8_board_uart_console_write().
Referenced by c6_hosted_print_rx_header().
| void c6_hosted_put_i32 | ( | int32_t | value | ) |
Implementation of c6_hosted_put_i32() – two's-complement magnitude.
Emit a signed 32-bit value in decimal.
Definition at line 64 of file c6_hosted_console.c.
References c6_hosted_put_u32(), and c6_hosted_puts().
Referenced by c6_hosted_on_event(), c6_hosted_print_gpio(), c6_hosted_read_sideband(), and c6_hosted_run_transaction().
| void c6_hosted_put_u32 | ( | uint32_t | value | ) |
Implementation of c6_hosted_put_u32() – reversed division loop.
Emit an unsigned 32-bit value in decimal.
Definition at line 45 of file c6_hosted_console.c.
References k_c6_hosted_dec_digits, k_c6_hosted_dec_radix, and ra8_board_uart_console_write().
Referenced by c6_hosted_heartbeat(), c6_hosted_on_event(), c6_hosted_print_banner(), c6_hosted_print_gpio(), c6_hosted_print_route(), c6_hosted_print_rx_header(), c6_hosted_put_i32(), and c6_hosted_run_transaction().
| void c6_hosted_puts | ( | const char * | text | ) |
Write a NUL-terminated string to the board console.
| [in] | text | String to emit; null is ignored rather than dereferenced and the length is capped at k_c6_hosted_str_max. |
text is NUL-terminated within k_c6_hosted_str_max bytes. Definition at line 32 of file c6_hosted_console.c.
References k_c6_hosted_str_max, and ra8_board_uart_console_write().
Referenced by c6_hosted_heartbeat(), c6_hosted_on_event(), c6_hosted_print_banner(), c6_hosted_print_gpio(), c6_hosted_print_pin_map(), c6_hosted_print_route(), c6_hosted_print_rx_header(), c6_hosted_put_i32(), c6_hosted_read_sideband(), c6_hosted_run_transaction(), c6_hosted_worker_entry(), main(), and tx_application_define().