Compare commits
4 Commits
c4ebe23f73
...
35003ed187
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35003ed187 | ||
|
|
a2ed5a7526 | ||
|
|
c044e5243b | ||
|
|
5e42b68f47 |
|
|
@ -1,22 +1,16 @@
|
||||||
|
with System.Storage_Elements; use System.Storage_Elements;
|
||||||
|
|
||||||
package Interfaces.RP2040.PIO is
|
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
|
type CTRL_Type is
|
||||||
record
|
record
|
||||||
SM_Enable : Bit_Array (0 .. 3);
|
SM_Enable : Bit_4;
|
||||||
SM_Restart : Bit_Array (0 .. 3);
|
SM_Restart : Bit_4;
|
||||||
CLKDIV_Restart : Bit_Array (0 .. 3);
|
CLKDIV_Restart : Bit_4;
|
||||||
Reserved : Bit_Array (0 .. 19);
|
Reserved : Bit_20;
|
||||||
end record
|
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
|
for CTRL_Type use
|
||||||
record
|
record
|
||||||
|
|
@ -28,16 +22,17 @@ package Interfaces.RP2040.PIO is
|
||||||
|
|
||||||
type FSTAT_Type is
|
type FSTAT_Type is
|
||||||
record
|
record
|
||||||
RXFULL : Bit_Array (0 .. 3);
|
RXFULL : Bit_4;
|
||||||
Reserved_4_7 : Bit_Array (4 .. 7);
|
Reserved_4_7 : Bit_4;
|
||||||
RXEMPTY : Bit_Array (8 .. 11);
|
RXEMPTY : Bit_4;
|
||||||
Reserved_12_15 : Bit_Array (12 .. 15);
|
Reserved_12_15 : Bit_4;
|
||||||
TXFULL : Bit_Array (16 .. 19);
|
TXFULL : Bit_4;
|
||||||
Reserved_20_23 : Bit_Array (20 .. 23);
|
Reserved_20_23 : Bit_4;
|
||||||
TXEMPTY : Bit_Array (24 .. 27);
|
TXEMPTY : Bit_4;
|
||||||
Reserved_28_31 : Bit_Array (28 .. 31);
|
Reserved_28_31 : Bit_4;
|
||||||
end record
|
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
|
for FSTAT_Type use
|
||||||
record
|
record
|
||||||
|
|
@ -63,10 +58,40 @@ package Interfaces.RP2040.PIO is
|
||||||
FSTAT : Bit_32;
|
FSTAT : Bit_32;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
PIO_1 : PIO_Type
|
PIO_0 : PIO_Type
|
||||||
with Address => PIO_1_Base, Volatile;
|
with Volatile, Address => PIO_0_Base;
|
||||||
|
PIO_0_XOR : PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#1000#);
|
||||||
|
PIO_0_Set : PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#2000#);
|
||||||
|
PIO_0_Clear : PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#3000#);
|
||||||
|
|
||||||
Direct_PIO_1 : PIO_Type
|
Direct_PIO_0 : Direct_PIO_Type
|
||||||
with Address => PIO_1_Base, Volatile;
|
with Volatile, Address => PIO_0_Base;
|
||||||
|
Direct_PIO_0_XOR : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#1000#);
|
||||||
|
Direct_PIO_0_Set : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#2000#);
|
||||||
|
Direct_PIO_0_Clear : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_0_Base + Storage_Offset (16#3000#);
|
||||||
|
|
||||||
|
PIO_1 : PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base;
|
||||||
|
PIO_1_XOR : PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#1000#);
|
||||||
|
PIO_1_Set : PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#2000#);
|
||||||
|
PIO_1_Clear : PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#3000#);
|
||||||
|
|
||||||
|
Direct_PIO_1 : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base;
|
||||||
|
Direct_PIO_1_XOR : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#1000#);
|
||||||
|
Direct_PIO_1_Set : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#2000#);
|
||||||
|
Direct_PIO_1_Clear : Direct_PIO_Type
|
||||||
|
with Volatile, Address => PIO_1_Base + Storage_Offset (16#3000#);
|
||||||
|
|
||||||
end Interfaces.RP2040.PIO;
|
end Interfaces.RP2040.PIO;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,32 @@
|
||||||
package Interfaces
|
package Interfaces
|
||||||
with Pure is
|
with Pure is
|
||||||
|
|
||||||
type Integer_32 is range -2**31 .. 2**31 - 1;
|
type Bit_1 is mod 2**1
|
||||||
type Unsigned_32 is mod 2**32;
|
with Size => 1;
|
||||||
|
type Bit_2 is mod 2**2
|
||||||
|
with Size => 2;
|
||||||
|
type Bit_3 is mod 2**3
|
||||||
|
with Size => 3;
|
||||||
|
type Bit_4 is mod 2**4
|
||||||
|
with Size => 4;
|
||||||
|
|
||||||
function Shift_Left (Value : Unsigned_32; Amount : Natural)
|
type Bit_20 is mod 2**20
|
||||||
return Unsigned_32 with Import, Convention => Intrinsic;
|
with Size => 20;
|
||||||
function Shift_Right (Value : Unsigned_32; Amount : Natural)
|
|
||||||
return Unsigned_32 with Import, Convention => Intrinsic;
|
type Bit_31 is mod 2**31
|
||||||
function Shift_Right_Arithmetic (Value : Unsigned_32; Amount : Natural)
|
with Size => 31;
|
||||||
return Unsigned_32 with Import, Convention => Intrinsic;
|
type Bit_32 is mod 2**32
|
||||||
function Rotate_Left (Value : Unsigned_32; Amount : Natural)
|
with Size => 32;
|
||||||
return Unsigned_32 with Import, Convention => Intrinsic;
|
|
||||||
function Rotate_Right (Value : Unsigned_32; Amount : Natural)
|
function Shift_Left (Value : Bit_32; Amount : Natural)
|
||||||
return Unsigned_32 with Import, Convention => Intrinsic;
|
return Bit_32 with Import, Convention => Intrinsic;
|
||||||
|
function Shift_Right (Value : Bit_32; Amount : Natural)
|
||||||
|
return Bit_32 with Import, Convention => Intrinsic;
|
||||||
|
function Shift_Right_Arithmetic (Value : Bit_32; Amount : Natural)
|
||||||
|
return Bit_32 with Import, Convention => Intrinsic;
|
||||||
|
function Rotate_Left (Value : Bit_32; Amount : Natural)
|
||||||
|
return Bit_32 with Import, Convention => Intrinsic;
|
||||||
|
function Rotate_Right (Value : Bit_32; Amount : Natural)
|
||||||
|
return Bit_32 with Import, Convention => Intrinsic;
|
||||||
|
|
||||||
end Interfaces;
|
end Interfaces;
|
||||||
|
|
|
||||||
29
runtime/adainclude/system-storage_elements.ads
Normal file
29
runtime/adainclude/system-storage_elements.ads
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
package System.Storage_Elements
|
||||||
|
with Pure is
|
||||||
|
|
||||||
|
type Storage_Offset is range -2**31 .. 2**31 - 1;
|
||||||
|
subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
|
||||||
|
|
||||||
|
type Storage_Element is mod 2**8;
|
||||||
|
for Storage_Element'Size use Storage_Unit;
|
||||||
|
|
||||||
|
type Storage_Array is array
|
||||||
|
(Storage_Offset range <>) of aliased Storage_Element;
|
||||||
|
for Storage_Array'Component_Size use Storage_Unit;
|
||||||
|
|
||||||
|
function "+" (Left : Address; Right : Storage_Offset) return Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
function "+" (Left : Storage_Offset; Right : Address) return Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
function "-" (Left : Address; Right : Storage_Offset) return Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
function "-" (Left : Storage_Offset; Right : Address) return Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
|
||||||
|
type Integer_Address is mod 2**32;
|
||||||
|
function To_Address (Value : Integer_Address) return Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
function To_Integer (Value : Address) return Integer_Address
|
||||||
|
with Import, Convention => Intrinsic;
|
||||||
|
|
||||||
|
end System.Storage_Elements;
|
||||||
Loading…
Reference in New Issue
Block a user