Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

IO memory interface #94

Open
jklmnn opened this issue Sep 19, 2019 · 1 comment
Open

IO memory interface #94

jklmnn opened this issue Sep 19, 2019 · 1 comment

Comments

@jklmnn
Copy link
Member

jklmnn commented Sep 19, 2019

To implement device drivers a generic interface to access IO memory is required. A requirement is to be able to map memory at runtime and access registers with custom data types.

@jklmnn
Copy link
Member Author

jklmnn commented Sep 20, 2019

package Gneiss.IO_Memory with
   SPARK_Mode
is

   package SSE renames System.Storage_Elements;

   type Client_Session is limited private;

   function Initialized (C : Client_Session) return Boolean;

   function Size (C : Client_Session) return SSE.Storage_Count;

   function Base_Address (C : Client_Session) return SSE.Integer_Address;

end Gneiss.IO_Memory;

package Gneiss.IO_Memory.Client with
   SPARK_Mode
is

   procedure Initialize (C : in out Client_Session;
                         B :        SSE.Integer_Address;
                         S :        SSE.Storage_Count);

   procedure Finalize (C : in out Client_Session);

   generic
      type T is private;
      Offset : SSE.Storage_Count;
   package Register is

      procedure Write (C     : in out Client_Session;
                       Value :        T);

      procedure Read (C     : in out Client_Session;
                      Value :    out T);

   end Register;

   generic
      type T is private;
      type Index is range <>;
      Offset : SSE.Storage_Count
   package Register_Array is

      procedure Write (C       : in out Client_Session;
                       Value   :        T;
                       Element :        Index);

      procedure Read (C       : in out Client_Session;
                      Value   :    out T;
                      Element :        Index);

   end Register_Array;

end Gneiss.IO_Memory.Client;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant