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

Typed Port / Pin Constants for the RA8D2 IOPORT Module. More...

#include <stdint.h>
Include dependency graph for ra8_port_constants.h:

Go to the source code of this file.

Macros

#define RA8_PIN(port, pin)
 Build a ra8_port_pin_t from explicit port / pin indices.
#define RA8_PIN_PORT(p)
 Extract the port index from a packed ra8_port_pin_t.
#define RA8_PIN_PIN(p)
 Extract the pin index from a packed ra8_port_pin_t.

Enumerations

enum  ra8_port_t : uint8_t {
  k_ra8_port_0 = 0U ,
  k_ra8_port_1 = 1U ,
  k_ra8_port_2 = 2U ,
  k_ra8_port_3 = 3U ,
  k_ra8_port_4 = 4U ,
  k_ra8_port_5 = 5U ,
  k_ra8_port_6 = 6U ,
  k_ra8_port_7 = 7U ,
  k_ra8_port_8 = 8U ,
  k_ra8_port_9 = 9U ,
  k_ra8_port_10 = 10U ,
  k_ra8_port_11 = 11U ,
  k_ra8_port_12 = 12U ,
  k_ra8_port_13 = 13U ,
  k_ra8_port_14 = 14U ,
  k_ra8_port_count = 15U ,
  k_ra8_port_max = 14U
}
 Port indices for the RA8D2 IOPORT module. More...
enum  ra8_pin_t : uint8_t {
  k_ra8_pin_0 = 0U ,
  k_ra8_pin_1 = 1U ,
  k_ra8_pin_2 = 2U ,
  k_ra8_pin_3 = 3U ,
  k_ra8_pin_4 = 4U ,
  k_ra8_pin_5 = 5U ,
  k_ra8_pin_6 = 6U ,
  k_ra8_pin_7 = 7U ,
  k_ra8_pin_8 = 8U ,
  k_ra8_pin_9 = 9U ,
  k_ra8_pin_10 = 10U ,
  k_ra8_pin_11 = 11U ,
  k_ra8_pin_12 = 12U ,
  k_ra8_pin_13 = 13U ,
  k_ra8_pin_14 = 14U ,
  k_ra8_pin_15 = 15U ,
  k_ra8_pin_count = 16U ,
  k_ra8_pin_max = 15U
}
 Pin indices within an IOPORT port (0..15). More...
enum  ra8_port_pin_t : uint16_t {
  k_ra8_pin_none = 0xFFFFU ,
  k_ra8_pin_led1 = 0x0600U ,
  k_ra8_pin_led2 = 0x0303U ,
  k_ra8_pin_led3 = 0x0A07U ,
  k_ra8_pin_lcd_reset_l = 0x0606U ,
  k_ra8_pin_lcd_blen = 0x050EU
}
 Packed (port << 8) | pin pin identifier. More...
enum  ra8_pin_dir_t : uint8_t {
  k_ra8_dir_input = 0U ,
  k_ra8_dir_output = 1U
}
 Pin input / output direction. More...
enum  ra8_level_t : uint8_t {
  k_ra8_level_low = 0U ,
  k_ra8_level_high = 1U
}
 Digital output / input level. More...
enum  ra8_pin_pull_t : uint8_t {
  k_ra8_pull_none = 0U ,
  k_ra8_pull_up = 1U ,
  k_ra8_pull_down = 2U
}
 Pull-up/pull-down selection (where supported). More...
enum  ra8_pin_drive_t : uint8_t {
  k_ra8_drive_low = 0U ,
  k_ra8_drive_medium = 1U ,
  k_ra8_drive_high = 2U ,
  k_ra8_drive_highest = 3U
}
 Output drive strength (per Hardware User's Manual IOPORT chapter). More...

Detailed Description

Typed Port / Pin Constants for the RA8D2 IOPORT Module.

Provides ra8_port_t, ra8_pin_t, and a packed ra8_port_pin_t type that every GPIO, pin-function-select (PFS) and peripheral-routing API consumes.

Encoding

A single ra8_port_pin_t encodes both port and pin in 16 bits:

bits 15..8 : port index (0..14)
bits 7..0 : pin index (0..15)
ra8_board_eth_pin_t pin
Pin.

This matches the FSP BSP_IO_PORT_XX_PIN_YY layout exactly, so code can be read against the Hardware User's Manual without mental arithmetic.

Pin availability (EK-RA8D2, 289-BGA package)

Not every port has 16 pins bonded out on the 289-pin BGA. The pin-validator will reject claims against unpopulated pins at runtime. See the Hardware User's Manual chapter 20 ("I/O Ports") for the full availability table.

Reference pins (from EK-RA8D2 board BSP)

LED ra8_port_pin_t Raw value
LED1 k_ra8_pin_p6_00 0x0600
LED2 k_ra8_pin_p3_03 0x0303
LED3 k_ra8_pin_p10_07 0x0A07

Definition in file ra8_port_constants.h.

Macro Definition Documentation

◆ RA8_PIN

#define RA8_PIN ( port,
pin )
Value:
((ra8_port_pin_t)(((uint16_t)(port) << 8) | (uint16_t)(pin)))
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.

Build a ra8_port_pin_t from explicit port / pin indices.

Parameters
[in]portra8_port_t value (0..k_ra8_port_max).
[in]pinra8_pin_t value (0..k_ra8_pin_max).
Returns
Packed ra8_port_pin_t.

Definition at line 166 of file ra8_port_constants.h.

Referenced by cam_claim_probe_pins(), cam_release_probe_pins(), internal_usbhs_role_select_device(), and priv_ra8_esp_hosted_gpio_decode_pin().

◆ RA8_PIN_PIN

#define RA8_PIN_PIN ( p)
Value:
((ra8_pin_t)((uint16_t)(p) & 0xFFU))
ra8_pin_t
Pin indices within an IOPORT port (0..15).

Extract the pin index from a packed ra8_port_pin_t.

Parameters
[in]pPacked pin id.
Returns
ra8_pin_t value.

Definition at line 180 of file ra8_port_constants.h.

Referenced by blink_m33_hal_step(), c6_hosted_print_pin(), internal_claim(), internal_flat_index(), internal_glcdc_force_pin_output(), internal_pin_in_range(), ra8_gpio_read(), ra8_gpio_toggle(), ra8_gpio_write(), ra8_pfs_route_peripheral(), and ra8_pfs_set_drive_strength().

◆ RA8_PIN_PORT

#define RA8_PIN_PORT ( p)
Value:
((ra8_port_t)(((uint16_t)(p) >> 8) & 0xFFU))
ra8_port_t
Port indices for the RA8D2 IOPORT module.

Extract the port index from a packed ra8_port_pin_t.

Parameters
[in]pPacked pin id.
Returns
ra8_port_t value.

Definition at line 173 of file ra8_port_constants.h.

Referenced by blink_m33_hal_step(), c6_hosted_print_pin(), internal_claim(), internal_flat_index(), internal_glcdc_force_pin_output(), internal_pin_in_range(), internal_ra8_epaper_wait_ready(), ra8_gpio_read(), ra8_gpio_toggle(), ra8_gpio_write(), ra8_pfs_route_peripheral(), and ra8_pfs_set_drive_strength().

Enumeration Type Documentation

◆ ra8_level_t

enum ra8_level_t : uint8_t

Digital output / input level.

Enumerator
k_ra8_level_low 

Drive or read 0.

k_ra8_level_high 

Drive or read 1.

Definition at line 194 of file ra8_port_constants.h.

◆ ra8_pin_dir_t

enum ra8_pin_dir_t : uint8_t

Pin input / output direction.

Enumerator
k_ra8_dir_input 

Pin is an input (PDR bit = 0).

k_ra8_dir_output 

Pin is an output (PDR bit = 1).

Definition at line 188 of file ra8_port_constants.h.

◆ ra8_pin_drive_t

enum ra8_pin_drive_t : uint8_t

Output drive strength (per Hardware User's Manual IOPORT chapter).

Enumerator
k_ra8_drive_low 

Low drive.

k_ra8_drive_medium 

Medium drive.

k_ra8_drive_high 

High drive.

k_ra8_drive_highest 

Highest drive.

Definition at line 207 of file ra8_port_constants.h.

◆ ra8_pin_pull_t

enum ra8_pin_pull_t : uint8_t

Pull-up/pull-down selection (where supported).

Enumerator
k_ra8_pull_none 

No internal pull.

k_ra8_pull_up 

Internal pull-up.

k_ra8_pull_down 

Internal pull-down.

Definition at line 200 of file ra8_port_constants.h.

◆ ra8_pin_t

enum ra8_pin_t : uint8_t

Pin indices within an IOPORT port (0..15).

Enumerator
k_ra8_pin_0 

RA8 pin 0.

k_ra8_pin_1 

RA8 pin 1.

k_ra8_pin_2 

RA8 pin 2.

k_ra8_pin_3 

RA8 pin 3.

k_ra8_pin_4 

RA8 pin 4.

k_ra8_pin_5 

RA8 pin 5.

k_ra8_pin_6 

RA8 pin 6.

k_ra8_pin_7 

RA8 pin 7.

k_ra8_pin_8 

RA8 pin 8.

k_ra8_pin_9 

RA8 pin 9.

k_ra8_pin_10 

RA8 pin 10.

k_ra8_pin_11 

RA8 pin 11.

k_ra8_pin_12 

RA8 pin 12.

k_ra8_pin_13 

RA8 pin 13.

k_ra8_pin_14 

RA8 pin 14.

k_ra8_pin_15 

RA8 pin 15.

k_ra8_pin_count 

Number of pins per port.

k_ra8_pin_max 

Highest valid pin index.

Definition at line 93 of file ra8_port_constants.h.

◆ ra8_port_pin_t

enum ra8_port_pin_t : uint16_t

Packed (port << 8) | pin pin identifier.

Used by every GPIO, PFS and peripheral-routing API. The encoding matches the FSP BSP_IO_PORT_XX_PIN_YY convention so pinout tables from the Hardware User's Manual can be transcribed verbatim.

Construction:
The helper macro RA8_PIN(port, pin) builds a value at compile time:
@ k_ra8_port_3
RA8 port 3.
@ k_ra8_port_6
RA8 port 6.
@ k_ra8_port_10
RA8 port 10.
#define RA8_PIN(port, pin)
Build a ra8_port_pin_t from explicit port / pin indices.
@ k_ra8_pin_7
RA8 pin 7.
@ k_ra8_pin_0
RA8 pin 0.
@ k_ra8_pin_3
RA8 pin 3.

For the three on-board LEDs we also provide ready-made k_ra8_pin_led* enumerators below.

Decoding:
Invariant
Only values with port <= k_ra8_port_max and pin <= k_ra8_pin_max are legal. Other values will be rejected by ra8_pin_validator_claim().
Enumerator
k_ra8_pin_none 

Sentinel: no pin selected.

k_ra8_pin_led1 

LED1 on P6_00 – (port 6 << 8) | pin 0.

k_ra8_pin_led2 

LED2 on P3_03 – (port 3 << 8) | pin 3.

k_ra8_pin_led3 

LED3 on P10_07 – (port 10 << 8) | pin 7.

k_ra8_pin_lcd_reset_l 

J1-6 RST, P606 (active-low).

k_ra8_pin_lcd_blen 

J1-1 BLEN, P514 (active-high).

Definition at line 147 of file ra8_port_constants.h.

◆ ra8_port_t

enum ra8_port_t : uint8_t

Port indices for the RA8D2 IOPORT module.

The RA8D2 has ports 0..14. Each port's exact pin population depends on the package. Use k_ra8_port_count for loop bounds.

Enumerator
k_ra8_port_0 

RA8 port 0.

k_ra8_port_1 

RA8 port 1.

k_ra8_port_2 

RA8 port 2.

k_ra8_port_3 

RA8 port 3.

k_ra8_port_4 

RA8 port 4.

k_ra8_port_5 

RA8 port 5.

k_ra8_port_6 

RA8 port 6.

k_ra8_port_7 

RA8 port 7.

k_ra8_port_8 

RA8 port 8.

k_ra8_port_9 

RA8 port 9.

k_ra8_port_10 

RA8 port 10.

k_ra8_port_11 

RA8 port 11.

k_ra8_port_12 

RA8 port 12.

k_ra8_port_13 

RA8 port 13.

k_ra8_port_14 

RA8 port 14.

k_ra8_port_count 

Number of ports (0..14).

k_ra8_port_max 

Highest valid port index.

Definition at line 64 of file ra8_port_constants.h.