ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_etha_ops.h File Reference

Per-port ETHA lifecycle / IRQ / mode / queue API – HUM Ch 32 (p 1627-1702). More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_etha_regs.h"
#include "ra8_etha_types.h"
Include dependency graph for ra8_etha_ops.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ra8_err_t ra8_etha_init (ra8_etha_port_t port, const ra8_etha_config_t *cfg)
 Initialise an ETHA port (MSTP gate + reset registers + initial mode).
ra8_err_t ra8_etha_deinit (ra8_etha_port_t port)
 Tear down an ETHA port (drop into RESET, mask all IRQs).
ra8_err_t ra8_etha_get_status (ra8_etha_port_t port, ra8_etha_status_t *out)
 Read a port's status snapshot (mode + 3x error IRQ status + TAS).
ra8_err_t ra8_etha_clear_status (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask)
 Clear bits in EAEIS0 / EAEIS1 / EAEIS2 via EAEIDx.
ra8_err_t ra8_etha_enable_irq (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask)
 Atomically enable specific error IRQ bits in one of the three blocks.
ra8_err_t ra8_etha_disable_irq (ra8_etha_port_t port, ra8_etha_irq_class_t block, uint32_t mask)
 Atomically disable specific error IRQ bits in one of the three blocks.
ra8_err_t ra8_etha_attach_handler (ra8_etha_port_t port, ra8_etha_event_fn_t cb, void *ctx)
 Attach a per-port event handler.
void ra8_etha_dispatch (ra8_etha_port_t port)
 Snapshot all three EAEISx, clear them, then fire the per-port handler.
ra8_err_t ra8_etha_enter_stop (ra8_etha_port_t port)
 Drop an ETHA port into low-power stop (DISABLE mode).
ra8_err_t ra8_etha_exit_stop (ra8_etha_port_t port)
 Bring an ETHA port back from low-power stop (OPERATION mode).
ra8_err_t ra8_etha_reset (ra8_etha_port_t port)
 Software-reset the port: drop to RESET, then re-enter CONFIG.
ra8_err_t ra8_etha_set_mode (ra8_etha_port_t port, ra8_etha_opc_t mode)
 Issue an explicit EAMC mode-change command.
ra8_err_t ra8_etha_set_queue_arb (ra8_etha_port_t port, ra8_etha_tc_t tc, uint8_t arb)
 Configure the per-traffic-class TX queue arbitration weight.
ra8_err_t ra8_etha_set_queue_depth (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t depth)
 Set the TX descriptor queue depth for one traffic class.
ra8_err_t ra8_etha_get_queue_level (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t *cur_level, uint16_t *peak)
 Read the current and high-water-mark queue level for one class.
ra8_err_t ra8_etha_set_preemption (ra8_etha_port_t port, uint8_t preempt, uint8_t cut_thru, ra8_etha_afs_t afs)
 Configure 802.3br TX preemption: which classes are pre-emptable.
ra8_err_t ra8_etha_set_max_frame_size (ra8_etha_port_t port, ra8_etha_tc_t tc, uint16_t max_bytes)
 Set the maximum frame size for one traffic class (jumbo OK).
ra8_err_t ra8_etha_set_ipv_remap (ra8_etha_port_t port, const uint8_t *map)
 Programme the IPV (PCP-to-internal-priority) remap table.

Detailed Description

Per-port ETHA lifecycle / IRQ / mode / queue API – HUM Ch 32 (p 1627-1702).

Tag
[Ring 3 / HAL] {World: NS}

Lifecycle (init / deinit / reset), status snapshot, error-IRQ block management, event dispatch, low-power stop, explicit mode-change, and per-traffic-class TX-queue arbitration / depth / preemption / max frame-size / IPV-remap prototypes. Split out of the umbrella ra8_etha.h to keep that header under the per-file line budget; this is a pure move of the original declarations. The data types these functions take live in ra8_etha_types.h, and the register enums in ra8_etha_regs.h.

Since
0.1.0

Definition in file ra8_etha_ops.h.

Function Documentation

◆ ra8_etha_attach_handler()

ra8_err_t ra8_etha_attach_handler ( ra8_etha_port_t port,
ra8_etha_event_fn_t cb,
void * ctx )
nodiscard

Attach a per-port event handler.

Parameters
[in]portPort identifier.
[in]cbCallback to fire from::ra8_etha_dispatch (may be nullptr to detach).
[in]ctxOpaque cookie passed back to cb.
Returns
ra8_err_t Error code.
Return values
k_ra8_okHandler attached / detached.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously brought up via ra8_etha_init.
Caller owns the lifetime of ctx.
Postcondition
Subsequent dispatches for this port invoke cb (or nothing if cb == nullptr).
Previous handler for this port is no longer reachable.
Note
Not thread-safe; install handlers during init / before IRQ unmask.
See also
ra8_etha_dispatch
Since
0.1.0

Definition at line 343 of file ra8_etha.c.

References internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_ok, ra8_log_error, s_etha_slots, and s_tag.

◆ ra8_etha_clear_status()

ra8_err_t ra8_etha_clear_status ( ra8_etha_port_t port,
ra8_etha_irq_class_t block,
uint32_t mask )
nodiscard

Clear bits in EAEIS0 / EAEIS1 / EAEIS2 via EAEIDx.

Parameters
[in]portPort identifier.
[in]blockWhich error-interrupt block (0/1/2).
[in]maskBit mask to write to EAEIDx.
Returns
ra8_err_t Error code.
Return values
k_ra8_okBits cleared.
k_ra8_err_invalid_argport or block out of range.
Precondition
Port previously brought up via ra8_etha_init.
Caller has read the corresponding EAEISx via::ra8_etha_get_status.
Postcondition
Bits in mask are cleared in EAEISx.
EAEISx read-back excludes the cleared bits.
Note
IRQ-safe; the underlying write is atomic on Cortex-M85.
See also
ra8_etha_get_status
Since
0.1.0

Definition at line 255 of file ra8_etha.c.

References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIS0, r_etha_regs_t::EAEIS1, r_etha_regs_t::EAEIS2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_deinit()

ra8_err_t ra8_etha_deinit ( ra8_etha_port_t port)
nodiscard

Tear down an ETHA port (drop into RESET, mask all IRQs).

Parameters
[in]portPort identifier.
Returns
ra8_err_t Error code.
Return values
k_ra8_okPort returned to RESET mode.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously brought up via ra8_etha_init.
No outstanding DMA on this port.
Postcondition
EAMC =k_ra8_etha_opc_reset.
EAEIE0 = EAEIE1 = EAEIE2 = 0.
Note
See ra8_eth_deinit for the shared MSTP gate.
See also
ra8_etha_init
Since
0.1.0

Definition at line 203 of file ra8_etha.c.

References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_reset, k_ra8_ok, ra8_etha(), ra8_log_error, s_etha_slots, and s_tag.

Referenced by main().

◆ ra8_etha_disable_irq()

ra8_err_t ra8_etha_disable_irq ( ra8_etha_port_t port,
ra8_etha_irq_class_t block,
uint32_t mask )
nodiscard

Atomically disable specific error IRQ bits in one of the three blocks.

Parameters
[in]portPort identifier.
[in]blockWhich IRQ block.
[in]maskBits to OR into the corresponding EAEIDx.
Returns
ra8_err_t Error code.
Return values
k_ra8_okIRQ bits disabled.
k_ra8_err_invalid_argport or block out of range.
Precondition
Port previously brought up via ra8_etha_init.
IRQ at the NVIC is masked or this caller can tolerate a missed event.
Postcondition
Bits in mask are cleared in EAEIEx.
Other bits in EAEIEx are unchanged.
Note
Hardware uses a separate "clear" register so this is atomic.
See also
ra8_etha_enable_irq
Since
0.1.0

Definition at line 316 of file ra8_etha.c.

References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_dispatch()

void ra8_etha_dispatch ( ra8_etha_port_t port)

Snapshot all three EAEISx, clear them, then fire the per-port handler.

Reads the three Ethernet-A error/event status registers EAEIS0/1/2 (HUM Ch 32 "ETHA error / event status registers EAEISn", p ~1408) for the given port, atomically writes back the captured bits to acknowledge them, then invokes the handler installed via ra8_etha_attach_handler() with the snapshot mask. Out-of-range ports and missing handlers are silently ignored.

Parameters
[in]portPort identifier. Out-of-range silently ignored.
Precondition
Port previously brought up via ra8_etha_init for the call to do work.
Caller has masked the ETHA IRQ at the NVIC if reentrancy is undesirable.
Postcondition
All three EAEISx are cleared (matching what was passed to the handler).
Per-port callback (if any) has been invoked exactly once.
Note
IRQ-context safe; performs no allocation, no locks.
See also
ra8_etha_attach_handler
Since
0.1.0

Definition at line 355 of file ra8_etha.c.

References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIS0, r_etha_regs_t::EAEIS1, r_etha_regs_t::EAEIS2, internal_port_ok(), ra8_etha(), and s_etha_slots.

◆ ra8_etha_enable_irq()

ra8_err_t ra8_etha_enable_irq ( ra8_etha_port_t port,
ra8_etha_irq_class_t block,
uint32_t mask )
nodiscard

Atomically enable specific error IRQ bits in one of the three blocks.

Parameters
[in]portPort identifier.
[in]blockWhich IRQ block.
[in]maskBits to OR into the corresponding EAEIEx.
Returns
ra8_err_t Error code.
Return values
k_ra8_okIRQ bits enabled.
k_ra8_err_invalid_argport or block out of range.
Precondition
Port previously brought up via ra8_etha_init.
IRQ at the NVIC is disabled while this is called if reentrancy is undesirable.
Postcondition
Bits in mask are set in EAEIEx.
Other bits in EAEIEx are unchanged.
Note
Hardware uses a separate "set" register so this is atomic.
See also
ra8_etha_disable_irq
Since
0.1.0

Definition at line 289 of file ra8_etha.c.

References r_etha_regs_t::EAEIE0, r_etha_regs_t::EAEIE1, r_etha_regs_t::EAEIE2, internal_irq_block_ok(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_irq_class_0, k_ra8_etha_irq_class_1, k_ra8_etha_irq_class_2, k_ra8_etha_irq_class_count, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_enter_stop()

ra8_err_t ra8_etha_enter_stop ( ra8_etha_port_t port)
nodiscard

Drop an ETHA port into low-power stop (DISABLE mode).

Parameters
[in]portPort identifier.
Returns
ra8_err_t Error code.
Return values
k_ra8_okPort placed in DISABLE mode.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously brought up via ra8_etha_init.
No outstanding DMA on this port.
Postcondition
EAMC =k_ra8_etha_opc_disable.
Subsequent get_status reports OPS =k_ra8_etha_ops_disable (assuming hardware ack is observed).
Note
The shared ESWM MSTP gate is NOT dropped here.
See also
ra8_etha_exit_stop
Since
0.1.0

Definition at line 390 of file ra8_etha.c.

References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_disable, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_exit_stop()

ra8_err_t ra8_etha_exit_stop ( ra8_etha_port_t port)
nodiscard

Bring an ETHA port back from low-power stop (OPERATION mode).

Parameters
[in]portPort identifier.
Returns
ra8_err_t Error code.
Return values
k_ra8_okPort returned to OPERATION mode.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously placed in stop via ra8_etha_enter_stop.
Ethernet subsystem MSTP gate is live (ra8_eth_init was called).
Postcondition
EAMC =k_ra8_etha_opc_operation.
Subsequent get_status reports OPS =k_ra8_etha_ops_operation once the hardware ack is observed.
See also
ra8_etha_enter_stop
Since
0.1.0

Definition at line 401 of file ra8_etha.c.

References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_operation, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_get_queue_level()

ra8_err_t ra8_etha_get_queue_level ( ra8_etha_port_t port,
ra8_etha_tc_t tc,
uint16_t * cur_level,
uint16_t * peak )
nodiscard

Read the current and high-water-mark queue level for one class.

Parameters
[in]portPort identifier.
[in]tcTraffic class (0..7).
[out]cur_levelCurrent pending-descriptor count (DNQ).
[out]peakPeak pending-descriptor count since last clear (DMLQ).
Returns
ra8_err_t Error code.
Return values
k_ra8_okSnapshot returned.
k_ra8_err_null_ptrcur_level or peak is nullptr.
k_ra8_err_invalid_argport or tc out of range.
Precondition
Port previously brought up via ra8_etha_init.
cur_level and peak are writable pointers.
Postcondition
*cur_level = EATDQM[tc].DNQ.
*peak = EATDQMLM[tc].DMLQ.
Note
Read-only; does not clear the high-water mark.
See also
ra8_etha_set_queue_depth
Since
0.1.0

Definition at line 534 of file ra8_etha.c.

References r_etha_regs_t::EATDQM, r_etha_regs_t::EATDQMLM, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_dnq, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_get_status()

ra8_err_t ra8_etha_get_status ( ra8_etha_port_t port,
ra8_etha_status_t * out )
nodiscard

Read a port's status snapshot (mode + 3x error IRQ status + TAS).

Parameters
[in]portPort identifier.
[out]outDestination for the status snapshot.
Returns
ra8_err_t Error code.
Return values
k_ra8_okSnapshot populated.
k_ra8_err_null_ptrout is nullptr.
k_ra8_err_invalid_argport out of range.
Precondition
Port has been brought up via ra8_etha_init.
out is a writable pointer.
Postcondition
out fields reflect the live registers at the call site.
No register state is mutated.
Note
Reads are non-destructive; status bits are cleared via ra8_etha_clear_status.
See also
ra8_etha_clear_status
Since
0.1.0

Definition at line 228 of file ra8_etha.c.

References r_etha_regs_t::EAEIS0, ra8_etha_status_t::eaeis0, r_etha_regs_t::EAEIS1, ra8_etha_status_t::eaeis1, r_etha_regs_t::EAEIS2, ra8_etha_status_t::eaeis2, r_etha_regs_t::EAMS, r_etha_regs_t::EATASCTM, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_ops, k_ra8_ok, ra8_etha_status_t::ops, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, s_tag, and ra8_etha_status_t::tas_cycle.

Referenced by tsn_log_status().

◆ ra8_etha_init()

ra8_err_t ra8_etha_init ( ra8_etha_port_t port,
const ra8_etha_config_t * cfg )
nodiscard

Initialise an ETHA port (MSTP gate + reset registers + initial mode).

Parameters
[in]portPort identifier (k_ra8_etha_port_0 or _1).
[in]cfgPer-port configuration. Must not be nullptr.
Returns
ra8_err_t Error code.
Return values
k_ra8_okPort brought up in the requested mode.
k_ra8_err_null_ptrcfg is nullptr.
k_ra8_err_invalid_argport out of range.
Precondition
Caller is single-threaded with respect to this port.
Ethernet subsystem MSTP gate may already be enabled by ra8_eth.
Postcondition
EAMC is loaded with cfg->initial_mode.
EAEIE0/1/2 are loaded with cfg->eaeie0/1/2_mask.
Note
Per-port; safe to call concurrently for distinct ports.
See also
ra8_etha_deinit
Since
0.1.0

Definition at line 167 of file ra8_etha.c.

References r_etha_regs_t::EAEID0, r_etha_regs_t::EAEID1, r_etha_regs_t::EAEID2, r_etha_regs_t::EAEIE0, ra8_etha_config_t::eaeie0_mask, r_etha_regs_t::EAEIE1, ra8_etha_config_t::eaeie1_mask, r_etha_regs_t::EAEIE2, ra8_etha_config_t::eaeie2_mask, r_etha_regs_t::EAMC, ra8_etha_config_t::initial_mode, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_local_all_bits_set, k_ra8_etha_mask_opc, k_ra8_mstp_eswm, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, ra8_log_info, ra8_mstp_enable(), RA8_RETURN_ON_ERROR, s_etha_slots, and s_tag.

Referenced by internal_eth_loopback_run_once(), priv_ra8_board_eth_etha_to_config(), and tsn_arm().

◆ ra8_etha_reset()

ra8_err_t ra8_etha_reset ( ra8_etha_port_t port)
nodiscard

Software-reset the port: drop to RESET, then re-enter CONFIG.

Parameters
[in]portPort identifier.
Returns
ra8_err_t Error code.
Return values
k_ra8_okReset sequence issued.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously brought up via ra8_etha_init.
Caller is prepared to re-program per-class state after the reset.
Postcondition
EAMC traversed RESET -> CONFIG.
All transient queue / counter state is cleared by hardware.
Note
Used by error-recovery callers; does not touch the MSTP gate.
See also
ra8_etha_set_mode
Since
0.1.0

Definition at line 412 of file ra8_etha.c.

References r_etha_regs_t::EAMC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_opc_config, k_ra8_etha_opc_reset, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_set_ipv_remap()

ra8_err_t ra8_etha_set_ipv_remap ( ra8_etha_port_t port,
const uint8_t * map )
nodiscard

Programme the IPV (PCP-to-internal-priority) remap table.

Parameters
[in]portPort identifier.
[in]map8-entry array, each value 0..7. ipv_map[i] is the internal priority for incoming PCP=i.
Returns
ra8_err_t Error code.
Return values
k_ra8_okEAIRC packed and written.
k_ra8_err_null_ptrmap is nullptr.
k_ra8_err_invalid_argport out of range or any map[i] > 7.
Precondition
Port is in CONFIG mode.
map points to 8 valid entries.
Postcondition
EAIRC packs eight 3-bit fields, IPVR0..IPVR7, from map[].
Out-of-range values are rejected without partial writes.
Note
Used to map 802.1p PCP -> RA8D2 internal traffic class.
See also
ra8_etha_set_queue_arb
Since
0.1.0

Definition at line 583 of file ra8_etha.c.

References r_etha_regs_t::EAIRC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_ipv, k_ra8_etha_tc_count, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_set_max_frame_size()

ra8_err_t ra8_etha_set_max_frame_size ( ra8_etha_port_t port,
ra8_etha_tc_t tc,
uint16_t max_bytes )
nodiscard

Set the maximum frame size for one traffic class (jumbo OK).

Parameters
[in]portPort identifier.
[in]tcTraffic class (0..7).
[in]max_bytesFrame size limit in bytes (16-bit, 64..16383 typical).
Returns
ra8_err_t Error code.
Return values
k_ra8_okEATMFSC[tc] updated.
k_ra8_err_invalid_argport or tc out of range.
Precondition
Port is in CONFIG mode.
max_bytes >= 64 to satisfy IEEE 802.3 minimum.
Postcondition
EATMFSC[tc].MFS = max_bytes.
Frames larger than max_bytes are counted in EAFSECN.
Note
Jumbo frames (>1500) supported up to a 16-bit limit.
See also
ra8_etha_read_stats
Since
0.1.0

Definition at line 572 of file ra8_etha.c.

References r_etha_regs_t::EATMFSC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_mfs, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_set_mode()

ra8_err_t ra8_etha_set_mode ( ra8_etha_port_t port,
ra8_etha_opc_t mode )
nodiscard

Issue an explicit EAMC mode-change command.

Parameters
[in]portPort identifier.
[in]modeTarget mode (one of::ra8_etha_opc_t).
Returns
ra8_err_t Error code.
Return values
k_ra8_okCommand written.
k_ra8_err_invalid_argport out of range.
Precondition
Port previously brought up via ra8_etha_init.
mode is a legal transition from the current state per HUM Ch 32.2.
Postcondition
EAMC = mode.
Caller must poll get_status until OPS == ops-of-mode for ack.
Note
State machine: RESET -> CONFIG -> OPERATION; OPERATION -> DISABLE.
State Machine
See also
ra8_etha_get_status
Since
0.1.0

Definition at line 494 of file ra8_etha.c.

References r_etha_regs_t::EAMC, internal_etha_wait_for_mode(), internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_opc, ra8_etha(), ra8_log_error, and s_tag.

Referenced by internal_bring_up_rmac(), internal_eth_etha_to_operation(), internal_eth_loopback_run_once(), internal_program_mpic(), and priv_ra8_board_eth_etha_to_config().

◆ ra8_etha_set_preemption()

ra8_err_t ra8_etha_set_preemption ( ra8_etha_port_t port,
uint8_t preempt,
uint8_t cut_thru,
ra8_etha_afs_t afs )
nodiscard

Configure 802.3br TX preemption: which classes are pre-emptable.

Parameters
[in]portPort identifier.
[in]preemptBit-mask of pre-emptable classes (bit q -> class q).
[in]cut_thruNon-zero -> set TTQ8 (cut-through path is pre-emptable).
[in]afsAdditional fragment size policy (ra8_etha_afs_t).
Returns
ra8_err_t Error code.
Return values
k_ra8_okEATPEC updated.
k_ra8_err_invalid_argport out of range.
Precondition
Port is in CONFIG mode.
afs is a valid::ra8_etha_afs_t.
Postcondition
EATPEC.TTQ7..TTQ0 = preempt&0xFF; TTQ8 = cut_thru!=0; AFS = afs.
802.3br express/preemptable selector is live for next frame.
Note
802.3br requires both ends to support preamble preemption.
See also
ra8_etha_set_max_frame_size
Since
0.1.0

Definition at line 555 of file ra8_etha.c.

References r_etha_regs_t::EATPEC, internal_port_ok(), k_ra8_err_invalid_arg, k_ra8_etha_eatpec_afs_pos, k_ra8_etha_local_byte_mask, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_set_queue_arb()

ra8_err_t ra8_etha_set_queue_arb ( ra8_etha_port_t port,
ra8_etha_tc_t tc,
uint8_t arb )
nodiscard

Configure the per-traffic-class TX queue arbitration weight.

Parameters
[in]portPort identifier.
[in]tcTraffic class (0..7).
[in]arbArbitration weight (4-bit field, 0=lowest, 15=highest).
Returns
ra8_err_t Error code.
Return values
k_ra8_okField updated.
k_ra8_err_invalid_argport, tc, or arb out of range.
Precondition
Port is in CONFIG mode (ra8_etha_set_mode k_ra8_etha_opc_config).
arb fits in 4 bits.
Postcondition
EATDQAC.TDQAtc = arb.
Other class weights are unchanged.
Note
Only takes effect after a transition back to OPERATION.
See also
ra8_etha_set_queue_depth
Since
0.1.0

Definition at line 506 of file ra8_etha.c.

References r_etha_regs_t::EATDQAC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_tdqa, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.

◆ ra8_etha_set_queue_depth()

ra8_err_t ra8_etha_set_queue_depth ( ra8_etha_port_t port,
ra8_etha_tc_t tc,
uint16_t depth )
nodiscard

Set the TX descriptor queue depth for one traffic class.

Parameters
[in]portPort identifier.
[in]tcTraffic class (0..7).
[in]depthQueue depth in descriptors (11-bit field, 1..2047).
Returns
ra8_err_t Error code.
Return values
k_ra8_okEATDQDC[tc] updated.
k_ra8_err_invalid_argport, tc, or depth out of range.
Precondition
Port is in CONFIG mode.
depth <= 2047.
Postcondition
EATDQDC[tc].DQD = depth.
Other classes unchanged.
Note
Backs the per-traffic-class descriptor ring.
See also
ra8_etha_get_queue_level
Since
0.1.0

Definition at line 523 of file ra8_etha.c.

References r_etha_regs_t::EATDQDC, internal_port_ok(), internal_tc_ok(), k_ra8_err_invalid_arg, k_ra8_etha_mask_dqd, k_ra8_ok, ra8_etha(), ra8_log_error, and s_tag.