ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_usb_device.c
Go to the documentation of this file.
1
23
24#include <stdint.h>
25
26#include "ra8_attributes.h"
27#include "ra8_check.h"
28#include "ra8_err.h"
29#include "ra8_log.h"
30#include "ra8_mstp.h"
31#include "ra8_usb.h"
32#include "ra8_usb_internal.h"
33#include "ra8_usb_regs.h"
34
35static const char* s_tag = "USB";
36
37/* =============================================================================
38 * Device-mode bring-up diagnostic probes (read via JLink)
39 * =============================================================================
40 */
41
55volatile uint16_t g_syscfg_after_phy_bringup = 0U;
56
67volatile uint16_t g_lpsts_after_phy_bringup = 0U;
68
79volatile uint16_t g_syscfg_after_attach = 0U;
80
91volatile uint16_t g_lpsts_after_attach = 0U;
92
115volatile uint16_t g_syssts0_after_attach = 0U;
116
130volatile uint16_t g_syscfg_before_dprpu = 0U;
131
132/* =============================================================================
133 * Device-mode state decode
134 * =============================================================================
135 */
136
153{
154 const uint16_t dvsq = (uint16_t)(intsts0 & k_ra8_intsts0_mask_dvsq);
155 /* Suspend bit (0x40) wins over the lower three states. */
156 if ((dvsq & k_ra8_dvsq_suspend) != 0U) {
158 }
159 if (dvsq == k_ra8_dvsq_default) {
161 }
162 if (dvsq == k_ra8_dvsq_address) {
164 }
165 if (dvsq == k_ra8_dvsq_configured) {
167 }
169}
170
187{
188 volatile r_usb_regs_t* reg = priv_pick(speed);
189 if (reg == nullptr) {
191 }
192
193 /* HUM Ch 11.2.7 "MSTPCRB : Module Stop Control Register B", p 444 */
194 const ra8_err_t mst_err = ra8_mstp_enable(priv_mstp(speed));
195 RA8_RETURN_ON_ERROR(mst_err, s_tag, "usb_init: mstp enable");
196
197 if (speed == k_ra8_usb_speed_hs) {
198 const ra8_err_t phy_err = priv_usbhs_phy_bringup(reg);
199 /* GCOVR_EXCL_BR_START -- HW bring-up fault */
200 RA8_RETURN_ON_ERROR(phy_err, s_tag, "usb_init: HS PHY bring-up");
201 /* GCOVR_EXCL_BR_STOP */
202 } else {
203 const ra8_err_t fs_err = priv_usbfs_module_bringup(reg);
204 RA8_RETURN_ON_ERROR(fs_err, s_tag, "usb_init: FS module bring-up");
205 }
206
208
209 /* Bisect probes: capture SYSCFG/LPSTS state at the END of device-init,
210 * BEFORE control returns to ra8_board_usbhs_device_init / the DCD
211 * bridge. HUM Ch 37.2.1 SYSCFG p 2060, HUM Ch 37.2.43 LPSTS p 2111. */
212 if (speed == k_ra8_usb_speed_hs) {
215 }
216
217 ra8_log_info_val(s_tag, "usb device init speed", (uint32_t)speed);
218 return k_ra8_ok;
219}
220
235{
236 volatile r_usb_regs_t* reg = priv_pick(speed);
237 if (reg == nullptr) {
239 }
240
241 /* HUM Ch 36.2.10 "INTENB0 : Interrupt Enable Register 0", p 1980 */
242 reg->INTENB0 = 0U;
243 reg->INTENB1 = 0U;
244 reg->BRDYENB = 0U;
245 reg->NRDYENB = 0U;
246 reg->BEMPENB = 0U;
247
248 /* HUM Ch 36.2.1 "SYSCFG : System Configuration Control Register", p 1967 */
249 reg->SYSCFG = 0U;
250 return ra8_mstp_disable(priv_mstp(speed));
251}
252
268{
269 volatile r_usb_regs_t* reg = priv_pick(speed);
270 if (reg == nullptr) {
272 }
273
274 /* HUM Ch 36.2.1 "SYSCFG : System Configuration Control Register", p 1967 */
275 /* HUM Ch 37.2.1 "SYSCFG : System Configuration Control Register", p 2061 */
276 const uint16_t dprpu = (uint16_t)(1U << k_ra8_syscfg_bit_dprpu);
277 const uint16_t cnen = (uint16_t)(1U << k_ra8_syscfg_bit_cnen);
278
279 if (attached) {
280 /* HUM Ch 37.2.1 SYSCFG, "CNEN bit (Single-ended Receiver Enable)"
281 * p 2062: "In device controller mode, set this bit to 1 when VBUS
282 * is detected because of a VBUS interrupt, and set it to 0 when
283 * the VBUS line is removed."
284 *
285 * Without CNEN=1 the HS PHY's single-end receivers are powered
286 * down and SYSSTS0.LNST[1:0] reads 00b (SE0) regardless of what
287 * the host's 1.5 kohm-or-15 kohm pull-down arrangement and the
288 * device's DPRPU 1.5 kohm pull-up are doing on the wires.
289 *
290 * Programme CNEN BEFORE DPRPU so the receivers latch the line
291 * state the moment DPRPU pulls D+ high; this is the FS-attach
292 * sequence sketched in HUM Ch 37.3.3 Figure 37.2 p 2121
293 * ("Resistor control" step comes after USBE/CNEN are settled).
294 * The FS instance has no CNEN gate (HUM Ch 36.2.1 SYSCFG p 1966),
295 * so CNEN is HS-only here. */
296 if (speed == k_ra8_usb_speed_hs) {
297 priv_rmw16(&reg->SYSCFG, cnen, 0U);
299 }
300 priv_rmw16(&reg->SYSCFG, dprpu, 0U);
301 } else {
302 priv_rmw16(&reg->SYSCFG, 0U, dprpu);
303 if (speed == k_ra8_usb_speed_hs) {
304 /* HUM Ch 37.2.1 p 2062: clear CNEN when VBUS is removed /
305 * detach is requested, to avoid through-current on floating
306 * D+/D- when the cable is unplugged. */
307 priv_rmw16(&reg->SYSCFG, 0U, cnen);
308 }
309 }
310
311 /* Bisect probes: capture SYSCFG/LPSTS/SYSSTS0 at end of attach. HUM
312 * Ch 37.2.1 SYSCFG p 2060, HUM Ch 37.2.3 SYSSTS0 p 2063, HUM
313 * Ch 37.2.43 LPSTS p 2111. */
314 if (speed == k_ra8_usb_speed_hs) {
318 }
319 return k_ra8_ok;
320}
321
322/* =============================================================================
323 * Status / state
324 * =============================================================================
325 */
326
342{
343 RA8_CHECK_NULL_PTR(out_mask, s_tag, "out_mask must not be nullptr");
344 volatile const r_usb_regs_t* reg = priv_pick(speed);
345 if (reg == nullptr) {
347 }
348 /* HUM Ch 36.2.14 "INTSTS0 : Interrupt Status Register 0", p 1986 */
349 *out_mask = reg->INTSTS0;
350 return k_ra8_ok;
351}
352
368{
369 volatile r_usb_regs_t* reg = priv_pick(speed);
370 if (reg == nullptr) {
372 }
373 /* HUM Ch 36.2.14 "INTSTS0 : Interrupt Status Register 0", p 1986 */
374 reg->INTSTS0 = (uint16_t)(reg->INTSTS0 & (uint16_t)~mask);
375 return k_ra8_ok;
376}
377
393{
394 RA8_CHECK_NULL_PTR(out_state, s_tag, "out_state must not be nullptr");
395 volatile const r_usb_regs_t* reg = priv_pick(speed);
396 if (reg == nullptr) {
398 }
399 /* HUM Ch 36.2.14 "INTSTS0 : Interrupt Status Register 0", p 1986 */
400 *out_state = internal_decode_dvsq(reg->INTSTS0);
401 return k_ra8_ok;
402}
403
419{
420 volatile r_usb_regs_t* reg = priv_pick(speed);
421 if (reg == nullptr) {
423 }
424 if (address > k_ra8_usb_max_address) {
426 }
427 /* HUM Ch 36.2.16 "USBADDR : USB Address Register", p 1994 */
428 /* HUM Ch 37.2.16 "USBADDR : USB Address Register", p 2089 */
429 reg->USBADDR = (uint16_t)((uint16_t)address & k_ra8_usbaddr_addr_mask);
430 return k_ra8_ok;
431}
432
454{
455 reg->DCPCFG = 0U;
457 priv_select_cfifo(reg, 0U, true);
458 reg->CFIFOCTR = (uint16_t)k_ra8_fifoctr_bclr;
459}
460
479{
480 volatile r_usb_regs_t* reg = priv_pick(speed);
481 if (reg == nullptr) {
483 }
484
485 /* HUM Ch 36.2.27 "PIPECTR : Pipe n Control Register", p 2007.
486 * Clear PID for every non-control pipe so any half-completed pre-
487 * reset transfer is forgotten. The class driver re-issues queue_in /
488 * queue_out which will set PID=BUF when ready. */
489 for (uint8_t i = 0U; i < (uint8_t)k_ra8_usb_pipectr_count; i++) {
490 reg->PIPECTR[i] = 0U;
491 }
492
493 /* HUM Ch 36.2.13/14 BRDYSTS / NRDYSTS / BEMPSTS, p 1983-1985 (W0C).
494 * Drop any per-pipe status bits left over from before the reset so
495 * stale BRDY edges don't fire spurious BRDY callbacks during the next
496 * enumeration. Writing 0 clears every bit; writing 1 preserves. */
497 reg->BRDYSTS = 0U;
498 reg->NRDYSTS = 0U;
499 reg->BEMPSTS = 0U;
500
501 /* DCP defaults + FIFO clear (see helper). HUM Ch 36.2.19 / 37.2.29
502 * DCPCFG p 1989 / 2091 and HUM Ch 36.2.20 / 37.2.30 DCPMAXP p 1990
503 * / 2092. DCPCTR is intentionally NOT written here: HUM Ch 36.2.21
504 * / 37.2.31 (p 1991 / 2093) states the IP auto-defaults the
505 * writable DCPCTR fields on bus reset (PID=NAK, CCPL=0). */
507
508 /* HUM Ch 36.2.10 "INTENB0 : Interrupt Enable Register 0", p 1980.
509 * Some RA silicon revisions clear individual INTENB0 bits across a
510 * bus reset (notably CTRT). Re-apply the post-init mask defensively
511 * so the next SETUP raises CTRT as expected. Mirrors the mask in
512 * priv_usb_init_common. */
513 /* SOFR and RSME are intentionally NOT enabled here:
514 * - SOFR fires every 125us on HS (= 8 kHz);
515 * - RSME stays asserted on USBHS via the PHY's USBR signal
516 * while the host holds the bus in resume signalling;
517 * Both starve PendSV and the demo worker thread never gets
518 * scheduled. NRDY is still useful (drives the bridge's per-pipe
519 * NAK re-arm) and does not cause a storm on its own. RSME / SOFR
520 * status is still readable from INTSTS0 for poll-style drivers. */
521 reg->INTENB0 = (uint16_t)((1U << k_ra8_int0_bit_bemp) | (1U << k_ra8_int0_bit_brdy) |
522 (1U << k_ra8_int0_bit_nrdy) | (1U << k_ra8_int0_bit_ctrt) |
523 (1U << k_ra8_int0_bit_dvst) | (1U << k_ra8_int0_bit_vbse));
524
525 return k_ra8_ok;
526}
527/* =============================================================================
528 * Endpoints
529 * =============================================================================
530 */
531
552static ra8_err_t internal_check_ep_args(uint8_t pipe_num,
553 uint8_t ep_addr,
556 uint16_t max_packet)
557{
558 if ((pipe_num == 0U) || (pipe_num > k_ra8_usb_max_pipe_num)) {
560 }
561 if ((ep_addr == 0U) || (ep_addr > k_ra8_usb_max_ep_addr)) {
563 }
564 if ((dir != k_ra8_usb_ep_dir_in) && (dir != k_ra8_usb_ep_dir_out)) {
566 }
567 if (type > k_ra8_usb_ep_type_iso) {
569 }
570 if ((max_packet == 0U) || (max_packet > k_ra8_usb_pipe_max_packet)) {
572 }
573 return k_ra8_ok;
574}
575
594static void
595internal_pipe_finalize(volatile r_usb_regs_t* reg, uint8_t pipe_num, ra8_usb_ep_dir_t dir)
596{
597 const uint8_t ctr_idx = (uint8_t)(pipe_num - 1U);
598 const uint16_t pipe_bit = (uint16_t)(1U << pipe_num);
599 priv_rmw16(&reg->PIPECTR[ctr_idx], k_ra8_pipectr_sqclr, 0U);
600 priv_rmw16(&reg->PIPECTR[ctr_idx], k_ra8_pipectr_aclrm, 0U);
601 priv_rmw16(&reg->PIPECTR[ctr_idx], 0U, k_ra8_pipectr_aclrm);
602 reg->BRDYSTS = (uint16_t)(~pipe_bit);
603 reg->BEMPSTS = (uint16_t)(~pipe_bit);
605}
606
627static void
628internal_pipe_arm_irq(volatile r_usb_regs_t* reg, uint8_t pipe_num, ra8_usb_ep_dir_t dir)
629{
630 const uint16_t pipe_bit = (uint16_t)(1U << pipe_num);
631 if (dir == k_ra8_usb_ep_dir_out) {
632 reg->BRDYENB = (uint16_t)(reg->BRDYENB | pipe_bit);
633 } else {
634 reg->BEMPENB = (uint16_t)(reg->BEMPENB | pipe_bit);
635 }
636}
637
662 uint8_t pipe_num,
663 uint8_t ep_addr,
666 uint16_t max_packet)
667{
668 volatile r_usb_regs_t* reg = priv_pick(speed);
669 if (reg == nullptr) {
671 }
672 const ra8_err_t arg_err = internal_check_ep_args(pipe_num, ep_addr, dir, type, max_packet);
673 if (arg_err != k_ra8_ok) {
674 return arg_err;
675 }
676
677 priv_pipe_quiesce(reg, pipe_num);
678
679 /* HUM Ch 36.2.23 "PIPESEL : Pipe Window Select Register", p 2002 */
680 reg->PIPESEL = pipe_num;
681 /* HUM Ch 36.2.24 "PIPECFG : Pipe Configuration Register", p 2003 */
682 reg->PIPECFG = priv_pipecfg_word(ep_addr, dir, type, false);
683 /* HUM Ch 37.2.35 "PIPEBUF : Pipe Buffer Register", p 2100. PIPEBUF is a
684 * USBHS-only register; the USBFS instance (Ch 36) has no equivalent.
685 * Bulk pipes get a single MPS-sized bank (DBLB clear). Interrupt/iso
686 * pipes keep the reset default. */
687 if (type == k_ra8_usb_ep_type_bulk) {
688 reg->PIPEBUF = priv_pipebuf_word(pipe_num, max_packet);
689 }
690 /* HUM Ch 36.2.26 "PIPEMAXP : Pipe Maximum Packet Size Register", p 2005 */
691 reg->PIPEMAXP = max_packet;
692 reg->PIPEPERI = 0U;
693 /* Deselect window (FIT step 4) so a later stray PIPECFG write does
694 * not land on this pipe. */
695 reg->PIPESEL = 0U;
696
697 internal_pipe_finalize(reg, pipe_num, dir);
698 internal_pipe_arm_irq(reg, pipe_num, dir);
699 return k_ra8_ok;
700}
701
717{
718 volatile r_usb_regs_t* reg = priv_pick(speed);
719 if (reg == nullptr) {
721 }
722 if (pipe_num > k_ra8_usb_max_pipe_num) {
724 }
725 if (pipe_num == 0U) {
726 /* HUM Ch 36.2.21 "DCPCTR : DCP Control Register", p 1999 */
728 } else {
729 /* HUM Ch 36.2.27 "PIPEnCTR : PIPE n Control Register", p 2005 */
730 priv_pipe_pid(reg, pipe_num, k_ra8_pid_stall);
731 }
732 return k_ra8_ok;
733}
static const char * s_tag
Logging / check tag.
Definition ra8_app.c:17
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Definition ra8_check.h:184
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
Definition ra8_log.h:366
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
Definition ra8_mstp.c:343
ra8_err_t ra8_mstp_disable(ra8_mstp_t id)
Reference-counted "gate this peripheral" request.
Definition ra8_mstp.c:382
void priv_dcp_pid(volatile r_usb_regs_t *reg, ra8_usb_pid_t pid)
Set DCPCTR PID field to a specific value while preserving the rest of the register.
Definition ra8_usb.c:288
void priv_rmw16(volatile uint16_t *reg, uint16_t set_mask, uint16_t clr_mask)
Apply a generic read-modify-write to a 16-bit register.
Definition ra8_usb.c:154
void priv_select_cfifo(volatile r_usb_regs_t *reg, uint16_t pipe_num, bool is_in_dir)
Set CFIFOSEL.MBW + CURPIPE + ISEL for the given pipe / direction.
Definition ra8_usb.c:199
ra8_mstp_t priv_mstp(ra8_usb_speed_t speed)
Resolve the per-speed MSTP id.
Definition ra8_usb.c:135
volatile r_usb_regs_t * priv_pick(ra8_usb_speed_t speed)
Resolve the per-speed register pointer.
Definition ra8_usb.c:110
uint16_t priv_pipebuf_word(uint8_t pipe_num, uint16_t max_packet)
Compute the PIPEBUF word for a bulk pipe (2*MPS region).
Definition ra8_usb.c:353
void priv_pipe_pid(volatile r_usb_regs_t *reg, uint8_t pipe_num, ra8_usb_pid_t pid)
Set PIPECTR[idx] PID field.
Definition ra8_usb.c:308
void priv_pipe_quiesce(volatile r_usb_regs_t *reg, uint8_t pipe_num)
Quiesce the pipe so PIPECFG/PIPEMAXP/PIPEPERI become writable.
Definition ra8_usb.c:447
uint16_t priv_pipecfg_word(uint8_t ep_addr, ra8_usb_ep_dir_t dir, ra8_usb_ep_type_t type, bool dblb_in)
Pack PIPECFG fields for a configured non-control pipe.
Definition ra8_usb.c:401
Native USB controller driver public API (device + host modes).
static ra8_err_t internal_check_ep_args(uint8_t pipe_num, uint8_t ep_addr, ra8_usb_ep_dir_t dir, ra8_usb_ep_type_t type, uint16_t max_packet)
Validate the argument set for ra8_usb_configure_endpoint.
ra8_err_t ra8_usb_device_init(ra8_usb_speed_t speed)
Implementation of ra8_usb_device_init().
static ra8_usb_dev_state_t internal_decode_dvsq(uint16_t intsts0)
Translate INTSTS0.DVSQ[2:0] into the public state enum.
volatile uint16_t g_syscfg_after_attach
SYSCFG snapshot captured at the end of ra8_usb_device_attach(true).
static void internal_pipe_arm_irq(volatile r_usb_regs_t *reg, uint8_t pipe_num, ra8_usb_ep_dir_t dir)
Re-arm the per-pipe interrupt the dispatcher routes off of.
volatile uint16_t g_syscfg_before_dprpu
SYSCFG snapshot captured immediately BEFORE the DPRPU write.
volatile uint16_t g_lpsts_after_attach
LPSTS snapshot at the end of ra8_usb_device_attach(true).
static void internal_dcp_reset_defaults(volatile r_usb_regs_t *reg)
Reset DCP defaults + clear DCP FIFO on bus-reset rearm.
ra8_err_t ra8_usb_device_busreset_rearm(ra8_usb_speed_t speed)
Implementation of ra8_usb_device_busreset_rearm (see header).
ra8_err_t ra8_usb_set_address(ra8_usb_speed_t speed, uint8_t address)
Implementation of ra8_usb_set_address().
ra8_err_t ra8_usb_get_device_state(ra8_usb_speed_t speed, ra8_usb_dev_state_t *out_state)
Implementation of ra8_usb_get_device_state().
ra8_err_t ra8_usb_device_deinit(ra8_usb_speed_t speed)
Implementation of ra8_usb_device_deinit().
static void internal_pipe_finalize(volatile r_usb_regs_t *reg, uint8_t pipe_num, ra8_usb_ep_dir_t dir)
Finalize the pipe after PIPECFG/PIPEMAXP/PIPEPERI have landed.
ra8_err_t ra8_usb_stall_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num)
Implementation of ra8_usb_stall_endpoint().
ra8_err_t ra8_usb_configure_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num, uint8_t ep_addr, ra8_usb_ep_dir_t dir, ra8_usb_ep_type_t type, uint16_t max_packet)
Implementation of ra8_usb_configure_endpoint().
ra8_err_t ra8_usb_device_attach(ra8_usb_speed_t speed, bool attached)
Implementation of ra8_usb_device_attach().
volatile uint16_t g_syscfg_after_phy_bringup
SYSCFG snapshot captured at the end of ra8_usb_device_init.
volatile uint16_t g_lpsts_after_phy_bringup
LPSTS snapshot at the end of ra8_usb_device_init.
volatile uint16_t g_syssts0_after_attach
SYSSTS0 snapshot captured at the end of ra8_usb_device_attach(true).
ra8_err_t ra8_usb_get_status(ra8_usb_speed_t speed, uint16_t *out_mask)
Implementation of ra8_usb_get_status().
ra8_err_t ra8_usb_clear_status(ra8_usb_speed_t speed, uint16_t mask)
Implementation of ra8_usb_clear_status().
ra8_usb_ep_type_t
Transfer type for a non-control endpoint.
@ k_ra8_usb_ep_type_bulk
Bulk transfer.
@ k_ra8_usb_ep_type_iso
Isochronous transfer.
ra8_usb_ep_dir_t
Endpoint direction.
@ k_ra8_usb_ep_dir_in
Device -> host.
@ k_ra8_usb_ep_dir_out
Host -> device.
ra8_usb_speed_t
Selects which controller instance the call targets.
@ k_ra8_usb_speed_hs
High-Speed controller (USBHS @ 0x40351000).
ra8_usb_dev_state_t
Decoded INTSTS0.DVSQ[2:0] device-state values.
@ k_ra8_usb_dev_state_suspended
Suspended.
@ k_ra8_usb_dev_state_default
Default (post reset).
@ k_ra8_usb_dev_state_address
Address assigned.
@ k_ra8_usb_dev_state_configured
Configured.
@ k_ra8_usb_dev_state_powered
Powered, no reset yet.
Cross-TU surface for the ra8_usb driver split.
ra8_err_t priv_usbhs_phy_bringup(volatile r_usb_regs_t *reg)
USBHS embedded-PHY bring-up (HUM Figure 37.2 p 2121).
void priv_usb_init_common(volatile r_usb_regs_t *reg)
Programme the post-SYSCFG common registers (FIFO, DCP, INTENB).
@ k_ra8_usb_max_address
7-bit USB address.
@ k_ra8_usb_pipe_max_packet
Max packet ceiling for pipes.
@ k_ra8_usb_max_pipe_num
PIPE1..PIPE9 + DCP at 0.
@ k_ra8_usb_max_ep_addr
USB EP number is 4 bits.
@ k_ra8_usb_dcp_max_packet
EP0 default packet size.
ra8_err_t priv_usbfs_module_bringup(volatile r_usb_regs_t *reg)
USBFS module bring-up (FSP hw_usb_pmodule_init IP0 branch).
USB Full-Speed + High-Speed controller layout for the Renesas RA8D2.
static volatile uint16_t * ra8_usbhs_lpsts(void)
Get pointer to USBHS LPSTS register.
@ k_ra8_pipectr_aclrm
Auto buffer clear mode.
@ k_ra8_pipectr_sqclr
Toggle clear.
@ k_ra8_pid_buf
BUF response (transmit/receive).
@ k_ra8_pid_nak
NAK response.
@ k_ra8_pid_stall
STALL response.
@ k_ra8_syscfg_bit_dprpu
D+ pull-up enable (device).
@ k_ra8_syscfg_bit_cnen
Single-end receiver enable.
@ k_ra8_fifoctr_bclr
Buffer clear.
@ k_ra8_usbaddr_addr_mask
7-bit USB address [6:0].
@ k_ra8_intsts0_mask_dvsq
Device state.
@ k_ra8_int0_bit_bemp
Buffer-empty interrupt.
@ k_ra8_int0_bit_dvst
Device-state transition.
@ k_ra8_int0_bit_brdy
Buffer-ready interrupt.
@ k_ra8_int0_bit_ctrt
Control-transfer-stage transition.
@ k_ra8_int0_bit_vbse
VBUS change.
@ k_ra8_int0_bit_nrdy
Buffer-not-ready interrupt.
@ k_ra8_dvsq_suspend
Suspended (any sub-state).
@ k_ra8_dvsq_address
Address assigned.
@ k_ra8_dvsq_default
Default (post bus reset).
@ k_ra8_dvsq_configured
Configured.
@ k_ra8_usb_pipectr_count
PIPECTR[9] = PIPE1..PIPE9.
USB FS / HS register window (device-mode subset).
volatile uint16_t NRDYENB
+0x038 NRDY Interrupt Enable.
volatile uint16_t CFIFOCTR
+0x022 Control FIFO control.
volatile uint16_t DCPMAXP
+0x05E DCP Max Packet.
volatile uint16_t USBADDR
+0x050 USB Address.
volatile uint16_t PIPECTR[k_ra8_usb_pipectr_count]
+0x070 PIPE1..9 ctrl.
volatile uint16_t INTENB0
+0x030 Interrupt Enable 0.
volatile uint16_t INTSTS0
+0x040 Interrupt Status 0.
volatile uint16_t PIPEPERI
+0x06E Selected pipe period.
volatile uint16_t SYSCFG
+0x000 System Configuration.
volatile uint16_t SYSSTS0
+0x004 System Status 0.
volatile uint16_t BRDYENB
+0x036 BRDY Interrupt Enable.
volatile uint16_t PIPEMAXP
+0x06C Selected pipe max packet.
volatile uint16_t BEMPSTS
+0x04A BEMP Interrupt Status.
volatile uint16_t PIPEBUF
+0x06A Selected pipe buffer.
volatile uint16_t PIPECFG
+0x068 Selected pipe config.
volatile uint16_t INTENB1
+0x032 Interrupt Enable 1.
volatile uint16_t DCPCFG
+0x05C DCP Configuration.
volatile uint16_t NRDYSTS
+0x048 NRDY Interrupt Status.
volatile uint16_t BEMPENB
+0x03A BEMP Interrupt Enable.
volatile uint16_t PIPESEL
+0x064 Pipe window select.
volatile uint16_t BRDYSTS
+0x046 BRDY Interrupt Status.