|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Cellular AT-modem device model for ra8_emulator (attached to SCI7 UART). More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| bool | board_modem_attach (void) |
| Attach (arm) the modelled AT cellular modem. | |
| bool | board_modem_attached (void) |
| Report whether the AT modem model is currently attached. | |
| uint8_t | board_modem_channel (void) |
| SCI channel the modem is wired to (RXD7 / TXD7 = SCI7). | |
| uint32_t | board_modem_feed_tx (uint8_t tx, uint8_t *out, uint32_t out_cap) |
| Feed one firmware-transmitted byte into the modem and drain a reply. | |
| void | board_modem_reset (void) |
| Clear the modem's parser state (keeps the attached flag). | |
| void | board_modem_report (void) |
| Print a one-line end-of-run summary if the modem was exercised. | |
Cellular AT-modem device model for ra8_emulator (attached to SCI7 UART).
Models a 3GPP AT-command cellular modem (SIM7600 / Quectel BG95 class) wired to the EK-RA8D2 MikroBUS UART – RXD7 / TXD7, i.e. SCI channel 7 (k_ra8_board_mikrobus_uart_sci_channel). A MikroE cellular Click (LTE IoT / 4G LTE / NB-IoT) presents its modem UART on exactly these pads.
The model is transport-symmetric with board_periph_sd.c / board_periph_eink.c: it is attached with --modem and one seam ties it into the rest of the emulator. The SCI_B block model (board_periph_sci.c) routes every TDR byte the firmware writes on the modem channel into board_modem_feed_tx; the model accumulates a command line, and when the terminating \r arrives it answers with the exact bytes a real modem would send, which the SCI block pushes back into that channel's RX queue (RDR / RDRF). The genuine firmware path – ra8_modem_at over ra8_sci polled TX/RX – then runs byte for byte, so the modem_at_demo example brings the modem up, walks its AT state machine (sync / SIM / signal / registration / attach), dispatches a +CREG URC and exercises the +CME ERROR path with no physical modem (EIL == HIL for the protocol; the physical RF link is the only unmodelled part, hence the app is hw_pending).
The AT script answered here mirrors what the demo sends; an unrecognised command is rejected with +CME ERROR: 4 exactly as a modem with AT+CMEE=1 active would, so the demo's error branch is faithful too.
Definition in file board_periph_modem.h.
| bool board_modem_attach | ( | void | ) |
Attach (arm) the modelled AT cellular modem.
Sets the module's armed flag so board_modem_attached returns true and the SCI_B block routes the modem channel's TDR writes into board_modem_feed_tx. Idempotent: a second call re-arms and clears the parser state.
| true | Modem armed (always, on this in-memory model). |
Definition at line 150 of file board_periph_modem.c.
References board_modem_reset(), and s_modem.
Referenced by internal_args_try_mode().
| bool board_modem_attached | ( | void | ) |
Report whether the AT modem model is currently attached.
| false | No --modem was passed. |
Report whether the at modem model is currently attached; this step is contained within the board periph modem model and uses bounded caller or module-owned storage.
Definition at line 157 of file board_periph_modem.c.
References s_modem.
Referenced by internal_sci_reg_write().
| uint8_t board_modem_channel | ( | void | ) |
SCI channel the modem is wired to (RXD7 / TXD7 = SCI7).
Matches k_ra8_board_mikrobus_uart_sci_channel on the firmware side so the SCI_B block routes only that channel's bytes into the model.
| 7 | Always, for the EK-RA8D2 MikroBUS UART mapping. |
Definition at line 162 of file board_periph_modem.c.
References k_modem_channel.
Referenced by internal_sci_reg_write().
| uint32_t board_modem_feed_tx | ( | uint8_t | tx, |
| uint8_t * | out, | ||
| uint32_t | out_cap ) |
Feed one firmware-transmitted byte into the modem and drain a reply.
Appends tx to the command-line accumulator. Most bytes buffer silently and return 0; the terminating \r closes the line, looks up the scripted response for that AT command, copies it into out (bounded by out_cap) and returns its length. An unrecognised command yields +CME ERROR: 4. A command whose response also stages an unsolicited +CREG URC (the AT+CREG=1 enable) appends that URC after the OK so the demo's ra8_modem_at_poll dispatch fires exactly as on silicon.
| [in] | tx | The byte the firmware wrote to the modem-channel TDR. |
| [out] | out | Destination for any response bytes (may stay untouched). |
| [in] | out_cap | Capacity of out in bytes. |
out (0 if none this byte). | 0 | The byte was buffered; no complete line yet. |
out is non-null and points to at least out_cap bytes. out holds a full modem response (<= out_cap). Definition at line 167 of file board_periph_modem.c.
References internal_modem_answer_line(), k_modem_cmd_cap, k_modem_cr, k_modem_lf, and s_modem.
Referenced by internal_sci_reg_write().
| void board_modem_report | ( | void | ) |
Print a one-line end-of-run summary if the modem was exercised.
Print a one-line end-of-run summary if the modem was exercised; this step is contained within the board periph modem model and uses bounded caller or module-owned storage.
Definition at line 193 of file board_periph_modem.c.
References priv_emu_io_errf(), and s_modem.
Referenced by internal_sci_report().
| void board_modem_reset | ( | void | ) |
Clear the modem's parser state (keeps the attached flag).
Called from the SCI block reset so a mid-run reset re-frames the command accumulator without detaching the modem (the SCI reset re-frames transport, not the modem's presence). Run counters are retained for the end-of-run report.
Definition at line 187 of file board_periph_modem.c.
References s_modem.
Referenced by board_modem_attach(), and internal_sci_reset().