From c044e5243b925bcf435aabab129a36e52e6cba1f Mon Sep 17 00:00:00 2001 From: Folkert Kevelam Date: Fri, 27 Jun 2025 21:04:49 +0200 Subject: [PATCH] Standardize register access --- runtime/adainclude/interfaces-rp2040-pio.ads | 41 ++++++++------------ runtime/adainclude/interfaces.ads | 5 ++- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/runtime/adainclude/interfaces-rp2040-pio.ads b/runtime/adainclude/interfaces-rp2040-pio.ads index 853ec78..999cad3 100644 --- a/runtime/adainclude/interfaces-rp2040-pio.ads +++ b/runtime/adainclude/interfaces-rp2040-pio.ads @@ -1,22 +1,14 @@ package Interfaces.RP2040.PIO is - type Bit is range 0 .. 1; - for Bit'Size use 1; - - type Bit_32 is mod 2**32; - for Bit_32'Size use 32; - - type Bit_Array is array (Natural range <>) of Bit - with Pack; - type CTRL_Type is record - SM_Enable : Bit_Array (0 .. 3); - SM_Restart : Bit_Array (0 .. 3); - CLKDIV_Restart : Bit_Array (0 .. 3); - Reserved : Bit_Array (0 .. 19); + SM_Enable : Bit_4; + SM_Restart : Bit_4; + CLKDIV_Restart : Bit_4; + Reserved : Bit_20; end record - with Object_Size => 32, Bit_Order => System.Low_Order_First; + with Object_Size => 32, Bit_Order => System.Low_Order_First, + Volatile, Full_Access_Only; for CTRL_Type use record @@ -28,16 +20,17 @@ package Interfaces.RP2040.PIO is type FSTAT_Type is record - RXFULL : Bit_Array (0 .. 3); - Reserved_4_7 : Bit_Array (4 .. 7); - RXEMPTY : Bit_Array (8 .. 11); - Reserved_12_15 : Bit_Array (12 .. 15); - TXFULL : Bit_Array (16 .. 19); - Reserved_20_23 : Bit_Array (20 .. 23); - TXEMPTY : Bit_Array (24 .. 27); - Reserved_28_31 : Bit_Array (28 .. 31); + RXFULL : Bit_4; + Reserved_4_7 : Bit_4; + RXEMPTY : Bit_4; + Reserved_12_15 : Bit_4; + TXFULL : Bit_4; + Reserved_20_23 : Bit_4; + TXEMPTY : Bit_4; + Reserved_28_31 : Bit_4; end record - with Object_Size => 32, Bit_Order => System.Low_Order_First; + with Object_Size => 32, Bit_Order => System.Low_Order_First, + Volatile, Full_Access_Only; for FSTAT_Type use record @@ -66,7 +59,7 @@ package Interfaces.RP2040.PIO is PIO_1 : PIO_Type with Address => PIO_1_Base, Volatile; - Direct_PIO_1 : PIO_Type + Direct_PIO_1 : Direct_PIO_Type with Address => PIO_1_Base, Volatile; end Interfaces.RP2040.PIO; diff --git a/runtime/adainclude/interfaces.ads b/runtime/adainclude/interfaces.ads index dc63d8d..68d23c0 100644 --- a/runtime/adainclude/interfaces.ads +++ b/runtime/adainclude/interfaces.ads @@ -10,7 +10,10 @@ package Interfaces type Bit_4 is mod 2**4 with Size => 4; - type Bit_31 is mod 2**32 + type Bit_20 is mod 2**20 + with Size => 20; + + type Bit_31 is mod 2**31 with Size => 31; type Bit_32 is mod 2**32 with Size => 32;