repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
reznikmm/matreshka | Ada | 6,550 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0024 is
pragma Preelaborate;
Group_0024 : aliased constant Core_Second_Stage
:= (16#00# .. 16#26# => -- 2400 .. 2426
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#27# .. 16#3F# => -- 2427 .. 243F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(Pattern_Syntax => True,
others => False)),
16#40# .. 16#4A# => -- 2440 .. 244A
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#4B# .. 16#5F# => -- 244B .. 245F
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(Pattern_Syntax => True,
others => False)),
16#9C# .. 16#B5# => -- 249C .. 24B5
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B6# .. 16#CF# => -- 24B6 .. 24CF
(Other_Symbol, Ambiguous,
Other, A_Letter, Upper, Ambiguous,
(Other_Alphabetic
| Other_Uppercase
| Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| Uppercase
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#D0# .. 16#E9# => -- 24D0 .. 24E9
(Other_Symbol, Ambiguous,
Other, A_Letter, Lower, Ambiguous,
(Other_Alphabetic
| Other_Lowercase
| Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| Lowercase
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#EA# => -- 24EA
(Other_Number, Neutral,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#EB# .. 16#FE# => -- 24EB .. 24FE
(Other_Number, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base => True,
others => False)),
16#FF# => -- 24FF
(Other_Number, Ambiguous,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
others =>
(Other_Number, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0024;
|
gonma95/RealTimeSystem_CarDistrations | Ada | 2,303 | ads | -- Gonzalo Martin Rodriguez
-- Ivan Fernandez Samaniego
with Priorities; use Priorities;
with devices; use devices;
with ada.strings.unbounded; use ada.strings.unbounded;
with ada.strings.unbounded.text_io; use ada.strings.unbounded.text_io;
package Driver is
task Distance is
pragma Priority (Distance_Priority);
end Distance;
task Steering is
pragma Priority (Steering_Priority);
end Steering;
task Head is
pragma Priority (Head_Priority);
end Head;
protected Symptoms is
pragma Priority (Head_Priority);
procedure Write_Head_Symptom (Value: in Boolean);
procedure Read_Head_Symptom (Value: out Boolean);
procedure Write_Distancia_Insegura (Value: in Boolean);
procedure Read_Distancia_Insegura (Value: out Boolean);
procedure Write_Distancia_Imprudente (Value: in Boolean);
procedure Read_Distancia_Imprudente (Value: out Boolean);
procedure Write_Peligro_Colision (Value: in Boolean);
procedure Read_Peligro_Colision (Value: out Boolean);
procedure Write_Steering_Symptom (Value: in Boolean);
procedure Read_Steering_Symptom (Value: out Boolean);
procedure Write_HeadPosition;
procedure Read_HeadPosition (Value: out HeadPosition_Samples_Type);
procedure Write_Steering;
procedure Read_Steering (Value: out Steering_Samples_Type);
procedure Display_Symptom (Symptom: in Unbounded_String);
procedure Show_Symptoms;
private
Head_Symptom: Boolean := False;
Steering_Symptom: Boolean := False;
Distancia_Insegura: Boolean := False;
Distancia_Imprudente: Boolean := False;
Peligro_Colision: Boolean := False;
HeadPosition: HeadPosition_Samples_Type := (+2, -2);
Steering: Steering_Samples_Type := 0;
end Symptoms;
protected Measures is
pragma Priority (Risk_Priority);
procedure Read_Distance (Value: out Distance_Samples_Type);
procedure Write_Distance;
procedure Show_Distance;
procedure Read_Speed (Value: out Speed_Samples_Type);
procedure Write_Speed;
procedure Show_Speed;
private
Distance: Distance_Samples_Type;
Speed: Speed_Samples_Type;
end Measures;
end Driver;
|
MinimSecure/unum-sdk | Ada | 947 | ads | -- Copyright 2014-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Packed_Array is array (Natural range <>) of Boolean;
pragma Pack (Packed_Array);
function Make (H, L : Natural) return Packed_Array;
procedure Do_Nothing (A : System.Address);
end Pck;
|
zhmu/ananas | Ada | 3,842 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . R E D _ B L A C K _ T R E E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- This package declares the tree type used to implement ordered containers
with Ada.Containers.Helpers;
package Ada.Containers.Red_Black_Trees is
pragma Pure;
type Color_Type is (Red, Black);
generic
type Node_Type (<>) is limited private;
type Node_Access is access Node_Type;
package Generic_Tree_Types is
type Tree_Type is tagged record
First : Node_Access := null;
Last : Node_Access := null;
Root : Node_Access := null;
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
end record;
package Implementation is new Helpers.Generic_Implementation;
end Generic_Tree_Types;
generic
type Node_Type is private;
package Generic_Bounded_Tree_Types is
type Nodes_Type is array (Count_Type range <>) of Node_Type;
-- Note that objects of type Tree_Type are logically initialized (in the
-- sense that representation invariants of type are satisfied by dint of
-- default initialization), even without the Nodes component also having
-- its own initialization expression.
type Tree_Type (Capacity : Count_Type) is tagged record
First : Count_Type := 0;
Last : Count_Type := 0;
Root : Count_Type := 0;
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
Free : Count_Type'Base := -1;
Nodes : Nodes_Type (1 .. Capacity);
end record;
package Implementation is new Helpers.Generic_Implementation;
end Generic_Bounded_Tree_Types;
end Ada.Containers.Red_Black_Trees;
|
jhumphry/PRNG_Zoo | Ada | 1,513 | adb | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
package body PRNGTests_Suite.LFib_Tests is
--------------------
-- Register_Tests --
--------------------
procedure Register_Tests (T: in out LFib_Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Sanity_Check_LFib'Access, "Basic sanity checks on Lagged Fibonacci generator.");
end Register_Tests;
----------
-- Name --
----------
function Name (T : LFib_Test) return Test_String is
pragma Unreferenced (T);
begin
return Format ("Lagged Fibonacci PRNG Tests");
end Name;
------------
-- Set_Up --
------------
procedure Set_Up (T : in out LFib_Test) is
begin
null;
end Set_Up;
end PRNGTests_Suite.LFib_Tests;
|
reznikmm/matreshka | Ada | 16,265 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Interfaces.C;
with System;
with Matreshka.Internals.Utf16;
package Matreshka.Internals.SQL_Drivers.Oracle is
-- Options supported by driver:
Database_Option : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("database");
Password_Option : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("password");
User_Option : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("user");
-- Low level Oracle Call interface binding below this line.
subtype Address is System.Address;
Null_Address : constant Address := System.Null_Address;
subtype Size_T is Interfaces.C.size_t;
subtype Sword is Interfaces.C.int;
subtype Ub4 is Interfaces.Unsigned_32;
subtype Ub2 is Interfaces.Unsigned_16;
subtype Ub1 is Interfaces.Unsigned_8;
subtype Sb1 is Interfaces.Integer_8;
subtype Sb2 is Interfaces.C.short;
subtype Ora_Text is Interfaces.C.char_array;
type Ub4_Ptr is access all Ub4;
type Sb2_Ptr is access all Sb2;
type Error_Code is new Sword;
OCI_SUCCESS : constant Error_Code := 0;
OCI_SUCCESS_WITH_INFO : constant Error_Code := 1;
OCI_NEED_DATA : constant Error_Code := 99;
OCI_NO_DATA : constant Error_Code := 100;
OCI_ERROR : constant Error_Code := -1;
OCI_INVALID_HANDLE : constant Error_Code := -2;
OCI_STILL_EXECUTING : constant Error_Code := -3123;
OCI_CONTINUE : constant Error_Code := -24200;
type Handle_Type is new Ub4;
OCI_HTYPE_ENV : constant Handle_Type := 1;
OCI_HTYPE_ERROR : constant Handle_Type := 2;
OCI_HTYPE_SVCCTX : constant Handle_Type := 3;
OCI_HTYPE_STMT : constant Handle_Type := 4;
OCI_DTYPE_PARAM : constant Handle_Type := 53;
OCI_DTYPE_TIMESTAMP : constant Handle_Type := 68;
OCI_DTYPE_TIMESTAMP_TZ : constant Handle_Type := 69;
OCI_DTYPE_TIMESTAMP_LTZ : constant Handle_Type := 70;
type Data_Type is new Ub2;
SQLT_CHR : constant Data_Type := 1;
SQLT_NUM : constant Data_Type := 2;
SQLT_INT : constant Data_Type := 3;
SQLT_FLT : constant Data_Type := 4;
SQLT_STR : constant Data_Type := 5;
SQLT_VNU : constant Data_Type := 6;
SQLT_VCS : constant Data_Type := 9;
SQLT_DAT : constant Data_Type := 12;
SQLT_BFLOAT : constant Data_Type := 21;
SQLT_BDOUBLE : constant Data_Type := 22;
SQLT_AFC : constant Data_Type := 96;
SQLT_IBFLOAT : constant Data_Type := 100;
SQLT_IBDOUBLE : constant Data_Type := 101;
SQLT_ODT : constant Data_Type := 156;
SQLT_TIMESTAMP : constant Data_Type := 187;
SQLT_TIMESTAMP_TZ : constant Data_Type := 188;
SQLT_INTERVAL_YM : constant Data_Type := 189;
SQLT_INTERVAL_DS : constant Data_Type := 190;
SQLT_TIMESTAMP_LTZ : constant Data_Type := 232;
type Internal is limited private;
type Handle is access all Internal;
pragma Convention (C, Handle);
subtype Environment is Handle;
subtype Error_Handle is Handle;
subtype Parameter is Handle;
subtype Date_Time is Handle;
subtype Service_Handle is Handle;
subtype Statement_Handle is Handle;
type Bind is access all Internal;
pragma Convention (C, Bind);
type Define is access all Internal;
pragma Convention (C, Define);
OCI_ATTR_DATA_SIZE : constant Ub4 := 1;
OCI_ATTR_DATA_TYPE : constant Ub4 := 2;
OCI_ATTR_NAME : constant Ub4 := 4;
OCI_ATTR_PRECISION : constant Ub4 := 5;
OCI_ATTR_SCALE : constant Ub4 := 6;
OCI_ATTR_PARAM_COUNT : constant Ub4 := 18;
OCI_ATTR_STMT_TYPE : constant Ub4 := 24;
OCI_ATTR_CHARSET_ID : constant Ub4 := 31;
OCI_ATTR_PTYPE : constant Ub4 := 123;
OCI_ATTR_CHAR_USED : constant Ub4 := 285;
OCI_ATTR_CHAR_SIZE : constant Ub4 := 286;
type Env_Mode is new Ub4;
OCI_DEFAULT : constant := 16#000#;
OCI_THREADED : constant Env_Mode := 16#001#;
OCI_OBJECT : constant Env_Mode := 16#002#;
OCI_EVENTS : constant Env_Mode := 16#004#;
OCI_SHARED : constant Env_Mode := 16#010#;
OCI_UTF16ID : constant := 1000;
OCI_STMT_UNKNOWN : constant Ub2 := 0; -- Unknown statement
OCI_STMT_SELECT : constant Ub2 := 1; -- select statement
OCI_STMT_UPDATE : constant Ub2 := 2; -- update statement
OCI_STMT_DELETE : constant Ub2 := 3; -- delete statement
OCI_STMT_INSERT : constant Ub2 := 4; -- Insert Statement
OCI_STMT_CREATE : constant Ub2 := 5; -- create statement
OCI_STMT_DROP : constant Ub2 := 6; -- drop statement
OCI_STMT_ALTER : constant Ub2 := 7; -- alter statement
OCI_STMT_BEGIN : constant Ub2 := 8; -- begin ... (pl/sql statement)
OCI_STMT_DECLARE : constant Ub2 := 9; -- declare .. (pl/sql statement)
OCI_STMT_CALL : constant Ub2 := 10; -- corresponds to kpu call
OCI_DATA_AT_EXEC : constant Ub4 := 2; -- data at execute time
function OCIHandleAlloc
(Parent : Environment;
Target : access Handle;
Target_Type : Handle_Type;
Extra_Sz : Size_T := 0;
Extra_Ptr : Address := Null_Address) return Error_Code;
pragma Import (C, OCIHandleAlloc, "OCIHandleAlloc");
function OCIHandleFree
(Target : Handle;
Target_Type : Handle_Type) return Error_Code;
pragma Import (C, OCIHandleFree, "OCIHandleFree");
function OCIDescriptorAlloc
(Parent : Environment;
Target : access Handle;
Target_Type : Handle_Type;
Extra_Sz : Size_T := 0;
Extra_Ptr : Address := Null_Address) return Error_Code;
pragma Import (C, OCIDescriptorAlloc, "OCIDescriptorAlloc");
function OCIAttrGet
(Target : Handle;
Target_Type : Handle_Type;
Buffer : Address;
Length : Ub4_Ptr;
Attr : Ub4;
Error : Error_Handle) return Error_Code;
pragma Import (C, OCIAttrGet, "OCIAttrGet");
function OCIDescriptorFree
(Target : Handle;
Target_Type : Handle_Type) return Error_Code;
pragma Import (C, OCIDescriptorFree, "OCIDescriptorFree");
function OCIParamGet
(Target : Handle;
Target_Type : Handle_Type;
Error : Error_Handle;
Result : access Parameter;
Position : Ub4) return Error_Code;
pragma Import (C, OCIParamGet, "OCIParamGet");
function OCIEnvNlsCreate
(Target : access Environment;
Mode : Env_Mode;
Ctxp : Address := Null_Address;
Malocfp : Address := Null_Address;
Ralocfp : Address := Null_Address;
Mfreefp : Address := Null_Address;
Extra_Sz : Size_T := 0;
Extra_Ptr : Address := Null_Address;
Charset : Ub2 := OCI_UTF16ID;
N_Charset : Ub2 := OCI_UTF16ID) return Error_Code;
pragma Import (C, OCIEnvNlsCreate, "OCIEnvNlsCreate");
function OCILogon
(Env : Environment;
Error : Error_Handle;
Target : access Service_Handle;
Username : Matreshka.Internals.Utf16.Utf16_String;
Username_Len : Ub4;
Password : Matreshka.Internals.Utf16.Utf16_String;
Passwd_Len : Ub4;
Dbname : Matreshka.Internals.Utf16.Utf16_String;
Dbname_Len : Ub4) return Error_Code;
pragma Import (C, OCILogon, "OCILogon");
function OCILogoff
(Target : Service_Handle; Error : Error_Handle) return Error_Code;
pragma Import (C, OCILogoff, "OCILogoff");
function OCITransCommit
(Target : Service_Handle;
Error : Error_Handle;
Flags : Ub4 := OCI_DEFAULT) return Error_Code;
pragma Import (C, OCITransCommit, "OCITransCommit");
function OCITransRollback
(Target : Service_Handle;
Error : Error_Handle;
Flags : Ub4 := OCI_DEFAULT) return Error_Code;
pragma Import (C, OCITransRollback, "OCITransRollback");
function OCIErrorGet
(Error : Error_Handle;
Record_No : Ub4;
Sql_State : Address := Null_Address;
Ora_Code : access Ub4;
Buffer : Matreshka.Internals.Utf16.Utf16_String;
Buffer_Size : Ub4;
H_Type : Handle_Type := OCI_HTYPE_ERROR) return Error_Code;
pragma Import (C, OCIErrorGet, "OCIErrorGet");
function OCIStmtPrepare
(Stmt : Statement_Handle;
Error : Error_Handle;
Text : Matreshka.Internals.Utf16.Utf16_String;
Text_Length : Ub4;
Language : Ub4 := 1;
Mode : Ub4 := 0) return Error_Code;
pragma Import (C, OCIStmtPrepare, "OCIStmtPrepare");
function OCIStmtExecute
(Service : Service_Handle;
Stmt : Statement_Handle;
Errhp : Error_Handle;
Iters : Ub4;
Row_Off : Ub4 := 0;
Snap_In : Address := Null_Address;
Snap_Out : Address := Null_Address;
Mode : Ub4 := 0) return Error_Code;
pragma Import (C, OCIStmtExecute, "OCIStmtExecute");
function OCIStmtFetch2
(Stmt : Statement_Handle;
Error : Error_Handle;
Rows : Ub4 := 1;
Orientation : Ub2 := OCI_DEFAULT;
Offset : Ub4 := 0;
Mode : Ub4 := OCI_DEFAULT) return Error_Code;
pragma Import (C, OCIStmtFetch2, "OCIStmtFetch2");
function OCIBindByName
(Stmt : Statement_Handle;
Target : access Bind;
Error : Error_Handle;
Place : Matreshka.Internals.Utf16.Utf16_String;
Place_Length : Ub4;
Value : Address := Null_Address;
Value_Length : Ub4;
Value_Type : Data_Type;
Indicator : Sb2_Ptr := null;
Array_Length : Address := Null_Address;
Rcodep : Address := Null_Address;
Max_Array : Ub4 := 0;
Curelep : Address := Null_Address;
Mode : Ub4 := 0) return Error_Code;
pragma Import (C, OCIBindByName, "OCIBindByName");
function OCIBindByPos
(Stmt : Statement_Handle;
Target : access Bind;
Error : Error_Handle;
Position : Ub4;
Value : Address := Null_Address;
Value_Length : Ub4;
Value_Type : Data_Type;
Indicator : Sb2_Ptr := null;
Array_Length : Address := Null_Address;
Rcodep : Address := Null_Address;
Max_Array : Ub4 := 0;
Curelep : Address := Null_Address;
Mode : Ub4 := 0) return Error_Code;
pragma Import (C, OCIBindByPos, "OCIBindByPos");
function OCIDefineByPos
(Stmt : Statement_Handle;
Target : access Define;
Error : Error_Handle;
Position : Ub4;
Value : Address;
Value_Length : Ub4;
Value_Type : Data_Type;
Indicator : access Sb2;
Array_Length : Address := Null_Address;
Rcodep : Address := Null_Address;
Mode : Ub4 := 0) return Error_Code;
pragma Import (C, OCIDefineByPos, "OCIDefineByPos");
function OCINlsCharSetIdToName
(Env : Environment;
Buffer : Ora_Text;
Buffer_Len : Size_T;
Id : Ub2) return Error_Code;
pragma Import (C, OCINlsCharSetIdToName, "OCINlsCharSetIdToName");
function OCINlsNameMap
(Env : Environment;
Buffer : Ora_Text;
Buffer_Len : Size_T;
Source : Ora_Text;
Flag : Sword) return Error_Code;
pragma Import (C, OCINlsNameMap, "OCINlsNameMap");
function OCIDateTimeGetDate
(Env : Environment;
Error : Error_Handle;
Date : Date_Time;
Year : access Sb2;
Month : access Ub1;
Day : access Ub1) return Error_Code;
pragma Import (C, OCIDateTimeGetDate, "OCIDateTimeGetDate");
function OCIDateTimeGetTime
(Env : Environment;
Error : Error_Handle;
Date : Date_Time;
Hour : access Ub1;
Min : access Ub1;
Sec : access Ub1;
Fract : access Ub4) return Error_Code;
pragma Import (C, OCIDateTimeGetTime, "OCIDateTimeGetTime");
function OCIDateTimeConstruct
(Env : Environment;
Error : Error_Handle;
Date : Date_Time;
Year : Sb2;
Month : Ub1;
Day : Ub1;
Hour : Ub1;
Min : Ub1;
Sec : Ub1;
Fract : Ub4;
TZ : Address := Null_Address;
TZ_Len : Size_T := 0) return Error_Code;
pragma Import (C, OCIDateTimeConstruct, "OCIDateTimeConstruct");
OCI_ONE_PIECE : constant Ub1 := 0;
OCI_FIRST_PIECE : constant Ub1 := 1;
OCI_NEXT_PIECE : constant Ub1 := 2;
OCI_LAST_PIECE : constant Ub1 := 3;
function OCIBindDynamic
(bindp : Bind;
Error : Error_Handle;
ictxp : Address;
icbfp : Address;
octxp : Address;
ocbfp : Address) return Error_Code;
pragma Import (C, OCIBindDynamic, "OCIBindDynamic");
private
type Internal is limited null record;
end Matreshka.Internals.SQL_Drivers.Oracle;
|
jam3st/edk2 | Ada | 712 | ads | with Interfaces.C;
with HW;
use HW;
package GMA
is
procedure test_debugprint;
pragma Export (C, test_debugprint, "gma_test_debugprint");
procedure gfxinit (lightup_ok : out Interfaces.C.int);
pragma Export (C, gfxinit, "gma_gfxinit");
----------------------------------------------------------------------------
type lb_framebuffer is record
physical_address : word64;
x_resolution : word64;
y_resolution : word64;
bpp : word64;
end record;
function fill_lb_framebuffer
(framebuffer : in out lb_framebuffer)
return Interfaces.C.int;
pragma Export (C, fill_lb_framebuffer, "fill_lb_framebuffer");
end GMA;
|
reznikmm/matreshka | Ada | 3,744 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Meta_Ole_Object_Count_Attributes is
pragma Preelaborate;
type ODF_Meta_Ole_Object_Count_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Meta_Ole_Object_Count_Attribute_Access is
access all ODF_Meta_Ole_Object_Count_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Meta_Ole_Object_Count_Attributes;
|
zhmu/ananas | Ada | 1,174 | adb | -- { dg-do run }
with Ada.Text_IO, Ada.Tags;
procedure Test_Iface_Aggr is
package Pkg is
type Iface is interface;
function Constructor (S: Iface) return Iface'Class is abstract;
procedure Do_Test (It : Iface'class);
type Root is abstract tagged record
Comp_1 : Natural := 0;
end record;
type DT_1 is new Root and Iface with record
Comp_2, Comp_3 : Natural := 0;
end record;
function Constructor (S: DT_1) return Iface'Class;
type DT_2 is new DT_1 with null record; -- Test
function Constructor (S: DT_2) return Iface'Class;
end;
package body Pkg is
procedure Do_Test (It: in Iface'Class) is
Obj : Iface'Class := Constructor (It);
S : String := Ada.Tags.External_Tag (Obj'Tag);
begin
null;
end;
function Constructor (S: DT_1) return Iface'Class is
begin
return Iface'Class(DT_1'(others => <>));
end;
function Constructor (S: DT_2) return Iface'Class is
Result : DT_2;
begin
return Iface'Class(DT_2'(others => <>)); -- Test
end;
end;
use Pkg;
Obj: DT_2;
begin
Do_Test (Obj);
end;
|
davidkristola/vole | Ada | 5,091 | ads | -- public domain
with Ada.Calendar;
with Ada.Strings.Maps;
with Interfaces;
package String_Ops is
pragma Elaborate_Body;
type String_Pointer_Type is access String;
-- All the control characters plus space and non-breaking-space.
--
function Is_White_Space
(Char : in Character) return Boolean;
-- The Stuff routines place the source into the target,
-- padding with space or zeros.
--
procedure Stuff
(This : in String;
Into : out String);
procedure Stuff_Right
(This : in String;
Into : out String);
procedure Stuff_Number
(Number : in Integer;
Into : out String);
procedure Stuff_Hex
(Number : in Interfaces.Unsigned_32;
Into : out String);
-- Kills Ada comments from The_String
--
function Drop_Ada_Comments
(The_String : String) return String;
function Drop_Vole_Comments
(The_String : String) return String;
function Up_Case
(The_String : String) return String;
function Down_Case
(The_String : String) return String;
-- Discards blanks from the front and back end
-- of The_String.
--
function Trim_Blanks
(The_String : String) return String;
-- Many times the important string will be enclosed in
-- quotation marks or brackets. This trims one character
-- off of each end.
--
function Trim_One_From_Both_Ends(The_String : String) return String;
-- Discards non-printable characters from
-- The_String.
--
function Filter
(The_String : String) return String;
-- Return the first substring of Str (deliniated by white space).
-- Note: Str is assumed to not start with white space.
--
function First
(Str : in String) return String;
-- Return the second part of Str.
--
function Rest
(Str : in String) return String;
-- Return the second substring of Str (deliniated by white space).
--
function Second
(Str : in String) return String;
-- This returns the Rest of the Rest.
--
function Second_Rest
(Str : in String) return String;
-- Return the third substring of Str (deliniated by white space).
--
function Third
(Str : in String) return String;
-- Return the Nth substring of Str (deliniated by white space).
--
function Nth
(Str : in String;
N : in Positive) return String;
-- Return the Nth substring of Str (deliniated by Set).
--
function Nth
(Str : in String;
N : in Positive;
Set : in Ada.Strings.Maps.Character_Set) return String;
-- This is a caseless compare.
--
function Same(L, R : in String) return Boolean;
-- This is a specialized "=" for strings. For
-- the length of the smaller of Check and Master,
-- both strings must be the same.
--
function Conformance
(Master : in String;
Check : in String) return Boolean;
-- Returns a string in the form "16#0000_0000#"
--
function Integer_To_Hex_String
(Value : in Interfaces.Unsigned_32) return String;
-- These return images without leading blanks.
--
function Str
(Int : Integer) return String;
function Str
(Int : Interfaces.Unsigned_32) return String;
-- This "image" routine will only resort to scientific notation
-- if the number is too large or too small.
--
function Img
(Flt : Float) return String;
-- This will take a number (floating point or integer) from the
-- string and return a Float.
--
function Value
(Str : String) return Float;
function Img
(Int : Integer) return String renames Str;
function Value
(Str : String) return Integer;
function Long_Date
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function Short_Date
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function Date_As_Filename
(Date : in Ada.Calendar.Time := Ada.Calendar.Clock) return String;
function IP_Address
(Addr : Interfaces.Unsigned_32) return String;
-----------------------------------------------------------------------------
generic
type Selection_Type is (<>); -- enumeration
package Selection_Ops is
-- Return true if and only if Str passes "Conformance"
-- to the image of a member of Selection_Type.
-- Str is up cased before conformance checking.
--
function String_Matches
(Str : in String) return Boolean;
-- Return the number of "Conformance" matches.
--
function String_Matches
(Str : in String) return Natural;
-- Returns the first member of Selection_Type to
-- conform to Str, or the first member of
-- Selection_Type.
--
function To_Selection
(Str : in String) return Selection_Type;
end Selection_Ops;
end String_Ops;
|
esbullington/aflex | Ada | 1,950 | ads | -- Warning: This lexical scanner is automatically generated by AFLEX.
-- It is useless to modify it. Change the ".Y" & ".L" files instead.
--# line 1 "ascan.l"
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- TITLE scanner specification file
-- AUTHOR: John Self (UCI)
-- DESCRIPTION regular expressions and actions matching tokens
-- that aflex expects to find in its input.
-- NOTES input to aflex (NOT alex.) It uses exclusive start conditions
-- and case insensitive scanner generation available only in aflex
-- (or flex if you use C.)
-- generate scanner using the command 'aflex -is ascan.l'
-- $Header: C:/CVSROOT/afay/aflex/src/ascan.l,v 1.3 2004/10/23 22:06:12 Grands Exp $
--
-- 2004/10/16 Thierry Bernier
-- + Add "%unit" to support Ada-95 parent/child units
-- + Less -gnatwa warnings
-- To be aflex'ed using "-i" : case insensitive
--# line 53 "ascan.l"
with Parse_Tokens;
package scanner is
call_yylex : Boolean := False;
function get_token return Parse_Tokens.Token;
end scanner;
|
zhmu/ananas | Ada | 565 | adb | -- { dg-do compile { target i?86-*-linux* x86_64-*-linux* } }
-- { dg-options "-O3 -gnatp" }
package body Machine_Attr1 is
procedure Proc1 is
begin
Proc3;
Proc4;
end;
procedure Proc2 is
begin
Proc1;
end;
procedure Proc3 is
begin
A (1) := 0;
end;
procedure Proc4 is
begin
A (2) := 0;
end;
procedure Proc5 is
begin
for I in A'Range loop
A(I) := B(I) + C(I);
end loop;
end;
procedure Proc6 is
begin
for I in A'Range loop
A(I) := B(I) + C(I);
end loop;
end;
end Machine_Attr1;
|
ekoeppen/MSP430_Generic_Ada_Drivers | Ada | 2,682 | ads | with Interfaces; use Interfaces;
generic
with procedure Write (Data : Unsigned_8);
with function Read return Unsigned_8;
package CBOR_Codec is
pragma Preelaborate;
type Major_Type is (Unsigned_Integer, Negative_Integer, Byte_String,
UTF8_String, Item_Array, Item_Map, Tag, Simple_Or_Float)
with Size => 3;
for Major_Type use (
Unsigned_Integer => 0,
Negative_Integer => 1,
Byte_String => 2,
UTF8_String => 3,
Item_Array => 4,
Item_Map => 5,
Tag => 6,
Simple_Or_Float => 7);
Date_Time_String_Tag : constant Natural := 0;
Epoch_Time_Tag : constant Natural := 1;
Positive_Bignum_Tag : constant Natural := 2;
Negative_Bignum_Tag : constant Natural := 3;
Decimal_Fraction_Tag : constant Natural := 4;
Bigfloat_Tag : constant Natural := 5;
Base64_URL_Expected_Tag : constant Natural := 21;
Base64_Expected_Tag : constant Natural := 22;
Base16_Expected_Tag : constant Natural := 23;
CBOR_Data_Tag : constant Natural := 24;
URI_String_Tag : constant Natural := 32;
Base64_URL_String_Tag : constant Natural := 33;
Base64_String_Tag : constant Natural := 34;
Regexp_Tag : constant Natural := 35;
MIME_Message_Tag : constant Natural := 36;
procedure Encode_Integer (Value : Integer);
procedure Encode_Byte_String (Value : String);
procedure Encode_UTF8_String (Value : String);
procedure Encode_Array (Count : Natural);
procedure Encode_Map (Count : Natural);
procedure Encode_Tag (Value : Natural);
procedure Encode_Null;
procedure Encode_False;
procedure Encode_True;
procedure Encode_Undefined;
procedure Encode_Simple_Value (Value : Integer);
procedure Encode_Float (Value : Short_Float);
procedure Encode_Float (Value : Float);
procedure Encode_Decimal_Fraction (Value : Integer; Mantissa : Integer);
function Decode_Integer (Value : out Integer) return Boolean;
function Decode_Byte_String (Size : out Natural) return Boolean;
function Decode_UTF8_String return Boolean;
function Decode_Array (Count : out Natural) return Boolean;
function Decode_Map return Boolean;
function Decode_Tag (Value : out Integer) return Boolean;
function Decode_Null return Boolean;
function Decode_Boolean return Boolean;
function Decode_Undefined return Boolean;
function Decode_Simple_Value return Boolean;
function Decode_Float return Boolean;
function Decode_Decimal_Fraction (Value : out Integer;
Mantissa : out Integer) return Boolean;
end CBOR_Codec;
|
pchapin/acrypto | Ada | 532 | adb | ---------------------------------------------------------------------------
-- FILE : test_block_ciphers-test_aes.adb
-- SUBJECT : Procedure to test the AES implementation.
-- AUTHOR : (C) Copyright 2013 by Peter Chapin
--
-- Please send comments or bug reports to
--
-- Peter Chapin <[email protected]>
---------------------------------------------------------------------------
with ACO.Crypto.Block_Cipher.AES;
separate( Test_Block_Ciphers )
procedure Test_AES is
begin -- Test_AES
null;
end Test_AES;
|
zhmu/ananas | Ada | 12,769 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . R E A L _ T I M E . T I M I N G _ E V E N T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Task_Primitives.Operations;
with System.Tasking.Utilities;
with System.Soft_Links;
with System.Interrupt_Management.Operations;
with Ada.Containers.Doubly_Linked_Lists;
pragma Elaborate_All (Ada.Containers.Doubly_Linked_Lists);
---------------------------------
-- Ada.Real_Time.Timing_Events --
---------------------------------
package body Ada.Real_Time.Timing_Events is
use System.Task_Primitives.Operations;
package SSL renames System.Soft_Links;
type Any_Timing_Event is access all Timing_Event'Class;
-- We must also handle user-defined types derived from Timing_Event
------------
-- Events --
------------
package Events is new Ada.Containers.Doubly_Linked_Lists (Any_Timing_Event);
-- Provides the type for the container holding pointers to events
All_Events : Events.List;
-- The queue of pending events, ordered by increasing timeout value, that
-- have been "set" by the user via Set_Handler.
Event_Queue_Lock : aliased System.Task_Primitives.RTS_Lock;
-- Used for mutually exclusive access to All_Events
-- We need to Initialize_Lock before Timer is activated. The purpose of the
-- Dummy package is to get around Ada's syntax rules.
package Dummy is end Dummy;
package body Dummy is
begin
Initialize_Lock (Event_Queue_Lock'Access, Level => PO_Level);
end Dummy;
procedure Process_Queued_Events;
-- Examine the queue of pending events for any that have timed out. For
-- those that have timed out, remove them from the queue and invoke their
-- handler (unless the user has cancelled the event by setting the handler
-- pointer to null). Mutually exclusive access is held via Event_Queue_Lock
-- during part of the processing.
procedure Insert_Into_Queue (This : Any_Timing_Event);
-- Insert the specified event pointer into the queue of pending events
-- with mutually exclusive access via Event_Queue_Lock.
procedure Remove_From_Queue (This : Any_Timing_Event);
-- Remove the specified event pointer from the queue of pending events with
-- mutually exclusive access via Event_Queue_Lock. This procedure is used
-- by the client-side routines (Set_Handler, etc.).
-----------
-- Timer --
-----------
task Timer is
pragma Priority (System.Priority'Last);
end Timer;
task body Timer is
Period : constant Time_Span := Milliseconds (100);
-- This is a "chiming" clock timer that fires periodically. The period
-- selected is arbitrary and could be changed to suit the application
-- requirements. Obviously a shorter period would give better resolution
-- at the cost of more overhead.
Ignore : constant Boolean := System.Tasking.Utilities.Make_Independent;
pragma Unreferenced (Ignore);
begin
-- Since this package may be elaborated before System.Interrupt,
-- we need to call Setup_Interrupt_Mask explicitly to ensure that
-- this task has the proper signal mask.
System.Interrupt_Management.Operations.Setup_Interrupt_Mask;
loop
Process_Queued_Events;
delay until Clock + Period;
end loop;
end Timer;
---------------------------
-- Process_Queued_Events --
---------------------------
procedure Process_Queued_Events is
Next_Event : Any_Timing_Event;
begin
loop
SSL.Abort_Defer.all;
Write_Lock (Event_Queue_Lock'Access);
if All_Events.Is_Empty then
Unlock (Event_Queue_Lock'Access);
SSL.Abort_Undefer.all;
return;
else
Next_Event := All_Events.First_Element;
end if;
if Next_Event.Timeout > Clock then
-- We found one that has not yet timed out. The queue is in
-- ascending order by Timeout so there is no need to continue
-- processing (and indeed we must not continue since we always
-- delete the first element).
Unlock (Event_Queue_Lock'Access);
SSL.Abort_Undefer.all;
return;
end if;
-- We have an event that has timed out so we will process it. It must
-- be the first in the queue so no search is needed.
All_Events.Delete_First;
-- A fundamental issue is that the invocation of the event's handler
-- might call Set_Handler on itself to re-insert itself back into the
-- queue of future events. Thus we cannot hold the lock on the queue
-- while invoking the event's handler.
Unlock (Event_Queue_Lock'Access);
SSL.Abort_Undefer.all;
-- There is no race condition with the user changing the handler
-- pointer while we are processing because we are executing at the
-- highest possible application task priority and are not doing
-- anything to block prior to invoking their handler.
declare
Handler : constant Timing_Event_Handler := Next_Event.Handler;
begin
-- The first act is to clear the event, per D.15(13/2). Besides,
-- we cannot clear the handler pointer *after* invoking the
-- handler because the handler may have re-inserted the event via
-- Set_Event. Thus we take a copy and then clear the component.
Next_Event.Handler := null;
if Handler /= null then
Handler.all (Timing_Event (Next_Event.all));
end if;
-- Ignore exceptions propagated by Handler.all, as required by
-- RM D.15(21/2).
exception
when others =>
null;
end;
end loop;
end Process_Queued_Events;
-----------------------
-- Insert_Into_Queue --
-----------------------
procedure Insert_Into_Queue (This : Any_Timing_Event) is
function Sooner (Left, Right : Any_Timing_Event) return Boolean;
-- Compares events in terms of timeout values
package By_Timeout is new Events.Generic_Sorting (Sooner);
-- Used to keep the events in ascending order by timeout value
------------
-- Sooner --
------------
function Sooner (Left, Right : Any_Timing_Event) return Boolean is
begin
return Left.Timeout < Right.Timeout;
end Sooner;
-- Start of processing for Insert_Into_Queue
begin
SSL.Abort_Defer.all;
Write_Lock (Event_Queue_Lock'Access);
All_Events.Append (This);
-- A critical property of the implementation of this package is that
-- all occurrences are in ascending order by Timeout. Thus the first
-- event in the queue always has the "next" value for the Timer task
-- to use in its delay statement.
By_Timeout.Sort (All_Events);
Unlock (Event_Queue_Lock'Access);
SSL.Abort_Undefer.all;
end Insert_Into_Queue;
-----------------------
-- Remove_From_Queue --
-----------------------
procedure Remove_From_Queue (This : Any_Timing_Event) is
use Events;
Location : Cursor;
begin
SSL.Abort_Defer.all;
Write_Lock (Event_Queue_Lock'Access);
Location := All_Events.Find (This);
if Location /= No_Element then
All_Events.Delete (Location);
end if;
Unlock (Event_Queue_Lock'Access);
SSL.Abort_Undefer.all;
end Remove_From_Queue;
-----------------
-- Set_Handler --
-----------------
procedure Set_Handler
(Event : in out Timing_Event;
At_Time : Time;
Handler : Timing_Event_Handler)
is
begin
Remove_From_Queue (Event'Unchecked_Access);
Event.Handler := null;
-- RM D.15(15/2) required that at this point, we check whether the time
-- has already passed, and if so, call Handler.all directly from here
-- instead of doing the enqueuing below. However, this caused a nasty
-- race condition and potential deadlock. If the current task has
-- already locked the protected object of Handler.all, and the time has
-- passed, deadlock would occur. It has been fixed by AI05-0094-1, which
-- says that the handler should be executed as soon as possible, meaning
-- that the timing event will be executed after the protected action
-- finishes (Handler.all should not be called directly from here).
-- The same comment applies to the other Set_Handler below.
if Handler /= null then
Event.Timeout := At_Time;
Event.Handler := Handler;
Insert_Into_Queue (Event'Unchecked_Access);
end if;
end Set_Handler;
-----------------
-- Set_Handler --
-----------------
procedure Set_Handler
(Event : in out Timing_Event;
In_Time : Time_Span;
Handler : Timing_Event_Handler)
is
begin
Remove_From_Queue (Event'Unchecked_Access);
Event.Handler := null;
-- See comment in the other Set_Handler above
if Handler /= null then
Event.Timeout := Clock + In_Time;
Event.Handler := Handler;
Insert_Into_Queue (Event'Unchecked_Access);
end if;
end Set_Handler;
---------------------
-- Current_Handler --
---------------------
function Current_Handler
(Event : Timing_Event) return Timing_Event_Handler
is
begin
return Event.Handler;
end Current_Handler;
--------------------
-- Cancel_Handler --
--------------------
procedure Cancel_Handler
(Event : in out Timing_Event;
Cancelled : out Boolean)
is
begin
Remove_From_Queue (Event'Unchecked_Access);
Cancelled := Event.Handler /= null;
Event.Handler := null;
end Cancel_Handler;
-------------------
-- Time_Of_Event --
-------------------
function Time_Of_Event (Event : Timing_Event) return Time is
begin
-- RM D.15(18/2): Time_First must be returned in the event is not set
return (if Event.Handler = null then Time_First else Event.Timeout);
end Time_Of_Event;
--------------
-- Finalize --
--------------
procedure Finalize (This : in out Timing_Event) is
begin
-- D.15 (19/2) says finalization clears the event
This.Handler := null;
Remove_From_Queue (This'Unchecked_Access);
end Finalize;
end Ada.Real_Time.Timing_Events;
|
flyx/OpenGLAda | Ada | 2,215 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Buffers;
with GL.Pixels;
with GL.Types;
private with GL.Low_Level;
package GL.Framebuffer is
pragma Preelaborate;
use GL.Types;
type Logic_Op is (Clear, And_Op, And_Reverse, Copy, And_Inverted, Noop,
Xor_Op, Or_Op, Nor, Equiv, Invert, Or_Reverse,
Copy_Inverted, Or_Inverted, Nand, Set);
subtype Read_Buffer_Selector is Buffers.Color_Buffer_Selector range
Buffers.None .. Buffers.Right;
-- this package provides functionality the works implicitly on the current
-- framebuffer. for working with framebuffer objects,
-- see GL.Objects.Framebuffers.
procedure Set_Clamp_Read_Color (Enabled : Boolean);
procedure Set_Read_Buffer (Value : Read_Buffer_Selector);
function Read_Buffer return Read_Buffer_Selector;
generic
type Element_Type is private;
type Index_Type is (<>);
type Array_Type is array (Index_Type range <>) of aliased Element_Type;
procedure Read_Pixels (X, Y : Int; Width, Height : Size;
Format : Pixels.Framebuffer_Format;
Data_Type : Pixels.Data_Type; Data : out Array_Type);
procedure Set_Logic_Op_Mode (Value : Logic_Op);
function Logic_Op_Mode return Logic_Op;
private
for Logic_Op use (Clear => 16#1500#,
And_Op => 16#1501#,
And_Reverse => 16#1502#,
Copy => 16#1503#,
And_Inverted => 16#1504#,
Noop => 16#1505#,
Xor_Op => 16#1506#,
Or_Op => 16#1507#,
Nor => 16#1508#,
Equiv => 16#1509#,
Invert => 16#150A#,
Or_Reverse => 16#150B#,
Copy_Inverted => 16#150C#,
Or_Inverted => 16#150D#,
Nand => 16#150E#,
Set => 16#150F#);
for Logic_Op'Size use Low_Level.Enum'Size;
end GL.Framebuffer;
|
stcarrez/ada-asf | Ada | 1,214 | ads | -----------------------------------------------------------------------
-- util-factory -- Factory for UI Util Components
-- Copyright (C) 2009, 2010, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Functions;
with ASF.Factory;
package ASF.Components.Utils.Factory is
-- Register the Util component factory.
procedure Register (Factory : in out ASF.Factory.Component_Factory);
procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class);
end ASF.Components.Utils.Factory;
|
apple-oss-distributions/old_ncurses | Ada | 3,084 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Rain --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Laurent Pautet <[email protected]> 1997 (modified by J.Pfeifer)
-- Version Control
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-- --
procedure Rain;
|
sungyeon/drake | Ada | 540 | ads | pragma License (Unrestricted);
-- implementation unit
package Ada.Containers.Binary_Trees.Arne_Andersson.Debug is
pragma Preelaborate;
function Root (Node : not null Node_Access) return not null Node_Access;
function Dump (
Container : Node_Access;
Marker : Node_Access;
Message : String := "")
return Boolean;
function Valid (
Container : Node_Access;
Length : Count_Type;
Level_Check : Boolean := True)
return Boolean;
end Ada.Containers.Binary_Trees.Arne_Andersson.Debug;
|
python36/0xfa | Ada | 752 | ads | with ada.text_io;
with ada.containers.vectors;
with ada.unchecked_deallocation;
with strings; use strings;
package getter.file is
function get return character;
procedure open (path : string);
private
type descriptor_access_t is access ada.text_io.file_type;
type file_t is record
descriptor : descriptor_access_t;
line : pos_count;
end record;
procedure free is new ada.unchecked_deallocation
(object => ada.text_io.file_type, name => descriptor_access_t);
package files_stack_t is new ada.containers.vectors(
element_type => file_t, index_type => natural);
files_stack : files_stack_t.vector;
current_ptr : descriptor_access_t;
current_line : pos_count;
sended_last_lf : boolean := false;
end getter.file; |
persan/A-gst | Ada | 30,773 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with glib;
with glib.Values;
with System;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_codecparsers_gstmpeg4parser_h is
-- * GStreamer
-- * Copyright (C) 2009 Carl-Anton Ingmarsson <[email protected]>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
type GstMpeg4VisualObjectSequence;
--subtype GstMpeg4VisualObjectSequence is u_GstMpeg4VisualObjectSequence; -- gst/codecparsers/gstmpeg4parser.h:27
type GstMpeg4VisualObject;
--subtype GstMpeg4VisualObject is u_GstMpeg4VisualObject; -- gst/codecparsers/gstmpeg4parser.h:28
type GstMpeg4VideoObjectLayer;
type u_GstMpeg4VideoObjectLayer_intra_quant_mat_array is array (0 .. 63) of aliased GLIB.guint8;
type u_GstMpeg4VideoObjectLayer_non_intra_quant_mat_array is array (0 .. 63) of aliased GLIB.guint8;
--subtype GstMpeg4VideoObjectLayer is u_GstMpeg4VideoObjectLayer; -- gst/codecparsers/gstmpeg4parser.h:29
type GstMpeg4GroupOfVOP;
--subtype GstMpeg4GroupOfVOP is u_GstMpeg4GroupOfVOP; -- gst/codecparsers/gstmpeg4parser.h:30
type GstMpeg4VideoObjectPlane;
--subtype GstMpeg4VideoObjectPlane is u_GstMpeg4VideoObjectPlane; -- gst/codecparsers/gstmpeg4parser.h:31
type GstMpeg4VideoSignalType;
--subtype GstMpeg4VideoSignalType is u_GstMpeg4VideoSignalType; -- gst/codecparsers/gstmpeg4parser.h:32
type GstMpeg4VideoPlaneShortHdr;
--subtype GstMpeg4VideoPlaneShortHdr is u_GstMpeg4VideoPlaneShortHdr; -- gst/codecparsers/gstmpeg4parser.h:33
type GstMpeg4VideoPacketHdr;
--subtype GstMpeg4VideoPacketHdr is u_GstMpeg4VideoPacketHdr; -- gst/codecparsers/gstmpeg4parser.h:34
type GstMpeg4SpriteTrajectory;
type u_GstMpeg4SpriteTrajectory_vop_ref_points_array is array (0 .. 62) of aliased GLIB.guint16;
type u_GstMpeg4SpriteTrajectory_sprite_ref_points_array is array (0 .. 62) of aliased GLIB.guint16;
--subtype GstMpeg4SpriteTrajectory is u_GstMpeg4SpriteTrajectory; -- gst/codecparsers/gstmpeg4parser.h:36
type GstMpeg4Packet;
--subtype GstMpeg4Packet is u_GstMpeg4Packet; -- gst/codecparsers/gstmpeg4parser.h:38
--*
-- * GstMpeg4StartCode:
-- *
-- * Defines the different startcodes present in the bitstream as
-- * defined in: Table 6-3 — Start code values
--
subtype GstMpeg4StartCode is unsigned;
GST_MPEG4_VIDEO_OBJ_FIRST : constant GstMpeg4StartCode := 0;
GST_MPEG4_VIDEO_OBJ_LAST : constant GstMpeg4StartCode := 31;
GST_MPEG4_VIDEO_LAYER_FIRST : constant GstMpeg4StartCode := 32;
GST_MPEG4_VIDEO_LAYER_LAST : constant GstMpeg4StartCode := 47;
GST_MPEG4_VISUAL_OBJ_SEQ_START : constant GstMpeg4StartCode := 176;
GST_MPEG4_VISUAL_OBJ_SEQ_END : constant GstMpeg4StartCode := 177;
GST_MPEG4_USER_DATA : constant GstMpeg4StartCode := 178;
GST_MPEG4_GROUP_OF_VOP : constant GstMpeg4StartCode := 179;
GST_MPEG4_VIDEO_SESSION_ERR : constant GstMpeg4StartCode := 180;
GST_MPEG4_VISUAL_OBJ : constant GstMpeg4StartCode := 181;
GST_MPEG4_VIDEO_OBJ_PLANE : constant GstMpeg4StartCode := 182;
GST_MPEG4_FBA : constant GstMpeg4StartCode := 186;
GST_MPEG4_FBA_PLAN : constant GstMpeg4StartCode := 187;
GST_MPEG4_MESH : constant GstMpeg4StartCode := 188;
GST_MPEG4_MESH_PLAN : constant GstMpeg4StartCode := 189;
GST_MPEG4_STILL_TEXTURE_OBJ : constant GstMpeg4StartCode := 190;
GST_MPEG4_TEXTURE_SPATIAL : constant GstMpeg4StartCode := 191;
GST_MPEG4_TEXTURE_SNR_LAYER : constant GstMpeg4StartCode := 192;
GST_MPEG4_TEXTURE_TILE : constant GstMpeg4StartCode := 193;
GST_MPEG4_SHAPE_LAYER : constant GstMpeg4StartCode := 194;
GST_MPEG4_STUFFING : constant GstMpeg4StartCode := 195;
GST_MPEG4_SYSTEM_FIRST : constant GstMpeg4StartCode := 198;
GST_MPEG4_SYSTEM_LAST : constant GstMpeg4StartCode := 255;
GST_MPEG4_RESYNC : constant GstMpeg4StartCode := 4095; -- gst/codecparsers/gstmpeg4parser.h:72
--*
-- * GstMpeg4VisualObjectType:
-- *
-- * Defines the different visual object types as
-- * defined in: Table 6-5 -- Meaning of visual object type
--
--... reserved
subtype GstMpeg4VisualObjectType is unsigned;
GST_MPEG4_VIDEO_ID : constant GstMpeg4VisualObjectType := 1;
GST_MPEG4_STILL_TEXTURE_ID : constant GstMpeg4VisualObjectType := 2;
GST_MPEG4_STILL_MESH_ID : constant GstMpeg4VisualObjectType := 3;
GST_MPEG4_STILL_FBA_ID : constant GstMpeg4VisualObjectType := 4;
GST_MPEG4_STILL_3D_MESH_ID : constant GstMpeg4VisualObjectType := 5; -- gst/codecparsers/gstmpeg4parser.h:88
--*
-- * GstMpeg4AspectRatioInfo:
-- * @GST_MPEG4_SQUARE: 1:1 square
-- * @GST_MPEG4_625_TYPE_4_3: 12:11 (625-type for 4:3 picture)
-- * @GST_MPEG4_525_TYPE_4_3: 10:11 (525-type for 4:3 picture)
-- * @GST_MPEG4_625_TYPE_16_9: 16:11 (625-type stretched for 16:9 picture)
-- * @GST_MPEG4_525_TYPE_16_9: 40:33 (525-type stretched for 16:9 picture)
-- * @GST_MPEG4_EXTENDED_PAR: Extended par
-- *
-- * Defines the different pixel aspect ratios as
-- * defined in: Table 6-12 -- Meaning of pixel aspect ratio
--
subtype GstMpeg4AspectRatioInfo is unsigned;
GST_MPEG4_SQUARE : constant GstMpeg4AspectRatioInfo := 1;
GST_MPEG4_625_TYPE_4_3 : constant GstMpeg4AspectRatioInfo := 2;
GST_MPEG4_525_TYPE_4_3 : constant GstMpeg4AspectRatioInfo := 3;
GST_MPEG4_625_TYPE_16_9 : constant GstMpeg4AspectRatioInfo := 4;
GST_MPEG4_525_TYPE_16_9 : constant GstMpeg4AspectRatioInfo := 5;
GST_MPEG4_EXTENDED_PAR : constant GstMpeg4AspectRatioInfo := 15; -- gst/codecparsers/gstmpeg4parser.h:109
--*
-- * GstMpeg4ParseResult:
-- * @GST_MPEG4_PARSER_OK: The parsing went well
-- * @GST_MPEG4_PARSER_BROKEN_DATA: The bitstream was broken
-- * @GST_MPEG4_PARSER_NO_PACKET: There was no packet in the buffer
-- * @GST_MPEG4_PARSER_NO_PACKET_END: There was no packet end in the buffer
-- * @GST_MPEG4_PARSER_NO_PACKET_ERROR: An error accured durint the parsing
-- *
-- * Result type of any parsing function.
--
type GstMpeg4ParseResult is
(GST_MPEG4_PARSER_OK,
GST_MPEG4_PARSER_BROKEN_DATA,
GST_MPEG4_PARSER_NO_PACKET,
GST_MPEG4_PARSER_NO_PACKET_END,
GST_MPEG4_PARSER_ERROR);
pragma Convention (C, GstMpeg4ParseResult); -- gst/codecparsers/gstmpeg4parser.h:127
--*
-- * GstMpeg4VideoObjectCodingType:
-- * @GST_MPEG4_I_VOP: intra-coded (I)
-- * @GST_MPEG4_P_VOP: predictive-coded (P)
-- * @GST_MPEG4_B_VOP: bidirectionally-predictive-coded (B)
-- * @GST_MPEG4_S_VOP: sprite (S)
-- *
-- * The vop coding types as defined in:
-- * Table 6-20 -- Meaning of vop_coding_type
--
type GstMpeg4VideoObjectCodingType is
(GST_MPEG4_I_VOP,
GST_MPEG4_P_VOP,
GST_MPEG4_B_VOP,
GST_MPEG4_S_VOP);
pragma Convention (C, GstMpeg4VideoObjectCodingType); -- gst/codecparsers/gstmpeg4parser.h:144
--*
-- * GstMpeg4ChromaFormat
-- *
-- * The chroma format in use as
-- * defined in: Table 6-13 -- Meaning of chroma_format
--
-- Other value are reserved
subtype GstMpeg4ChromaFormat is unsigned;
GST_MPEG4_CHROMA_4_2_0 : constant GstMpeg4ChromaFormat := 1; -- gst/codecparsers/gstmpeg4parser.h:155
--*
-- * GstMpeg4VideoObjectLayerShape:
-- *
-- * The different video object layer shapes as defined in:
-- * Table 6-16 — Video Object Layer shape type
--
type GstMpeg4VideoObjectLayerShape is
(GST_MPEG4_RECTANGULAR,
GST_MPEG4_BINARY,
GST_MPEG4_BINARY_ONLY,
GST_MPEG4_GRAYSCALE);
pragma Convention (C, GstMpeg4VideoObjectLayerShape); -- gst/codecparsers/gstmpeg4parser.h:168
--*
-- * GstMpeg4SpriteEnable:
-- *
-- * Indicates the usage of static sprite coding
-- * or global motion compensation (GMC) as defined in:
-- * Table V2 - 2 -- Meaning of sprite_enable codewords
--
type GstMpeg4SpriteEnable is
(GST_MPEG4_SPRITE_UNUSED,
GST_MPEG4_SPRITE_STATIC,
GST_MPEG4_SPRITE_GMG);
pragma Convention (C, GstMpeg4SpriteEnable); -- gst/codecparsers/gstmpeg4parser.h:181
--*
-- * GstMpeg4Profile:
-- *
-- * Different defined profiles as defined in:
-- * 9- Profiles and levels
-- *
-- * It is computed using:
-- * Table G.1 — FLC table for profile_and_level_indication
--
type GstMpeg4Profile is
(GST_MPEG4_PROFILE_CORE,
GST_MPEG4_PROFILE_MAIN,
GST_MPEG4_PROFILE_N_BIT,
GST_MPEG4_PROFILE_SIMPLE,
GST_MPEG4_PROFILE_HYBRID,
GST_MPEG4_PROFILE_RESERVED,
GST_MPEG4_PROFILE_SIMPLE_FBA,
GST_MPEG4_PROFILE_CORE_STUDIO,
GST_MPEG4_PROFILE_SIMPLE_STUDIO,
GST_MPEG4_PROFILE_CORE_SCALABLE,
GST_MPEG4_PROFILE_ADVANCED_CORE,
GST_MPEG4_PROFILE_ADVANCED_SIMPLE,
GST_MPEG4_PROFILE_SIMPLE_SCALABLE,
GST_MPEG4_PROFILE_SCALABLE_TEXTURE,
GST_MPEG4_PROFILE_SIMPLE_FACE_ANIMATION,
GST_MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE,
GST_MPEG4_PROFILE_ADVANCED_REALTIME_SIMPLE,
GST_MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE,
GST_MPEG4_PROFILE_FINE_GRANULARITY_SCALABLE,
GST_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY);
pragma Convention (C, GstMpeg4Profile); -- gst/codecparsers/gstmpeg4parser.h:213
--*
-- * GstMpeg4Level:
-- *
-- * Different levels as defined in:
-- * 9- Profiles and levels
-- *
-- * It is computed using:
-- * Table G.1 — FLC table for profile_and_level_indication
--
type GstMpeg4Level is
(GST_MPEG4_LEVEL0,
GST_MPEG4_LEVEL1,
GST_MPEG4_LEVEL2,
GST_MPEG4_LEVEL3,
GST_MPEG4_LEVEL3b,
GST_MPEG4_LEVEL4,
GST_MPEG4_LEVEL5,
GST_MPEG4_LEVEL_RESERVED);
pragma Convention (C, GstMpeg4Level); -- gst/codecparsers/gstmpeg4parser.h:233
--*
-- * GstMpeg4VisualObjectSequence:
-- *
-- * The visual object sequence structure as defined in:
-- * 6.2.2 Visual Object Sequence and Visual Object
--
type GstMpeg4VisualObjectSequence is record
profile_and_level_indication : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:242
level : aliased GstMpeg4Level; -- gst/codecparsers/gstmpeg4parser.h:246
profile : aliased GstMpeg4Profile; -- gst/codecparsers/gstmpeg4parser.h:247
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VisualObjectSequence); -- gst/codecparsers/gstmpeg4parser.h:241
-- Computed according to:
-- * Table G.1 — FLC table for profile_and_level_indication
--*
-- * The visual object structure as defined in:
-- * 6.2.2 Visual Object Sequence and Visual Object
--
type GstMpeg4VisualObject is record
is_identifier : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:255
verid : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:257
priority : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:258
c_type : aliased GstMpeg4VisualObjectType; -- gst/codecparsers/gstmpeg4parser.h:260
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VisualObject); -- gst/codecparsers/gstmpeg4parser.h:254
-- If is_identifier
--*
-- * GstMpeg4VideoSignalType:
-- *
-- * The video signal type structure as defined in:
-- * 6.2.2 Visual Object Sequence and Visual Object.
--
type GstMpeg4VideoSignalType is record
c_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:270
format : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:272
c_range : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:273
color_description : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:274
color_primaries : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:275
transfer_characteristics : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:276
matrix_coefficients : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:277
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VideoSignalType); -- gst/codecparsers/gstmpeg4parser.h:269
--*
-- * GstMpeg4VideoPlaneShortHdr:
-- *
-- * The video plane short header structure as defined in:
-- * 6.2.5.2 Video Plane with Short Header
--
type GstMpeg4VideoPlaneShortHdr is record
temporal_reference : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:287
split_screen_indicator : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:288
document_camera_indicator : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:289
full_picture_freeze_release : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:290
source_format : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:291
picture_coding_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:292
vop_quant : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:293
pei : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:294
psupp : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:295
gob_header_empty : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:298
gob_number : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:299
gob_frame_id : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:300
quant_scale : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:301
vop_width : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:307
vop_height : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:308
num_macroblocks_in_gob : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:309
num_gobs_in_vop : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:310
size : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:313
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VideoPlaneShortHdr); -- gst/codecparsers/gstmpeg4parser.h:286
-- Gob layer specific fields
-- Computed
-- * If all the values are set to 0, then it is reserved
-- * Table 6-25 -- Parameters Defined by source_format Field
--
-- The size in bits
--*
-- * GstMpeg4VideoObjectLayer:
-- *
-- * The video object layer structure as defined in:
-- * 6.2.3 Video Object Layer
--
type GstMpeg4VideoObjectLayer is record
random_accessible_vol : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:323
video_object_type_indication : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:324
is_object_layer_identifier : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:326
verid : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:328
priority : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:329
aspect_ratio_info : aliased GstMpeg4AspectRatioInfo; -- gst/codecparsers/gstmpeg4parser.h:331
par_width : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:332
par_height : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:333
control_parameters : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:335
chroma_format : aliased GstMpeg4ChromaFormat; -- gst/codecparsers/gstmpeg4parser.h:337
low_delay : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:338
vbv_parameters : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:339
first_half_bitrate : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:341
latter_half_bitrate : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:342
first_half_vbv_buffer_size : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:343
latter_half_vbv_buffer_size : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:344
first_half_vbv_occupancy : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:345
latter_half_vbv_occupancy : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:346
bit_rate : aliased GLIB.guint32; -- gst/codecparsers/gstmpeg4parser.h:349
vbv_buffer_size : aliased GLIB.guint32; -- gst/codecparsers/gstmpeg4parser.h:350
shape : aliased GstMpeg4VideoObjectLayerShape; -- gst/codecparsers/gstmpeg4parser.h:352
shape_extension : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:354
vop_time_increment_resolution : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:356
vop_time_increment_bits : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:357
fixed_vop_rate : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:358
fixed_vop_time_increment : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:360
width : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:362
height : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:363
interlaced : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:364
obmc_disable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:365
sprite_enable : aliased GstMpeg4SpriteEnable; -- gst/codecparsers/gstmpeg4parser.h:367
sprite_width : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:370
sprite_height : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:371
sprite_left_coordinate : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:372
sprite_top_coordinate : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:373
no_of_sprite_warping_points : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:375
sprite_warping_accuracy : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:376
sprite_brightness_change : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:377
low_latency_sprite_enable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:379
sadct_disable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:382
not_8_bit : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:384
quant_precision : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:387
bits_per_pixel : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:388
no_gray_quant_update : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:391
composition_method : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:392
linear_composition : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:393
quant_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:395
load_intra_quant_mat : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:397
intra_quant_mat : aliased u_GstMpeg4VideoObjectLayer_intra_quant_mat_array; -- gst/codecparsers/gstmpeg4parser.h:398
load_non_intra_quant_mat : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:399
non_intra_quant_mat : aliased u_GstMpeg4VideoObjectLayer_non_intra_quant_mat_array; -- gst/codecparsers/gstmpeg4parser.h:400
quarter_sample : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:402
complexity_estimation_disable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:403
resync_marker_disable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:404
data_partitioned : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:405
reversible_vlc : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:406
newpred_enable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:407
reduced_resolution_vop_enable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:408
scalability : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:409
enhancement_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:410
short_hdr : aliased GstMpeg4VideoPlaneShortHdr; -- gst/codecparsers/gstmpeg4parser.h:412
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VideoObjectLayer); -- gst/codecparsers/gstmpeg4parser.h:322
-- if is_object_layer_identifier
-- if control_parameters
-- if vbv_parameters
-- Computed values
-- if shape == GST_MPEG4_GRAYSCALE && verid =! 1
-- if fixed_vop_rate
-- if vol->sprite_enable == SPRITE_GMG or SPRITE_STATIC
-- if vol->sprite_enable != GST_MPEG4_SPRITE_GMG
-- if vol->sprite_enable != GST_MPEG4_SPRITE_GMG
-- if shape != GST_MPEG4_RECTANGULAR
-- if no_8_bit
-- if shape == GRAYSCALE
-- if quant_type
--*
-- * GstMpeg4SpriteTrajectory:
-- *
-- * The sprite trajectory structure as defined in:
-- * 7.8.4 Sprite reference point decoding and
-- * 6.2.5.4 Sprite coding
--
-- Defined as "du" in 6.2.5.4
type GstMpeg4SpriteTrajectory is record
vop_ref_points : aliased u_GstMpeg4SpriteTrajectory_vop_ref_points_array; -- gst/codecparsers/gstmpeg4parser.h:423
sprite_ref_points : aliased u_GstMpeg4SpriteTrajectory_sprite_ref_points_array; -- gst/codecparsers/gstmpeg4parser.h:424
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4SpriteTrajectory); -- gst/codecparsers/gstmpeg4parser.h:422
-- Defined as "dv" in 6.2.5.4
--*
-- * GstMpeg4GroupOfVOP:
-- *
-- * The group of video object plane structure as defined in:
-- * 6.2.4 Group of Video Object Plane
--
type GstMpeg4GroupOfVOP is record
hours : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:434
minutes : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:435
seconds : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:436
closed : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:438
broken_link : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:439
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4GroupOfVOP); -- gst/codecparsers/gstmpeg4parser.h:433
--*
-- * GstMpeg4VideoObjectPlane:
-- *
-- * The Video object plane structure as defined in:
-- * 6.2.5 Video Object Plane and Video Plane with Short Header
--
type GstMpeg4VideoObjectPlane is record
coding_type : aliased GstMpeg4VideoObjectCodingType; -- gst/codecparsers/gstmpeg4parser.h:449
modulo_time_base : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:451
time_increment : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:452
coded : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:454
id : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:456
id_for_prediction_indication : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:457
id_for_prediction : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:458
width : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:460
height : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:461
horizontal_mc_spatial_ref : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:462
vertical_mc_spatial_ref : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:463
rounding_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:465
background_composition : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:467
change_conv_ratio_disable : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:468
constant_alpha : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:469
constant_alpha_value : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:470
reduced_resolution : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:471
intra_dc_vlc_thr : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:473
top_field_first : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:476
alternate_vertical_scan_flag : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:477
quant : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:479
fcode_forward : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:481
fcode_backward : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:482
shape_coding_type : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:484
load_backward_shape : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:485
ref_select_code : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:486
mb_height : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:489
mb_width : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:490
mb_num : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:491
size : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:494
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VideoObjectPlane); -- gst/codecparsers/gstmpeg4parser.h:448
-- if newpred_enable
--if vol->shape != GST_MPEG4_RECTANGULAR
-- Computed macroblock informations
-- The size of the header
--*
-- * GstMpeg4VideoPacketHdr:
-- * @size: Size of the header in bit.
-- *
-- * The video packet header structure as defined in:
-- * 6.2.5.2 Video Plane with Short Header
--
type GstMpeg4VideoPacketHdr is record
header_extension_code : aliased GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:505
macroblock_number : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:506
quant_scale : aliased GLIB.guint16; -- gst/codecparsers/gstmpeg4parser.h:507
size : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:508
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4VideoPacketHdr); -- gst/codecparsers/gstmpeg4parser.h:504
--*
-- * GstMpeg4Packet:
-- * @type: the type of the packet that start at @offset
-- * @data: the data of the packet, statring at @offset
-- * @offset: offset of the start of the packet (without the 3 bytes startcode), but
-- * including the #GstMpeg4StartCode byte.
-- * @size: The size in bytes of the packet or %G_MAXUINT if the end wasn't found.
-- * @marker_size: The size in bit of the resync marker.
-- *
-- * A structure that contains the type of a packet, its offset and its size
--
type GstMpeg4Packet is record
data : access GLIB.guint8; -- gst/codecparsers/gstmpeg4parser.h:524
offset : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:525
size : aliased GLIB.gsize; -- gst/codecparsers/gstmpeg4parser.h:526
marker_size : aliased GLIB.guint; -- gst/codecparsers/gstmpeg4parser.h:527
c_type : aliased GstMpeg4StartCode; -- gst/codecparsers/gstmpeg4parser.h:529
end record;
pragma Convention (C_Pass_By_Copy, GstMpeg4Packet); -- gst/codecparsers/gstmpeg4parser.h:522
function gst_h263_parse
(packet : access GstMpeg4Packet;
data : access GLIB.guint8;
offset : GLIB.guint;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:532
pragma Import (C, gst_h263_parse, "gst_h263_parse");
function gst_mpeg4_parse
(packet : access GstMpeg4Packet;
skip_user_data : GLIB.gboolean;
vop : access GstMpeg4VideoObjectPlane;
data : access GLIB.guint8;
offset : GLIB.guint;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:537
pragma Import (C, gst_mpeg4_parse, "gst_mpeg4_parse");
function gst_mpeg4_parse_video_object_plane
(vop : access GstMpeg4VideoObjectPlane;
sprite_trajectory : access GstMpeg4SpriteTrajectory;
vol : access GstMpeg4VideoObjectLayer;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:544
pragma Import (C, gst_mpeg4_parse_video_object_plane, "gst_mpeg4_parse_video_object_plane");
function gst_mpeg4_parse_group_of_vop
(gov : access GstMpeg4GroupOfVOP;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:551
pragma Import (C, gst_mpeg4_parse_group_of_vop, "gst_mpeg4_parse_group_of_vop");
function gst_mpeg4_parse_video_object_layer
(vol : access GstMpeg4VideoObjectLayer;
vo : access GstMpeg4VisualObject;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:555
pragma Import (C, gst_mpeg4_parse_video_object_layer, "gst_mpeg4_parse_video_object_layer");
function gst_mpeg4_parse_visual_object
(vo : access GstMpeg4VisualObject;
signal_type : access GstMpeg4VideoSignalType;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:560
pragma Import (C, gst_mpeg4_parse_visual_object, "gst_mpeg4_parse_visual_object");
function gst_mpeg4_parse_visual_object_sequence
(vos : access GstMpeg4VisualObjectSequence;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:565
pragma Import (C, gst_mpeg4_parse_visual_object_sequence, "gst_mpeg4_parse_visual_object_sequence");
function gst_mpeg4_parse_video_plane_short_header
(shorthdr : access GstMpeg4VideoPlaneShortHdr;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:568
pragma Import (C, gst_mpeg4_parse_video_plane_short_header, "gst_mpeg4_parse_video_plane_short_header");
function gst_mpeg4_parse_video_packet_header
(videopackethdr : access GstMpeg4VideoPacketHdr;
vol : access GstMpeg4VideoObjectLayer;
vop : access GstMpeg4VideoObjectPlane;
sprite_trajectory : access GstMpeg4SpriteTrajectory;
data : access GLIB.guint8;
size : GLIB.gsize) return GstMpeg4ParseResult; -- gst/codecparsers/gstmpeg4parser.h:572
pragma Import (C, gst_mpeg4_parse_video_packet_header, "gst_mpeg4_parse_video_packet_header");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_codecparsers_gstmpeg4parser_h;
|
mgrojo/bingada | Ada | 24,075 | adb | --*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_bingada.adb
--*
--* AUTHOR: Javier Fuica Fernandez
--*
--*****************************************************************************
with Text_Io;
with Ada.Strings.Fixed;
with Glib.Main;
with Glib.Error;
with Glib.Properties;
with Gtk.Box;
with Gtk.Main;
with Gtk.Window;
with Gtk.Enums;
with Gtk.Widget;
with Gtk.Image;
with Gtk.Button;
with Gtk.Menu;
with Gtk.Menu_Bar;
with Gtk.Menu_Item;
with Gtk.Handlers;
with Gtk.Settings;
with Gtk.Style_Provider;
with Gdk.Event;
with Gdk.Types.Keysyms;
with Gdk.Pixbuf;
with Gtkada.Style;
with Gtkada.Intl; use Gtkada.Intl;
with Q_Bingo.Q_Bombo;
with Q_Bingo_Help;
with Q_Csv.Q_Read_File;
with Q_Bingo.Q_Gtk.Q_Intl;
with Q_Sound;
package body Q_Bingada is
use type Glib.Main.G_Source_Id;
use type Glib.Guint;
--==================================================================
C_Null_Number_Image : constant String := " ";
C_Bombo_File : constant String := "bombo.png";
C_Drum_Spin_File : constant String := "drum_spin.png";
V_Drum_Is_Spun : Boolean := True;
V_Dark_Style : Boolean := False;
V_Is_In_Fullscreen : Boolean := False;
V_Bombo_Button : Gtk.Button.Gtk_Button;
--==================================================================
procedure P_Load_Css (V_Filename : String) is
begin
-- Use this if you want to use Aero themes from Gnome
-- This is not recommended but can help if animation is requested.
-- In this case the .themes directory must exists in the home directory.
-- Glib.Properties.Set_Property
-- (Object => Gtk.Settings.Get_Default,
-- Name => Gtk.Settings.Gtk_Theme_Name,
-- Value => "Aero");
Glib.Properties.Set_Property
(Object => Gtk.Settings.Get_Default,
Name => Gtk.Settings.Gtk_Cursor_Blink_Property,
Value => True);
Gtkada.Style.Load_Css_File
(Path => V_Filename,
Error => Text_Io.Put_Line'Access,
Priority => Gtk.Style_Provider.Priority_Application);
end P_Load_Css;
--=========================================================================
function F_Swap_Bombo_Image return String is
begin
V_Drum_Is_Spun := not V_Drum_Is_Spun;
return (if V_Drum_Is_Spun then C_Bombo_File else C_Drum_Spin_File);
end F_Swap_Bombo_Image;
--==================================================================
procedure P_Main_Quit (Self : access Gtk.Widget.Gtk_Widget_Record'Class) is
pragma Unreferenced (Self);
begin
Q_Sound.P_Clean_Up;
Text_Io.Put_Line (-"exit_message");
Gtk.Main.Main_Quit;
end P_Main_Quit;
--==================================================================
V_Current_Number : Gtk.Button.Gtk_Button;
V_Previous_Number_1 : Gtk.Button.Gtk_Button;
V_Previous_Number_2 : Gtk.Button.Gtk_Button;
V_Previous_Number_3 : Gtk.Button.Gtk_Button;
C_Max_Buttons : constant := Q_Bingo.C_Last_Number;
type T_Buttons_Array is array (1 .. C_Max_Buttons) of Gtk.Button.Gtk_Button;
V_Button_Array : T_Buttons_Array;
--==================================================================
function F_Get_Number (V_Index : Positive) return String is
V_Image : String := " ";
begin
Ada.Strings.Fixed.Move
(Source => V_Index'Image,
Target => V_Image,
Drop => Ada.Strings.Left);
return V_Image;
end F_Get_Number;
--==================================================================
procedure P_Set_Current_And_Previous_Numbers
(V_Current_Index : Q_Bingo.T_Number) is
C_Number : constant Positive :=
Q_Bingo.Q_Bombo.F_Get_Number (V_Current_Index);
begin
V_Button_Array (C_Number).Set_Name ("myButton_blue");
V_Current_Number.Set_Name ("myButton_blue");
V_Current_Number.Set_Label (F_Get_Number (C_Number));
if V_Current_Index > 1 then
V_Previous_Number_1.Set_Label
(F_Get_Number
(Q_Bingo.Q_Bombo.F_Get_Number (V_Current_Index - 1)));
V_Previous_Number_1.Set_Name ("myButton_previous_1");
end if;
if V_Current_Index > 2 then
V_Previous_Number_2.Set_Label
(F_Get_Number
(Q_Bingo.Q_Bombo.F_Get_Number (V_Current_Index - 2)));
V_Previous_Number_2.Set_Name ("myButton_previous_2");
end if;
if V_Current_Index > 3 then
V_Previous_Number_3.Set_Label
(F_Get_Number
(Q_Bingo.Q_Bombo.F_Get_Number (V_Current_Index - 3)));
V_Previous_Number_3.Set_Name ("myButton_previous_3");
end if;
end P_Set_Current_And_Previous_Numbers;
--==================================================================
procedure P_Get_Number is
V_Last_Number : Boolean;
V_Current_Index : Q_Bingo.T_Number;
V_Number : Positive;
begin
Q_Bingo.Q_Bombo.P_Spin (V_Number => V_Number,
V_Current_Index => V_Current_Index,
V_Last_Number => V_Last_Number);
P_Set_Current_And_Previous_Numbers (V_Current_Index => V_Current_Index);
end P_Get_Number;
--==================================================================
procedure P_Button_Clicked
(Self : access Gtk.Button.Gtk_Button_Record'Class) is
pragma Unreferenced (Self);
begin
P_Get_Number;
end P_Button_Clicked;
--==================================================================
procedure P_Button_Pressed
(Self : access Gtk.Button.Gtk_Button_Record'Class) is
V_Drum_Spin_Image : Gtk.Image.Gtk_Image;
begin
V_Drum_Spin_Image := Gtk.Image.Gtk_Image_New_From_File (F_Swap_Bombo_Image);
Self.Set_Image (V_Drum_Spin_Image);
end P_Button_Pressed;
--==================================================================
procedure P_Button_Released
(Self : access Gtk.Button.Gtk_Button_Record'Class) is
V_Bombo_Image : Gtk.Image.Gtk_Image;
begin
V_Bombo_Image := Gtk.Image.Gtk_Image_New_From_File (F_Swap_Bombo_Image);
Self.Set_Image (V_Bombo_Image);
end P_Button_Released;
--==================================================================
procedure P_Create_Numbers (V_Numbers_Box : out Gtk.Box.Gtk_Box) is
V_Horizontal : Gtk.Box.Gtk_Box;
V_Index : Positive := 1;
begin
Gtk.Box.Gtk_New_Vbox
(Box => V_Numbers_Box,
Homogeneous => True);
for I in 1 .. 9 loop
Gtk.Box.Gtk_New_Hbox (Box => V_Horizontal,
Homogeneous => True);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box,
Child => V_Horizontal,
Expand => True,
Fill => True);
for J in 1 .. 10 loop
Gtk.Button.Gtk_New
(V_Button_Array (V_Index), Label => F_Get_Number (V_Index));
V_Button_Array (V_Index).Set_Sensitive (False);
Gtk.Box.Pack_Start
(In_Box => V_Horizontal,
Child => V_Button_Array (V_Index),
Expand => True,
Fill => True);
V_Index := V_Index + 1;
end loop;
end loop;
end P_Create_Numbers;
--==================================================================
type T_Widgets_To_Update is null record;
V_Null_Record : T_Widgets_To_Update;
package Q_Timeout is new Glib.Main.Generic_Sources (T_Widgets_To_Update);
V_Timeout : Glib.Main.G_Source_Id;
V_Spin_Timeout : Glib.Main.G_Source_Id;
--==================================================================
function F_Swap_Bombo_Image (V_User : T_Widgets_To_Update) return Boolean is
pragma Unreferenced (V_User);
begin
V_Bombo_Button.Set_Image
(Gtk.Image.Gtk_Image_New_From_File (F_Swap_Bombo_Image));
return True;
end F_Swap_Bombo_Image;
--==================================================================
function F_Spin_Timeout (V_User : T_Widgets_To_Update) return Boolean is
pragma Unreferenced (V_User);
begin
P_Get_Number;
return True;
end F_Spin_Timeout;
--==================================================================
procedure P_Start_Timer is
begin
V_Spin_Timeout := Q_Timeout.Timeout_Add
(-- This timeout will refresh every 5sec
500,
-- This is the function to call in the timeout
F_Swap_Bombo_Image'Access,
-- This is the part of the GUI to refresh
V_Null_Record);
V_Timeout := Q_Timeout.Timeout_Add
(-- This timeout will refresh every 5sec
6000,
-- This is the function to call in the timeout
F_Spin_Timeout'Access,
-- This is the part of the GUI to refresh
V_Null_Record);
end P_Start_Timer;
--==================================================================
procedure P_Stop_Timer is
begin
if V_Timeout /= 0 then
Glib.Main.Remove (V_Timeout);
Glib.Main.Remove (V_Spin_Timeout);
V_Timeout := 0;
V_Spin_Timeout := 0;
end if;
end P_Stop_Timer;
--==================================================================
procedure P_Start_Pause_Bingo is
begin
if V_Timeout /= 0 then
P_Stop_Timer;
else
P_Start_Timer;
end if;
end P_Start_Pause_Bingo;
--==================================================================
package Q_Main_Window_Handler is new Gtk.Handlers.Return_Callback
(Gtk.Widget.Gtk_Widget_Record, Boolean);
function F_Main_Window_Button_Press
(V_Object : access Gtk.Widget.Gtk_Widget_Record'Class;
V_Event : Gdk.Event.Gdk_Event) return Boolean is
C_Key_Val : constant Gdk.Types.Gdk_Key_Type :=
Gdk.Event.Get_Key_Val (V_Event);
begin
case C_Key_Val is
when Gdk.Types.Keysyms.Gdk_Lc_S |
Gdk.Types.Keysyms.Gdk_S |
Gdk.Types.Keysyms.Gdk_Space =>
P_Start_Pause_Bingo;
when Gdk.Types.Keysyms.Gdk_F11 =>
if V_Is_In_Fullscreen then
Gtk.Window.Gtk_Window(V_Object).Unfullscreen;
V_Is_In_Fullscreen := False;
else
Gtk.Window.Gtk_Window(V_Object).Fullscreen;
V_Is_In_Fullscreen := True;
end if;
when Gdk.Types.Keysyms.Gdk_Escape =>
Gtk.Window.Gtk_Window(V_Object).Unfullscreen;
V_Is_In_Fullscreen := False;
when others =>
null;
end case;
return True;
end F_Main_Window_Button_Press;
--==================================================================
procedure P_Create_Upper_Area (V_Upper_Area : out Gtk.Box.Gtk_Box) is
V_Bombo_Image : Gtk.Image.Gtk_Image;
V_Numbers_Box : Gtk.Box.Gtk_Box;
V_Numbers_Box_Upper : Gtk.Box.Gtk_Box;
V_Numbers_Box_Lower : Gtk.Box.Gtk_Box;
begin
Gtk.Box.Gtk_New_Hbox
(Box => V_Upper_Area,
Homogeneous => True);
Gtk.Button.Gtk_New (V_Bombo_Button);
Gtk.Button.Gtk_New (V_Current_Number, Label => C_Null_Number_Image);
V_Current_Number.Set_Sensitive (False);
Gtk.Button.Gtk_New (V_Previous_Number_1, Label => C_Null_Number_Image);
V_Previous_Number_1.Set_Sensitive (False);
Gtk.Button.Gtk_New (V_Previous_Number_2, Label => C_Null_Number_Image);
V_Previous_Number_2.Set_Sensitive (False);
Gtk.Button.Gtk_New (V_Previous_Number_3, Label => C_Null_Number_Image);
V_Previous_Number_3.Set_Sensitive (False);
Q_Main_Window_Handler.Connect
(V_Bombo_Button,
"key_press_event",
Q_Main_Window_Handler.To_Marshaller
(F_Main_Window_Button_Press'Access));
V_Bombo_Button.On_Pressed (P_Button_Pressed'Access);
V_Bombo_Button.On_Released (P_Button_Released'Access);
V_Bombo_Button.On_Clicked (P_Button_Clicked'Access);
V_Bombo_Image := Gtk.Image.Gtk_Image_New_From_File (C_Bombo_File);
V_Bombo_Button.Set_Image (Image => V_Bombo_Image);
V_Bombo_Button.Set_Name ("drum_button");
Gtk.Box.Pack_Start
(In_Box => V_Upper_Area,
Child => V_Bombo_Button);
Gtk.Box.Gtk_New_Vbox
(Box => V_Numbers_Box,
Homogeneous => True);
Gtk.Box.Pack_Start
(In_Box => V_Upper_Area,
Child => V_Numbers_Box);
Gtk.Box.Gtk_New_Hbox
(Box => V_Numbers_Box_Upper,
Homogeneous => True);
Gtk.Box.Gtk_New_Hbox
(Box => V_Numbers_Box_Lower,
Homogeneous => True);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box,
Child => V_Numbers_Box_Upper);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box,
Child => V_Numbers_Box_Lower);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box_Upper,
Child => V_Current_Number);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box_Lower,
Child => V_Previous_Number_1);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box_Lower,
Child => V_Previous_Number_2);
Gtk.Box.Pack_Start
(In_Box => V_Numbers_Box_Lower,
Child => V_Previous_Number_3);
end P_Create_Upper_Area;
--==================================================================
procedure P_Create_Main_Window
(V_Menu_Bar : Gtk.Menu_Bar.Gtk_Menu_Bar;
V_Upper_Area : Gtk.Box.Gtk_Box;
V_Numbers_Box : Gtk.Box.Gtk_Box;
V_Main_Window : out Gtk.Window.Gtk_Window) is
V_Vertical_Box : Gtk.Box.Gtk_Box;
C_Icon : constant String := "bingada.png";
V_Icon : Gdk.Pixbuf.Gdk_Pixbuf;
V_Icon_Error : Glib.Error.Gerror;
begin
-- Create main window box
--
Gtk.Window.Gtk_New (V_Main_Window, Gtk.Enums.Window_Toplevel);
Gtk.Window.Set_Modal (Window => V_Main_Window,
Modal => False);
Gtk.Window.Set_Title (V_Main_Window, "BingAda");
Gdk.Pixbuf.Gdk_New_From_File
(Pixbuf => V_Icon,
Filename => C_Icon,
Error => V_Icon_Error);
Gtk.Window.Set_Default_Icon
(Icon => V_Icon);
-- |--- Vertical BOX |
-- | |
-- | |
-- | |
--
Gtk.Box.Gtk_New_Vbox
(Box => V_Vertical_Box,
Homogeneous => False);
Gtk.Window.Add
(V_Main_Window,
V_Vertical_Box);
Gtk.Box.Pack_Start
(In_Box => V_Vertical_Box,
Child => V_Menu_Bar,
Expand => False,
Fill => True);
--
-- | ---- Vertical Box --- |
-- | ------ Upper Area---- |
-- | - - |
-- | - - |
-- | ------Numbers_box-----|
-- | - - |
-- | - - |
-- | ----------------------|
--
Gtk.Box.Pack_Start
(In_Box => V_Vertical_Box,
Child => V_Upper_Area);
Gtk.Box.Pack_Start
(In_Box => V_Vertical_Box,
Child => V_Numbers_Box);
end P_Create_Main_Window;
--==================================================================
procedure P_Start_Bingo
(V_Object : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (V_Object);
begin
-- If there is no timeout registered to monitor the tasks,
-- start one now!
--
if V_Timeout = 0 then
P_Start_Timer;
end if;
end P_Start_Bingo;
--==================================================================
procedure P_Pause_Bingo
(V_Object : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (V_Object);
begin
P_Stop_Timer;
end P_Pause_Bingo;
--==================================================================
V_Cards : Q_Csv.Q_Read_File.Q_Bingo_Cards.Vector;
function F_Is_Number_Marked_Off
(V_Number : Q_Bingo.T_Number) return Boolean is
V_Found : Boolean := False;
begin
for I in 1 .. Q_Bingo.Q_Bombo.F_Get_Current_Index loop
V_Found := Q_Bingo.Q_Bombo.F_Get_Number (I) = V_Number;
exit when V_Found;
end loop;
return V_Found;
end F_Is_Number_Marked_Off;
--==================================================================
function F_All_Numbers_Marked_Off
(V_Card : Q_Csv.Q_Read_File.T_Card) return Boolean is
V_All_Marked_Off : Boolean := True;
begin
for V_Number of V_Card.R_Numbers loop
V_All_Marked_Off := F_Is_Number_Marked_Off (V_Number);
exit when not V_All_Marked_Off;
end loop;
return V_All_Marked_Off;
end F_All_Numbers_Marked_Off;
--==================================================================
procedure P_Check_Bingo (V_Cards : Q_Csv.Q_Read_File.Q_Bingo_Cards.Vector) is
begin
Text_Io.Put_Line ("-------------------------------------------");
for V_Card of V_Cards loop
Text_Io.Put_Line
(V_Card.R_Name & " : " &
Boolean'Image (F_All_Numbers_Marked_Off (V_Card)));
end loop;
end P_Check_Bingo;
--==================================================================
procedure P_Read_Cards_From_File is
begin
V_Cards.Set_Length (0);
Q_Csv.Q_Read_File.P_Read_Bingo_Cards
(V_File_Name => "bingo_cards.csv",
V_Cards => V_Cards);
P_Check_Bingo (V_Cards);
end P_Read_Cards_From_File;
--==================================================================
procedure P_Check_Cards
(V_Object : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (V_Object);
begin
P_Read_Cards_From_File;
end P_Check_Cards;
--==================================================================
procedure P_Load_Style is
C_Default_Css_File : constant String := "bingada.css";
C_Dark_Css_File : constant String := "bingada-dark.css";
begin
P_Load_Css (V_Filename => (if V_Dark_Style then C_Dark_Css_File
else C_Default_Css_File));
V_Dark_Style := not V_Dark_Style;
end P_Load_Style;
--==================================================================
procedure P_Toggle_Style
(V_Object : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (V_Object);
begin
P_Load_Style;
end p_toggle_style;
--==================================================================
procedure P_Init_Bingo is
begin
Q_Bingo.Q_Bombo.P_Init;
for V_Button of V_Button_Array loop
V_Button.Set_Name ("myButton_white");
end loop;
V_Current_Number.Set_Name ("current");
V_Current_Number.Set_Label (C_Null_Number_Image);
V_Previous_Number_1.Set_Label (C_Null_Number_Image);
V_Previous_Number_2.Set_Label (C_Null_Number_Image);
V_Previous_Number_3.Set_Label (C_Null_Number_Image);
P_Stop_Timer;
end P_Init_Bingo;
--==================================================================
package P_Menu_Item_Handler is new Gtk.Handlers.Callback
(Gtk.Menu_Item.Gtk_Menu_Item_Record);
procedure P_New_Game
(V_Emitter : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (V_Emitter);
begin
P_Init_Bingo;
end P_New_Game;
--==================================================================
procedure P_Exit_Bingo
(Self : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
begin
P_Main_Quit (Self);
end P_Exit_Bingo;
--==================================================================
procedure P_Help_Bingo
(V_Widget : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
begin
Q_Bingo_Help.P_Show_Window
(V_Parent_Window =>
Gtk.Window.Gtk_Window (Gtk.Menu_Item.Get_Toplevel (V_Widget)));
end P_Help_Bingo;
--==================================================================
procedure P_Create_Game_Menu
(V_Game_Menu_Item : out Gtk.Menu_Item.Gtk_Menu_Item) is
V_New_Game, V_Auto_Start, V_Pause, V_Check_Cards, V_Toggle_Style, V_Exit,
V_Help : Gtk.Menu_Item.Gtk_Menu_Item;
V_Game_Menu : Gtk.Menu.Gtk_Menu;
begin
-- Creates GAME menu submenus
--
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_New_Game, -"menu_new_game");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Auto_Start, -"menu_auto_spin");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Pause, -"menu_pause");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Check_Cards, -"menu_check_cards");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Toggle_Style, -"menu_toggle_style");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Exit, -"menu_exit");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Help, -"menu_help");
Gtk.Menu_Item.Gtk_New_With_Mnemonic
(V_Game_Menu_Item, -"main_menu");
-- Creates the menu called game
--
Gtk.Menu.Gtk_New (V_Game_Menu);
-- Append all menu items to the game menu.
--
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_New_Game);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Auto_Start);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Pause);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Check_Cards);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Toggle_Style);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Help);
Gtk.Menu.Append (Menu_Shell => V_Game_Menu,
Child => V_Exit);
-- Sets the submenu
--
Gtk.Menu_Item.Set_Submenu (V_Game_Menu_Item, V_Game_Menu);
P_Menu_Item_Handler.Connect
(V_New_Game,
"activate",
P_New_Game'Access);
P_Menu_Item_Handler.Connect
(V_Auto_Start,
"activate",
P_Start_Bingo'Access);
P_Menu_Item_Handler.Connect
(V_Pause,
"activate",
P_Pause_Bingo'Access);
P_Menu_Item_Handler.Connect
(V_Check_Cards,
"activate",
P_Check_Cards'Access);
P_Menu_Item_Handler.Connect
(V_Toggle_Style,
"activate",
P_Toggle_Style'Access);
P_Menu_Item_Handler.Connect
(V_Exit,
"activate",
P_Exit_Bingo'Access);
P_Menu_Item_Handler.Connect
(V_Help,
"activate",
P_Help_Bingo'Access);
end P_Create_Game_Menu;
--==================================================================
procedure P_Create_Menu_Bar
(V_Menu_Bar : out Gtk.Menu_Bar.Gtk_Menu_Bar) is
V_Game_Menu_Item : Gtk.Menu_Item.Gtk_Menu_Item;
begin
P_Create_Game_Menu (V_Game_Menu_Item => V_Game_Menu_Item);
-- It creates the menu bar which contains all the menus.
--
Gtk.Menu_Bar.Gtk_New (V_Menu_Bar);
Gtk.Menu_Bar.Add (V_Menu_Bar, V_Game_Menu_Item);
end P_Create_Menu_Bar;
--==================================================================
--[
-- This is the main gtkada procedure.
-- It initialises the bingo's bombo and the GTKAda HMI.
--]
procedure P_Create_Widgets is
V_Upper_Area : Gtk.Box.Gtk_Box;
V_Numbers_Box : Gtk.Box.Gtk_Box;
V_Main_Window : Gtk.Window.Gtk_Window;
V_Menu_Bar : Gtk.Menu_Bar.Gtk_Menu_Bar;
begin
Q_Bingo.Q_Gtk.Q_Intl.P_Initialise;
P_Load_Style;
P_Create_Upper_Area (V_Upper_Area => V_Upper_Area);
P_Create_Numbers (V_Numbers_Box => V_Numbers_Box);
P_Create_Menu_Bar (V_Menu_Bar => V_Menu_Bar);
P_Create_Main_Window (V_Menu_Bar => V_Menu_Bar,
V_Upper_Area => V_Upper_Area,
V_Numbers_Box => V_Numbers_Box,
V_Main_Window => V_Main_Window);
Q_Main_Window_Handler.Connect
(V_Main_Window,
"key_press_event",
Q_Main_Window_Handler.To_Marshaller
(F_Main_Window_Button_Press'Access));
-- Initialise bombo numbers.
--
P_Init_Bingo;
Q_Sound.P_Initialize;
V_Main_Window.On_Destroy (P_Main_Quit'Access);
V_Main_Window.Maximize;
V_Main_Window.Show_All;
end P_Create_Widgets;
--==================================================================
end Q_Bingada;
|
charlie5/cBound | Ada | 1,602 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_is_texture_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context_tag : aliased xcb.xcb_glx_context_tag_t;
texture : aliased Interfaces.Unsigned_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_is_texture_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_is_texture_request_t.Item,
Element_Array => xcb.xcb_glx_is_texture_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_is_texture_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_is_texture_request_t.Pointer,
Element_Array => xcb.xcb_glx_is_texture_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_is_texture_request_t;
|
AdaCore/Ada_Drivers_Library | Ada | 6,712 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with STM32.DMA; use STM32.DMA;
with HAL.SPI;
package body STM32.SPI.DMA is
procedure Transmit_Common
(This : in out SPI_Port_DMA;
Source : System.Address;
Data_Count : UInt16;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000);
---------------------
-- Transmit_Common --
---------------------
procedure Transmit_Common
(This : in out SPI_Port_DMA;
Source : System.Address;
Data_Count : UInt16;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000)
is
pragma Unreferenced (Timeout);
DMA_Status : DMA_Error_Code;
begin
if not Compatible_Alignments (This.TX_DMA.Controller.all,
This.TX_DMA.Stream,
Source,
This.Data_Register_Address)
then
raise Program_Error with "Incompatible alignments";
end if;
-- Enable TX DMA
This.Periph.CR2.TXDMAEN := True;
This.TX_DMA.Start_Transfer (Source => Source,
Destination => This.Data_Register_Address,
Data_Count => Data_Count);
This.TX_DMA.Wait_For_Completion (DMA_Status);
if DMA_Status = DMA_No_Error then
Status := HAL.SPI.Ok;
else
Status := HAL.SPI.Err_Error;
end if;
end Transmit_Common;
------------------------
-- Set_TX_DMA_Handler --
------------------------
procedure Set_TX_DMA_Handler
(This : in out SPI_Port_DMA;
DMA : DMA_Interrupt_Controller_Access)
is
begin
This.TX_DMA := DMA;
end Set_TX_DMA_Handler;
---------------------------
-- Set_Polling_Threshold --
---------------------------
procedure Set_Polling_Threshold
(This : in out SPI_Port_DMA;
Threshold : Natural)
is
begin
This.Threshold := Threshold;
end Set_Polling_Threshold;
---------------
-- Configure --
---------------
overriding procedure Configure
(This : in out SPI_Port_DMA;
Conf : SPI_Configuration)
is
begin
Configure (Parent (This), Conf);
end Configure;
--------------
-- Transmit --
--------------
overriding procedure Transmit
(This : in out SPI_Port_DMA;
Data : HAL.SPI.SPI_Data_8b;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000)
is
begin
if This.TX_DMA = null or else Data'Length < This.Threshold then
-- Fallback to polling implementation
Transmit (Parent (This), Data, Status, Timeout);
else
Transmit_Common (This,
Data (Data'First)'Address,
Data'Length,
Status,
Timeout);
end if;
end Transmit;
--------------
-- Transmit --
--------------
overriding procedure Transmit
(This : in out SPI_Port_DMA;
Data : HAL.SPI.SPI_Data_16b;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000)
is
begin
if This.TX_DMA = null or else Data'Length < This.Threshold then
-- Fallback to polling implementation
Transmit (Parent (This), Data, Status, Timeout);
else
Transmit_Common (This,
Data (Data'First)'Address,
Data'Length,
Status,
Timeout);
end if;
end Transmit;
-------------
-- Receive --
-------------
overriding procedure Receive
(This : in out SPI_Port_DMA;
Data : out HAL.SPI.SPI_Data_8b;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000)
is
begin
-- Not implemented, fallback to polling implementation
Receive (Parent (This), Data, Status, Timeout);
end Receive;
-------------
-- Receive --
-------------
overriding procedure Receive
(This : in out SPI_Port_DMA;
Data : out HAL.SPI.SPI_Data_16b;
Status : out HAL.SPI.SPI_Status;
Timeout : Natural := 1000)
is
begin
-- Not implemented, fallback to polling implementation
Receive (Parent (This), Data, Status, Timeout);
end Receive;
end STM32.SPI.DMA;
|
stcarrez/ada-asf | Ada | 3,377 | adb | -----------------------------------------------------------------------
-- html -- ASF HTML Components
-- Copyright (C) 2009, 2010, 2011, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Objects;
with ASF.Components.Base;
package body ASF.Components.Html is
use EL.Objects;
procedure Render_Attributes (UI : in UIHtmlComponent;
Context : in out Faces_Context'Class;
Writer : in Response_Writer_Access) is
Style : constant Object := UI.Get_Attribute (Context, "style");
Class : constant Object := UI.Get_Attribute (Context, "styleClass");
Title : constant Object := UI.Get_Attribute (Context, "title");
begin
if not UI.Is_Generated_Id then
Writer.Write_Attribute ("id", UI.Get_Client_Id);
end if;
if not Is_Null (Class) then
Writer.Write_Attribute ("class", Class);
end if;
if not Is_Null (Style) then
Writer.Write_Attribute ("style", Style);
end if;
if not Is_Null (Title) then
Writer.Write_Attribute ("title", Title);
end if;
end Render_Attributes;
-- ------------------------------
-- Render the attributes which are defined on the component and which are
-- in the list specified by <b>names</b>.
-- ------------------------------
procedure Render_Attributes (UI : in UIHtmlComponent;
Context : in out Faces_Context'Class;
Names : in Util.Strings.String_Set.Set;
Writer : in Response_Writer_Access;
Write_Id : in Boolean := True) is
pragma Unreferenced (Context);
procedure Process_Attribute (Name : in String;
Attr : in UIAttribute);
procedure Process_Attribute (Name : in String;
Attr : in UIAttribute) is
begin
if Names.Contains (Name'Unrestricted_Access) then
declare
Value : constant Object := Base.Get_Value (Attr, UI);
begin
if Name = "styleClass" then
Writer.Write_Attribute ("class", Value);
else
Writer.Write_Attribute (Name, Value);
end if;
end;
end if;
end Process_Attribute;
procedure Write_Attributes is new Base.Iterate_Attributes (Process_Attribute);
begin
if Write_Id and then not UI.Is_Generated_Id then
Writer.Write_Attribute ("id", UI.Get_Client_Id);
end if;
Write_Attributes (UI);
end Render_Attributes;
end ASF.Components.Html;
|
MinimSecure/unum-sdk | Ada | 804 | ads | -- Copyright 2013-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Callee is
procedure Increment (Val : in out Float; Msg : String);
end Callee;
|
reznikmm/matreshka | Ada | 3,719 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Start_Angle_Attributes is
pragma Preelaborate;
type ODF_Draw_Start_Angle_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Start_Angle_Attribute_Access is
access all ODF_Draw_Start_Angle_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Start_Angle_Attributes;
|
vpodzime/ada-util | Ada | 12,635 | adb | -----------------------------------------------------------------------
-- measure -- Benchmark tools
-- Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2015 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Task_Attributes;
with Ada.Strings.Hash;
with Ada.Unchecked_Deallocation;
with GNAT.Calendar.Time_IO;
with Util.Streams.Buffered;
package body Util.Measures is
ISO_DATE_TIME : constant GNAT.Calendar.Time_IO.Picture_String := "%Y-%m-%d %H:%M:%S";
procedure Free is
new Ada.Unchecked_Deallocation (Buckets_Type, Buckets_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Measure, Measure_Access);
procedure Free is
new Ada.Unchecked_Deallocation (String, String_Access);
package Task_Context is new Ada.Task_Attributes
(Measure_Set_Access, null);
function Format (D : in Duration) return String;
-- Format the duration in a time in 'ns', 'us', 'ms' or seconds.
function Format (D : in Duration;
Unit : in Unit_Type) return String;
-- ------------------------------
-- Disable collecting measures on the measure set.
-- ------------------------------
procedure Disable (Measures : in out Measure_Set) is
begin
Measures.Enabled := False;
end Disable;
-- ------------------------------
-- Enable collecting measures on the measure set.
-- ------------------------------
procedure Enable (Measures : in out Measure_Set) is
begin
Measures.Enabled := True;
end Enable;
-- ------------------------------
-- Set the per-thread measure set.
-- ------------------------------
procedure Set_Current (Measures : in Measure_Set_Access) is
begin
Task_Context.Set_Value (Measures);
end Set_Current;
-- ------------------------------
-- Get the per-thread measure set.
-- ------------------------------
function Get_Current return Measure_Set_Access is
begin
return Task_Context.Value;
end Get_Current;
-- ------------------------------
-- Dump an XML result with the measures collected by the measure set.
-- When writing the measures, the measure set is cleared. It is safe
-- to write measures while other measures are being collected.
-- ------------------------------
procedure Write (Measures : in out Measure_Set;
Title : in String;
Stream : in out Util.Streams.Texts.Print_Stream'Class) is
use Util.Streams.Buffered;
procedure Dump_XML (Item : in Measure_Access);
procedure Dump_XML (Item : in Measure_Access) is
Total : constant String := Format (Item.Time);
Time : constant String := Format (Item.Time / Item.Count);
begin
Stream.Write ("<time count=""");
Stream.Write (Item.Count);
Stream.Write (""" time=""");
Stream.Write (Time (Time'First + 1 .. Time'Last));
if Item.Count > 1 then
Stream.Write (""" total=""");
Stream.Write (Total (Total'First + 1 .. Total'Last));
end if;
Stream.Write (""" title=""");
Util.Streams.Texts.TR.Escape_Java_Script (Into => Buffered_Stream (Stream),
Content => Item.Name.all);
Stream.Write ("""/>");
Stream.Write (ASCII.LF);
end Dump_XML;
Buckets : Buckets_Access;
TS, TE : Ada.Calendar.Time;
begin
Measures.Data.Steal_Map (Buckets, TS, TE);
Stream.Write ("<measures title=""");
Util.Streams.Texts.TR.Escape_Java_Script (Into => Buffered_Stream (Stream),
Content => Title);
Stream.Write (""" start=""");
Stream.Write (TS, ISO_DATE_TIME);
Stream.Write (""" end=""");
Stream.Write (TE, ISO_DATE_TIME);
Stream.Write (""">");
if Buckets /= null then
begin
for I in Buckets'Range loop
declare
Next : Measure_Access;
Node : Measure_Access := Buckets (I);
begin
while Node /= null loop
Dump_XML (Node);
Free (Node.Name);
Next := Node.Next;
Free (Node);
Node := Next;
end loop;
end;
end loop;
exception
when others =>
Free (Buckets);
raise;
end;
Free (Buckets);
end if;
Stream.Write ("</measures>");
end Write;
-- ------------------------------
-- Dump an XML result with the measures collected by the measure set.
-- ------------------------------
procedure Write (Measures : in out Measure_Set;
Title : in String;
Stream : in Ada.Text_IO.File_Type) is
Buffer : aliased Util.Streams.Buffered.Buffered_Stream;
Output : Util.Streams.Texts.Print_Stream;
begin
Buffer.Initialize (Size => 128 * 1024);
Output.Initialize (To => Buffer'Unchecked_Access);
Write (Measures, Title, Output);
Output.Flush;
Ada.Text_IO.Put_Line (Stream, Util.Streams.Texts.To_String (Buffer));
end Write;
-- ------------------------------
-- Dump an XML result with the measures in a file.
-- ------------------------------
procedure Write (Measures : in out Measure_Set;
Title : in String;
Path : in String) is
File : Ada.Text_IO.File_Type;
begin
Ada.Text_IO.Create (File => File, Name => Path);
Write (Measures, Title, File);
Ada.Text_IO.Close (File);
exception
when others =>
if Ada.Text_IO.Is_Open (File) then
Ada.Text_IO.Close (File);
end if;
raise;
end Write;
-- ------------------------------
-- Report the time spent between the stamp creation and this method call.
-- Collect the result in the per-thread measure set under the given measure
-- title.
-- ------------------------------
procedure Report (S : in out Stamp;
Title : in String;
Count : in Positive := 1) is
Measures : constant Measure_Set_Access := Task_Context.Value;
begin
if Measures /= null and then Measures.Enabled then
Report (Measures.all, S, Title, Count);
end if;
end Report;
-- ------------------------------
-- Report the time spent between the stamp creation and this method call.
-- Collect the result in the measure set under the given measure title.
-- ------------------------------
procedure Report (Measures : in out Measure_Set;
S : in out Stamp;
Title : in String;
Count : in Positive := 1) is
use Ada.Calendar;
begin
if Measures.Enabled then
declare
D : constant Duration := Ada.Calendar.Clock - S.Start;
begin
Measures.Data.Add (Title, D, Count);
end;
S.Start := Ada.Calendar.Clock;
end if;
end Report;
-- ------------------------------
-- Report the time spent between the stamp creation and this method call.
-- The report is written in the file with the given title. The duration is
-- expressed in the unit defined in <tt>Unit</tt>.
-- ------------------------------
procedure Report (S : in out Stamp;
File : in out Ada.Text_IO.File_Type;
Title : in String;
Unit : in Unit_Type := Microseconds) is
use Ada.Calendar;
D : constant Duration := Ada.Calendar.Clock - S.Start;
begin
Ada.Text_IO.Put (File, Title);
Ada.Text_IO.Put (File, Format (D, Unit));
S.Start := Ada.Calendar.Clock;
end Report;
protected body Measure_Data is
-- ------------------------------
-- Get the measures and clear to start a new set of measures.
-- Return in <b>Time_Start</b> and <b>Time_End</b> the period of time.
-- ------------------------------
procedure Steal_Map (Result : out Buckets_Access;
Time_Start : out Ada.Calendar.Time;
Time_End : out Ada.Calendar.Time) is
begin
Result := Buckets;
Time_Start := Start;
Start := Ada.Calendar.Clock;
Time_End := Start;
Buckets := null;
end Steal_Map;
-- ------------------------------
-- Add the measure
-- ------------------------------
procedure Add (Title : in String;
D : in Duration;
Count : in Positive := 1) is
use Ada.Containers;
use Ada.Calendar;
Pos : Hash_Type;
Node : Measure_Access;
begin
if Buckets = null then
Buckets := new Buckets_Type (0 .. 256);
end if;
Pos := Ada.Strings.Hash (Title) mod Buckets'Length;
Node := Buckets (Pos);
while Node /= null loop
if Node.Name'Length = Title'Length
and then Node.Name.all = Title
then
Node.Count := Node.Count + Count;
Node.Time := Node.Time + D;
return;
end if;
Node := Node.Next;
end loop;
Buckets (Pos) := new Measure '(Name => new String '(Title),
Time => D,
Count => Count,
Next => Buckets (Pos));
end Add;
end Measure_Data;
-- ------------------------------
-- Format the duration in a time in 'ns', 'us', 'ms' or seconds.
-- ------------------------------
function Format (D : in Duration) return String is
begin
if D < 0.000_001 then
return Duration'Image (D * 1_000_000_000) (1 .. 6) & " ns";
elsif D < 0.001 then
return Duration'Image (D * 1_000_000) (1 .. 6) & " us";
elsif D < 1.0 then
return Duration'Image (D * 1_000) (1 .. 6) & " ms";
else
return Duration'Image (D) (1 .. 6) & " s";
end if;
end Format;
-- ------------------------------
-- Format the duration in a time in 'ns', 'us', 'ms' or seconds.
-- ------------------------------
function Format (D : in Duration;
Unit : in Unit_Type) return String is
begin
case Unit is
when Seconds =>
return Duration'Image (D);
when Milliseconds =>
return Duration'Image (D * 1_000);
when Microseconds =>
return Duration'Image (D * 1_000_000);
when Nanoseconds =>
return Duration'Image (D * 1_000_000_000);
end case;
end Format;
-- ------------------------------
-- Finalize the measures and release the storage.
-- ------------------------------
overriding
procedure Finalize (Measures : in out Measure_Set) is
Buckets : Buckets_Access;
TS, TE : Ada.Calendar.Time;
begin
-- When deleting the measure set, we have to release the buckets and measures
-- that were allocated. We could call <b>Write</b> but we don't know where
-- the measures have to be written.
Measures.Data.Steal_Map (Buckets, TS, TE);
if Buckets /= null then
for I in Buckets'Range loop
declare
Next : Measure_Access;
Node : Measure_Access := Buckets (I);
begin
while Node /= null loop
Free (Node.Name);
Next := Node.Next;
Free (Node);
Node := Next;
end loop;
end;
end loop;
Free (Buckets);
end if;
end Finalize;
end Util.Measures;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 1,657 | adb | with Ada.Real_Time; use Ada.Real_Time;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.TIM; use STM32_SVD.TIM;
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32GD.Timer is
Timer_Callback : Callback_Type := null;
Frequency : constant Natural := 1_000;
CK_INT : constant Natural := 8_000_000;
Repeat : Boolean;
First : Boolean;
procedure Start (Time : Time_Span; Callback : Callback_Type);
protected body IRQ_Handler is
procedure Handler is
begin
Timer.SR.UIF := 0;
if Timer_Callback /= null then
if not First then
if not Repeat then
Stop;
end if;
Timer_Callback.all;
else
First := False;
end if;
end if;
end Handler;
end IRQ_Handler;
procedure Init is
begin
Timer.PSC.PSC := UInt16 (CK_INT / Frequency);
Timer.CR1.ARPE := 1;
end Init;
procedure Start (Time : Time_Span; Callback : Callback_Type) is
MS : UInt16;
begin
MS := UInt16 (To_Duration (Time) * 1_000);
Timer_Callback := Callback;
First := True;
Timer.CNT.CNT := 0;
Timer.ARR.ARR := MS;
Timer.CR1.CEN := 1;
end Start;
procedure Stop is
begin
Timer.CR1.CEN := 0;
Timer.DIER.UIE := 0;
end Stop;
procedure After (Time : Time_Span; Callback : Callback_Type) is
begin
Repeat := False;
Start (Time, Callback);
end After;
procedure Every (Interval : Time_Span; Callback : Callback_Type) is
begin
Repeat := True;
Start (Interval, Callback);
end Every;
end STM32GD.Timer;
|
charlie5/lace | Ada | 9,724 | adb | with
physics.Model,
Physics,
openGL.Model.terrain,
openGL.IO,
ada.unchecked_Deallocation,
ada.unchecked_Conversion;
package body gel.Terrain
is
type Heightfield_view is access all physics.Heightfield;
type height_Map_view is access all opengl.height_Map;
type height_map_Grid is array (math.Index range <>,
math.Index range <>) of height_Map_view;
function Width (Self : in opengl.height_Map) return math.Real
is
begin
return math.Real (self'Length (2) - 1);
end Width;
function Depth (Self : in opengl.height_Map) return math.Real
is
begin
return math.Real (self'Length (1) - 1);
end Depth;
function new_Terrain (World : in gel.World.view;
heights_File : in String;
texture_File : in String := "";
Scale : in math.Vector_3 := (1.0, 1.0, 1.0)) return access gel.Sprite.Grid
is
use Math;
the_Pixels : opengl.IO.height_Map_view := opengl.IO.to_height_Map (openGL.to_Asset (heights_File));
tile_Width : constant Positive := 8 * 32 - 1;
tile_Depth : constant Positive := 8 * 32 - 1;
total_Width : constant Real := Real (the_Pixels'Length (2) - 1) * Scale (1);
total_Depth : constant Real := Real (the_Pixels'Length (1) - 1) * Scale (3);
base_Centre : constant Vector_3 := (0.0, 0.0, 0.0);
function Grid_last (total_Size, tile_Size : in Positive) return math.Index
is
Last : constant math.Index := math.Index ( 1
+ (total_Size - 1) / tile_Size);
begin
return Last;
end Grid_last;
the_heightmap_Grid : height_map_Grid (1 .. Grid_last (the_Pixels'Length (1), tile_Depth),
1 .. Grid_last (the_Pixels'Length (2), tile_Width));
the_Sprite_Grid : constant gel.Sprite.Grid_view := new gel.Sprite.Grid (the_heightmap_Grid'Range (1),
the_heightmap_Grid'Range (2));
procedure free is new ada.unchecked_Deallocation (opengl.height_Map,
opengl.IO.height_Map_view);
procedure flip (Self : opengl.IO.height_Map_view)
is
use type opengl.Index_t;
the_Map : opengl.IO.height_Map_view := new opengl.height_Map' (Self.all);
begin
for Row in Self'Range (1)
loop
for Col in Self'Range (2)
loop
Self (Row, Col) := the_Map (Self'Last (1) - Row + 1, Col);
end loop;
end loop;
free (the_Map);
end flip;
begin
flip (the_Pixels.all'unchecked_Access);
-- Create each grid elements 'heightmap'.
--
declare
use openGL;
row_First, row_Last,
col_First, col_Last : math.Index; -- Row and col ranges for each sub-matrix.
begin
for Row in the_sprite_Grid'Range (1)
loop
row_First := math.Index (tile_Depth - 1) * (Row - 1) + 1;
row_Last := math.Index'Min (row_First + math.Index (tile_Depth - 1),
math.Index (the_Pixels'Last (1)));
for Col in the_sprite_Grid'Range (2)
loop
col_First := math.Index (tile_Width - 1) * (Col - 1) + 1;
col_Last := math.Index'Min (col_First + math.Index (tile_Width - 1),
math.Index (the_Pixels'Last (2)));
the_heightmap_Grid (Row, Col)
:= new opengl.height_Map' (Region (the_Pixels.all, (Index_t (row_First), Index_t (row_Last)),
(Index_t (col_First), Index_t (col_Last))));
end loop;
end loop;
end;
-- Create the Sprite for each grid element.
--
declare
site_X_offset,
site_Z_offset : Real := 0.0;
site_Y_Offset : Real;
tile_X_Offset : Real := 0.0;
tile_Z_Offset : Real := total_Depth;
tile_X_Scale : Real;
tile_Z_Scale : Real;
begin
for Row in the_sprite_Grid'Range (1)
loop
site_X_offset := 0.0;
tile_X_Offset := 0.0;
tile_Z_Offset := tile_Z_Offset - Depth (the_heightmap_Grid (Row, 1).all) * Scale (3);
for Col in the_sprite_Grid'Range (2)
loop
tile_Z_Scale := Depth (the_heightmap_Grid (Row, 1).all) / total_Depth;
tile_X_Scale := Width (the_heightmap_Grid (Row, Col).all) / total_Width;
declare
the_Region : constant height_Map_view := the_heightmap_Grid (Row, Col);
the_height_Range : constant opengl.Vector_2 := openGL.height_Extent (the_Region.all);
Tiling : constant opengl.texture_Transform_2d
:= (S => (opengl.Real (tile_X_Offset / total_Width) / opengl.Real (tile_X_Scale * Scale (1)),
opengl.Real (tile_X_Scale * Scale (1))),
T => (opengl.Real (tile_Z_Offset / total_Depth) / opengl.Real (tile_Z_Scale * Scale (3)),
opengl.Real (tile_Z_Scale * Scale (3))));
the_ground_Model : constant access openGL.Model.terrain.item
:= openGL.Model.terrain.new_Terrain (heights_Asset => openGL.to_Asset (heights_File),
Row => Row,
Col => Col,
Heights => the_Region.all'Access,
color_Map => openGL.to_Asset (texture_File),
Tiling => Tiling);
function to_Physics is new ada.unchecked_Conversion (height_Map_view,
Heightfield_view);
the_ground_physics_Model : constant physics.Model.view
:= new physics.Model.item' (Id => physics.null_model_Id,
-- Site => Origin_3d,
Scale => Scale,
shape_Info => (physics.Model.Heightfield,
Heights => to_Physics (the_Region),
height_range => (the_height_Range (1),
the_height_Range (2))),
Shape => null,
Mass => 0.0,
Friction => 0.5,
Restitution => 0.5,
is_Tangible => True);
the_height_Extents : constant opengl.Vector_2 := opengl.height_Extent (the_Region.all);
the_Sprite : gel.Sprite.view renames the_sprite_Grid (Row, Col);
the_Site : vector_3;
begin
-- the_ground_Model.Scale := (Scale (1),
-- Scale (2),
-- Scale (3));
the_Site := (0.0, 0.0, 0.0);
the_Sprite := gel.Sprite.Forge.new_Sprite ("Terrain" & Row'Image & Col'Image,
sprite.World_view (World),
the_Site,
the_ground_Model,
the_ground_physics_Model,
owns_Graphics => True,
owns_Physics => True);
site_y_Offset := math.Real ( the_height_Extents (1)
+ (the_height_Extents (2) - the_height_Extents (1)) / 2.0);
-- the_sprite_Grid (Row, Col).Site_is (the_Site + base_Centre);
the_Sprite. Site_is (the_Site + base_Centre);
the_Sprite.Scale_is (Scale);
tile_X_Offset := tile_X_Offset + Width (the_heightmap_Grid (Row, Col).all) * Scale (1);
if Col /= the_sprite_Grid'Last (2)
then
site_X_offset := site_X_offset
+ Width (the_heightmap_Grid (Row, Col ).all) * Scale (1) / 2.0
+ Width (the_heightmap_Grid (Row, Col + 1).all) * Scale (1) / 2.0;
end if;
end;
end loop;
if Row /= the_sprite_Grid'Last (1)
then
site_Z_offset := site_Z_offset + Depth (the_heightmap_Grid (Row, 1).all) * Scale (3) / 2.0
+ Depth (the_heightmap_Grid (Row + 1, 1).all) * Scale (3) / 2.0;
end if;
end loop;
end;
free (the_Pixels);
return the_Sprite_Grid;
end new_Terrain;
end gel.Terrain;
|
twdroeger/ada-awa | Ada | 5,111 | ads | -----------------------------------------------------------------------
-- awa-counters --
-- Copyright (C) 2015, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO.Objects;
with ADO.Schemas;
with Util.Strings;
with AWA.Index_Arrays;
-- = Counters Module =
-- The `Counters` module defines a general purpose counter service that allows to
-- associate counters to database entities. For example it can be used to track the number
-- of times a blog post or a wiki page is accessed. The `Counters` module maintains the
-- counters in a table on a per-day and per-entity basis. It allows to update the full counter
-- in the target database entity table.
--
-- @include awa-counters-modules.ads
-- @include counters.xml
--
-- == Counter Declaration ==
-- Each counter must be declared by instantiating the `Definition` package.
-- This instantiation serves as identification of the counter and it defines the database
-- table as well as the column in that table that will hold the total counter. The following
-- definition is used for the read counter of a wiki page. The wiki page table contains a
-- `read_count` column and it will be incremented each time the counter is incremented.
--
-- with AWA.Counters.Definition;
-- ...
-- package Read_Counter is
-- new AWA.Counters.Definition (AWA.Wikis.Models.WIKI_PAGE_TABLE, "read_count");
--
-- When the database table does not contain any counter column, the column field name is not
-- given and the counter definition is defined as follows:
--
-- with AWA.Counters.Definition;
-- ...
-- package Login_Counter is
-- new AWA.Counters.Definition (AWA.Users.Models.USER_PAGE_TABLE);
--
-- Sometimes a counter is not associated with any database entity. Such counters are global
-- and they are assigned a unique name.
--
-- with AWA.Counters.Definition;
-- ...
-- package Start_Counter is
-- new AWA.Counters.Definition (null, "startup_counter");
--
-- == Incrementing the counter ==
-- Incrementing the counter is done by calling the `Increment` operation.
-- When the counter is associated with a database entity, the entity primary key must be given.
-- The counter is not immediately incremented in the database so that several calls to the
-- `Increment` operation will not trigger a database update.
--
-- with AWA.Counters;
-- ...
-- AWA.Counters.Increment (Counter => Read_Counter.Counter, Key => Id);
--
-- A global counter is also incremented by using the `Increment` operation.
--
-- with AWA.Counters;
-- ...
-- AWA.Counters.Increment (Counter => Start_Counter.Counter);
--
-- @include awa-counters-beans.ads
-- @include awa-counters-components.ads
--
-- == Data model ==
-- The `Counters` module has a simple database model which needs two tables.
-- The `Counter_Definition` table is used to keep track of the different counters
-- used by the application. A row in that table is created for each counter declared by
-- instantiating the `Definition` package. The `Counter` table holds the counters
-- for each database entity and for each day. By looking at that table, it becomes possible
-- to look at the daily access or usage of the counter.
--
-- [images/awa_counters_model.png]
--
package AWA.Counters is
type Counter_Index_Type is new Natural;
-- Increment the counter identified by <tt>Counter</tt> and associated with the
-- database object <tt>Object</tt>.
procedure Increment (Counter : in Counter_Index_Type;
Object : in ADO.Objects.Object_Ref'Class);
-- Increment the counter identified by <tt>Counter</tt> and associated with the
-- database object key <tt>Key</tt>.
procedure Increment (Counter : in Counter_Index_Type;
Key : in ADO.Objects.Object_Key);
-- Increment the global counter identified by <tt>Counter</tt>.
procedure Increment (Counter : in Counter_Index_Type);
private
type Counter_Def is record
Table : ADO.Schemas.Class_Mapping_Access;
Field : Util.Strings.Name_Access;
end record;
function "=" (Left, Right : in Counter_Def) return Boolean;
function "<" (Left, Right : in Counter_Def) return Boolean;
function "&" (Left : in String;
Right : in Counter_Def) return String;
package Counter_Arrays is new AWA.Index_Arrays (Counter_Index_Type, Counter_Def);
end AWA.Counters;
|
stcarrez/ada-security | Ada | 2,814 | adb | -----------------------------------------------------------------------
-- security-auth-oauth-github -- Github OAuth based authentication
-- Copyright (C) 2020, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Util.Http.Clients;
with Util.Properties.JSON;
package body Security.Auth.OAuth.Github is
use Util.Log;
Log : constant Loggers.Logger := Util.Log.Loggers.Create ("Security.Auth.OAuth.Github");
-- ------------------------------
-- Verify the OAuth access token and retrieve information about the user.
-- ------------------------------
overriding
procedure Verify_Access_Token (Realm : in Manager;
Assoc : in Association;
Request : in Parameters'Class;
Token : in Security.OAuth.Clients.Access_Token_Access;
Result : in out Authentication) is
pragma Unreferenced (Assoc, Request);
URI : constant String := "https://api.github.com/user";
Http : Util.Http.Clients.Client;
Reply : Util.Http.Clients.Response;
Props : Util.Properties.Manager;
begin
Http.Add_Header ("Authorization", "token " & Token.Get_Name);
Http.Get (URI, Reply);
if Reply.Get_Status /= Util.Http.SC_OK then
Log.Warn ("Cannot retrieve Github user information");
Set_Result (Result, INVALID_SIGNATURE, "invalid access token");
return;
end if;
Util.Properties.JSON.Parse_JSON (Props, Reply.Get_Body);
Result.Identity := Realm.Issuer;
Append (Result.Identity, "/");
Append (Result.Identity, String '(Props.Get ("id")));
Result.Claimed_Id := Result.Identity;
Result.First_Name := To_Unbounded_String (Props.Get ("name"));
Result.Full_Name := To_Unbounded_String (Props.Get ("name"));
-- The email is optional and depends on the scope.
Result.Email := To_Unbounded_String (Props.Get ("email"));
Set_Result (Result, AUTHENTICATED, "authenticated");
end Verify_Access_Token;
end Security.Auth.OAuth.Github;
|
reznikmm/matreshka | Ada | 4,801 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Db_Component_Collection_Elements;
package Matreshka.ODF_Db.Component_Collection_Elements is
type Db_Component_Collection_Element_Node is
new Matreshka.ODF_Db.Abstract_Db_Element_Node
and ODF.DOM.Db_Component_Collection_Elements.ODF_Db_Component_Collection
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Component_Collection_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Db_Component_Collection_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Db_Component_Collection_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Db_Component_Collection_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Db_Component_Collection_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Db.Component_Collection_Elements;
|
Tim-Tom/project-euler | Ada | 1,563 | adb | with Ada.Text_IO;
with Ada.Integer_Text_IO;
package body Problem_34 is
package IO renames Ada.Text_IO;
package I_IO renames Ada.Integer_Text_IO;
function Factorial(n: Integer) return Integer is
product : Integer := 1;
begin
for i in 2 .. n loop
product := product * i;
end loop;
return product;
end Factorial;
procedure Solve is
subtype Digit is Integer range 0 .. 9;
facts : constant Array(Digit) of Integer := (Factorial(0), Factorial(1),
Factorial(2), Factorial(3),
Factorial(4), Factorial(5),
Factorial(6), Factorial(7),
Factorial(8), Factorial(9));
function Fact_Sum(n : Integer) return Integer is
part_n : Integer := n;
modulo : Digit;
sum : Integer := 0;
begin
loop
modulo := part_n mod 10;
part_n := part_n / 10;
sum := sum + Factorial(modulo);
exit when part_n = 0;
end loop;
return sum;
end Fact_Sum;
total_sum : Integer := 0;
begin
for num in 3 .. 7*facts(9) loop
declare
sum : constant Integer := fact_sum(num);
begin
if sum = num then
total_sum := total_sum + num;
end if;
end;
end loop;
I_IO.Put(total_sum);
IO.New_Line;
end Solve;
end Problem_34;
|
ohenley/awt | Ada | 5,098 | adb | with Ada.Text_IO;
with GL.Types;
with Orka.Logging;
with Orka.Resources.Locations.Directories;
with Orka.Rendering.Programs.Modules;
with Orka.Rendering.Drawing;
with Orka.Windows;
with AWT.Drag_And_Drop;
package body Package_Test is
use all type Orka.Logging.Source;
use all type Orka.Logging.Severity;
use Orka.Logging;
package Messages is new Orka.Logging.Messages (Window_System);
protected body Dnd_Signal is
procedure Set is
begin
Dropped := True;
end Set;
entry Wait when Dropped is
begin
Dropped := False;
end Wait;
end Dnd_Signal;
overriding
function On_Close (Object : Test_Window) return Boolean is
begin
Ada.Text_IO.Put_Line ("Test_Window.On_Close");
return True;
end On_Close;
overriding
procedure On_Drag
(Object : in out Test_Window;
X, Y : AWT.Inputs.Fixed)
is
use all type AWT.Inputs.Action_Kind;
use type AWT.Inputs.Fixed;
begin
Messages.Log (Debug, "user dragged at " & X'Image & Y'Image);
AWT.Drag_And_Drop.Set_Action (if X < 300.0 and Y < 300.0 then Copy else None);
end On_Drag;
overriding
procedure On_Drop
(Object : in out Test_Window)
is
use all type AWT.Inputs.Action_Kind;
Action : constant AWT.Inputs.Action_Kind := AWT.Drag_And_Drop.Valid_Action;
begin
Messages.Log (Info, "user dropped! action: " & Action'Image);
if Action /= None then
Dnd_Signal.Set;
end if;
end On_Drop;
overriding
procedure On_Configure
(Object : in out Test_Window;
State : Standard.AWT.Windows.Window_State) is
begin
Ada.Text_IO.Put_Line ("Configure xdg_surface:" &
State.Width'Image & State.Height'Image & State.Margin'Image);
Object.Resize := State.Visible and State.Width > 0 and State.Height > 0;
end On_Configure;
procedure Post_Initialize (Object : in out Test_Window) is
Location_Shaders : constant Orka.Resources.Locations.Location_Ptr :=
Orka.Resources.Locations.Directories.Create_Location ("./");
Alpha : constant GL.Types.Single := (if Object.State.Transparent then 0.5 else 1.0);
begin
Object.FB := Orka.Rendering.Framebuffers.Get_Default_Framebuffer (Object);
Object.FB.Set_Default_Values ((Color => (0.0, 0.0, 0.0, Alpha), others => <>));
Object.FB.Use_Framebuffer;
Messages.Log (Debug, "FB default window: " & Object.Width'Image & Object.Height'Image);
Object.Program := Orka.Rendering.Programs.Create_Program
(Orka.Rendering.Programs.Modules.Create_Module
(Location_Shaders,
VS => "cursor.vert",
FS => "cursor.frag"));
Object.Program.Use_Program;
Object.Cursor := Object.Program.Uniform ("cursor");
end Post_Initialize;
procedure Render (Object : in out Test_Window) is
use type GL.Types.Single;
use Standard.AWT.Inputs;
Window_State : constant Standard.AWT.Windows.Window_State := Object.State;
Pointer_State : constant Standard.AWT.Inputs.Pointer_State := Object.State;
subtype Single is GL.Types.Single;
Width : constant Single := Single (Window_State.Width + 2 * Window_State.Margin);
Height : constant Single := Single (Window_State.Height + 2 * Window_State.Margin);
PX : constant Single := Single (Pointer_State.Position (X));
PY : constant Single := Single (Pointer_State.Position (Y));
Horizontal : constant GL.Types.Single := PX / Width * 2.0 - 1.0;
Vertical : constant GL.Types.Single := PY / Height * 2.0 - 1.0;
Alpha : constant GL.Types.Single := (if Window_State.Transparent then 0.5 else 1.0);
begin
-- Messages.Log (Debug, PX'Image & Width'Image & Horizontal'Image);
if Object.Resize then
Object.Resize := False;
Object.FB := Orka.Rendering.Framebuffers.Get_Default_Framebuffer (Object);
Object.FB.Set_Default_Values ((Color => (0.0, 0.0, 0.0, Alpha), others => <>));
Object.FB.Use_Framebuffer;
Messages.Log (Debug, "FB default window, new size: " &
Object.Width'Image & Object.Height'Image);
end if;
Object.FB.Clear ((Color => True, others => False));
Object.Cursor.Set_Vector (GL.Types.Single_Array'(Horizontal, -Vertical));
Orka.Rendering.Drawing.Draw (GL.Types.Points, 0, 1);
Object.Swap_Buffers;
end Render;
overriding
function Create_Window
(Context : Orka.Contexts.Surface_Context'Class;
Width, Height : Positive;
Title : String := "";
Samples : Natural := 0;
Visible, Resizable : Boolean := True;
Transparent : Boolean := False) return Test_Window is
begin
return Result : constant Test_Window :=
(Orka.Contexts.EGL.AWT.Create_Window
(Context, Width, Height, Title, Samples,
Visible => Visible,
Resizable => Resizable,
Transparent => Transparent) with others => <>);
end Create_Window;
end Package_Test;
|
persan/AdaYaml | Ada | 1,650 | adb | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Text_IO;
with Ada.Command_Line;
with Yaml.Source.Text_IO;
with Yaml.Source.File;
with Yaml.Stream_Concept;
with Yaml.Parser.Stream;
with Yaml.Presenter;
with Yaml.Destination.Text_IO;
with Yaml.Source;
with Yaml.Transformator.Annotation_Processor;
with Yaml.Transformator.Canonical;
with Yaml.Transformation;
procedure Yaml.Transform is
package Parser_Transformation is new Transformation (Parser.Stream);
package Transformation_Stream is new Stream_Concept
(Parser_Transformation.Instance, Parser_Transformation.Reference,
Parser_Transformation.Accessor, Parser_Transformation.Value,
Parser_Transformation.Next);
Input : Source.Pointer;
P : constant Parser.Reference := Parser.New_Parser;
Trans : Parser_Transformation.Instance := Parser_Transformation.Transform (P);
Pres : Presenter.Instance;
procedure Consume_Canonical is new
Presenter.Consume (Transformation_Stream);
begin
if Ada.Command_Line.Argument_Count = 0 then
Input := Source.Text_IO.As_Source (Ada.Text_IO.Standard_Input);
else
Input := Source.File.As_Source (Ada.Command_Line.Argument (1));
end if;
P.Value.Set_Input (Input);
Trans.Append (Transformator.Annotation_Processor.New_Processor (P.Value.Pool));
Trans.Append (new Transformator.Canonical.Instance);
Pres.Configure (Presenter.Default_Line_Length, Presenter.Canonical);
Pres.Set_Output (Destination.Text_IO.As_Destination (Ada.Text_IO.Standard_Output));
Consume_Canonical (Pres, Trans);
end Yaml.Transform;
|
charlie5/lace | Ada | 2,319 | adb | with
openGL.Visual,
openGL.Model.Billboard. textured,
openGL.Model.Billboard.colored_textured,
openGL.Palette,
openGL.Demo;
procedure launch_render_Billboards
--
-- Exercise the render of billboard models.
--
is
use openGL,
openGL.Model,
openGL.Math,
openGL.linear_Algebra_3d;
the_Texture : constant openGL.asset_Name := to_Asset ("assets/opengl/texture/Face1.bmp");
begin
Demo.print_Usage;
Demo.define ("openGL 'Render Billboards' Demo");
Demo.Camera.Position_is ([0.0, 0.0, 10.0],
y_Rotation_from (to_Radians (0.0)));
declare
-- The Models.
--
the_Billboard_Model : constant Model.Billboard.textured.view
:= Model.Billboard.textured.forge.new_Billboard (--Scale => (1.0, 1.0, 1.0),
Plane => Billboard.xy,
Texture => the_Texture);
the_colored_Billboard_Model : constant Model.Billboard.colored_textured.view
:= Model.Billboard.colored_textured.new_Billboard (--Scale => (1.0, 1.0, 1.0),
Plane => Billboard.xy,
Color => (Palette.Green, Opaque),
Texture => the_Texture);
-- The Sprites.
--
use openGL.Visual.Forge;
the_Sprites : constant openGL.Visual.views := [new_Visual ( the_Billboard_Model.all'Access),
new_Visual (the_colored_Billboard_Model.all'Access)];
begin
the_Sprites (2).Site_is ([3.0, 0.0, 0.0]);
-- Main loop.
--
while not Demo.Done
loop
-- Handle user commands.
--
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
-- Render the sprites.
--
Demo.Camera.render (the_Sprites);
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
Demo.FPS_Counter.increment; -- Frames per second display.
end loop;
end;
Demo.destroy;
end launch_render_Billboards;
|
LiberatorUSA/GUCEF | Ada | 7,641 | ads | with Agar.Core.Thin;
with Agar.Core.Data_Source;
with Interfaces;
package Agar.Core.Object is
subtype Object_Access_t is Thin.Object.Object_Access_t;
subtype Object_Not_Null_Access_t is Thin.Object.Object_Not_Null_Access_t;
subtype Object_Header_Access_t is Thin.Object.Object_Header_Access_t;
subtype Object_Header_Not_Null_Access_t is Thin.Object.Object_Header_Not_Null_Access_t;
subtype Class_Access_t is Thin.Object.Class_Access_t;
subtype Class_Not_Null_Access_t is Thin.Object.Class_Not_Null_Access_t;
subtype Dependency_Access_t is Thin.Object.Dependency_Access_t;
subtype Dependency_Not_Null_Access_t is Thin.Object.Dependency_Not_Null_Access_t;
--
--
--
function New_Object
(Parent : in Object_Access_t;
Name : in String;
Object_Class : in Class_Not_Null_Access_t) return Object_Access_t;
procedure Init
(Object : in Object_Not_Null_Access_t;
Object_Class : in Class_Not_Null_Access_t)
renames Thin.Object.Init;
procedure Init_Static
(Object : in Object_Not_Null_Access_t;
Object_Class : in Class_Not_Null_Access_t)
renames Thin.Object.Init_Static;
procedure Attach
(New_Parent : in Object_Access_t;
Object : in Object_Not_Null_Access_t)
renames Thin.Object.Attach;
procedure Attach_To_Named
(VFS_Root : in Object_Not_Null_Access_t;
Path : in String;
Child : in Object_Access_t);
procedure Detach
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Detach;
procedure Move_To_Head
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Move_To_Head;
procedure Move_To_Tail
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Move_To_Tail;
procedure Move_Up
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Move_Up;
procedure Move_Down
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Move_Down;
procedure Delete
(Object : in Object_Not_Null_Access_t)
renames Thin.Object.Delete;
function Root (Object : in Object_Not_Null_Access_t)
return Object_Not_Null_Access_t
renames Thin.Object.Root;
function Parent (Object : in Object_Not_Null_Access_t)
return Object_Access_t renames Thin.Object.Parent;
function Find
(VFS_Root : in Object_Not_Null_Access_t;
Pattern : in String) return Object_Access_t;
function Find_Parent
(VFS_Root : in Object_Not_Null_Access_t;
Name : in String;
Object_Type : in String) return Object_Access_t;
function Find_Child
(VFS_Root : in Object_Not_Null_Access_t;
Name : in String) return Object_Access_t;
-- XXX: Semantics?
procedure Copy_Name
(Object : in Object_Not_Null_Access_t;
Path : out String;
Used : out Natural);
procedure Lock (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Lock;
procedure Unlock (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Unlock;
procedure Lock_VFS (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Lock_VFS;
procedure Unlock_VFS (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Unlock_VFS;
procedure Set_Name
(Object : in Object_Not_Null_Access_t;
Name : in String);
-- XXX: Semantics?
-- procedure Generate_Name
-- (Object : in Object_Not_Null_Access_t;
-- Object_Class : in Class_Not_Null_Access_t;
-- Buffer : in String);
-- procedure Generate_Name_Prefixed
-- (Object : in Object_Not_Null_Access_t;
-- Prefix : in String;
-- Buffer : out String;
-- Size : out Natural);
-- FIXME : AG_ObjectSetDebugFn
procedure Register_Class
(Object_Class : Class_Not_Null_Access_t)
renames Thin.Object.Register_Class;
procedure Unregister_Class
(Object_Class : Class_Not_Null_Access_t)
renames Thin.Object.Unregister_Class;
procedure Register_Namespace
(Name : in String;
Prefix : in String;
URL : in String);
procedure Unregister_Namespace
(Name : in String);
function Lookup_Class
(Spec : in String) return Class_Access_t;
function Load_Class
(Spec : in String) return Class_Access_t;
procedure Register_Module_Directory
(Path : in String);
procedure Unregister_Module_Directory
(Path : in String);
function Is_Of_Class
(Object : in Object_Not_Null_Access_t;
Pattern : in String) return Boolean;
function Superclass
(Object : in Object_Not_Null_Access_t) return Object_Access_t
renames Thin.Object.Superclass;
function In_Use
(Object : in Object_Not_Null_Access_t) return Boolean;
function Add_Dependency
(Object : in Object_Not_Null_Access_t;
Dependency : in Object_Not_Null_Access_t;
Persistent : in Boolean) return Dependency_Access_t;
procedure Delete_Dependency
(Object : in Object_Not_Null_Access_t;
Dependency : in Object_Not_Null_Access_t)
renames Thin.Object.Delete_Dependency;
function Encode_Name
(Object : in Object_Not_Null_Access_t;
Dependency : in Object_Not_Null_Access_t) return Interfaces.Unsigned_32
renames Thin.Object.Encode_Name;
function Find_Dependency
(Object : in Object_Not_Null_Access_t;
Index : in Interfaces.Unsigned_32;
Pointer : access Object_Not_Null_Access_t) return Boolean;
procedure Destroy (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Destroy;
procedure Free_Dataset (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Dataset;
procedure Free_Events (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Events;
procedure Free_Variables (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Variables;
procedure Free_Dependencies (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Dependencies;
procedure Free_Dummy_Dependencies (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Dummy_Dependencies;
procedure Free_Children (Object : in Object_Not_Null_Access_t)
renames Thin.Object.Free_Children;
function Load (Object : in Object_Not_Null_Access_t) return Boolean;
function Load_From_File
(Object : in Object_Not_Null_Access_t;
File : in String) return Boolean;
function Load_Data (Object : in Object_Not_Null_Access_t) return Boolean;
function Load_Data_From_File
(Object : in Object_Not_Null_Access_t;
File : in String) return Boolean;
function Load_Generic (Object : in Object_Not_Null_Access_t) return Boolean;
function Load_Generic_From_File
(Object : in Object_Not_Null_Access_t;
File : in String) return Boolean;
function Save (Object : in Object_Not_Null_Access_t) return Boolean;
function Save_All (Object : in Object_Not_Null_Access_t) return Boolean;
function Save_To_File
(Object : in Object_Not_Null_Access_t;
File : in String) return Boolean;
function Serialize
(Object : in Object_Not_Null_Access_t;
Source : in Data_Source.Data_Source_Not_Null_Access_t) return Boolean;
function Unserialize
(Object : in Object_Not_Null_Access_t;
Source : in Data_Source.Data_Source_Not_Null_Access_t) return Boolean;
function Read_Header
(Object : in Object_Not_Null_Access_t;
Header : in Object_Header_Access_t) return Boolean;
function Page_In (Object : in Object_Not_Null_Access_t) return Boolean;
function Page_Out (Object : in Object_Not_Null_Access_t) return Boolean;
end Agar.Core.Object;
|
charlie5/cBound | Ada | 1,418 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_pointer_mapping_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_pointer_mapping_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_pointer_mapping_cookie_t.Item,
Element_Array => xcb.xcb_get_pointer_mapping_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_pointer_mapping_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_pointer_mapping_cookie_t.Pointer,
Element_Array => xcb.xcb_get_pointer_mapping_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_pointer_mapping_cookie_t;
|
twdroeger/ada-awa | Ada | 5,475 | ads | -----------------------------------------------------------------------
-- awa-storages -- Storage module
-- Copyright (C) 2012, 2015, 2016, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Finalization;
with ADO;
-- = Storages Module =
-- The `Storages` module provides a set of storage services allowing an application
-- to store data files, documents, images in a persistent area. The persistent store can
-- be on a file system, in the database or provided by a remote service such as
-- Amazon Simple Storage Service.
--
-- == Creating a storage ==
-- A data in the storage is represented by a `Storage_Ref` instance. The data itself
-- can be physically stored in a file system (`FILE` mode), in the database (`DATABASE`
-- mode) or on a remote server (`URL` mode). To put a file in the storage space, first create
-- the storage object instance:
--
-- Data : AWA.Storages.Models.Storage_Ref;
--
-- Then setup the storage mode that you want. The storage service uses this information
-- to save the data in a file, in the database or in a remote service (in the future).
-- To save a file in the store, we can use the `Save` operation of the storage service.
-- It will read the file and put in in the corresponding persistent store (the database
-- in this example).
--
-- Service.Save (Into => Data, Path => Path_To_The_File,
-- Storage => AWA.Storages.Models.DATABASE);
--
-- Upon successful completion, the storage instance `Data` will be allocated a unique
-- identifier that can be retrieved by `Get_Id` or `Get_Key`.
--
-- == Getting the data ==
-- Several operations are defined to retrieve the data. Each of them has been designed
-- to optimize the retrieval and
--
-- * The data can be retrieved in a local file.
-- This mode is useful if an external program must be launched and be able to read
-- the file. If the storage mode of the data is `FILE`, the path of the file on
-- the storage file system is used. For other storage modes, the file is saved
-- in a temporary file. In that case the `Store_Local` database table is used
-- to track such locally saved data.
--
-- * The data can be returned as a stream.
-- When the application has to read the data, opening a read stream connection is
-- the most efficient mechanism.
--
-- == Local file ==
-- To access the data by using a local file, we must define a local storage reference:
--
-- Data : AWA.Storages.Models.Store_Local_Ref;
--
-- and use the `Load` operation with the storage identifier. When loading locally we
-- also indicate whether the file will be read or written. A file that is in `READ` mode
-- can be shared by several tasks or processes. A file that is in `WRITE` mode will have
-- a specific copy for the caller. An optional expiration parameter indicate when the
-- local file representation can expire.
--
-- Service.Load (From => Id, Into => Data, Mode => READ, Expire => ONE_DAY);
--
-- Once the load operation succeeded, the data is stored on the file system and
-- the local path is obtained by using the `Get_Path` operation:
--
-- Path : constant String := Data.Get_Path;
--
-- @include awa-storages-modules.ads
-- @include awa-storages-services.ads
--
-- == Ada Beans ==
-- @include-bean storages.xml
-- @include-bean storage-list.xml
-- @include-bean folder-queries.xml
-- @include-bean storage-queries.xml
--
-- @include awa-storages-servlets.ads
--
-- == Queries ==
-- @include-query storage-list.xml
-- @include-query folder-queries.xml
-- @include-query storage-queries.xml
--
-- == Data model ==
-- [images/awa_storages_model.png]
--
package AWA.Storages is
type Storage_Type is (DATABASE, FILE, URL, CACHE, TMP);
type Storage_File (Storage : Storage_Type) is tagged limited private;
-- Get the path to get access to the file.
function Get_Path (File : in Storage_File) return String;
-- Set the file path for the FILE, URL, CACHE or TMP storage.
procedure Set (File : in out Storage_File;
Path : in String);
-- Set the file database storage identifier.
procedure Set (File : in out Storage_File;
Workspace : in ADO.Identifier;
Store : in ADO.Identifier);
private
type Storage_File (Storage : Storage_Type) is limited
new Ada.Finalization.Limited_Controlled with record
case Storage is
when DATABASE =>
Workspace : ADO.Identifier;
Store : ADO.Identifier;
when FILE | URL | CACHE | TMP =>
Path : Ada.Strings.Unbounded.Unbounded_String;
end case;
end record;
overriding
procedure Finalize (File : in out Storage_File);
end AWA.Storages;
|
Fabien-Chouteau/samd51-hal | Ada | 69,757 | ads | -- ============================================================================
-- Atmel Microcontroller Software Support
-- ============================================================================
-- Copyright (c) 2017 Atmel Corporation,
-- a wholly owned subsidiary of Microchip Technology Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the Licence at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- ============================================================================
-- This spec has been automatically generated from ATSAMD51J19A.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package SAM_SVD.TC is
pragma Preelaborate;
---------------
-- Registers --
---------------
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- Timer Counter Mode
type CTRLA_MODESelect is
(-- Counter in 16-bit mode
Count16,
-- Counter in 8-bit mode
Count8,
-- Counter in 32-bit mode
Count32)
with Size => 2;
for CTRLA_MODESelect use
(Count16 => 0,
Count8 => 1,
Count32 => 2);
-- Prescaler and Counter Synchronization
type CTRLA_PRESCSYNCSelect is
(-- Reload or reset the counter on next generic clock
Gclk,
-- Reload or reset the counter on next prescaler clock
Presc,
-- Reload or reset the counter on next generic clock and reset the prescaler
-- counter
Resync)
with Size => 2;
for CTRLA_PRESCSYNCSelect use
(Gclk => 0,
Presc => 1,
Resync => 2);
-- Prescaler
type CTRLA_PRESCALERSelect is
(-- Prescaler: GCLK_TC
Div1,
-- Prescaler: GCLK_TC/2
Div2,
-- Prescaler: GCLK_TC/4
Div4,
-- Prescaler: GCLK_TC/8
Div8,
-- Prescaler: GCLK_TC/16
Div16,
-- Prescaler: GCLK_TC/64
Div64,
-- Prescaler: GCLK_TC/256
Div256,
-- Prescaler: GCLK_TC/1024
Div1024)
with Size => 3;
for CTRLA_PRESCALERSelect use
(Div1 => 0,
Div2 => 1,
Div4 => 2,
Div8 => 3,
Div16 => 4,
Div64 => 5,
Div256 => 6,
Div1024 => 7);
-- TC_CTRLA_TC_COUNT8_CAPTEN array
type TC_CTRLA_TC_COUNT8_CAPTEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT8_CAPTEN
type TC_CTRLA_TC_COUNT8_CAPTEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CAPTEN as a value
Val : HAL.UInt2;
when True =>
-- CAPTEN as an array
Arr : TC_CTRLA_TC_COUNT8_CAPTEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT8_CAPTEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- TC_CTRLA_TC_COUNT8_COPEN array
type TC_CTRLA_TC_COUNT8_COPEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT8_COPEN
type TC_CTRLA_TC_COUNT8_COPEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COPEN as a value
Val : HAL.UInt2;
when True =>
-- COPEN as an array
Arr : TC_CTRLA_TC_COUNT8_COPEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT8_COPEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Capture Mode Channel 0
type CTRLA_CAPTMODE0Select is
(-- Default capture
Default,
-- Minimum capture
Captmin,
-- Maximum capture
Captmax)
with Size => 2;
for CTRLA_CAPTMODE0Select use
(Default => 0,
Captmin => 1,
Captmax => 2);
-- Capture mode Channel 1
type CTRLA_CAPTMODE1Select is
(-- Default capture
Default,
-- Minimum capture
Captmin,
-- Maximum capture
Captmax)
with Size => 2;
for CTRLA_CAPTMODE1Select use
(Default => 0,
Captmin => 1,
Captmax => 2);
-- Control A
type TC_CTRLA_TC_COUNT8_Register is record
-- Write-only. Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- Timer Counter Mode
MODE : CTRLA_MODESelect := SAM_SVD.TC.Count16;
-- Prescaler and Counter Synchronization
PRESCSYNC : CTRLA_PRESCSYNCSelect := SAM_SVD.TC.Gclk;
-- Run during Standby
RUNSTDBY : Boolean := False;
-- Clock On Demand
ONDEMAND : Boolean := False;
-- Prescaler
PRESCALER : CTRLA_PRESCALERSelect := SAM_SVD.TC.Div1;
-- Auto Lock
ALOCK : Boolean := False;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Capture Channel 0 Enable
CAPTEN : TC_CTRLA_TC_COUNT8_CAPTEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Capture On Pin 0 Enable
COPEN : TC_CTRLA_TC_COUNT8_COPEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Capture Mode Channel 0
CAPTMODE0 : CTRLA_CAPTMODE0Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_26_26 : HAL.Bit := 16#0#;
-- Capture mode Channel 1
CAPTMODE1 : CTRLA_CAPTMODE1Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_CTRLA_TC_COUNT8_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
MODE at 0 range 2 .. 3;
PRESCSYNC at 0 range 4 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
PRESCALER at 0 range 8 .. 10;
ALOCK at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CAPTEN at 0 range 16 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
COPEN at 0 range 20 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
CAPTMODE0 at 0 range 24 .. 25;
Reserved_26_26 at 0 range 26 .. 26;
CAPTMODE1 at 0 range 27 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
-- Command
type CTRLBCLR_CMDSelect is
(-- No action
None,
-- Force a start, restart or retrigger
Retrigger,
-- Force a stop
Stop,
-- Force update of double-buffered register
Update,
-- Force a read synchronization of COUNT
Readsync,
-- One-shot DMA trigger
Dmaos)
with Size => 3;
for CTRLBCLR_CMDSelect use
(None => 0,
Retrigger => 1,
Stop => 2,
Update => 3,
Readsync => 4,
Dmaos => 5);
-- Control B Clear
type TC_CTRLBCLR_TC_COUNT8_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBCLR_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBCLR_TC_COUNT8_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Command
type CTRLBSET_CMDSelect is
(-- No action
None,
-- Force a start, restart or retrigger
Retrigger,
-- Force a stop
Stop,
-- Force update of double-buffered register
Update,
-- Force a read synchronization of COUNT
Readsync,
-- One-shot DMA trigger
Dmaos)
with Size => 3;
for CTRLBSET_CMDSelect use
(None => 0,
Retrigger => 1,
Stop => 2,
Update => 3,
Readsync => 4,
Dmaos => 5);
-- Control B Set
type TC_CTRLBSET_TC_COUNT8_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBSET_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBSET_TC_COUNT8_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Event Action
type EVCTRL_EVACTSelect is
(-- Event action disabled
Off,
-- Start, restart or retrigger TC on event
Retrigger,
-- Count on event
Count,
-- Start TC on event
Start,
-- Time stamp capture
Stamp,
-- Period catured in CC0, pulse width in CC1
Ppw,
-- Period catured in CC1, pulse width in CC0
Pwp,
-- Pulse width capture
Pw)
with Size => 3;
for EVCTRL_EVACTSelect use
(Off => 0,
Retrigger => 1,
Count => 2,
Start => 3,
Stamp => 4,
Ppw => 5,
Pwp => 6,
Pw => 7);
-- TC_EVCTRL_TC_COUNT8_MCEO array
type TC_EVCTRL_TC_COUNT8_MCEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_EVCTRL_TC_COUNT8_MCEO
type TC_EVCTRL_TC_COUNT8_MCEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MCEO as a value
Val : HAL.UInt2;
when True =>
-- MCEO as an array
Arr : TC_EVCTRL_TC_COUNT8_MCEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_EVCTRL_TC_COUNT8_MCEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type TC_EVCTRL_TC_COUNT8_Register is record
-- Event Action
EVACT : EVCTRL_EVACTSelect := SAM_SVD.TC.Off;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- TC Event Input Polarity
TCINV : Boolean := False;
-- TC Event Enable
TCEI : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Event Output Enable
OVFEO : Boolean := False;
-- unspecified
Reserved_9_11 : HAL.UInt3 := 16#0#;
-- MC Event Output Enable 0
MCEO : TC_EVCTRL_TC_COUNT8_MCEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 16,
Bit_Order => System.Low_Order_First;
for TC_EVCTRL_TC_COUNT8_Register use record
EVACT at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TCINV at 0 range 4 .. 4;
TCEI at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
OVFEO at 0 range 8 .. 8;
Reserved_9_11 at 0 range 9 .. 11;
MCEO at 0 range 12 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
end record;
-- TC_INTENCLR_TC_COUNT8_MC array
type TC_INTENCLR_TC_COUNT8_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENCLR_TC_COUNT8_MC
type TC_INTENCLR_TC_COUNT8_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENCLR_TC_COUNT8_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENCLR_TC_COUNT8_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type TC_INTENCLR_TC_COUNT8_Register is record
-- OVF Interrupt Disable
OVF : Boolean := False;
-- ERR Interrupt Disable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Disable 0
MC : TC_INTENCLR_TC_COUNT8_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENCLR_TC_COUNT8_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTENSET_TC_COUNT8_MC array
type TC_INTENSET_TC_COUNT8_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENSET_TC_COUNT8_MC
type TC_INTENSET_TC_COUNT8_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENSET_TC_COUNT8_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENSET_TC_COUNT8_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type TC_INTENSET_TC_COUNT8_Register is record
-- OVF Interrupt Enable
OVF : Boolean := False;
-- ERR Interrupt Enable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Enable 0
MC : TC_INTENSET_TC_COUNT8_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENSET_TC_COUNT8_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTFLAG_TC_COUNT8_MC array
type TC_INTFLAG_TC_COUNT8_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTFLAG_TC_COUNT8_MC
type TC_INTFLAG_TC_COUNT8_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTFLAG_TC_COUNT8_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTFLAG_TC_COUNT8_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type TC_INTFLAG_TC_COUNT8_Register is record
-- OVF Interrupt Flag
OVF : Boolean := False;
-- ERR Interrupt Flag
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Flag 0
MC : TC_INTFLAG_TC_COUNT8_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTFLAG_TC_COUNT8_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_STATUS_TC_COUNT8_CCBUFV array
type TC_STATUS_TC_COUNT8_CCBUFV_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_STATUS_TC_COUNT8_CCBUFV
type TC_STATUS_TC_COUNT8_CCBUFV_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CCBUFV as a value
Val : HAL.UInt2;
when True =>
-- CCBUFV as an array
Arr : TC_STATUS_TC_COUNT8_CCBUFV_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_STATUS_TC_COUNT8_CCBUFV_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type TC_STATUS_TC_COUNT8_Register is record
-- Read-only. Stop Status Flag
STOP : Boolean := True;
-- Read-only. Slave Status Flag
SLAVE : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Synchronization Busy Status
PERBUFV : Boolean := False;
-- Compare channel buffer 0 valid
CCBUFV : TC_STATUS_TC_COUNT8_CCBUFV_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_STATUS_TC_COUNT8_Register use record
STOP at 0 range 0 .. 0;
SLAVE at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
PERBUFV at 0 range 3 .. 3;
CCBUFV at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Waveform Generation Mode
type WAVE_WAVEGENSelect is
(-- Normal frequency
Nfrq,
-- Match frequency
Mfrq,
-- Normal PWM
Npwm,
-- Match PWM
Mpwm)
with Size => 2;
for WAVE_WAVEGENSelect use
(Nfrq => 0,
Mfrq => 1,
Npwm => 2,
Mpwm => 3);
-- Waveform Generation Control
type TC_WAVE_TC_COUNT8_Register is record
-- Waveform Generation Mode
WAVEGEN : WAVE_WAVEGENSelect := SAM_SVD.TC.Nfrq;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_WAVE_TC_COUNT8_Register use record
WAVEGEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- TC_DRVCTRL_TC_COUNT8_INVEN array
type TC_DRVCTRL_TC_COUNT8_INVEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_DRVCTRL_TC_COUNT8_INVEN
type TC_DRVCTRL_TC_COUNT8_INVEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- INVEN as a value
Val : HAL.UInt2;
when True =>
-- INVEN as an array
Arr : TC_DRVCTRL_TC_COUNT8_INVEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_DRVCTRL_TC_COUNT8_INVEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control C
type TC_DRVCTRL_TC_COUNT8_Register is record
-- Output Waveform Invert Enable 0
INVEN : TC_DRVCTRL_TC_COUNT8_INVEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DRVCTRL_TC_COUNT8_Register use record
INVEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Debug Control
type TC_DBGCTRL_TC_COUNT8_Register is record
-- Run During Debug
DBGRUN : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DBGCTRL_TC_COUNT8_Register use record
DBGRUN at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- TC_SYNCBUSY_TC_COUNT8_CC array
type TC_SYNCBUSY_TC_COUNT8_CC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_SYNCBUSY_TC_COUNT8_CC
type TC_SYNCBUSY_TC_COUNT8_CC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CC as a value
Val : HAL.UInt2;
when True =>
-- CC as an array
Arr : TC_SYNCBUSY_TC_COUNT8_CC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_SYNCBUSY_TC_COUNT8_CC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Synchronization Status
type TC_SYNCBUSY_TC_COUNT8_Register is record
-- Read-only. swrst
SWRST : Boolean;
-- Read-only. enable
ENABLE : Boolean;
-- Read-only. CTRLB
CTRLB : Boolean;
-- Read-only. STATUS
STATUS : Boolean;
-- Read-only. Counter
COUNT : Boolean;
-- Read-only. Period
PER : Boolean;
-- Read-only. Compare Channel 0
CC : TC_SYNCBUSY_TC_COUNT8_CC_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_SYNCBUSY_TC_COUNT8_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
CTRLB at 0 range 2 .. 2;
STATUS at 0 range 3 .. 3;
COUNT at 0 range 4 .. 4;
PER at 0 range 5 .. 5;
CC at 0 range 6 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture
type TC_CC_TC_COUNT8_Registers is array (0 .. 1) of HAL.UInt8;
-- COUNT8 Compare and Capture Buffer
-- COUNT8 Compare and Capture Buffer
type TC_CCBUF_TC_COUNT8_Registers is array (0 .. 1) of HAL.UInt8;
-- 8-bit Counter Mode
type TcCount8_Cluster is record
-- Control A
CTRLA : aliased TC_CTRLA_TC_COUNT8_Register;
-- Control B Clear
CTRLBCLR : aliased TC_CTRLBCLR_TC_COUNT8_Register;
-- Control B Set
CTRLBSET : aliased TC_CTRLBSET_TC_COUNT8_Register;
-- Event Control
EVCTRL : aliased TC_EVCTRL_TC_COUNT8_Register;
-- Interrupt Enable Clear
INTENCLR : aliased TC_INTENCLR_TC_COUNT8_Register;
-- Interrupt Enable Set
INTENSET : aliased TC_INTENSET_TC_COUNT8_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased TC_INTFLAG_TC_COUNT8_Register;
-- Status
STATUS : aliased TC_STATUS_TC_COUNT8_Register;
-- Waveform Generation Control
WAVE : aliased TC_WAVE_TC_COUNT8_Register;
-- Control C
DRVCTRL : aliased TC_DRVCTRL_TC_COUNT8_Register;
-- Debug Control
DBGCTRL : aliased TC_DBGCTRL_TC_COUNT8_Register;
-- Synchronization Status
SYNCBUSY : aliased TC_SYNCBUSY_TC_COUNT8_Register;
-- COUNT8 Count
COUNT : aliased HAL.UInt8;
-- COUNT8 Period
PER : aliased HAL.UInt8;
-- COUNT8 Compare and Capture
CC : aliased TC_CC_TC_COUNT8_Registers;
-- COUNT8 Period Buffer
PERBUF : aliased HAL.UInt8;
-- COUNT8 Compare and Capture Buffer
CCBUF : aliased TC_CCBUF_TC_COUNT8_Registers;
end record
with Size => 416;
for TcCount8_Cluster use record
CTRLA at 16#0# range 0 .. 31;
CTRLBCLR at 16#4# range 0 .. 7;
CTRLBSET at 16#5# range 0 .. 7;
EVCTRL at 16#6# range 0 .. 15;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
STATUS at 16#B# range 0 .. 7;
WAVE at 16#C# range 0 .. 7;
DRVCTRL at 16#D# range 0 .. 7;
DBGCTRL at 16#F# range 0 .. 7;
SYNCBUSY at 16#10# range 0 .. 31;
COUNT at 16#14# range 0 .. 7;
PER at 16#1B# range 0 .. 7;
CC at 16#1C# range 0 .. 15;
PERBUF at 16#2F# range 0 .. 7;
CCBUF at 16#30# range 0 .. 15;
end record;
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- TC_CTRLA_TC_COUNT16_CAPTEN array
type TC_CTRLA_TC_COUNT16_CAPTEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT16_CAPTEN
type TC_CTRLA_TC_COUNT16_CAPTEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CAPTEN as a value
Val : HAL.UInt2;
when True =>
-- CAPTEN as an array
Arr : TC_CTRLA_TC_COUNT16_CAPTEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT16_CAPTEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- TC_CTRLA_TC_COUNT16_COPEN array
type TC_CTRLA_TC_COUNT16_COPEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT16_COPEN
type TC_CTRLA_TC_COUNT16_COPEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COPEN as a value
Val : HAL.UInt2;
when True =>
-- COPEN as an array
Arr : TC_CTRLA_TC_COUNT16_COPEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT16_COPEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control A
type TC_CTRLA_TC_COUNT16_Register is record
-- Write-only. Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- Timer Counter Mode
MODE : CTRLA_MODESelect := SAM_SVD.TC.Count16;
-- Prescaler and Counter Synchronization
PRESCSYNC : CTRLA_PRESCSYNCSelect := SAM_SVD.TC.Gclk;
-- Run during Standby
RUNSTDBY : Boolean := False;
-- Clock On Demand
ONDEMAND : Boolean := False;
-- Prescaler
PRESCALER : CTRLA_PRESCALERSelect := SAM_SVD.TC.Div1;
-- Auto Lock
ALOCK : Boolean := False;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Capture Channel 0 Enable
CAPTEN : TC_CTRLA_TC_COUNT16_CAPTEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Capture On Pin 0 Enable
COPEN : TC_CTRLA_TC_COUNT16_COPEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Capture Mode Channel 0
CAPTMODE0 : CTRLA_CAPTMODE0Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_26_26 : HAL.Bit := 16#0#;
-- Capture mode Channel 1
CAPTMODE1 : CTRLA_CAPTMODE1Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_CTRLA_TC_COUNT16_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
MODE at 0 range 2 .. 3;
PRESCSYNC at 0 range 4 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
PRESCALER at 0 range 8 .. 10;
ALOCK at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CAPTEN at 0 range 16 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
COPEN at 0 range 20 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
CAPTMODE0 at 0 range 24 .. 25;
Reserved_26_26 at 0 range 26 .. 26;
CAPTMODE1 at 0 range 27 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
-- Control B Clear
type TC_CTRLBCLR_TC_COUNT16_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBCLR_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBCLR_TC_COUNT16_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Control B Set
type TC_CTRLBSET_TC_COUNT16_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBSET_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBSET_TC_COUNT16_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- TC_EVCTRL_TC_COUNT16_MCEO array
type TC_EVCTRL_TC_COUNT16_MCEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_EVCTRL_TC_COUNT16_MCEO
type TC_EVCTRL_TC_COUNT16_MCEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MCEO as a value
Val : HAL.UInt2;
when True =>
-- MCEO as an array
Arr : TC_EVCTRL_TC_COUNT16_MCEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_EVCTRL_TC_COUNT16_MCEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type TC_EVCTRL_TC_COUNT16_Register is record
-- Event Action
EVACT : EVCTRL_EVACTSelect := SAM_SVD.TC.Off;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- TC Event Input Polarity
TCINV : Boolean := False;
-- TC Event Enable
TCEI : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Event Output Enable
OVFEO : Boolean := False;
-- unspecified
Reserved_9_11 : HAL.UInt3 := 16#0#;
-- MC Event Output Enable 0
MCEO : TC_EVCTRL_TC_COUNT16_MCEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 16,
Bit_Order => System.Low_Order_First;
for TC_EVCTRL_TC_COUNT16_Register use record
EVACT at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TCINV at 0 range 4 .. 4;
TCEI at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
OVFEO at 0 range 8 .. 8;
Reserved_9_11 at 0 range 9 .. 11;
MCEO at 0 range 12 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
end record;
-- TC_INTENCLR_TC_COUNT16_MC array
type TC_INTENCLR_TC_COUNT16_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENCLR_TC_COUNT16_MC
type TC_INTENCLR_TC_COUNT16_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENCLR_TC_COUNT16_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENCLR_TC_COUNT16_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type TC_INTENCLR_TC_COUNT16_Register is record
-- OVF Interrupt Disable
OVF : Boolean := False;
-- ERR Interrupt Disable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Disable 0
MC : TC_INTENCLR_TC_COUNT16_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENCLR_TC_COUNT16_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTENSET_TC_COUNT16_MC array
type TC_INTENSET_TC_COUNT16_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENSET_TC_COUNT16_MC
type TC_INTENSET_TC_COUNT16_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENSET_TC_COUNT16_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENSET_TC_COUNT16_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type TC_INTENSET_TC_COUNT16_Register is record
-- OVF Interrupt Enable
OVF : Boolean := False;
-- ERR Interrupt Enable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Enable 0
MC : TC_INTENSET_TC_COUNT16_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENSET_TC_COUNT16_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTFLAG_TC_COUNT16_MC array
type TC_INTFLAG_TC_COUNT16_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTFLAG_TC_COUNT16_MC
type TC_INTFLAG_TC_COUNT16_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTFLAG_TC_COUNT16_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTFLAG_TC_COUNT16_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type TC_INTFLAG_TC_COUNT16_Register is record
-- OVF Interrupt Flag
OVF : Boolean := False;
-- ERR Interrupt Flag
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Flag 0
MC : TC_INTFLAG_TC_COUNT16_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTFLAG_TC_COUNT16_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_STATUS_TC_COUNT16_CCBUFV array
type TC_STATUS_TC_COUNT16_CCBUFV_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_STATUS_TC_COUNT16_CCBUFV
type TC_STATUS_TC_COUNT16_CCBUFV_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CCBUFV as a value
Val : HAL.UInt2;
when True =>
-- CCBUFV as an array
Arr : TC_STATUS_TC_COUNT16_CCBUFV_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_STATUS_TC_COUNT16_CCBUFV_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type TC_STATUS_TC_COUNT16_Register is record
-- Read-only. Stop Status Flag
STOP : Boolean := True;
-- Read-only. Slave Status Flag
SLAVE : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Synchronization Busy Status
PERBUFV : Boolean := False;
-- Compare channel buffer 0 valid
CCBUFV : TC_STATUS_TC_COUNT16_CCBUFV_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_STATUS_TC_COUNT16_Register use record
STOP at 0 range 0 .. 0;
SLAVE at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
PERBUFV at 0 range 3 .. 3;
CCBUFV at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Waveform Generation Control
type TC_WAVE_TC_COUNT16_Register is record
-- Waveform Generation Mode
WAVEGEN : WAVE_WAVEGENSelect := SAM_SVD.TC.Nfrq;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_WAVE_TC_COUNT16_Register use record
WAVEGEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- TC_DRVCTRL_TC_COUNT16_INVEN array
type TC_DRVCTRL_TC_COUNT16_INVEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_DRVCTRL_TC_COUNT16_INVEN
type TC_DRVCTRL_TC_COUNT16_INVEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- INVEN as a value
Val : HAL.UInt2;
when True =>
-- INVEN as an array
Arr : TC_DRVCTRL_TC_COUNT16_INVEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_DRVCTRL_TC_COUNT16_INVEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control C
type TC_DRVCTRL_TC_COUNT16_Register is record
-- Output Waveform Invert Enable 0
INVEN : TC_DRVCTRL_TC_COUNT16_INVEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DRVCTRL_TC_COUNT16_Register use record
INVEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Debug Control
type TC_DBGCTRL_TC_COUNT16_Register is record
-- Run During Debug
DBGRUN : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DBGCTRL_TC_COUNT16_Register use record
DBGRUN at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- TC_SYNCBUSY_TC_COUNT16_CC array
type TC_SYNCBUSY_TC_COUNT16_CC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_SYNCBUSY_TC_COUNT16_CC
type TC_SYNCBUSY_TC_COUNT16_CC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CC as a value
Val : HAL.UInt2;
when True =>
-- CC as an array
Arr : TC_SYNCBUSY_TC_COUNT16_CC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_SYNCBUSY_TC_COUNT16_CC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Synchronization Status
type TC_SYNCBUSY_TC_COUNT16_Register is record
-- Read-only. swrst
SWRST : Boolean;
-- Read-only. enable
ENABLE : Boolean;
-- Read-only. CTRLB
CTRLB : Boolean;
-- Read-only. STATUS
STATUS : Boolean;
-- Read-only. Counter
COUNT : Boolean;
-- Read-only. Period
PER : Boolean;
-- Read-only. Compare Channel 0
CC : TC_SYNCBUSY_TC_COUNT16_CC_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_SYNCBUSY_TC_COUNT16_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
CTRLB at 0 range 2 .. 2;
STATUS at 0 range 3 .. 3;
COUNT at 0 range 4 .. 4;
PER at 0 range 5 .. 5;
CC at 0 range 6 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture
type TC_CC_TC_COUNT16_Registers is array (0 .. 1) of HAL.UInt16;
-- COUNT16 Compare and Capture Buffer
-- COUNT16 Compare and Capture Buffer
type TC_CCBUF_TC_COUNT16_Registers is array (0 .. 1) of HAL.UInt16;
-- 16-bit Counter Mode
type TcCount16_Cluster is record
-- Control A
CTRLA : aliased TC_CTRLA_TC_COUNT16_Register;
-- Control B Clear
CTRLBCLR : aliased TC_CTRLBCLR_TC_COUNT16_Register;
-- Control B Set
CTRLBSET : aliased TC_CTRLBSET_TC_COUNT16_Register;
-- Event Control
EVCTRL : aliased TC_EVCTRL_TC_COUNT16_Register;
-- Interrupt Enable Clear
INTENCLR : aliased TC_INTENCLR_TC_COUNT16_Register;
-- Interrupt Enable Set
INTENSET : aliased TC_INTENSET_TC_COUNT16_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased TC_INTFLAG_TC_COUNT16_Register;
-- Status
STATUS : aliased TC_STATUS_TC_COUNT16_Register;
-- Waveform Generation Control
WAVE : aliased TC_WAVE_TC_COUNT16_Register;
-- Control C
DRVCTRL : aliased TC_DRVCTRL_TC_COUNT16_Register;
-- Debug Control
DBGCTRL : aliased TC_DBGCTRL_TC_COUNT16_Register;
-- Synchronization Status
SYNCBUSY : aliased TC_SYNCBUSY_TC_COUNT16_Register;
-- COUNT16 Count
COUNT : aliased HAL.UInt16;
-- COUNT16 Compare and Capture
CC : aliased TC_CC_TC_COUNT16_Registers;
-- COUNT16 Compare and Capture Buffer
CCBUF : aliased TC_CCBUF_TC_COUNT16_Registers;
end record
with Size => 416;
for TcCount16_Cluster use record
CTRLA at 16#0# range 0 .. 31;
CTRLBCLR at 16#4# range 0 .. 7;
CTRLBSET at 16#5# range 0 .. 7;
EVCTRL at 16#6# range 0 .. 15;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
STATUS at 16#B# range 0 .. 7;
WAVE at 16#C# range 0 .. 7;
DRVCTRL at 16#D# range 0 .. 7;
DBGCTRL at 16#F# range 0 .. 7;
SYNCBUSY at 16#10# range 0 .. 31;
COUNT at 16#14# range 0 .. 15;
CC at 16#1C# range 0 .. 31;
CCBUF at 16#30# range 0 .. 31;
end record;
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- TC_CTRLA_TC_COUNT32_CAPTEN array
type TC_CTRLA_TC_COUNT32_CAPTEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT32_CAPTEN
type TC_CTRLA_TC_COUNT32_CAPTEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CAPTEN as a value
Val : HAL.UInt2;
when True =>
-- CAPTEN as an array
Arr : TC_CTRLA_TC_COUNT32_CAPTEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT32_CAPTEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- TC_CTRLA_TC_COUNT32_COPEN array
type TC_CTRLA_TC_COUNT32_COPEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_CTRLA_TC_COUNT32_COPEN
type TC_CTRLA_TC_COUNT32_COPEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COPEN as a value
Val : HAL.UInt2;
when True =>
-- COPEN as an array
Arr : TC_CTRLA_TC_COUNT32_COPEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_CTRLA_TC_COUNT32_COPEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control A
type TC_CTRLA_TC_COUNT32_Register is record
-- Write-only. Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- Timer Counter Mode
MODE : CTRLA_MODESelect := SAM_SVD.TC.Count16;
-- Prescaler and Counter Synchronization
PRESCSYNC : CTRLA_PRESCSYNCSelect := SAM_SVD.TC.Gclk;
-- Run during Standby
RUNSTDBY : Boolean := False;
-- Clock On Demand
ONDEMAND : Boolean := False;
-- Prescaler
PRESCALER : CTRLA_PRESCALERSelect := SAM_SVD.TC.Div1;
-- Auto Lock
ALOCK : Boolean := False;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Capture Channel 0 Enable
CAPTEN : TC_CTRLA_TC_COUNT32_CAPTEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Capture On Pin 0 Enable
COPEN : TC_CTRLA_TC_COUNT32_COPEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Capture Mode Channel 0
CAPTMODE0 : CTRLA_CAPTMODE0Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_26_26 : HAL.Bit := 16#0#;
-- Capture mode Channel 1
CAPTMODE1 : CTRLA_CAPTMODE1Select := SAM_SVD.TC.Default;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_CTRLA_TC_COUNT32_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
MODE at 0 range 2 .. 3;
PRESCSYNC at 0 range 4 .. 5;
RUNSTDBY at 0 range 6 .. 6;
ONDEMAND at 0 range 7 .. 7;
PRESCALER at 0 range 8 .. 10;
ALOCK at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CAPTEN at 0 range 16 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
COPEN at 0 range 20 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
CAPTMODE0 at 0 range 24 .. 25;
Reserved_26_26 at 0 range 26 .. 26;
CAPTMODE1 at 0 range 27 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
-- Control B Clear
type TC_CTRLBCLR_TC_COUNT32_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBCLR_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBCLR_TC_COUNT32_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Control B Set
type TC_CTRLBSET_TC_COUNT32_Register is record
-- Counter Direction
DIR : Boolean := False;
-- Lock Update
LUPD : Boolean := False;
-- One-Shot on Counter
ONESHOT : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Command
CMD : CTRLBSET_CMDSelect := SAM_SVD.TC.None;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_CTRLBSET_TC_COUNT32_Register use record
DIR at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
ONESHOT at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- TC_EVCTRL_TC_COUNT32_MCEO array
type TC_EVCTRL_TC_COUNT32_MCEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_EVCTRL_TC_COUNT32_MCEO
type TC_EVCTRL_TC_COUNT32_MCEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MCEO as a value
Val : HAL.UInt2;
when True =>
-- MCEO as an array
Arr : TC_EVCTRL_TC_COUNT32_MCEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_EVCTRL_TC_COUNT32_MCEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type TC_EVCTRL_TC_COUNT32_Register is record
-- Event Action
EVACT : EVCTRL_EVACTSelect := SAM_SVD.TC.Off;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- TC Event Input Polarity
TCINV : Boolean := False;
-- TC Event Enable
TCEI : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Event Output Enable
OVFEO : Boolean := False;
-- unspecified
Reserved_9_11 : HAL.UInt3 := 16#0#;
-- MC Event Output Enable 0
MCEO : TC_EVCTRL_TC_COUNT32_MCEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 16,
Bit_Order => System.Low_Order_First;
for TC_EVCTRL_TC_COUNT32_Register use record
EVACT at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
TCINV at 0 range 4 .. 4;
TCEI at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
OVFEO at 0 range 8 .. 8;
Reserved_9_11 at 0 range 9 .. 11;
MCEO at 0 range 12 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
end record;
-- TC_INTENCLR_TC_COUNT32_MC array
type TC_INTENCLR_TC_COUNT32_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENCLR_TC_COUNT32_MC
type TC_INTENCLR_TC_COUNT32_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENCLR_TC_COUNT32_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENCLR_TC_COUNT32_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type TC_INTENCLR_TC_COUNT32_Register is record
-- OVF Interrupt Disable
OVF : Boolean := False;
-- ERR Interrupt Disable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Disable 0
MC : TC_INTENCLR_TC_COUNT32_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENCLR_TC_COUNT32_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTENSET_TC_COUNT32_MC array
type TC_INTENSET_TC_COUNT32_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTENSET_TC_COUNT32_MC
type TC_INTENSET_TC_COUNT32_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTENSET_TC_COUNT32_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTENSET_TC_COUNT32_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type TC_INTENSET_TC_COUNT32_Register is record
-- OVF Interrupt Enable
OVF : Boolean := False;
-- ERR Interrupt Enable
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Enable 0
MC : TC_INTENSET_TC_COUNT32_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTENSET_TC_COUNT32_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_INTFLAG_TC_COUNT32_MC array
type TC_INTFLAG_TC_COUNT32_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_INTFLAG_TC_COUNT32_MC
type TC_INTFLAG_TC_COUNT32_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : TC_INTFLAG_TC_COUNT32_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_INTFLAG_TC_COUNT32_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type TC_INTFLAG_TC_COUNT32_Register is record
-- OVF Interrupt Flag
OVF : Boolean := False;
-- ERR Interrupt Flag
ERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- MC Interrupt Flag 0
MC : TC_INTFLAG_TC_COUNT32_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_INTFLAG_TC_COUNT32_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- TC_STATUS_TC_COUNT32_CCBUFV array
type TC_STATUS_TC_COUNT32_CCBUFV_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_STATUS_TC_COUNT32_CCBUFV
type TC_STATUS_TC_COUNT32_CCBUFV_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CCBUFV as a value
Val : HAL.UInt2;
when True =>
-- CCBUFV as an array
Arr : TC_STATUS_TC_COUNT32_CCBUFV_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_STATUS_TC_COUNT32_CCBUFV_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type TC_STATUS_TC_COUNT32_Register is record
-- Read-only. Stop Status Flag
STOP : Boolean := True;
-- Read-only. Slave Status Flag
SLAVE : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Synchronization Busy Status
PERBUFV : Boolean := False;
-- Compare channel buffer 0 valid
CCBUFV : TC_STATUS_TC_COUNT32_CCBUFV_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_STATUS_TC_COUNT32_Register use record
STOP at 0 range 0 .. 0;
SLAVE at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
PERBUFV at 0 range 3 .. 3;
CCBUFV at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Waveform Generation Control
type TC_WAVE_TC_COUNT32_Register is record
-- Waveform Generation Mode
WAVEGEN : WAVE_WAVEGENSelect := SAM_SVD.TC.Nfrq;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_WAVE_TC_COUNT32_Register use record
WAVEGEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- TC_DRVCTRL_TC_COUNT32_INVEN array
type TC_DRVCTRL_TC_COUNT32_INVEN_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_DRVCTRL_TC_COUNT32_INVEN
type TC_DRVCTRL_TC_COUNT32_INVEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- INVEN as a value
Val : HAL.UInt2;
when True =>
-- INVEN as an array
Arr : TC_DRVCTRL_TC_COUNT32_INVEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_DRVCTRL_TC_COUNT32_INVEN_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control C
type TC_DRVCTRL_TC_COUNT32_Register is record
-- Output Waveform Invert Enable 0
INVEN : TC_DRVCTRL_TC_COUNT32_INVEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DRVCTRL_TC_COUNT32_Register use record
INVEN at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- Debug Control
type TC_DBGCTRL_TC_COUNT32_Register is record
-- Run During Debug
DBGRUN : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 8, Bit_Order => System.Low_Order_First;
for TC_DBGCTRL_TC_COUNT32_Register use record
DBGRUN at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- TC_SYNCBUSY_TC_COUNT32_CC array
type TC_SYNCBUSY_TC_COUNT32_CC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for TC_SYNCBUSY_TC_COUNT32_CC
type TC_SYNCBUSY_TC_COUNT32_CC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CC as a value
Val : HAL.UInt2;
when True =>
-- CC as an array
Arr : TC_SYNCBUSY_TC_COUNT32_CC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for TC_SYNCBUSY_TC_COUNT32_CC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Synchronization Status
type TC_SYNCBUSY_TC_COUNT32_Register is record
-- Read-only. swrst
SWRST : Boolean;
-- Read-only. enable
ENABLE : Boolean;
-- Read-only. CTRLB
CTRLB : Boolean;
-- Read-only. STATUS
STATUS : Boolean;
-- Read-only. Counter
COUNT : Boolean;
-- Read-only. Period
PER : Boolean;
-- Read-only. Compare Channel 0
CC : TC_SYNCBUSY_TC_COUNT32_CC_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_SYNCBUSY_TC_COUNT32_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
CTRLB at 0 range 2 .. 2;
STATUS at 0 range 3 .. 3;
COUNT at 0 range 4 .. 4;
PER at 0 range 5 .. 5;
CC at 0 range 6 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture
type TC_CC_TC_COUNT32_Registers is array (0 .. 1) of HAL.UInt32;
-- COUNT32 Compare and Capture Buffer
-- COUNT32 Compare and Capture Buffer
type TC_CCBUF_TC_COUNT32_Registers is array (0 .. 1) of HAL.UInt32;
-- 32-bit Counter Mode
type TcCount32_Cluster is record
-- Control A
CTRLA : aliased TC_CTRLA_TC_COUNT32_Register;
-- Control B Clear
CTRLBCLR : aliased TC_CTRLBCLR_TC_COUNT32_Register;
-- Control B Set
CTRLBSET : aliased TC_CTRLBSET_TC_COUNT32_Register;
-- Event Control
EVCTRL : aliased TC_EVCTRL_TC_COUNT32_Register;
-- Interrupt Enable Clear
INTENCLR : aliased TC_INTENCLR_TC_COUNT32_Register;
-- Interrupt Enable Set
INTENSET : aliased TC_INTENSET_TC_COUNT32_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased TC_INTFLAG_TC_COUNT32_Register;
-- Status
STATUS : aliased TC_STATUS_TC_COUNT32_Register;
-- Waveform Generation Control
WAVE : aliased TC_WAVE_TC_COUNT32_Register;
-- Control C
DRVCTRL : aliased TC_DRVCTRL_TC_COUNT32_Register;
-- Debug Control
DBGCTRL : aliased TC_DBGCTRL_TC_COUNT32_Register;
-- Synchronization Status
SYNCBUSY : aliased TC_SYNCBUSY_TC_COUNT32_Register;
-- COUNT32 Count
COUNT : aliased HAL.UInt32;
-- COUNT32 Compare and Capture
CC : aliased TC_CC_TC_COUNT32_Registers;
-- COUNT32 Compare and Capture Buffer
CCBUF : aliased TC_CCBUF_TC_COUNT32_Registers;
end record
with Size => 448;
for TcCount32_Cluster use record
CTRLA at 16#0# range 0 .. 31;
CTRLBCLR at 16#4# range 0 .. 7;
CTRLBSET at 16#5# range 0 .. 7;
EVCTRL at 16#6# range 0 .. 15;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
STATUS at 16#B# range 0 .. 7;
WAVE at 16#C# range 0 .. 7;
DRVCTRL at 16#D# range 0 .. 7;
DBGCTRL at 16#F# range 0 .. 7;
SYNCBUSY at 16#10# range 0 .. 31;
COUNT at 16#14# range 0 .. 31;
CC at 16#1C# range 0 .. 63;
CCBUF at 16#30# range 0 .. 63;
end record;
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture Buffer
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture Buffer
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture Buffer
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture Buffer
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture Buffer
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture Buffer
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture Buffer
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture Buffer
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture Buffer
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture Buffer
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture Buffer
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture Buffer
----------------------------------
-- TcCount8 cluster's Registers --
----------------------------------
-- COUNT8 Compare and Capture
-- COUNT8 Compare and Capture Buffer
-----------------------------------
-- TcCount16 cluster's Registers --
-----------------------------------
-- COUNT16 Compare and Capture
-- COUNT16 Compare and Capture Buffer
-----------------------------------
-- TcCount32 cluster's Registers --
-----------------------------------
-- COUNT32 Compare and Capture
-- COUNT32 Compare and Capture Buffer
-----------------
-- Peripherals --
-----------------
type TC0_Disc is
(Val_8,
Val_16,
Val_32);
-- Basic Timer Counter 0
type TC_Peripheral
(Discriminent : TC0_Disc := Val_8)
is record
case Discriminent is
when Val_8 =>
-- 8-bit Counter Mode
TC_COUNT8 : aliased TcCount8_Cluster;
when Val_16 =>
-- 16-bit Counter Mode
TC_COUNT16 : aliased TcCount16_Cluster;
when Val_32 =>
-- 32-bit Counter Mode
TC_COUNT32 : aliased TcCount32_Cluster;
end case;
end record
with Unchecked_Union, Volatile;
for TC_Peripheral use record
TC_COUNT8 at 0 range 0 .. 415;
TC_COUNT16 at 0 range 0 .. 415;
TC_COUNT32 at 0 range 0 .. 447;
end record;
-- Basic Timer Counter 0
TC0_Periph : aliased TC_Peripheral
with Import, Address => TC0_Base;
-- Basic Timer Counter 1
TC1_Periph : aliased TC_Peripheral
with Import, Address => TC1_Base;
-- Basic Timer Counter 2
TC2_Periph : aliased TC_Peripheral
with Import, Address => TC2_Base;
-- Basic Timer Counter 3
TC3_Periph : aliased TC_Peripheral
with Import, Address => TC3_Base;
-- Basic Timer Counter 4
TC4_Periph : aliased TC_Peripheral
with Import, Address => TC4_Base;
-- Basic Timer Counter 5
TC5_Periph : aliased TC_Peripheral
with Import, Address => TC5_Base;
end SAM_SVD.TC;
|
reznikmm/gela | Ada | 123 | ads | package AG_Tools.Prop_Visiters is
procedure Generate (G : Anagram.Grammars.Grammar_Access);
end AG_Tools.Prop_Visiters;
|
reznikmm/matreshka | Ada | 4,018 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with League.Strings;
with Engines.Contexts;
package Properties.Common is
function False
(Engine : access Engines.Contexts.Context;
Element : Asis.Element;
Name : Engines.Boolean_Property) return Boolean is (False);
function True
(Engine : access Engines.Contexts.Context;
Element : Asis.Element;
Name : Engines.Boolean_Property) return Boolean is (True);
function Empty
(Engine : access Engines.Contexts.Context;
Element : Asis.Element;
Name : Engines.Text_Property)
return League.Strings.Universal_String is
(League.Strings.Empty_Universal_String);
end Properties.Common;
|
reznikmm/matreshka | Ada | 4,609 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.OCL.Holders.Collection_Kinds;
package body AMF.OCL.Holders is
-------------
-- Element --
-------------
function Element
(Holder : League.Holders.Holder)
return AMF.OCL.Optional_OCL_Collection_Kind is
begin
if not League.Holders.Has_Tag
(Holder, AMF.OCL.Holders.Collection_Kinds.Value_Tag)
then
raise Constraint_Error;
end if;
if League.Holders.Is_Empty (Holder) then
return (Is_Empty => True);
else
return (False, AMF.OCL.Holders.Collection_Kinds.Element (Holder));
end if;
end Element;
---------------
-- To_Holder --
---------------
function To_Holder
(Element : AMF.OCL.Optional_OCL_Collection_Kind)
return League.Holders.Holder is
begin
return Result : League.Holders.Holder do
League.Holders.Set_Tag
(Result, AMF.OCL.Holders.Collection_Kinds.Value_Tag);
if not Element.Is_Empty then
AMF.OCL.Holders.Collection_Kinds.Replace_Element
(Result, Element.Value);
end if;
end return;
end To_Holder;
end AMF.OCL.Holders;
|
godunko/adawebui | Ada | 1,921 | ads |
with OpenGL.Generic_Buffers;
with OpenGL.Programs;
package Cube_Programs is
type Vertex_Data is record
Vertex_Position : OpenGL.GLfloat_Vector_3;
Vertex_Color : OpenGL.GLfloat_Vector_3;
end record;
type Vertex_Data_Array is array (Positive range <>) of Vertex_Data;
package Vertex_Data_Buffers is
new OpenGL.Generic_Buffers (Vertex_Data, Positive, Vertex_Data_Array);
type Index_Data_Array is array (Positive range <>) of OpenGL.GLushort;
package Index_Data_Buffers is
new OpenGL.Generic_Buffers (OpenGL.GLushort, Positive, Index_Data_Array);
type Cube_Program is new OpenGL.Programs.OpenGL_Program with private;
procedure Initialize (Self : in out Cube_Program'Class);
-- Initialize program object.
procedure Set_Vertex_Data_Buffer
(Self : in out Cube_Program'Class;
Buffer : Vertex_Data_Buffers.OpenGL_Buffer'Class);
-- Sets buffer with data to draw.
procedure Set_Projection_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4);
-- Sets projection matrix to be used to draw.
procedure Set_Model_View_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4);
-- Sets model view matrix to be used to draw.
procedure Set_Model_Move_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4);
-- Sets model move matrix to be used to draw.
private
type Cube_Program is new OpenGL.Programs.OpenGL_Program with record
PM : OpenGL.Uniform_Location;
MVM : OpenGL.Uniform_Location;
MMM : OpenGL.Uniform_Location;
VP : OpenGL.Attribute_Location;
CP : OpenGL.Attribute_Location;
end record;
overriding function Link (Self : in out Cube_Program) return Boolean;
-- Executed at link time. Link shaders into program and extracts locations
-- of attributes.
end Cube_Programs;
|
AdaCore/libadalang | Ada | 120 | ads | with G;
generic
with package H is new G (<>);
package P is
function Foo (X : H.T) return Integer is (42);
end P;
|
io7m/coreland-math_2d | Ada | 2,398 | adb | package body Math_2D.Triangles is
use type Types.Real_Type;
use type Types.Point_t;
function Area
(Triangle : in Types.Triangle_t) return Types.Real_Type'Base
is
Point_A : Types.Point_t renames Triangle (1);
Point_B : Types.Point_t renames Triangle (2);
Point_C : Types.Point_t renames Triangle (3);
A : constant Types.Real_Type'Base := Point_A (1) - Point_C (1);
B : constant Types.Real_Type'Base := Point_A (2) - Point_C (2);
C : constant Types.Real_Type'Base := Point_B (1) - Point_C (1);
D : constant Types.Real_Type'Base := Point_B (2) - Point_C (2);
begin
return abs ((A * D) - (B * C)) / 2.0;
end Area;
function Orthocenter
(Triangle : in Types.Triangle_t) return Types.Point_t is
begin
return (Triangle (1)
+ Triangle (2)
+ Triangle (3)) / 3.0;
end Orthocenter;
function Perimeter
(Triangle : in Types.Triangle_t) return Types.Real_Type'Base
is
Point_A : Types.Point_t renames Triangle (1);
Point_B : Types.Point_t renames Triangle (2);
Point_C : Types.Point_t renames Triangle (3);
Distance_AB : constant Types.Real_Type'Base := Points.Distance (Point_A, Point_B);
Distance_BC : constant Types.Real_Type'Base := Points.Distance (Point_B, Point_C);
Distance_CA : constant Types.Real_Type'Base := Points.Distance (Point_C, Point_A);
begin
return Distance_AB + Distance_BC + Distance_CA;
end Perimeter;
function Point_Is_Inside
(Triangle : in Types.Triangle_t;
Point : in Types.Point_t) return Boolean
is
Point_A : Types.Point_t renames Triangle (1);
Point_B : Types.Point_t renames Triangle (2);
Point_C : Types.Point_t renames Triangle (3);
Sub_Tri_A : constant Types.Triangle_t := (Point, Point_A, Point_B);
Sub_Tri_B : constant Types.Triangle_t := (Point, Point_B, Point_C);
Sub_Tri_C : constant Types.Triangle_t := (Point, Point_A, Point_C);
Base_Area : constant Types.Real_Type'Base := Area (Triangle);
Area_A : constant Types.Real_Type'Base := Area (Sub_Tri_A);
Area_B : constant Types.Real_Type'Base := Area (Sub_Tri_B);
Area_C : constant Types.Real_Type'Base := Area (Sub_Tri_C);
Total_Area : constant Types.Real_Type'Base := Area_A + Area_B + Area_C;
begin
return Total_Area <= Base_Area;
end Point_Is_Inside;
end Math_2D.Triangles;
|
ficorax/PortAudioAda | Ada | 2,391 | adb | with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions;
with Ada.Unchecked_Conversion;
with Interfaces.C.Pointers;
with System;
with Ctestc_Types; use Ctestc_Types;
package body Ctestc_Callbacks is
package Float_Ptrs is
new Interfaces.C.Pointers (Index => Natural,
Element => Float,
Element_Array => Float_Array,
Default_Terminator => 0.0);
use type Float_Ptrs.Pointer;
subtype Float_Star is Float_Ptrs.Pointer;
function Convert is new Ada.Unchecked_Conversion
(System.Address,
Float_Star);
function Convert is new Ada.Unchecked_Conversion
(System.Address,
paTestData_Ptr);
----------------------
-- paMinLatCallback --
----------------------
function paMinLatCallback
(inputBuffer : System.Address;
outputBuffer : System.Address;
framesPerBuffer : Interfaces.C.unsigned_long;
timeInfo : access PA_Stream_Callback_Time_Info;
statusFlags : PA_Stream_Callback_Flags;
userData : System.Address)
return PA_Stream_Callback_Result
is
pragma Unreferenced (inputBuffer);
pragma Unreferenced (timeInfo);
pragma Unreferenced (statusFlags);
oBuff : Float_Star := Convert (outputBuffer);
lData : constant paTestData_Ptr := Convert (userData);
left_phaseInc : Float := 0.02;
right_phaseInc : Float := 0.06;
left_phase : Float := lData.all.left_phase;
right_phase : Float := lData.all.right_phase;
begin
for i in 1 .. Integer (framesPerBuffer) loop
left_phase := left_phase + left_phaseInc;
if left_phase > Two_Pi then
left_phase := left_phase - Two_Pi;
end if;
oBuff.all := Sin (left_phase);
Float_Ptrs.Increment (oBuff);
right_phase := right_phase + right_phaseInc;
if right_phase > Two_Pi then
right_phase := right_phase - Two_Pi;
end if;
oBuff.all := Sin (right_phase);
Float_Ptrs.Increment (oBuff);
end loop;
lData.all.left_phase := left_phase;
lData.all.right_phase := right_phase;
return paContinue;
end paMinLatCallback;
end Ctestc_Callbacks;
|
zhmu/ananas | Ada | 24,458 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . O R D E R E D _ M U L T I S E T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- The ordered multiset container is similar to the ordered set, but with the
-- difference that multiple equivalent elements are allowed. It also provides
-- additional operations, to iterate over items that are equivalent.
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
private with Ada.Strings.Text_Buffers;
with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
with function "<" (Left, Right : Element_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Ordered_Multisets with
SPARK_Mode => Off
is
pragma Annotate (CodePeer, Skip_Analysis);
pragma Preelaborate;
pragma Remote_Types;
function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
-- Returns False if Left is less than Right, or Right is less than Left;
-- otherwise, it returns True.
type Set is tagged private
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization (Set);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Set : constant Set;
-- The default value for set objects declared without an explicit
-- initialization expression.
No_Element : constant Cursor;
-- The default value for cursor objects declared without an explicit
-- initialization expression.
function Has_Element (Position : Cursor) return Boolean;
-- Equivalent to Position /= No_Element
package Set_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
function "=" (Left, Right : Set) return Boolean;
-- If Left denotes the same set object as Right, then equality returns
-- True. If the length of Left is different from the length of Right, then
-- it returns False. Otherwise, set equality iterates over Left and Right,
-- comparing the element of Left to the element of Right using the equality
-- operator for elements. If the elements compare False, then the iteration
-- terminates and set equality returns False. Otherwise, if all elements
-- compare True, then set equality returns True.
function Equivalent_Sets (Left, Right : Set) return Boolean;
-- Similar to set equality, but with the difference that elements are
-- compared for equivalence instead of equality.
function To_Set (New_Item : Element_Type) return Set;
-- Constructs a set object with New_Item as its single element
function Length (Container : Set) return Count_Type;
-- Returns the total number of elements in Container
function Is_Empty (Container : Set) return Boolean;
-- Returns True if Container.Length is 0
procedure Clear (Container : in out Set);
-- Deletes all elements from Container
function Element (Position : Cursor) return Element_Type;
-- If Position equals No_Element, then Constraint_Error is raised.
-- Otherwise, function Element returns the element designed by Position.
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type);
-- If Position equals No_Element, then Constraint_Error is raised. If
-- Position is associated with a set different from Container, then
-- Program_Error is raised. If New_Item is equivalent to the element
-- designated by Position, then if Container is locked (element tampering
-- has been attempted), Program_Error is raised; otherwise, the element
-- designated by Position is assigned the value of New_Item. If New_Item is
-- not equivalent to the element designated by Position, then if the
-- container is busy (cursor tampering has been attempted), Program_Error
-- is raised; otherwise, the element designed by Position is assigned the
-- value of New_Item, and the node is moved to its new position (in
-- canonical insertion order).
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
-- If Position equals No_Element, then Constraint_Error is
-- raised. Otherwise, it calls Process with the element designated by
-- Position as the parameter. This call locks the container, so attempts to
-- change the value of the element while Process is executing (to "tamper
-- with elements") will raise Program_Error.
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference
(Container : aliased Set;
Position : Cursor) return Constant_Reference_Type;
pragma Inline (Constant_Reference);
procedure Assign (Target : in out Set; Source : Set);
function Copy (Source : Set) return Set;
procedure Move (Target : in out Set; Source : in out Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If either Target or Source is busy (cursor tampering is
-- attempted), then it raises Program_Error. Otherwise, Target is cleared,
-- and the nodes from Source are moved (not copied) to Target (so Source
-- becomes empty).
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor);
-- Insert adds New_Item to Container, and returns cursor Position
-- designating the newly inserted node. The node is inserted after any
-- existing elements less than or equivalent to New_Item (and before any
-- elements greater than New_Item). Note that the issue of where the new
-- node is inserted relative to equivalent elements does not arise for
-- unique-key containers, since in that case the insertion would simply
-- fail. For a multiple-key container (the case here), insertion always
-- succeeds, and is defined such that the new item is positioned after any
-- equivalent elements already in the container.
procedure Insert
(Container : in out Set;
New_Item : Element_Type);
-- Inserts New_Item in Container, but does not return a cursor designating
-- the newly-inserted node.
-- TODO: include Replace too???
--
-- procedure Replace
-- (Container : in out Set;
-- New_Item : Element_Type);
procedure Exclude
(Container : in out Set;
Item : Element_Type);
-- Deletes from Container all of the elements equivalent to Item
procedure Delete
(Container : in out Set;
Item : Element_Type);
-- Deletes from Container all of the elements equivalent to Item. If there
-- are no elements equivalent to Item, then it raises Constraint_Error.
procedure Delete
(Container : in out Set;
Position : in out Cursor);
-- If Position equals No_Element, then Constraint_Error is raised. If
-- Position is associated with a set different from Container, then
-- Program_Error is raised. Otherwise, the node designated by Position is
-- removed from Container, and Position is set to No_Element.
procedure Delete_First (Container : in out Set);
-- Removes the first node from Container
procedure Delete_Last (Container : in out Set);
-- Removes the last node from Container
procedure Union (Target : in out Set; Source : Set);
-- If Target is busy (cursor tampering is attempted), the Program_Error is
-- raised. Otherwise, it inserts each element of Source into
-- Target. Elements are inserted in the canonical order for multisets, such
-- that the elements from Source are inserted after equivalent elements
-- already in Target.
function Union (Left, Right : Set) return Set;
-- Returns a set comprising the all elements from Left and all of the
-- elements from Right. The elements from Right follow the equivalent
-- elements from Left.
function "or" (Left, Right : Set) return Set renames Union;
procedure Intersection (Target : in out Set; Source : Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If Target is busy (cursor tampering is attempted),
-- Program_Error is raised. Otherwise, the elements in Target having no
-- equivalent element in Source are deleted from Target.
function Intersection (Left, Right : Set) return Set;
-- If Left denotes the same object as Right, then the function returns a
-- copy of Left. Otherwise, it returns a set comprising the equivalent
-- elements from both Left and Right. Items are inserted in the result set
-- in canonical order, such that the elements from Left precede the
-- equivalent elements from Right.
function "and" (Left, Right : Set) return Set renames Intersection;
procedure Difference (Target : in out Set; Source : Set);
-- If Target is busy (cursor tampering is attempted), then Program_Error is
-- raised. Otherwise, the elements in Target that are equivalent to
-- elements in Source are deleted from Target.
function Difference (Left, Right : Set) return Set;
-- Returns a set comprising the elements from Left that have no equivalent
-- element in Right.
function "-" (Left, Right : Set) return Set renames Difference;
procedure Symmetric_Difference (Target : in out Set; Source : Set);
-- If Target is busy, then Program_Error is raised. Otherwise, the elements
-- in Target equivalent to elements in Source are deleted from Target, and
-- the elements in Source not equivalent to elements in Target are inserted
-- into Target.
function Symmetric_Difference (Left, Right : Set) return Set;
-- Returns a set comprising the union of the elements from Target having no
-- equivalent in Source, and the elements of Source having no equivalent in
-- Target.
function "xor" (Left, Right : Set) return Set renames Symmetric_Difference;
function Overlap (Left, Right : Set) return Boolean;
-- Returns True if Left contains an element equivalent to an element of
-- Right.
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
-- Returns True if every element in Subset has an equivalent element in
-- Of_Set.
function First (Container : Set) return Cursor;
-- If Container is empty, the function returns No_Element. Otherwise, it
-- returns a cursor designating the smallest element.
function First_Element (Container : Set) return Element_Type;
-- Equivalent to Element (First (Container))
function Last (Container : Set) return Cursor;
-- If Container is empty, the function returns No_Element. Otherwise, it
-- returns a cursor designating the largest element.
function Last_Element (Container : Set) return Element_Type;
-- Equivalent to Element (Last (Container))
function Next (Position : Cursor) return Cursor;
-- If Position equals No_Element or Last (Container), the function returns
-- No_Element. Otherwise, it returns a cursor designating the node that
-- immediately follows (as per the insertion order) the node designated by
-- Position.
procedure Next (Position : in out Cursor);
-- Equivalent to Position := Next (Position)
function Previous (Position : Cursor) return Cursor;
-- If Position equals No_Element or First (Container), the function returns
-- No_Element. Otherwise, it returns a cursor designating the node that
-- immediately precedes (as per the insertion order) the node designated by
-- Position.
procedure Previous (Position : in out Cursor);
-- Equivalent to Position := Previous (Position)
function Find (Container : Set; Item : Element_Type) return Cursor;
-- Returns a cursor designating the first element in Container equivalent
-- to Item. If there is no equivalent element, it returns No_Element.
function Floor (Container : Set; Item : Element_Type) return Cursor;
-- If Container is empty, the function returns No_Element. If Item is
-- equivalent to elements in Container, it returns a cursor designating the
-- first equivalent element. Otherwise, it returns a cursor designating the
-- largest element less than Item, or No_Element if all elements are
-- greater than Item.
function Ceiling (Container : Set; Item : Element_Type) return Cursor;
-- If Container is empty, the function returns No_Element. If Item is
-- equivalent to elements of Container, it returns a cursor designating the
-- last equivalent element. Otherwise, it returns a cursor designating the
-- smallest element greater than Item, or No_Element if all elements are
-- less than Item.
function Contains (Container : Set; Item : Element_Type) return Boolean;
-- Equivalent to Container.Find (Item) /= No_Element
function "<" (Left, Right : Cursor) return Boolean;
-- Equivalent to Element (Left) < Element (Right)
function ">" (Left, Right : Cursor) return Boolean;
-- Equivalent to Element (Right) < Element (Left)
function "<" (Left : Cursor; Right : Element_Type) return Boolean;
-- Equivalent to Element (Left) < Right
function ">" (Left : Cursor; Right : Element_Type) return Boolean;
-- Equivalent to Right < Element (Left)
function "<" (Left : Element_Type; Right : Cursor) return Boolean;
-- Equivalent to Left < Element (Right)
function ">" (Left : Element_Type; Right : Cursor) return Boolean;
-- Equivalent to Element (Right) < Left
procedure Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor));
-- Calls Process with a cursor designating each element of Container, in
-- order from Container.First to Container.Last.
procedure Reverse_Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor));
-- Calls Process with a cursor designating each element of Container, in
-- order from Container.Last to Container.First.
procedure Iterate
(Container : Set;
Item : Element_Type;
Process : not null access procedure (Position : Cursor));
-- Call Process with a cursor designating each element equivalent to Item,
-- in order from Container.Floor (Item) to Container.Ceiling (Item).
procedure Reverse_Iterate
(Container : Set;
Item : Element_Type;
Process : not null access procedure (Position : Cursor));
-- Call Process with a cursor designating each element equivalent to Item,
-- in order from Container.Ceiling (Item) to Container.Floor (Item).
function Iterate
(Container : Set)
return Set_Iterator_Interfaces.Reversible_Iterator'class;
function Iterate
(Container : Set;
Start : Cursor)
return Set_Iterator_Interfaces.Reversible_Iterator'class;
generic
type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
package Generic_Keys is
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
-- Returns False if Left is less than Right, or Right is less than Left;
-- otherwise, it returns True.
function Key (Position : Cursor) return Key_Type;
-- Equivalent to Key (Element (Position))
function Element (Container : Set; Key : Key_Type) return Element_Type;
-- Equivalent to Element (Find (Container, Key))
procedure Exclude (Container : in out Set; Key : Key_Type);
-- Deletes from Container any elements whose key is equivalent to Key
procedure Delete (Container : in out Set; Key : Key_Type);
-- Deletes from Container any elements whose key is equivalent to
-- Key. If there are no such elements, then it raises Constraint_Error.
function Find (Container : Set; Key : Key_Type) return Cursor;
-- Returns a cursor designating the first element in Container whose key
-- is equivalent to Key. If there is no equivalent element, it returns
-- No_Element.
function Floor (Container : Set; Key : Key_Type) return Cursor;
-- If Container is empty, the function returns No_Element. If Item is
-- equivalent to the keys of elements in Container, it returns a cursor
-- designating the first such element. Otherwise, it returns a cursor
-- designating the largest element whose key is less than Item, or
-- No_Element if all keys are greater than Item.
function Ceiling (Container : Set; Key : Key_Type) return Cursor;
-- If Container is empty, the function returns No_Element. If Item is
-- equivalent to the keys of elements of Container, it returns a cursor
-- designating the last such element. Otherwise, it returns a cursor
-- designating the smallest element whose key is greater than Item, or
-- No_Element if all keys are less than Item.
function Contains (Container : Set; Key : Key_Type) return Boolean;
-- Equivalent to Find (Container, Key) /= No_Element
procedure Update_Element -- Update_Element_Preserving_Key ???
(Container : in out Set;
Position : Cursor;
Process : not null access
procedure (Element : in out Element_Type));
-- If Position equals No_Element, then Constraint_Error is raised. If
-- Position is associated with a set object different from Container,
-- then Program_Error is raised. Otherwise, it makes a copy of the key
-- of the element designated by Position, and then calls Process with
-- the element as the parameter. Update_Element then compares the key
-- value obtained before calling Process to the key value obtained from
-- the element after calling Process. If the keys are equivalent then
-- the operation terminates. If Container is busy (cursor tampering has
-- been attempted), then Program_Error is raised. Otherwise, the node
-- is moved to its new position (in canonical order).
procedure Iterate
(Container : Set;
Key : Key_Type;
Process : not null access procedure (Position : Cursor));
-- Call Process with a cursor designating each element equivalent to
-- Key, in order from Floor (Container, Key) to
-- Ceiling (Container, Key).
procedure Reverse_Iterate
(Container : Set;
Key : Key_Type;
Process : not null access procedure (Position : Cursor));
-- Call Process with a cursor designating each element equivalent to
-- Key, in order from Ceiling (Container, Key) to
-- Floor (Container, Key).
end Generic_Keys;
private
pragma Inline (Next);
pragma Inline (Previous);
type Node_Type;
type Node_Access is access Node_Type;
type Node_Type is limited record
Parent : Node_Access;
Left : Node_Access;
Right : Node_Access;
Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red;
Element : Element_Type;
end record;
package Tree_Types is
new Red_Black_Trees.Generic_Tree_Types (Node_Type, Node_Access);
type Set is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
end record with Put_Image => Put_Image;
procedure Put_Image
(S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
overriding procedure Finalize (Container : in out Set) renames Clear;
use Red_Black_Trees;
use Tree_Types, Tree_Types.Implementation;
use Ada.Finalization;
use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
-- In all predefined libraries the following type is controlled, for proper
-- management of tampering checks. For performance reason we omit this
-- machinery for multisets, which are used in a number of our tools.
type Reference_Control_Type is record
Container : Set_Access;
end record;
type Constant_Reference_Type
(Element : not null access constant Element_Type) is record
Control : Reference_Control_Type :=
raise Program_Error with "uninitialized reference";
-- The RM says, "The default initialization of an object of
-- type Constant_Reference_Type or Reference_Type propagates
-- Program_Error."
end record;
type Cursor is record
Container : Set_Access;
Node : Node_Access;
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Set);
for Set'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Set);
for Set'Read use Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type);
for Constant_Reference_Type'Read use Read;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type);
for Constant_Reference_Type'Write use Write;
Empty_Set : constant Set := (Controlled with others => <>);
type Iterator is new Limited_Controlled and
Set_Iterator_Interfaces.Reversible_Iterator with
record
Container : Set_Access;
Node : Node_Access;
end record
with Disable_Controlled => not T_Check;
overriding procedure Finalize (Object : in out Iterator);
overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
end Ada.Containers.Ordered_Multisets;
|
MinimSecure/unum-sdk | Ada | 933 | adb | -- Copyright 2018-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
function Get_Name return String is
begin
return "Some kind of string";
end Get_Name;
end Pck;
|
kontena/ruby-packer | Ada | 17,257 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses2.trace_set --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000-2011,2014 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.6 $
-- $Date: 2014/09/13 19:10:18 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Trace; use Terminal_Interface.Curses.Trace;
with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
with Ada.Strings.Bounded;
-- interactively set the trace level
procedure ncurses2.trace_set is
function menu_virtualize (c : Key_Code) return Key_Code;
function subset (super, sub : Trace_Attribute_Set) return Boolean;
function trace_or (a, b : Trace_Attribute_Set) return Trace_Attribute_Set;
function trace_num (tlevel : Trace_Attribute_Set) return String;
function tracetrace (tlevel : Trace_Attribute_Set) return String;
function run_trace_menu (m : Menu; count : Integer) return Boolean;
function menu_virtualize (c : Key_Code) return Key_Code is
begin
case c is
when Character'Pos (newl) | Key_Exit =>
return Menu_Request_Code'Last + 1; -- MAX_COMMAND? TODO
when Character'Pos ('u') =>
return M_ScrollUp_Line;
when Character'Pos ('d') =>
return M_ScrollDown_Line;
when Character'Pos ('b') | Key_Next_Page =>
return M_ScrollUp_Page;
when Character'Pos ('f') | Key_Previous_Page =>
return M_ScrollDown_Page;
when Character'Pos ('n') | Key_Cursor_Down =>
return M_Next_Item;
when Character'Pos ('p') | Key_Cursor_Up =>
return M_Previous_Item;
when Character'Pos (' ') =>
return M_Toggle_Item;
when Key_Mouse =>
return c;
when others =>
Beep;
return c;
end case;
end menu_virtualize;
type string_a is access String;
type tbl_entry is record
name : string_a;
mask : Trace_Attribute_Set;
end record;
t_tbl : constant array (Positive range <>) of tbl_entry :=
(
(new String'("Disable"),
Trace_Disable),
(new String'("Times"),
Trace_Attribute_Set'(Times => True, others => False)),
(new String'("Tputs"),
Trace_Attribute_Set'(Tputs => True, others => False)),
(new String'("Update"),
Trace_Attribute_Set'(Update => True, others => False)),
(new String'("Cursor_Move"),
Trace_Attribute_Set'(Cursor_Move => True, others => False)),
(new String'("Character_Output"),
Trace_Attribute_Set'(Character_Output => True, others => False)),
(new String'("Ordinary"),
Trace_Ordinary),
(new String'("Calls"),
Trace_Attribute_Set'(Calls => True, others => False)),
(new String'("Virtual_Puts"),
Trace_Attribute_Set'(Virtual_Puts => True, others => False)),
(new String'("Input_Events"),
Trace_Attribute_Set'(Input_Events => True, others => False)),
(new String'("TTY_State"),
Trace_Attribute_Set'(TTY_State => True, others => False)),
(new String'("Internal_Calls"),
Trace_Attribute_Set'(Internal_Calls => True, others => False)),
(new String'("Character_Calls"),
Trace_Attribute_Set'(Character_Calls => True, others => False)),
(new String'("Termcap_TermInfo"),
Trace_Attribute_Set'(Termcap_TermInfo => True, others => False)),
(new String'("Maximium"),
Trace_Maximum)
);
package BS is new Ada.Strings.Bounded.Generic_Bounded_Length (300);
function subset (super, sub : Trace_Attribute_Set) return Boolean is
begin
if
(super.Times or not sub.Times) and
(super.Tputs or not sub.Tputs) and
(super.Update or not sub.Update) and
(super.Cursor_Move or not sub.Cursor_Move) and
(super.Character_Output or not sub.Character_Output) and
(super.Calls or not sub.Calls) and
(super.Virtual_Puts or not sub.Virtual_Puts) and
(super.Input_Events or not sub.Input_Events) and
(super.TTY_State or not sub.TTY_State) and
(super.Internal_Calls or not sub.Internal_Calls) and
(super.Character_Calls or not sub.Character_Calls) and
(super.Termcap_TermInfo or not sub.Termcap_TermInfo) and
True
then
return True;
else
return False;
end if;
end subset;
function trace_or (a, b : Trace_Attribute_Set) return Trace_Attribute_Set is
retval : Trace_Attribute_Set := Trace_Disable;
begin
retval.Times := (a.Times or b.Times);
retval.Tputs := (a.Tputs or b.Tputs);
retval.Update := (a.Update or b.Update);
retval.Cursor_Move := (a.Cursor_Move or b.Cursor_Move);
retval.Character_Output := (a.Character_Output or b.Character_Output);
retval.Calls := (a.Calls or b.Calls);
retval.Virtual_Puts := (a.Virtual_Puts or b.Virtual_Puts);
retval.Input_Events := (a.Input_Events or b.Input_Events);
retval.TTY_State := (a.TTY_State or b.TTY_State);
retval.Internal_Calls := (a.Internal_Calls or b.Internal_Calls);
retval.Character_Calls := (a.Character_Calls or b.Character_Calls);
retval.Termcap_TermInfo := (a.Termcap_TermInfo or b.Termcap_TermInfo);
return retval;
end trace_or;
-- Print the hexadecimal value of the mask so
-- users can set it from the command line.
function trace_num (tlevel : Trace_Attribute_Set) return String is
result : Integer := 0;
m : Integer := 1;
begin
if tlevel.Times then
result := result + m;
end if;
m := m * 2;
if tlevel.Tputs then
result := result + m;
end if;
m := m * 2;
if tlevel.Update then
result := result + m;
end if;
m := m * 2;
if tlevel.Cursor_Move then
result := result + m;
end if;
m := m * 2;
if tlevel.Character_Output then
result := result + m;
end if;
m := m * 2;
if tlevel.Calls then
result := result + m;
end if;
m := m * 2;
if tlevel.Virtual_Puts then
result := result + m;
end if;
m := m * 2;
if tlevel.Input_Events then
result := result + m;
end if;
m := m * 2;
if tlevel.TTY_State then
result := result + m;
end if;
m := m * 2;
if tlevel.Internal_Calls then
result := result + m;
end if;
m := m * 2;
if tlevel.Character_Calls then
result := result + m;
end if;
m := m * 2;
if tlevel.Termcap_TermInfo then
result := result + m;
end if;
m := m * 2;
return result'Img;
end trace_num;
function tracetrace (tlevel : Trace_Attribute_Set) return String is
use BS;
buf : Bounded_String := To_Bounded_String ("");
begin
-- The C version prints the hexadecimal value of the mask, we
-- won't do that here because this is Ada.
if tlevel = Trace_Disable then
Append (buf, "Trace_Disable");
else
if subset (tlevel,
Trace_Attribute_Set'(Times => True, others => False))
then
Append (buf, "Times");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Tputs => True, others => False))
then
Append (buf, "Tputs");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Update => True, others => False))
then
Append (buf, "Update");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Cursor_Move => True,
others => False))
then
Append (buf, "Cursor_Move");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Character_Output => True,
others => False))
then
Append (buf, "Character_Output");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Ordinary)
then
Append (buf, "Ordinary");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Calls => True, others => False))
then
Append (buf, "Calls");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Virtual_Puts => True,
others => False))
then
Append (buf, "Virtual_Puts");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Input_Events => True,
others => False))
then
Append (buf, "Input_Events");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(TTY_State => True,
others => False))
then
Append (buf, "TTY_State");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Internal_Calls => True,
others => False))
then
Append (buf, "Internal_Calls");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Character_Calls => True,
others => False))
then
Append (buf, "Character_Calls");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Attribute_Set'(Termcap_TermInfo => True,
others => False))
then
Append (buf, "Termcap_TermInfo");
Append (buf, ", ");
end if;
if subset (tlevel,
Trace_Maximum)
then
Append (buf, "Maximium");
Append (buf, ", ");
end if;
end if;
if To_String (buf) (Length (buf) - 1) = ',' then
Delete (buf, Length (buf) - 1, Length (buf));
end if;
return To_String (buf);
end tracetrace;
function run_trace_menu (m : Menu; count : Integer) return Boolean is
i, p : Item;
changed : Boolean;
c, v : Key_Code;
begin
loop
changed := (count /= 0);
c := Getchar (Get_Window (m));
v := menu_virtualize (c);
case Driver (m, v) is
when Unknown_Request =>
return False;
when others =>
i := Current (m);
if i = Menus.Items (m, 1) then -- the first item
for n in t_tbl'First + 1 .. t_tbl'Last loop
if Value (i) then
Set_Value (i, False);
changed := True;
end if;
end loop;
else
for n in t_tbl'First + 1 .. t_tbl'Last loop
p := Menus.Items (m, n);
if Value (p) then
Set_Value (Menus.Items (m, 1), False);
changed := True;
exit;
end if;
end loop;
end if;
if not changed then
return True;
end if;
end case;
end loop;
end run_trace_menu;
nc_tracing, mask : Trace_Attribute_Set;
pragma Import (C, nc_tracing, "_nc_tracing");
items_a : constant Item_Array_Access :=
new Item_Array (t_tbl'First .. t_tbl'Last + 1);
mrows : Line_Count;
mcols : Column_Count;
menuwin : Window;
menu_y : constant Line_Position := 8;
menu_x : constant Column_Position := 8;
ip : Item;
m : Menu;
count : Integer;
newtrace : Trace_Attribute_Set;
begin
Add (Line => 0, Column => 0, Str => "Interactively set trace level:");
Add (Line => 2, Column => 0,
Str => " Press space bar to toggle a selection.");
Add (Line => 3, Column => 0,
Str => " Use up and down arrow to move the select bar.");
Add (Line => 4, Column => 0,
Str => " Press return to set the trace level.");
Add (Line => 6, Column => 0, Str => "(Current trace level is ");
Add (Str => tracetrace (nc_tracing) & " numerically: " &
trace_num (nc_tracing));
Add (Ch => ')');
Refresh;
for n in t_tbl'Range loop
items_a.all (n) := New_Item (t_tbl (n).name.all);
end loop;
items_a.all (t_tbl'Last + 1) := Null_Item;
m := New_Menu (items_a);
Set_Format (m, 16, 2);
Scale (m, mrows, mcols);
Switch_Options (m, (One_Valued => True, others => False), On => False);
menuwin := New_Window (mrows + 2, mcols + 2, menu_y, menu_x);
Set_Window (m, menuwin);
Set_KeyPad_Mode (menuwin, SwitchOn => True);
Box (menuwin);
Set_Sub_Window (m, Derived_Window (menuwin, mrows, mcols, 1, 1));
Post (m);
for n in t_tbl'Range loop
ip := Items (m, n);
mask := t_tbl (n).mask;
if mask = Trace_Disable then
Set_Value (ip, nc_tracing = Trace_Disable);
elsif subset (sub => mask, super => nc_tracing) then
Set_Value (ip, True);
end if;
end loop;
count := 1;
while run_trace_menu (m, count) loop
count := count + 1;
end loop;
newtrace := Trace_Disable;
for n in t_tbl'Range loop
ip := Items (m, n);
if Value (ip) then
mask := t_tbl (n).mask;
newtrace := trace_or (newtrace, mask);
end if;
end loop;
Trace_On (newtrace);
Trace_Put ("trace level interactively set to " &
tracetrace (nc_tracing));
Move_Cursor (Line => Lines - 4, Column => 0);
Add (Str => "Trace level is ");
Add (Str => tracetrace (nc_tracing));
Add (Ch => newl);
Pause; -- was just Add(); Getchar
Post (m, False);
-- menuwin has subwindows I think, which makes an error.
declare begin
Delete (menuwin);
exception when Curses_Exception => null; end;
-- free_menu(m);
-- free_item()
end ncurses2.trace_set;
|
Wilfred/difftastic | Ada | 99 | adb | with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line ("Hello WORLD!"); end Hello;
|
rveenker/sdlada | Ada | 1,412 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- Windows implementation.
--------------------------------------------------------------------------------------------------------------------
separate (SDL.Platform)
function Get return Platforms is
begin
return Windows;
end Get;
|
zhmu/ananas | Ada | 831 | adb | -- { dg-do compile }
-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } }
-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" }
-- The DW_AT_byte_size attribute DWARF expression for the
-- DW_TAG_structure_type DIE that describes Rec_Type contains the -4u literal.
-- Check that it is not created using an inefficient encoding (DW_OP_const1s
-- is expected).
procedure Debug8 is
type Rec_Type (I : Integer) is record
B : Boolean;
case I is
when 0 =>
null;
when 1 .. 10 =>
C : Character;
when others =>
N : Natural;
end case;
end record;
R : access Rec_Type := null;
begin
null;
end Debug8;
-- { dg-final { scan-assembler-not "DW_OP_const4u" } }
-- { dg-final { scan-assembler-not "DW_OP_const8u" } }
|
persan/A-gst | Ada | 46,210 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with glib;
with glib.Values;
with System;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_codecparsers_gsth264parser_h is
GST_H264_MAX_SPS_COUNT : constant := 32; -- gst/codecparsers/gsth264parser.h:42
GST_H264_MAX_PPS_COUNT : constant := 256; -- gst/codecparsers/gsth264parser.h:43
-- arg-macro: function GST_H264_IS_P_SLICE (slice)
-- return ((slice).type mod 5) = GST_H264_P_SLICE;
-- arg-macro: function GST_H264_IS_B_SLICE (slice)
-- return ((slice).type mod 5) = GST_H264_B_SLICE;
-- arg-macro: function GST_H264_IS_I_SLICE (slice)
-- return ((slice).type mod 5) = GST_H264_I_SLICE;
-- arg-macro: function GST_H264_IS_SP_SLICE (slice)
-- return ((slice).type mod 5) = GST_H264_SP_SLICE;
-- arg-macro: function GST_H264_IS_SI_SLICE (slice)
-- return ((slice).type mod 5) = GST_H264_SI_SLICE;
-- Gstreamer
-- * Copyright (C) <2011> Intel Corporation
-- * Copyright (C) <2011> Collabora Ltd.
-- * Copyright (C) <2011> Thibault Saunier <[email protected]>
-- *
-- * Some bits C-c,C-v'ed and s/4/3 from h264parse and videoparsers/h264parse.c:
-- * Copyright (C) <2010> Mark Nauwelaerts <[email protected]>
-- * Copyright (C) <2010> Collabora Multimedia
-- * Copyright (C) <2010> Nokia Corporation
-- *
-- * (C) 2005 Michal Benes <[email protected]>
-- * (C) 2008 Wim Taymans <[email protected]>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
--*
-- * GstH264NalUnitType:
-- * @GST_H264_NAL_UNKNOWN: Unknown nal type
-- * @GST_H264_NAL_SLICE: Slice nal
-- * @GST_H264_NAL_SLICE_DPA: DPA slice nal
-- * @GST_H264_NAL_SLICE_DPB: DPB slice nal
-- * @GST_H264_NAL_SLICE_DPC: DPC slice nal
-- * @GST_H264_NAL_SLICE_IDR: DPR slice nal
-- * @GST_H264_NAL_SEI: Supplemental enhancement information (SEI) nal unit
-- * @GST_H264_NAL_SPS: Sequence parameter set (SPS) nal unit
-- * @GST_H264_NAL_PPS: Picture parameter set (PPS) nal unit
-- * @GST_H264_NAL_AU_DELIMITER: Access unit (AU) delimiter nal unit
-- * @GST_H264_NAL_SEQ_END: End of sequence nal unit
-- * @GST_H264_NAL_STREAM_END: End of stream nal unit
-- * @GST_H264_NAL_FILLER_DATA: Filler data nal lunit
-- *
-- * Indicates the type of H264 Nal Units
--
type GstH264NalUnitType is
(GST_H264_NAL_UNKNOWN,
GST_H264_NAL_SLICE,
GST_H264_NAL_SLICE_DPA,
GST_H264_NAL_SLICE_DPB,
GST_H264_NAL_SLICE_DPC,
GST_H264_NAL_SLICE_IDR,
GST_H264_NAL_SEI,
GST_H264_NAL_SPS,
GST_H264_NAL_PPS,
GST_H264_NAL_AU_DELIMITER,
GST_H264_NAL_SEQ_END,
GST_H264_NAL_STREAM_END,
GST_H264_NAL_FILLER_DATA);
pragma Convention (C, GstH264NalUnitType); -- gst/codecparsers/gsth264parser.h:84
--*
-- * GstH264ParserResult:
-- * @GST_H264_PARSER_OK: The parsing succeded
-- * @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken
-- * @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
-- * @GST_H264_PARSER_ERROR: An error accured when parsing
-- * @GST_H264_PARSER_NO_NAL: No nal found during the parsing
-- * @GST_H264_PARSER_NO_NAL_END: Start of the nal found, but not the end.
-- *
-- * The result of parsing H264 data.
--
type GstH264ParserResult is
(GST_H264_PARSER_OK,
GST_H264_PARSER_BROKEN_DATA,
GST_H264_PARSER_BROKEN_LINK,
GST_H264_PARSER_ERROR,
GST_H264_PARSER_NO_NAL,
GST_H264_PARSER_NO_NAL_END);
pragma Convention (C, GstH264ParserResult); -- gst/codecparsers/gsth264parser.h:105
--*
-- * GstH264SEIPayloadType:
-- * @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
-- * @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
-- * ...
-- *
-- * The type of SEI message.
--
-- and more...
type GstH264SEIPayloadType is
(GST_H264_SEI_BUF_PERIOD,
GST_H264_SEI_PIC_TIMING);
pragma Convention (C, GstH264SEIPayloadType); -- gst/codecparsers/gsth264parser.h:120
--*
-- * GstH264SEIPicStructType:
-- * @GST_H264_SEI_PIC_STRUCT_FRAME: Picture is a frame
-- * @GST_H264_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
-- * @GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
-- * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
-- * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
-- * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
-- * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
-- * @GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
-- * be displayed two times consecutively
-- * @GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
-- * displayed three times consecutively
-- *
-- * SEI pic_struct type
--
type GstH264SEIPicStructType is
(GST_H264_SEI_PIC_STRUCT_FRAME,
GST_H264_SEI_PIC_STRUCT_TOP_FIELD,
GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD,
GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM,
GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP,
GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP,
GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM,
GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING,
GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING);
pragma Convention (C, GstH264SEIPicStructType); -- gst/codecparsers/gsth264parser.h:149
--*
-- * GstH264SliceType:
-- *
-- * Type of Picture slice
--
type GstH264SliceType is
(GST_H264_P_SLICE,
GST_H264_B_SLICE,
GST_H264_I_SLICE,
GST_H264_SP_SLICE,
GST_H264_SI_SLICE,
GST_H264_S_P_SLICE,
GST_H264_S_B_SLICE,
GST_H264_S_I_SLICE,
GST_H264_S_SP_SLICE,
GST_H264_S_SI_SLICE);
pragma Convention (C, GstH264SliceType); -- gst/codecparsers/gsth264parser.h:169
type GstH264NalParser;
--subtype GstH264NalParser is u_GstH264NalParser; -- gst/codecparsers/gsth264parser.h:171
type GstH264NalUnit;
--subtype GstH264NalUnit is u_GstH264NalUnit; -- gst/codecparsers/gsth264parser.h:173
type u_GstH264SPS_scaling_lists_4x4_array is array (0 .. 5, 0 .. 15) of aliased GLIB.guint8;
type u_GstH264SPS_scaling_lists_8x8_array is array (0 .. 5, 0 .. 63) of aliased GLIB.guint8;
type u_GstH264SPS_offset_for_ref_frame_array is array (0 .. 254) of aliased GLIB.gint32;
--subtype GstH264SPS is u_GstH264SPS; -- gst/codecparsers/gsth264parser.h:175
type u_GstH264PPS_run_length_minus1_array is array (0 .. 7) of aliased GLIB.guint32;
type u_GstH264PPS_top_left_array is array (0 .. 7) of aliased GLIB.guint32;
type u_GstH264PPS_bottom_right_array is array (0 .. 7) of aliased GLIB.guint32;
type u_GstH264PPS_scaling_lists_4x4_array is array (0 .. 5, 0 .. 15) of aliased GLIB.guint8;
type u_GstH264PPS_scaling_lists_8x8_array is array (0 .. 5, 0 .. 63) of aliased GLIB.guint8;
--subtype GstH264PPS is u_GstH264PPS; -- gst/codecparsers/gsth264parser.h:176
type GstH264HRDParams;
type u_GstH264HRDParams_bit_rate_value_minus1_array is array (0 .. 31) of aliased GLIB.guint32;
type u_GstH264HRDParams_cpb_size_value_minus1_array is array (0 .. 31) of aliased GLIB.guint32;
type u_GstH264HRDParams_cbr_flag_array is array (0 .. 31) of aliased GLIB.guint8;
--subtype GstH264HRDParams is u_GstH264HRDParams; -- gst/codecparsers/gsth264parser.h:177
type GstH264VUIParams;
--subtype GstH264VUIParams is u_GstH264VUIParams; -- gst/codecparsers/gsth264parser.h:178
type GstH264RefPicListModification;
type anon_449 (discr : unsigned := 0) is record
case discr is
when 0 =>
abs_diff_pic_num_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:495
when others =>
long_term_pic_num : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:497
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_449);
pragma Unchecked_Union (anon_449);--subtype GstH264RefPicListModification is u_GstH264RefPicListModification; -- gst/codecparsers/gsth264parser.h:180
type GstH264DecRefPicMarking;
--subtype GstH264DecRefPicMarking is u_GstH264DecRefPicMarking; -- gst/codecparsers/gsth264parser.h:181
type GstH264RefPicMarking;
--subtype GstH264RefPicMarking is u_GstH264RefPicMarking; -- gst/codecparsers/gsth264parser.h:182
type GstH264PredWeightTable;
type u_GstH264PredWeightTable_luma_weight_l0_array is array (0 .. 31) of aliased GLIB.gint16;
type u_GstH264PredWeightTable_luma_offset_l0_array is array (0 .. 31) of aliased GLIB.gint8;
type u_GstH264PredWeightTable_chroma_weight_l0_array is array (0 .. 31, 0 .. 1) of aliased GLIB.gint16;
type u_GstH264PredWeightTable_chroma_offset_l0_array is array (0 .. 31, 0 .. 1) of aliased GLIB.gint8;
type u_GstH264PredWeightTable_luma_weight_l1_array is array (0 .. 31) of aliased GLIB.gint16;
type u_GstH264PredWeightTable_luma_offset_l1_array is array (0 .. 31) of aliased GLIB.gint8;
type u_GstH264PredWeightTable_chroma_weight_l1_array is array (0 .. 31, 0 .. 1) of aliased GLIB.gint16;
type u_GstH264PredWeightTable_chroma_offset_l1_array is array (0 .. 31, 0 .. 1) of aliased GLIB.gint8;
--subtype GstH264PredWeightTable is u_GstH264PredWeightTable; -- gst/codecparsers/gsth264parser.h:183
type GstH264SliceHdr;
type u_GstH264SliceHdr_delta_pic_order_cnt_array is array (0 .. 1) of aliased GLIB.gint32;
--subtype GstH264SliceHdr is u_GstH264SliceHdr; -- gst/codecparsers/gsth264parser.h:184
type GstH264ClockTimestamp;
--subtype GstH264ClockTimestamp is u_GstH264ClockTimestamp; -- gst/codecparsers/gsth264parser.h:186
type GstH264PicTiming;
type u_GstH264PicTiming_clock_timestamp_flag_array is array (0 .. 2) of aliased GLIB.guint8;
--subtype GstH264PicTiming is u_GstH264PicTiming; -- gst/codecparsers/gsth264parser.h:187
type GstH264BufferingPeriod;
type u_GstH264BufferingPeriod_nal_initial_cpb_removal_delay_array is array (0 .. 31) of aliased GLIB.guint8;
type u_GstH264BufferingPeriod_nal_initial_cpb_removal_delay_offset_array is array (0 .. 31) of aliased GLIB.guint8;
type u_GstH264BufferingPeriod_vcl_initial_cpb_removal_delay_array is array (0 .. 31) of aliased GLIB.guint8;
type u_GstH264BufferingPeriod_vcl_initial_cpb_removal_delay_offset_array is array (0 .. 31) of aliased GLIB.guint8;
--subtype GstH264BufferingPeriod is u_GstH264BufferingPeriod; -- gst/codecparsers/gsth264parser.h:188
type GstH264SEIMessage;
--*
-- * GstH264NalUnit:
-- * @ref_idc: not equal to 0 specifies that the content of the NAL unit contains a sequence
-- * parameter set, a sequence * parameter set extension, a subset sequence parameter set, a
-- * picture parameter set, a slice of a reference picture, a slice data partition of a
-- * reference picture, or a prefix NAL unit preceding a slice of a reference picture.
-- * @type: A #GstH264NalUnitType
-- * @idr_pic_flag: calculated idr_pic_flag
-- * @size: The size of the nal unit starting from @offset
-- * @offset: The offset of the actual start of the nal unit
-- * @sc_offset:The offset of the start code of the nal unit
-- * @valid: If the nal unit is valid, which mean it has
-- * already been parsed
-- * @data: The data from which the Nalu has been parsed
-- *
-- * Structure defining the Nal unit headers
--
type GstH264NalUnit is record
ref_idc : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:210
c_type : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:211
idr_pic_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:214
size : aliased GLIB.guint; -- gst/codecparsers/gsth264parser.h:215
offset : aliased GLIB.guint; -- gst/codecparsers/gsth264parser.h:216
sc_offset : aliased GLIB.guint; -- gst/codecparsers/gsth264parser.h:217
valid : aliased GLIB.gboolean; -- gst/codecparsers/gsth264parser.h:218
data : access GLIB.guint8; -- gst/codecparsers/gsth264parser.h:220
end record;
pragma Convention (C_Pass_By_Copy, GstH264NalUnit); -- gst/codecparsers/gsth264parser.h:208
-- calculated values
--*
-- * GstH264HRDParams:
-- * @cpb_cnt_minus1: plus 1 specifies the number of alternative
-- * CPB specifications in the bitstream
-- * @bit_rate_scale: specifies the maximum input bit rate of the
-- * SchedSelIdx-th CPB
-- * @cpb_size_scale: specifies the CPB size of the SchedSelIdx-th CPB
-- * @guint32 bit_rate_value_minus1: specifies the maximum input bit rate for the
-- * SchedSelIdx-th CPB
-- * @cpb_size_value_minus1: is used together with cpb_size_scale to specify the
-- * SchedSelIdx-th CPB size
-- * @cbr_flag: Specifies if running in itermediate bitrate mode or constant
-- * @initial_cpb_removal_delay_length_minus1: specifies the length in bits of
-- * the cpb_removal_delay syntax element
-- * @cpb_removal_delay_length_minus1: specifies the length in bits of the
-- * dpb_output_delay syntax element
-- * @dpb_output_delay_length_minus1: >0 specifies the length in bits of the time_offset syntax element.
-- * =0 specifies that the time_offset syntax element is not present
-- * @time_offset_length: Length of the time offset
-- *
-- * Defines the HRD parameters
--
type GstH264HRDParams is record
cpb_cnt_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:247
bit_rate_scale : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:248
cpb_size_scale : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:249
bit_rate_value_minus1 : aliased u_GstH264HRDParams_bit_rate_value_minus1_array; -- gst/codecparsers/gsth264parser.h:251
cpb_size_value_minus1 : aliased u_GstH264HRDParams_cpb_size_value_minus1_array; -- gst/codecparsers/gsth264parser.h:252
cbr_flag : aliased u_GstH264HRDParams_cbr_flag_array; -- gst/codecparsers/gsth264parser.h:253
initial_cpb_removal_delay_length_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:255
cpb_removal_delay_length_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:256
dpb_output_delay_length_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:257
time_offset_length : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:258
end record;
pragma Convention (C_Pass_By_Copy, GstH264HRDParams); -- gst/codecparsers/gsth264parser.h:245
--*
-- * GstH264VUIParams:
-- * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
-- * %FALSE specifies that aspect_ratio_idc is not present
-- * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
-- * @sar_width indicates the horizontal size of the sample aspect ratio
-- * @sar_height indicates the vertical size of the sample aspect ratio
-- * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwize
-- * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
-- * output are suitable for display using overscan. %FALSE the cropped decoded pictures
-- * output contain visually important information
-- * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
-- * colour_description_present_flag are present.
-- * @video_format: indicates the representation of the picture
-- * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
-- * @colour_description_present_flag: %TRUE specifies that colour_primaries,
-- * transfer_characteristics and matrix_coefficients are present
-- * @colour_primaries: indicates the chromaticity coordinates of the source primaries
-- * @transfer_characteristics: indicates the opto-electronic transfer characteristic
-- * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
-- * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
-- * chroma_sample_loc_type_bottom_field are present, %FALSE otherwize
-- * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
-- * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
-- * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
-- * time_scale and fixed_frame_rate_flag are present in the bitstream
-- * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
-- * time_scale: is the number of time units that pass in one second
-- * @fixed_frame_rate_flag: %TRUE indicates that the temporal distance between the HRD output times
-- * of any two consecutive pictures in output order is constrained as specified in the spec, %FALSE
-- * otherwize.
-- * @nal_hrd_parameters_present_flag: %TRUE if nal hrd parameters present in the bitstream
-- * @vcl_hrd_parameters_present_flag: %TRUE if nal vlc hrd parameters present in the bitstream
-- * @low_delay_hrd_flag: specifies the HRD operational mode
-- * @pic_struct_present_flag: %TRUE specifies that picture timing SEI messages are present or not
-- * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
-- * parameters are present
-- * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
-- * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
-- * samples outside picture boundaries may be used in inter prediction
-- * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
-- * the VCL NAL units associated with any coded picture in the coded video sequence.
-- * @max_bits_per_mb_denom: indicates the maximum number of coded bits of macroblock_layer
-- * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
-- * motion vector component
-- * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
-- * motion vector component
-- * @num_reorder_frames: indicates the maximum number of frames, complementary field pairs,
-- * or non-paired fields that precede any frame,
-- * @max_dec_frame_buffering: specifies the required size of the HRD decoded picture buffer in
-- * units of frame buffers.
-- *
-- * The structure representing the VUI parameters.
--
type GstH264VUIParams is record
aspect_ratio_info_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:317
aspect_ratio_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:318
sar_width : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:320
sar_height : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:321
overscan_info_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:323
overscan_appropriate_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:325
video_signal_type_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:327
video_format : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:328
video_full_range_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:329
colour_description_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:330
colour_primaries : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:331
transfer_characteristics : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:332
matrix_coefficients : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:333
chroma_loc_info_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:335
chroma_sample_loc_type_top_field : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:336
chroma_sample_loc_type_bottom_field : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:337
timing_info_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:339
num_units_in_tick : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:341
time_scale : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:342
fixed_frame_rate_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:343
nal_hrd_parameters_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:345
nal_hrd_parameters : aliased GstH264HRDParams; -- gst/codecparsers/gsth264parser.h:347
vcl_hrd_parameters_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:349
vcl_hrd_parameters : aliased GstH264HRDParams; -- gst/codecparsers/gsth264parser.h:351
low_delay_hrd_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:353
pic_struct_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:354
bitstream_restriction_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:356
motion_vectors_over_pic_boundaries_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:358
max_bytes_per_pic_denom : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:359
max_bits_per_mb_denom : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:360
log2_max_mv_length_horizontal : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:361
log2_max_mv_length_vertical : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:362
num_reorder_frames : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:363
max_dec_frame_buffering : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:364
end record;
pragma Convention (C_Pass_By_Copy, GstH264VUIParams); -- gst/codecparsers/gsth264parser.h:315
-- if aspect_ratio_idc == 255
-- if overscan_info_present_flag
-- if timing_info_present_flag
-- if nal_hrd_parameters_present_flag
-- if nal_hrd_parameters_present_flag
-- if bitstream_restriction_flag
--*
-- * GstH264SPS:
-- * @id: The ID of the sequence parameter set
-- * @profile_idc: indicate the profile to which the coded video sequence conforms
-- *
-- * H264 Sequence Parameter Set (SPS)
--
type GstH264SPS is record
id : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:376
profile_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:378
constraint_set0_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:379
constraint_set1_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:380
constraint_set2_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:381
constraint_set3_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:382
level_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:383
chroma_format_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:385
separate_colour_plane_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:386
bit_depth_luma_minus8 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:387
bit_depth_chroma_minus8 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:388
qpprime_y_zero_transform_bypass_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:389
scaling_matrix_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:391
scaling_lists_4x4 : aliased u_GstH264SPS_scaling_lists_4x4_array; -- gst/codecparsers/gsth264parser.h:392
scaling_lists_8x8 : aliased u_GstH264SPS_scaling_lists_8x8_array; -- gst/codecparsers/gsth264parser.h:393
log2_max_frame_num_minus4 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:395
pic_order_cnt_type : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:396
log2_max_pic_order_cnt_lsb_minus4 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:399
delta_pic_order_always_zero_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:402
offset_for_non_ref_pic : aliased GLIB.gint32; -- gst/codecparsers/gsth264parser.h:403
offset_for_top_to_bottom_field : aliased GLIB.gint32; -- gst/codecparsers/gsth264parser.h:404
num_ref_frames_in_pic_order_cnt_cycle : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:405
offset_for_ref_frame : aliased u_GstH264SPS_offset_for_ref_frame_array; -- gst/codecparsers/gsth264parser.h:406
num_ref_frames : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:408
gaps_in_frame_num_value_allowed_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:409
pic_width_in_mbs_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:410
pic_height_in_map_units_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:411
frame_mbs_only_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:412
mb_adaptive_frame_field_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:414
direct_8x8_inference_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:416
frame_cropping_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:418
frame_crop_left_offset : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:421
frame_crop_right_offset : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:422
frame_crop_top_offset : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:423
frame_crop_bottom_offset : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:424
vui_parameters_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:426
vui_parameters : aliased GstH264VUIParams; -- gst/codecparsers/gsth264parser.h:428
chroma_array_type : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:431
max_frame_num : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:432
width : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:433
height : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:433
fps_num : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:434
fps_den : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:434
valid : aliased GLIB.gboolean; -- gst/codecparsers/gsth264parser.h:435
end record;
pragma Convention (C_Pass_By_Copy, GstH264SPS); -- gst/codecparsers/gsth264parser.h:374
-- if pic_order_cnt_type == 0
-- else if pic_order_cnt_type == 1
-- if frame_cropping_flag
-- if vui_parameters_present_flag
-- calculated values
--*
-- * GstH264PPS:
-- *
-- * H264 Picture Parameter Set
--
type GstH264PPS is record
id : aliased GLIB.gint; -- gst/codecparsers/gsth264parser.h:445
sequence : access GstH264SPS; -- gst/codecparsers/gsth264parser.h:447
entropy_coding_mode_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:449
pic_order_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:450
num_slice_groups_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:452
slice_group_map_type : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:455
run_length_minus1 : aliased u_GstH264PPS_run_length_minus1_array; -- gst/codecparsers/gsth264parser.h:457
top_left : aliased u_GstH264PPS_top_left_array; -- gst/codecparsers/gsth264parser.h:459
bottom_right : aliased u_GstH264PPS_bottom_right_array; -- gst/codecparsers/gsth264parser.h:460
slice_group_change_direction_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:462
slice_group_change_rate_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:463
pic_size_in_map_units_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:465
slice_group_id : access GLIB.guint8; -- gst/codecparsers/gsth264parser.h:466
num_ref_idx_l0_active_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:468
num_ref_idx_l1_active_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:469
weighted_pred_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:470
weighted_bipred_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:471
pic_init_qp_minus26 : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:472
pic_init_qs_minus26 : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:473
chroma_qp_index_offset : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:474
deblocking_filter_control_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:475
constrained_intra_pred_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:476
redundant_pic_cnt_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:477
transform_8x8_mode_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:479
scaling_lists_4x4 : aliased u_GstH264PPS_scaling_lists_4x4_array; -- gst/codecparsers/gsth264parser.h:481
scaling_lists_8x8 : aliased u_GstH264PPS_scaling_lists_8x8_array; -- gst/codecparsers/gsth264parser.h:482
second_chroma_qp_index_offset : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:484
valid : aliased GLIB.gboolean; -- gst/codecparsers/gsth264parser.h:486
end record;
pragma Convention (C_Pass_By_Copy, GstH264PPS); -- gst/codecparsers/gsth264parser.h:443
type u_GstH264NalParser_sps_array is array (0 .. 31) of aliased GstH264SPS;
type u_GstH264NalParser_pps_array is array (0 .. 255) of aliased GstH264PPS;
-- if num_slice_groups_minus1 > 0
-- and if slice_group_map_type == 0
-- or if slice_group_map_type == 2
-- or if slice_group_map_type == (3, 4, 5)
-- or if slice_group_map_type == 6
type GstH264RefPicListModification is record
modification_of_pic_nums_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:491
value : aliased anon_449; -- gst/codecparsers/gsth264parser.h:498
end record;
pragma Convention (C_Pass_By_Copy, GstH264RefPicListModification); -- gst/codecparsers/gsth264parser.h:489
type u_GstH264SliceHdr_ref_pic_list_modification_l0_array is array (0 .. 31) of aliased GstH264RefPicListModification;
type u_GstH264SliceHdr_ref_pic_list_modification_l1_array is array (0 .. 31) of aliased GstH264RefPicListModification;
-- if modification_of_pic_nums_idc == 0 || 1
-- if modification_of_pic_nums_idc == 2
type GstH264PredWeightTable is record
luma_log2_weight_denom : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:503
chroma_log2_weight_denom : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:504
luma_weight_l0 : aliased u_GstH264PredWeightTable_luma_weight_l0_array; -- gst/codecparsers/gsth264parser.h:506
luma_offset_l0 : aliased u_GstH264PredWeightTable_luma_offset_l0_array; -- gst/codecparsers/gsth264parser.h:507
chroma_weight_l0 : aliased u_GstH264PredWeightTable_chroma_weight_l0_array; -- gst/codecparsers/gsth264parser.h:510
chroma_offset_l0 : aliased u_GstH264PredWeightTable_chroma_offset_l0_array; -- gst/codecparsers/gsth264parser.h:511
luma_weight_l1 : aliased u_GstH264PredWeightTable_luma_weight_l1_array; -- gst/codecparsers/gsth264parser.h:514
luma_offset_l1 : aliased u_GstH264PredWeightTable_luma_offset_l1_array; -- gst/codecparsers/gsth264parser.h:515
chroma_weight_l1 : aliased u_GstH264PredWeightTable_chroma_weight_l1_array; -- gst/codecparsers/gsth264parser.h:518
chroma_offset_l1 : aliased u_GstH264PredWeightTable_chroma_offset_l1_array; -- gst/codecparsers/gsth264parser.h:519
end record;
pragma Convention (C_Pass_By_Copy, GstH264PredWeightTable); -- gst/codecparsers/gsth264parser.h:501
-- if seq->ChromaArrayType != 0
-- if slice->slice_type % 5 == 1
-- and if seq->ChromaArrayType != 0
type GstH264RefPicMarking is record
memory_management_control_operation : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:524
difference_of_pic_nums_minus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:526
long_term_pic_num : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:527
long_term_frame_idx : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:528
max_long_term_frame_idx_plus1 : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:529
end record;
pragma Convention (C_Pass_By_Copy, GstH264RefPicMarking); -- gst/codecparsers/gsth264parser.h:522
type u_GstH264DecRefPicMarking_ref_pic_marking_array is array (0 .. 9) of aliased GstH264RefPicMarking;
-- if slice->nal_unit.IdrPicFlag
type GstH264DecRefPicMarking is record
no_output_of_prior_pics_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:535
long_term_reference_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:536
adaptive_ref_pic_marking_mode_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:538
ref_pic_marking : aliased u_GstH264DecRefPicMarking_ref_pic_marking_array; -- gst/codecparsers/gsth264parser.h:539
n_ref_pic_marking : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:540
end record;
pragma Convention (C_Pass_By_Copy, GstH264DecRefPicMarking); -- gst/codecparsers/gsth264parser.h:532
type GstH264SliceHdr is record
first_mb_in_slice : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:546
c_type : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:547
pps : access GstH264PPS; -- gst/codecparsers/gsth264parser.h:548
colour_plane_id : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:551
frame_num : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:553
field_pic_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:555
bottom_field_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:556
idr_pic_id : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:559
pic_order_cnt_lsb : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:562
delta_pic_order_cnt_bottom : aliased GLIB.gint32; -- gst/codecparsers/gsth264parser.h:564
delta_pic_order_cnt : aliased u_GstH264SliceHdr_delta_pic_order_cnt_array; -- gst/codecparsers/gsth264parser.h:566
redundant_pic_cnt : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:567
direct_spatial_mv_pred_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:570
num_ref_idx_l0_active_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:572
num_ref_idx_l1_active_minus1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:573
ref_pic_list_modification_flag_l0 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:575
n_ref_pic_list_modification_l0 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:576
ref_pic_list_modification_l0 : aliased u_GstH264SliceHdr_ref_pic_list_modification_l0_array; -- gst/codecparsers/gsth264parser.h:577
ref_pic_list_modification_flag_l1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:578
n_ref_pic_list_modification_l1 : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:579
ref_pic_list_modification_l1 : aliased u_GstH264SliceHdr_ref_pic_list_modification_l1_array; -- gst/codecparsers/gsth264parser.h:580
pred_weight_table : aliased GstH264PredWeightTable; -- gst/codecparsers/gsth264parser.h:582
dec_ref_pic_marking : aliased GstH264DecRefPicMarking; -- gst/codecparsers/gsth264parser.h:584
cabac_init_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:586
slice_qp_delta : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:587
slice_qs_delta : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:588
disable_deblocking_filter_idc : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:590
slice_alpha_c0_offset_div2 : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:591
slice_beta_offset_div2 : aliased GLIB.gint8; -- gst/codecparsers/gsth264parser.h:592
slice_group_change_cycle : aliased GLIB.guint16; -- gst/codecparsers/gsth264parser.h:594
max_pic_num : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:597
valid : aliased GLIB.gboolean; -- gst/codecparsers/gsth264parser.h:598
header_size : aliased GLIB.guint; -- gst/codecparsers/gsth264parser.h:601
end record;
pragma Convention (C_Pass_By_Copy, GstH264SliceHdr); -- gst/codecparsers/gsth264parser.h:544
-- if seq->separate_colour_plane_flag
-- if nal_unit.type == 5
-- if seq->pic_order_cnt_type == 0
-- if seq->pic_order_present_flag && !field_pic_flag
-- if slice_type == B_SLICE
-- if nal_unit.ref_idc != 0
-- calculated values
-- Size of the slice_header() in bits
type GstH264ClockTimestamp is record
ct_type : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:607
nuit_field_based_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:608
counting_type : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:609
discontinuity_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:610
cnt_dropped_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:611
n_frames : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:612
seconds_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:614
seconds_value : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:615
minutes_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:617
minutes_value : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:618
hours_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:620
hours_value : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:621
time_offset : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:623
end record;
pragma Convention (C_Pass_By_Copy, GstH264ClockTimestamp); -- gst/codecparsers/gsth264parser.h:605
type u_GstH264PicTiming_clock_timestamp_array is array (0 .. 2) of aliased GstH264ClockTimestamp;
type GstH264PicTiming is record
cpb_removal_delay : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:628
dpb_output_delay : aliased GLIB.guint32; -- gst/codecparsers/gsth264parser.h:629
pic_struct_present_flag : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:631
pic_struct : aliased GLIB.guint8; -- gst/codecparsers/gsth264parser.h:633
clock_timestamp_flag : aliased u_GstH264PicTiming_clock_timestamp_flag_array; -- gst/codecparsers/gsth264parser.h:635
clock_timestamp : aliased u_GstH264PicTiming_clock_timestamp_array; -- gst/codecparsers/gsth264parser.h:636
end record;
pragma Convention (C_Pass_By_Copy, GstH264PicTiming); -- gst/codecparsers/gsth264parser.h:626
-- if pic_struct_present_flag
type GstH264BufferingPeriod is record
sps : access GstH264SPS; -- gst/codecparsers/gsth264parser.h:641
nal_initial_cpb_removal_delay : aliased u_GstH264BufferingPeriod_nal_initial_cpb_removal_delay_array; -- gst/codecparsers/gsth264parser.h:644
nal_initial_cpb_removal_delay_offset : aliased u_GstH264BufferingPeriod_nal_initial_cpb_removal_delay_offset_array; -- gst/codecparsers/gsth264parser.h:645
vcl_initial_cpb_removal_delay : aliased u_GstH264BufferingPeriod_vcl_initial_cpb_removal_delay_array; -- gst/codecparsers/gsth264parser.h:648
vcl_initial_cpb_removal_delay_offset : aliased u_GstH264BufferingPeriod_vcl_initial_cpb_removal_delay_offset_array; -- gst/codecparsers/gsth264parser.h:649
end record;
pragma Convention (C_Pass_By_Copy, GstH264BufferingPeriod); -- gst/codecparsers/gsth264parser.h:639
-- seq->vui_parameters->nal_hrd_parameters_present_flag
-- seq->vui_parameters->vcl_hrd_parameters_present_flag
type anon_450 (discr : unsigned := 0) is record
case discr is
when 0 =>
buffering_period : aliased GstH264BufferingPeriod; -- gst/codecparsers/gsth264parser.h:657
when others =>
pic_timing : aliased GstH264PicTiming; -- gst/codecparsers/gsth264parser.h:658
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_450);
pragma Unchecked_Union (anon_450);--subtype GstH264SEIMessage is u_GstH264SEIMessage; -- gst/codecparsers/gsth264parser.h:189
type GstH264SEIMessage is record
payloadType : aliased GstH264SEIPayloadType; -- gst/codecparsers/gsth264parser.h:654
field_2 : aliased anon_450;
end record;
pragma Convention (C_Pass_By_Copy, GstH264SEIMessage); -- gst/codecparsers/gsth264parser.h:652
-- ... could implement more
--*
-- * GstH264NalParser:
-- *
-- * H264 NAL Parser (opaque structure).
--
--< private >
type GstH264NalParser is record
sps : aliased u_GstH264NalParser_sps_array; -- gst/codecparsers/gsth264parser.h:671
pps : aliased u_GstH264NalParser_pps_array; -- gst/codecparsers/gsth264parser.h:672
last_sps : access GstH264SPS; -- gst/codecparsers/gsth264parser.h:673
last_pps : access GstH264PPS; -- gst/codecparsers/gsth264parser.h:674
end record;
pragma Convention (C_Pass_By_Copy, GstH264NalParser); -- gst/codecparsers/gsth264parser.h:668
function gst_h264_nal_parser_new return access GstH264NalParser; -- gst/codecparsers/gsth264parser.h:677
pragma Import (C, gst_h264_nal_parser_new, "gst_h264_nal_parser_new");
function gst_h264_parser_identify_nalu
(nalparser : access GstH264NalParser;
data : access GLIB.guint8;
offset : GLIB.guint;
size : GLIB.gsize;
nalu : access GstH264NalUnit) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:679
pragma Import (C, gst_h264_parser_identify_nalu, "gst_h264_parser_identify_nalu");
function gst_h264_parser_identify_nalu_unchecked
(nalparser : access GstH264NalParser;
data : access GLIB.guint8;
offset : GLIB.guint;
size : GLIB.gsize;
nalu : access GstH264NalUnit) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:683
pragma Import (C, gst_h264_parser_identify_nalu_unchecked, "gst_h264_parser_identify_nalu_unchecked");
function gst_h264_parser_identify_nalu_avc
(nalparser : access GstH264NalParser;
data : access GLIB.guint8;
offset : GLIB.guint;
size : GLIB.gsize;
nal_length_size : GLIB.guint8;
nalu : access GstH264NalUnit) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:687
pragma Import (C, gst_h264_parser_identify_nalu_avc, "gst_h264_parser_identify_nalu_avc");
function gst_h264_parser_parse_nal (nalparser : access GstH264NalParser; nalu : access GstH264NalUnit) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:691
pragma Import (C, gst_h264_parser_parse_nal, "gst_h264_parser_parse_nal");
function gst_h264_parser_parse_slice_hdr
(nalparser : access GstH264NalParser;
nalu : access GstH264NalUnit;
slice : access GstH264SliceHdr;
parse_pred_weight_table : GLIB.gboolean;
parse_dec_ref_pic_marking : GLIB.gboolean) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:694
pragma Import (C, gst_h264_parser_parse_slice_hdr, "gst_h264_parser_parse_slice_hdr");
function gst_h264_parser_parse_sps
(nalparser : access GstH264NalParser;
nalu : access GstH264NalUnit;
sps : access GstH264SPS;
parse_vui_params : GLIB.gboolean) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:698
pragma Import (C, gst_h264_parser_parse_sps, "gst_h264_parser_parse_sps");
function gst_h264_parser_parse_pps
(nalparser : access GstH264NalParser;
nalu : access GstH264NalUnit;
pps : access GstH264PPS) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:701
pragma Import (C, gst_h264_parser_parse_pps, "gst_h264_parser_parse_pps");
function gst_h264_parser_parse_sei
(nalparser : access GstH264NalParser;
nalu : access GstH264NalUnit;
sei : access GstH264SEIMessage) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:704
pragma Import (C, gst_h264_parser_parse_sei, "gst_h264_parser_parse_sei");
procedure gst_h264_nal_parser_free (nalparser : access GstH264NalParser); -- gst/codecparsers/gsth264parser.h:707
pragma Import (C, gst_h264_nal_parser_free, "gst_h264_nal_parser_free");
function gst_h264_parse_sps
(nalu : access GstH264NalUnit;
sps : access GstH264SPS;
parse_vui_params : GLIB.gboolean) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:709
pragma Import (C, gst_h264_parse_sps, "gst_h264_parse_sps");
function gst_h264_parse_pps
(nalparser : access GstH264NalParser;
nalu : access GstH264NalUnit;
pps : access GstH264PPS) return GstH264ParserResult; -- gst/codecparsers/gsth264parser.h:712
pragma Import (C, gst_h264_parse_pps, "gst_h264_parse_pps");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_codecparsers_gsth264parser_h;
|
twdroeger/ada-awa | Ada | 2,834 | ads | -----------------------------------------------------------------------
-- awa-users-principals -- User principals
-- Copyright (C) 2011, 2012, 2013, 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO;
with AWA.Users.Models;
with ASF.Principals;
package AWA.Users.Principals is
type Principal is new ASF.Principals.Principal with private;
type Principal_Access is access all Principal'Class;
-- Get the principal name.
function Get_Name (From : in Principal) return String;
-- Get the principal identifier (name)
function Get_Id (From : in Principal) return String;
-- Get the user associated with the principal.
function Get_User (From : in Principal) return AWA.Users.Models.User_Ref;
-- Get the current user identifier invoking the service operation.
-- Returns NO_IDENTIFIER if there is none.
function Get_User_Identifier (From : in Principal) return ADO.Identifier;
-- Get the connection session used by the user.
function Get_Session (From : in Principal) return AWA.Users.Models.Session_Ref;
-- Get the connection session identifier used by the user.
function Get_Session_Identifier (From : in Principal) return ADO.Identifier;
-- Create a principal for the given user.
function Create (User : in AWA.Users.Models.User_Ref;
Session : in AWA.Users.Models.Session_Ref) return Principal_Access;
-- Create a principal for the given user.
function Create (User : in AWA.Users.Models.User_Ref;
Session : in AWA.Users.Models.Session_Ref) return Principal;
-- Utility functions based on the security principal access type.
-- Get the current user identifier invoking the service operation.
-- Returns NO_IDENTIFIER if there is none or if the principal is not an AWA principal.
function Get_User_Identifier (From : in ASF.Principals.Principal_Access)
return ADO.Identifier;
private
type Principal is new ASF.Principals.Principal with record
User : AWA.Users.Models.User_Ref;
Session : AWA.Users.Models.Session_Ref;
end record;
end AWA.Users.Principals;
|
AdaCore/Ada_Drivers_Library | Ada | 35,870 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f429xx.h --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides declarations for devices on the STM32F42xxx MCUs
-- manufactured by ST Microelectronics. For example, an STM32F429.
private with ADL_Config;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.DSI;
with STM32_SVD.SAI;
with STM32_SVD.SDMMC;
with STM32.ADC; use STM32.ADC;
with STM32.DAC; use STM32.DAC;
with STM32.DMA; use STM32.DMA;
with STM32.DSI; use STM32.DSI;
with STM32.GPIO; use STM32.GPIO;
with STM32.I2C; use STM32.I2C;
with STM32.SDMMC; use STM32.SDMMC;
with STM32.SPI; use STM32.SPI;
with STM32.SPI.DMA; use STM32.SPI.DMA;
with STM32.I2S; use STM32.I2S;
with STM32.Timers; use STM32.Timers;
with STM32.RTC; use STM32.RTC;
package STM32.Device is
pragma Elaborate_Body;
Unknown_Device : exception;
-- Raised by the routines below for a device passed as an actual parameter
-- when that device is not present on the given hardware instance.
HSI_VALUE : constant := 16_000_000;
-- Internal oscillator in Hz
HSE_VALUE : constant UInt32;
-- External oscillator in Hz
procedure Enable_Clock (This : aliased in out GPIO_Port)
with Inline;
procedure Enable_Clock (Point : GPIO_Point)
with Inline;
procedure Enable_Clock (Points : GPIO_Points)
with Inline;
procedure Reset (This : aliased in out GPIO_Port)
with Inline;
procedure Reset (Point : GPIO_Point)
with Inline;
procedure Reset (Points : GPIO_Points)
with Inline;
GPIO_A : aliased GPIO_Port
with Import, Volatile, Address => GPIOA_Base;
GPIO_B : aliased GPIO_Port
with Import, Volatile, Address => GPIOB_Base;
GPIO_C : aliased GPIO_Port
with Import, Volatile, Address => GPIOC_Base;
GPIO_D : aliased GPIO_Port
with Import, Volatile, Address => GPIOD_Base;
GPIO_E : aliased GPIO_Port
with Import, Volatile, Address => GPIOE_Base;
GPIO_F : aliased GPIO_Port
with Import, Volatile, Address => GPIOF_Base;
GPIO_G : aliased GPIO_Port
with Import, Volatile, Address => GPIOG_Base;
GPIO_H : aliased GPIO_Port
with Import, Volatile, Address => GPIOH_Base;
GPIO_I : aliased GPIO_Port
with Import, Volatile, Address => GPIOI_Base;
GPIO_J : aliased GPIO_Port
with Import, Volatile, Address => GPIOJ_Base;
GPIO_K : aliased GPIO_Port
with Import, Volatile, Address => GPIOK_Base;
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4
with Inline;
PA0 : aliased GPIO_Point := (GPIO_A'Access, Pin_0);
PA1 : aliased GPIO_Point := (GPIO_A'Access, Pin_1);
PA2 : aliased GPIO_Point := (GPIO_A'Access, Pin_2);
PA3 : aliased GPIO_Point := (GPIO_A'Access, Pin_3);
PA4 : aliased GPIO_Point := (GPIO_A'Access, Pin_4);
PA5 : aliased GPIO_Point := (GPIO_A'Access, Pin_5);
PA6 : aliased GPIO_Point := (GPIO_A'Access, Pin_6);
PA7 : aliased GPIO_Point := (GPIO_A'Access, Pin_7);
PA8 : aliased GPIO_Point := (GPIO_A'Access, Pin_8);
PA9 : aliased GPIO_Point := (GPIO_A'Access, Pin_9);
PA10 : aliased GPIO_Point := (GPIO_A'Access, Pin_10);
PA11 : aliased GPIO_Point := (GPIO_A'Access, Pin_11);
PA12 : aliased GPIO_Point := (GPIO_A'Access, Pin_12);
PA13 : aliased GPIO_Point := (GPIO_A'Access, Pin_13);
PA14 : aliased GPIO_Point := (GPIO_A'Access, Pin_14);
PA15 : aliased GPIO_Point := (GPIO_A'Access, Pin_15);
PB0 : aliased GPIO_Point := (GPIO_B'Access, Pin_0);
PB1 : aliased GPIO_Point := (GPIO_B'Access, Pin_1);
PB2 : aliased GPIO_Point := (GPIO_B'Access, Pin_2);
PB3 : aliased GPIO_Point := (GPIO_B'Access, Pin_3);
PB4 : aliased GPIO_Point := (GPIO_B'Access, Pin_4);
PB5 : aliased GPIO_Point := (GPIO_B'Access, Pin_5);
PB6 : aliased GPIO_Point := (GPIO_B'Access, Pin_6);
PB7 : aliased GPIO_Point := (GPIO_B'Access, Pin_7);
PB8 : aliased GPIO_Point := (GPIO_B'Access, Pin_8);
PB9 : aliased GPIO_Point := (GPIO_B'Access, Pin_9);
PB10 : aliased GPIO_Point := (GPIO_B'Access, Pin_10);
PB11 : aliased GPIO_Point := (GPIO_B'Access, Pin_11);
PB12 : aliased GPIO_Point := (GPIO_B'Access, Pin_12);
PB13 : aliased GPIO_Point := (GPIO_B'Access, Pin_13);
PB14 : aliased GPIO_Point := (GPIO_B'Access, Pin_14);
PB15 : aliased GPIO_Point := (GPIO_B'Access, Pin_15);
PC0 : aliased GPIO_Point := (GPIO_C'Access, Pin_0);
PC1 : aliased GPIO_Point := (GPIO_C'Access, Pin_1);
PC2 : aliased GPIO_Point := (GPIO_C'Access, Pin_2);
PC3 : aliased GPIO_Point := (GPIO_C'Access, Pin_3);
PC4 : aliased GPIO_Point := (GPIO_C'Access, Pin_4);
PC5 : aliased GPIO_Point := (GPIO_C'Access, Pin_5);
PC6 : aliased GPIO_Point := (GPIO_C'Access, Pin_6);
PC7 : aliased GPIO_Point := (GPIO_C'Access, Pin_7);
PC8 : aliased GPIO_Point := (GPIO_C'Access, Pin_8);
PC9 : aliased GPIO_Point := (GPIO_C'Access, Pin_9);
PC10 : aliased GPIO_Point := (GPIO_C'Access, Pin_10);
PC11 : aliased GPIO_Point := (GPIO_C'Access, Pin_11);
PC12 : aliased GPIO_Point := (GPIO_C'Access, Pin_12);
PC13 : aliased GPIO_Point := (GPIO_C'Access, Pin_13);
PC14 : aliased GPIO_Point := (GPIO_C'Access, Pin_14);
PC15 : aliased GPIO_Point := (GPIO_C'Access, Pin_15);
PD0 : aliased GPIO_Point := (GPIO_D'Access, Pin_0);
PD1 : aliased GPIO_Point := (GPIO_D'Access, Pin_1);
PD2 : aliased GPIO_Point := (GPIO_D'Access, Pin_2);
PD3 : aliased GPIO_Point := (GPIO_D'Access, Pin_3);
PD4 : aliased GPIO_Point := (GPIO_D'Access, Pin_4);
PD5 : aliased GPIO_Point := (GPIO_D'Access, Pin_5);
PD6 : aliased GPIO_Point := (GPIO_D'Access, Pin_6);
PD7 : aliased GPIO_Point := (GPIO_D'Access, Pin_7);
PD8 : aliased GPIO_Point := (GPIO_D'Access, Pin_8);
PD9 : aliased GPIO_Point := (GPIO_D'Access, Pin_9);
PD10 : aliased GPIO_Point := (GPIO_D'Access, Pin_10);
PD11 : aliased GPIO_Point := (GPIO_D'Access, Pin_11);
PD12 : aliased GPIO_Point := (GPIO_D'Access, Pin_12);
PD13 : aliased GPIO_Point := (GPIO_D'Access, Pin_13);
PD14 : aliased GPIO_Point := (GPIO_D'Access, Pin_14);
PD15 : aliased GPIO_Point := (GPIO_D'Access, Pin_15);
PE0 : aliased GPIO_Point := (GPIO_E'Access, Pin_0);
PE1 : aliased GPIO_Point := (GPIO_E'Access, Pin_1);
PE2 : aliased GPIO_Point := (GPIO_E'Access, Pin_2);
PE3 : aliased GPIO_Point := (GPIO_E'Access, Pin_3);
PE4 : aliased GPIO_Point := (GPIO_E'Access, Pin_4);
PE5 : aliased GPIO_Point := (GPIO_E'Access, Pin_5);
PE6 : aliased GPIO_Point := (GPIO_E'Access, Pin_6);
PE7 : aliased GPIO_Point := (GPIO_E'Access, Pin_7);
PE8 : aliased GPIO_Point := (GPIO_E'Access, Pin_8);
PE9 : aliased GPIO_Point := (GPIO_E'Access, Pin_9);
PE10 : aliased GPIO_Point := (GPIO_E'Access, Pin_10);
PE11 : aliased GPIO_Point := (GPIO_E'Access, Pin_11);
PE12 : aliased GPIO_Point := (GPIO_E'Access, Pin_12);
PE13 : aliased GPIO_Point := (GPIO_E'Access, Pin_13);
PE14 : aliased GPIO_Point := (GPIO_E'Access, Pin_14);
PE15 : aliased GPIO_Point := (GPIO_E'Access, Pin_15);
PF0 : aliased GPIO_Point := (GPIO_F'Access, Pin_0);
PF1 : aliased GPIO_Point := (GPIO_F'Access, Pin_1);
PF2 : aliased GPIO_Point := (GPIO_F'Access, Pin_2);
PF3 : aliased GPIO_Point := (GPIO_F'Access, Pin_3);
PF4 : aliased GPIO_Point := (GPIO_F'Access, Pin_4);
PF5 : aliased GPIO_Point := (GPIO_F'Access, Pin_5);
PF6 : aliased GPIO_Point := (GPIO_F'Access, Pin_6);
PF7 : aliased GPIO_Point := (GPIO_F'Access, Pin_7);
PF8 : aliased GPIO_Point := (GPIO_F'Access, Pin_8);
PF9 : aliased GPIO_Point := (GPIO_F'Access, Pin_9);
PF10 : aliased GPIO_Point := (GPIO_F'Access, Pin_10);
PF11 : aliased GPIO_Point := (GPIO_F'Access, Pin_11);
PF12 : aliased GPIO_Point := (GPIO_F'Access, Pin_12);
PF13 : aliased GPIO_Point := (GPIO_F'Access, Pin_13);
PF14 : aliased GPIO_Point := (GPIO_F'Access, Pin_14);
PF15 : aliased GPIO_Point := (GPIO_F'Access, Pin_15);
PG0 : aliased GPIO_Point := (GPIO_G'Access, Pin_0);
PG1 : aliased GPIO_Point := (GPIO_G'Access, Pin_1);
PG2 : aliased GPIO_Point := (GPIO_G'Access, Pin_2);
PG3 : aliased GPIO_Point := (GPIO_G'Access, Pin_3);
PG4 : aliased GPIO_Point := (GPIO_G'Access, Pin_4);
PG5 : aliased GPIO_Point := (GPIO_G'Access, Pin_5);
PG6 : aliased GPIO_Point := (GPIO_G'Access, Pin_6);
PG7 : aliased GPIO_Point := (GPIO_G'Access, Pin_7);
PG8 : aliased GPIO_Point := (GPIO_G'Access, Pin_8);
PG9 : aliased GPIO_Point := (GPIO_G'Access, Pin_9);
PG10 : aliased GPIO_Point := (GPIO_G'Access, Pin_10);
PG11 : aliased GPIO_Point := (GPIO_G'Access, Pin_11);
PG12 : aliased GPIO_Point := (GPIO_G'Access, Pin_12);
PG13 : aliased GPIO_Point := (GPIO_G'Access, Pin_13);
PG14 : aliased GPIO_Point := (GPIO_G'Access, Pin_14);
PG15 : aliased GPIO_Point := (GPIO_G'Access, Pin_15);
PH0 : aliased GPIO_Point := (GPIO_H'Access, Pin_0);
PH1 : aliased GPIO_Point := (GPIO_H'Access, Pin_1);
PH2 : aliased GPIO_Point := (GPIO_H'Access, Pin_2);
PH3 : aliased GPIO_Point := (GPIO_H'Access, Pin_3);
PH4 : aliased GPIO_Point := (GPIO_H'Access, Pin_4);
PH5 : aliased GPIO_Point := (GPIO_H'Access, Pin_5);
PH6 : aliased GPIO_Point := (GPIO_H'Access, Pin_6);
PH7 : aliased GPIO_Point := (GPIO_H'Access, Pin_7);
PH8 : aliased GPIO_Point := (GPIO_H'Access, Pin_8);
PH9 : aliased GPIO_Point := (GPIO_H'Access, Pin_9);
PH10 : aliased GPIO_Point := (GPIO_H'Access, Pin_10);
PH11 : aliased GPIO_Point := (GPIO_H'Access, Pin_11);
PH12 : aliased GPIO_Point := (GPIO_H'Access, Pin_12);
PH13 : aliased GPIO_Point := (GPIO_H'Access, Pin_13);
PH14 : aliased GPIO_Point := (GPIO_H'Access, Pin_14);
PH15 : aliased GPIO_Point := (GPIO_H'Access, Pin_15);
PI0 : aliased GPIO_Point := (GPIO_I'Access, Pin_0);
PI1 : aliased GPIO_Point := (GPIO_I'Access, Pin_1);
PI2 : aliased GPIO_Point := (GPIO_I'Access, Pin_2);
PI3 : aliased GPIO_Point := (GPIO_I'Access, Pin_3);
PI4 : aliased GPIO_Point := (GPIO_I'Access, Pin_4);
PI5 : aliased GPIO_Point := (GPIO_I'Access, Pin_5);
PI6 : aliased GPIO_Point := (GPIO_I'Access, Pin_6);
PI7 : aliased GPIO_Point := (GPIO_I'Access, Pin_7);
PI8 : aliased GPIO_Point := (GPIO_I'Access, Pin_8);
PI9 : aliased GPIO_Point := (GPIO_I'Access, Pin_9);
PI10 : aliased GPIO_Point := (GPIO_I'Access, Pin_10);
PI11 : aliased GPIO_Point := (GPIO_I'Access, Pin_11);
PI12 : aliased GPIO_Point := (GPIO_I'Access, Pin_12);
PI13 : aliased GPIO_Point := (GPIO_I'Access, Pin_13);
PI14 : aliased GPIO_Point := (GPIO_I'Access, Pin_14);
PI15 : aliased GPIO_Point := (GPIO_I'Access, Pin_15);
PJ0 : aliased GPIO_Point := (GPIO_J'Access, Pin_0);
PJ1 : aliased GPIO_Point := (GPIO_J'Access, Pin_1);
PJ2 : aliased GPIO_Point := (GPIO_J'Access, Pin_2);
PJ3 : aliased GPIO_Point := (GPIO_J'Access, Pin_3);
PJ4 : aliased GPIO_Point := (GPIO_J'Access, Pin_4);
PJ5 : aliased GPIO_Point := (GPIO_J'Access, Pin_5);
PJ6 : aliased GPIO_Point := (GPIO_J'Access, Pin_6);
PJ7 : aliased GPIO_Point := (GPIO_J'Access, Pin_7);
PJ8 : aliased GPIO_Point := (GPIO_J'Access, Pin_8);
PJ9 : aliased GPIO_Point := (GPIO_J'Access, Pin_9);
PJ10 : aliased GPIO_Point := (GPIO_J'Access, Pin_10);
PJ11 : aliased GPIO_Point := (GPIO_J'Access, Pin_11);
PJ12 : aliased GPIO_Point := (GPIO_J'Access, Pin_12);
PJ13 : aliased GPIO_Point := (GPIO_J'Access, Pin_13);
PJ14 : aliased GPIO_Point := (GPIO_J'Access, Pin_14);
PJ15 : aliased GPIO_Point := (GPIO_J'Access, Pin_15);
PK0 : aliased GPIO_Point := (GPIO_K'Access, Pin_0);
PK1 : aliased GPIO_Point := (GPIO_K'Access, Pin_1);
PK2 : aliased GPIO_Point := (GPIO_K'Access, Pin_2);
PK3 : aliased GPIO_Point := (GPIO_K'Access, Pin_3);
PK4 : aliased GPIO_Point := (GPIO_K'Access, Pin_4);
PK5 : aliased GPIO_Point := (GPIO_K'Access, Pin_5);
PK6 : aliased GPIO_Point := (GPIO_K'Access, Pin_6);
PK7 : aliased GPIO_Point := (GPIO_K'Access, Pin_7);
PK8 : aliased GPIO_Point := (GPIO_K'Access, Pin_8);
PK9 : aliased GPIO_Point := (GPIO_K'Access, Pin_9);
PK10 : aliased GPIO_Point := (GPIO_K'Access, Pin_10);
PK11 : aliased GPIO_Point := (GPIO_K'Access, Pin_11);
PK12 : aliased GPIO_Point := (GPIO_K'Access, Pin_12);
PK13 : aliased GPIO_Point := (GPIO_K'Access, Pin_13);
PK14 : aliased GPIO_Point := (GPIO_K'Access, Pin_14);
PK15 : aliased GPIO_Point := (GPIO_K'Access, Pin_15);
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function;
GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function;
GPIO_AF_I2C4_1 : constant GPIO_Alternate_Function;
GPIO_AF_UART5_1 : constant GPIO_Alternate_Function;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function;
GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function;
GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function;
GPIO_AF_LPTIM1_3 : constant GPIO_Alternate_Function;
GPIO_AF_DFSDM1_3 : constant GPIO_Alternate_Function;
GPIO_AF_CEC_3 : constant GPIO_Alternate_Function;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function;
GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function;
GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function;
GPIO_AF_I2C4_4 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_4 : constant GPIO_Alternate_Function;
GPIO_AF_CEC_4 : constant GPIO_Alternate_Function;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function;
GPIO_AF_I2S3_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function;
GPIO_AF_SPI2_6 : constant GPIO_Alternate_Function;
GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function;
GPIO_AF_I2S2_6 : constant GPIO_Alternate_Function;
GPIO_AF_I2S3_6 : constant GPIO_Alternate_Function;
GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function;
GPIO_AF_UART4_6 : constant GPIO_Alternate_Function;
GPIO_AF_DFSDM1_6 : constant GPIO_Alternate_Function;
GPIO_AF_SPI2_7 : constant GPIO_Alternate_Function;
GPIO_AF_I2S2_7 : constant GPIO_Alternate_Function;
GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function;
GPIO_AF_I2S3_7 : constant GPIO_Alternate_Function;
GPIO_AF_SPI6_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function;
GPIO_AF_UART5_7 : constant GPIO_Alternate_Function;
GPIO_AF_DFSDM1_7 : constant GPIO_Alternate_Function;
GPIO_AF_SPDIF_7 : constant GPIO_Alternate_Function;
GPIO_AF_SPI6_8 : constant GPIO_Alternate_Function;
GPIO_AF_SAI2_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART4_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART5_8 : constant GPIO_Alternate_Function;
GPIO_AF_USART6_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART7_8 : constant GPIO_Alternate_Function;
GPIO_AF_UART8_8 : constant GPIO_Alternate_Function;
GPIO_AF_OTG_FS_8 : constant GPIO_Alternate_Function;
GPIO_AF_SPDIF_8 : constant GPIO_Alternate_Function;
GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function;
GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function;
GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function;
GPIO_AF_QUADSPI_9 : constant GPIO_Alternate_Function;
GPIO_AF_FMC_9 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function;
GPIO_AF_SAI2_10 : constant GPIO_Alternate_Function;
GPIO_AF_QUADSPI_10 : constant GPIO_Alternate_Function;
GPIO_AF_SDMMC2_10 : constant GPIO_Alternate_Function;
GPIO_AF_DFSDM1_10 : constant GPIO_Alternate_Function;
GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function;
GPIO_AF_OTG_HS_10 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_10 : constant GPIO_Alternate_Function;
GPIO_AF_I2C4_11 : constant GPIO_Alternate_Function;
GPIO_AF_CAN3_11 : constant GPIO_Alternate_Function;
GPIO_AF_SDMMC2_11 : constant GPIO_Alternate_Function;
GPIO_AF_ETH_11 : constant GPIO_Alternate_Function;
GPIO_AF_UART7_12 : constant GPIO_Alternate_Function;
GPIO_AF_FMC_12 : constant GPIO_Alternate_Function;
GPIO_AF_SDMMC1_12 : constant GPIO_Alternate_Function;
GPIO_AF_MDIOS_12 : constant GPIO_Alternate_Function;
GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function;
GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function;
GPIO_AF_DSI_13 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_13 : constant GPIO_Alternate_Function;
GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function;
ADC_1 : aliased Analog_To_Digital_Converter
with Import, Volatile, Address => ADC1_Base;
ADC_2 : aliased Analog_To_Digital_Converter
with Import, Volatile, Address => ADC2_Base;
ADC_3 : aliased Analog_To_Digital_Converter
with Import, Volatile, Address => ADC3_Base;
VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel);
Temperature_Sensor : constant ADC_Point := VBat;
-- see RM pg 410, section 13.10, also pg 389
VBat_Bridge_Divisor : constant := 4;
-- The VBAT pin is internally connected to a bridge divider. The actual
-- voltage is the raw conversion value * the divisor. See section 13.11,
-- pg 412 of the RM.
procedure Enable_Clock (This : aliased in out Analog_To_Digital_Converter);
procedure Reset_All_ADC_Units;
DAC_1 : aliased Digital_To_Analog_Converter
with Import, Volatile, Address => DAC_Base;
-- ??? Taken from the STM32F429 definition, TO BE CHECKED FOR THE F7
DAC_Channel_1_IO : constant GPIO_Point := PA4;
DAC_Channel_2_IO : constant GPIO_Point := PA5;
procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter);
procedure Reset (This : aliased in out Digital_To_Analog_Converter);
-- USART_1 : aliased USART with Import, Volatile, Address => USART1_Base;
-- USART_2 : aliased USART with Import, Volatile, Address => USART2_Base;
-- USART_3 : aliased USART with Import, Volatile, Address => USART3_Base;
-- UART_4 : aliased USART with Import, Volatile, Address => UART4_Base;
-- UART_5 : aliased USART with Import, Volatile, Address => UART5_Base;
-- USART_6 : aliased USART with Import, Volatile, Address => USART6_Base;
-- USART_7 : aliased USART with Import, Volatile, Address => UART7_Base;
-- USART_8 : aliased USART with Import, Volatile, Address => UART8_Base;
--
-- procedure Enable_Clock (This : aliased in out USART);
--
-- procedure Reset (This : aliased in out USART);
DMA_1 : aliased DMA_Controller with Import, Volatile, Address => DMA1_Base;
DMA_2 : aliased DMA_Controller with Import, Volatile, Address => DMA2_Base;
procedure Enable_Clock (This : aliased in out DMA_Controller);
procedure Reset (This : aliased in out DMA_Controller);
Internal_I2C_Port_1 : aliased Internal_I2C_Port
with Import, Volatile, Address => I2C1_Base;
Internal_I2C_Port_2 : aliased Internal_I2C_Port
with Import, Volatile, Address => I2C2_Base;
Internal_I2C_Port_3 : aliased Internal_I2C_Port
with Import, Volatile, Address => I2C3_Base;
Internal_I2C_Port_4 : aliased Internal_I2C_Port
with Import, Volatile, Address => I2C4_Base;
I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access);
I2C_2 : aliased I2C_Port (Internal_I2C_Port_2'Access);
I2C_3 : aliased I2C_Port (Internal_I2C_Port_3'Access);
I2C_4 : aliased I2C_Port (Internal_I2C_Port_4'Access);
type I2C_Port_Id is (I2C_Id_1, I2C_Id_2, I2C_Id_3, I2C_Id_4);
function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id with Inline;
procedure Enable_Clock (This : I2C_Port'Class);
procedure Enable_Clock (This : I2C_Port_Id);
procedure Reset (This : I2C_Port'Class);
procedure Reset (This : I2C_Port_Id);
Internal_SPI_1 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI1_Base;
Internal_SPI_2 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI2_Base;
Internal_SPI_3 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI3_Base;
Internal_SPI_4 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI4_Base;
Internal_SPI_5 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI5_Base;
Internal_SPI_6 : aliased Internal_SPI_Port
with Import, Volatile, Address => SPI6_Base;
SPI_1 : aliased SPI_Port (Internal_SPI_1'Access);
SPI_2 : aliased SPI_Port (Internal_SPI_2'Access);
SPI_3 : aliased SPI_Port (Internal_SPI_3'Access);
SPI_4 : aliased SPI_Port (Internal_SPI_4'Access);
SPI_5 : aliased SPI_Port (Internal_SPI_5'Access);
SPI_6 : aliased SPI_Port (Internal_SPI_6'Access);
SPI_1_DMA : aliased SPI_Port_DMA (Internal_SPI_1'Access);
SPI_2_DMA : aliased SPI_Port_DMA (Internal_SPI_2'Access);
SPI_3_DMA : aliased SPI_Port_DMA (Internal_SPI_3'Access);
SPI_4_DMA : aliased SPI_Port_DMA (Internal_SPI_4'Access);
SPI_5_DMA : aliased SPI_Port_DMA (Internal_SPI_5'Access);
SPI_6_DMA : aliased SPI_Port_DMA (Internal_SPI_6'Access);
procedure Enable_Clock (This : SPI_Port'Class);
procedure Reset (This : SPI_Port'Class);
Internal_I2S_1 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI1_Base;
Internal_I2S_2 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI2_Base;
Internal_I2S_3 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI3_Base;
Internal_I2S_4 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI4_Base;
Internal_I2S_5 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI5_Base;
Internal_I2S_6 : aliased Internal_I2S_Port
with Import, Volatile, Address => SPI6_Base;
I2S_1 : aliased I2S_Port (Internal_I2S_1'Access, Extended => False);
I2S_2 : aliased I2S_Port (Internal_I2S_2'Access, Extended => False);
I2S_3 : aliased I2S_Port (Internal_I2S_3'Access, Extended => False);
I2S_4 : aliased I2S_Port (Internal_I2S_4'Access, Extended => False);
I2S_5 : aliased I2S_Port (Internal_I2S_5'Access, Extended => False);
I2S_6 : aliased I2S_Port (Internal_I2S_6'Access, Extended => False);
procedure Enable_Clock (This : I2S_Port);
procedure Reset (This : in out I2S_Port);
Timer_1 : aliased Timer with Volatile, Address => TIM1_Base;
pragma Import (Ada, Timer_1);
Timer_2 : aliased Timer with Volatile, Address => TIM2_Base;
pragma Import (Ada, Timer_2);
Timer_3 : aliased Timer with Volatile, Address => TIM3_Base;
pragma Import (Ada, Timer_3);
Timer_4 : aliased Timer with Volatile, Address => TIM4_Base;
pragma Import (Ada, Timer_4);
Timer_5 : aliased Timer with Volatile, Address => TIM5_Base;
pragma Import (Ada, Timer_5);
Timer_6 : aliased Timer with Volatile, Address => TIM6_Base;
pragma Import (Ada, Timer_6);
Timer_7 : aliased Timer with Volatile, Address => TIM7_Base;
pragma Import (Ada, Timer_7);
Timer_8 : aliased Timer with Volatile, Address => TIM8_Base;
pragma Import (Ada, Timer_8);
Timer_9 : aliased Timer with Volatile, Address => TIM9_Base;
pragma Import (Ada, Timer_9);
Timer_10 : aliased Timer with Volatile, Address => TIM10_Base;
pragma Import (Ada, Timer_10);
Timer_11 : aliased Timer with Volatile, Address => TIM11_Base;
pragma Import (Ada, Timer_11);
Timer_12 : aliased Timer with Volatile, Address => TIM12_Base;
pragma Import (Ada, Timer_12);
Timer_13 : aliased Timer with Volatile, Address => TIM13_Base;
pragma Import (Ada, Timer_13);
Timer_14 : aliased Timer with Volatile, Address => TIM14_Base;
pragma Import (Ada, Timer_14);
procedure Enable_Clock (This : in out Timer);
procedure Reset (This : in out Timer);
-----------
-- Audio --
-----------
subtype SAI_Port is STM32_SVD.SAI.SAI_Peripheral;
SAI_1 : SAI_Port renames STM32_SVD.SAI.SAI1_Periph;
SAI_2 : SAI_Port renames STM32_SVD.SAI.SAI2_Periph;
procedure Enable_Clock (This : in out SAI_Port);
procedure Reset (This : in out SAI_Port);
function Get_Input_Clock (Periph : SAI_Port) return UInt32;
--------------
-- DSI Host --
--------------
DSIHOST : aliased DSI_Host (STM32_SVD.DSI.DSI_Periph'Access);
------------
-- SDMMC --
------------
type SDMMC_Clock_Source is (Src_Sysclk, Src_48Mhz);
SDMMC_1 : aliased SDMMC_Controller (STM32_SVD.SDMMC.SDMMC1_Periph'Access);
SDMMC_2 : aliased SDMMC_Controller (STM32_SVD.SDMMC.SDMMC2_Periph'Access);
procedure Enable_Clock (This : in out SDMMC_Controller);
procedure Reset (This : in out SDMMC_Controller);
procedure Set_Clock_Source
(This : in out SDMMC_Controller;
Src : SDMMC_Clock_Source);
-----------------------------
-- Reset and Clock Control --
-----------------------------
type RCC_System_Clocks is record
SYSCLK : UInt32;
HCLK : UInt32;
PCLK1 : UInt32;
PCLK2 : UInt32;
TIMCLK1 : UInt32;
TIMCLK2 : UInt32;
I2SCLK : UInt32;
end record;
function System_Clock_Frequencies return RCC_System_Clocks;
procedure Set_PLLI2S_Factors (Pll_N : UInt9;
Pll_R : UInt3);
function PLLI2S_Enabled return Boolean;
procedure Enable_PLLI2S
with Post => PLLI2S_Enabled;
procedure Disable_PLLI2S
with Post => not PLLI2S_Enabled;
type PLLSAI_DivR is new UInt2;
PLLSAI_DIV2 : constant PLLSAI_DivR := 0;
PLLSAI_DIV4 : constant PLLSAI_DivR := 1;
PLLSAI_DIV8 : constant PLLSAI_DivR := 2;
PLLSAI_DIV16 : constant PLLSAI_DivR := 3;
procedure Set_PLLSAI_Factors
(LCD : UInt3;
VCO : UInt9;
DivR : PLLSAI_DivR);
procedure Enable_PLLSAI;
procedure Disable_PLLSAI;
function PLLSAI_Ready return Boolean;
subtype DIVQ is Natural range 1 .. 32;
procedure Configure_SAI_I2S_Clock
(Periph : SAI_Port;
PLLI2SN : UInt9;
PLLI2SQ : UInt4;
PLLI2SDIVQ : DIVQ);
procedure Enable_DCMI_Clock;
procedure Reset_DCMI;
RTC : aliased RTC_Device;
private
HSE_VALUE : constant UInt32 := ADL_Config.High_Speed_External_Clock;
GPIO_AF_RTC_50Hz_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_MCO_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TAMPER_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_SWJ_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TRACE_0 : constant GPIO_Alternate_Function := 0;
GPIO_AF_TIM1_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM2_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_I2C4_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_UART5_1 : constant GPIO_Alternate_Function := 1;
GPIO_AF_TIM3_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM4_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM5_2 : constant GPIO_Alternate_Function := 2;
GPIO_AF_TIM8_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM9_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM10_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_TIM11_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_LPTIM1_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_DFSDM1_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_CEC_3 : constant GPIO_Alternate_Function := 3;
GPIO_AF_I2C1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_I2C2_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_I2C3_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_I2C4_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_USART1_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_CEC_4 : constant GPIO_Alternate_Function := 4;
GPIO_AF_SPI1_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI2_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_I2S3_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI4_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI5_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI6_5 : constant GPIO_Alternate_Function := 5;
GPIO_AF_SPI2_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SPI3_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_I2S2_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_I2S3_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SAI1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_UART4_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_DFSDM1_6 : constant GPIO_Alternate_Function := 6;
GPIO_AF_SPI2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_I2S2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_SPI3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_I2S3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_SPI6_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART2_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_USART3_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_UART5_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_DFSDM1_7 : constant GPIO_Alternate_Function := 7;
GPIO_AF_SPDIF_7 : constant GPIO_Alternate_Function := 8;
GPIO_AF_SPI6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_SAI2_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART4_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART5_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_USART6_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART7_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_UART8_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_OTG_FS_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_SPDIF_8 : constant GPIO_Alternate_Function := 8;
GPIO_AF_CAN1_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_CAN2_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM12_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM13_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_TIM14_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_QUADSPI_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_FMC_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_LTDC_9 : constant GPIO_Alternate_Function := 9;
GPIO_AF_SAI2_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_QUADSPI_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_SDMMC2_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_DFSDM1_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_OTG1_FS_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_OTG_HS_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_LTDC_10 : constant GPIO_Alternate_Function := 10;
GPIO_AF_I2C4_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_CAN3_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_SDMMC2_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_ETH_11 : constant GPIO_Alternate_Function := 11;
GPIO_AF_UART7_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_FMC_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_SDMMC1_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_MDIOS_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_OTG2_FS_12 : constant GPIO_Alternate_Function := 12;
GPIO_AF_DCMI_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_DSI_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_LTDC_13 : constant GPIO_Alternate_Function := 13;
GPIO_AF_LTDC_14 : constant GPIO_Alternate_Function := 14;
GPIO_AF_EVENTOUT_15 : constant GPIO_Alternate_Function := 15;
end STM32.Device;
|
tum-ei-rcs/StratoX | Ada | 65,965 | ads | -- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.CAN is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- MCR_Register --
------------------
-- master control register
type MCR_Register is record
-- INRQ
INRQ : Boolean := False;
-- SLEEP
SLEEP : Boolean := True;
-- TXFP
TXFP : Boolean := False;
-- RFLM
RFLM : Boolean := False;
-- NART
NART : Boolean := False;
-- AWUM
AWUM : Boolean := False;
-- ABOM
ABOM : Boolean := False;
-- TTCM
TTCM : Boolean := False;
-- unspecified
Reserved_8_14 : HAL.UInt7 := 16#0#;
-- RESET
RESET : Boolean := False;
-- DBF
DBF : Boolean := True;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MCR_Register use record
INRQ at 0 range 0 .. 0;
SLEEP at 0 range 1 .. 1;
TXFP at 0 range 2 .. 2;
RFLM at 0 range 3 .. 3;
NART at 0 range 4 .. 4;
AWUM at 0 range 5 .. 5;
ABOM at 0 range 6 .. 6;
TTCM at 0 range 7 .. 7;
Reserved_8_14 at 0 range 8 .. 14;
RESET at 0 range 15 .. 15;
DBF at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
------------------
-- MSR_Register --
------------------
-- master status register
type MSR_Register is record
-- Read-only. INAK
INAK : Boolean := False;
-- Read-only. SLAK
SLAK : Boolean := True;
-- ERRI
ERRI : Boolean := False;
-- WKUI
WKUI : Boolean := False;
-- SLAKI
SLAKI : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- Read-only. TXM
TXM : Boolean := False;
-- Read-only. RXM
RXM : Boolean := False;
-- Read-only. SAMP
SAMP : Boolean := True;
-- Read-only. RX
RX : Boolean := True;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MSR_Register use record
INAK at 0 range 0 .. 0;
SLAK at 0 range 1 .. 1;
ERRI at 0 range 2 .. 2;
WKUI at 0 range 3 .. 3;
SLAKI at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
TXM at 0 range 8 .. 8;
RXM at 0 range 9 .. 9;
SAMP at 0 range 10 .. 10;
RX at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
------------------
-- TSR_Register --
------------------
subtype TSR_CODE_Field is HAL.UInt2;
-------------
-- TSR.TME --
-------------
-- TSR_TME array
type TSR_TME_Field_Array is array (0 .. 2) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for TSR_TME
type TSR_TME_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TME as a value
Val : HAL.UInt3;
when True =>
-- TME as an array
Arr : TSR_TME_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for TSR_TME_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-------------
-- TSR.LOW --
-------------
-- TSR_LOW array
type TSR_LOW_Field_Array is array (0 .. 2) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for TSR_LOW
type TSR_LOW_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LOW as a value
Val : HAL.UInt3;
when True =>
-- LOW as an array
Arr : TSR_LOW_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for TSR_LOW_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- transmit status register
type TSR_Register is record
-- RQCP0
RQCP0 : Boolean := False;
-- TXOK0
TXOK0 : Boolean := False;
-- ALST0
ALST0 : Boolean := False;
-- TERR0
TERR0 : Boolean := False;
-- unspecified
Reserved_4_6 : HAL.UInt3 := 16#0#;
-- ABRQ0
ABRQ0 : Boolean := False;
-- RQCP1
RQCP1 : Boolean := False;
-- TXOK1
TXOK1 : Boolean := False;
-- ALST1
ALST1 : Boolean := False;
-- TERR1
TERR1 : Boolean := False;
-- unspecified
Reserved_12_14 : HAL.UInt3 := 16#0#;
-- ABRQ1
ABRQ1 : Boolean := False;
-- RQCP2
RQCP2 : Boolean := False;
-- TXOK2
TXOK2 : Boolean := False;
-- ALST2
ALST2 : Boolean := False;
-- TERR2
TERR2 : Boolean := False;
-- unspecified
Reserved_20_22 : HAL.UInt3 := 16#0#;
-- ABRQ2
ABRQ2 : Boolean := False;
-- Read-only. CODE
CODE : TSR_CODE_Field := 16#0#;
-- Read-only. Lowest priority flag for mailbox 0
TME : TSR_TME_Field := (As_Array => False, Val => 16#1#);
-- Read-only. Lowest priority flag for mailbox 0
LOW : TSR_LOW_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TSR_Register use record
RQCP0 at 0 range 0 .. 0;
TXOK0 at 0 range 1 .. 1;
ALST0 at 0 range 2 .. 2;
TERR0 at 0 range 3 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
ABRQ0 at 0 range 7 .. 7;
RQCP1 at 0 range 8 .. 8;
TXOK1 at 0 range 9 .. 9;
ALST1 at 0 range 10 .. 10;
TERR1 at 0 range 11 .. 11;
Reserved_12_14 at 0 range 12 .. 14;
ABRQ1 at 0 range 15 .. 15;
RQCP2 at 0 range 16 .. 16;
TXOK2 at 0 range 17 .. 17;
ALST2 at 0 range 18 .. 18;
TERR2 at 0 range 19 .. 19;
Reserved_20_22 at 0 range 20 .. 22;
ABRQ2 at 0 range 23 .. 23;
CODE at 0 range 24 .. 25;
TME at 0 range 26 .. 28;
LOW at 0 range 29 .. 31;
end record;
-------------------
-- RF0R_Register --
-------------------
subtype RF0R_FMP0_Field is HAL.UInt2;
-- receive FIFO 0 register
type RF0R_Register is record
-- Read-only. FMP0
FMP0 : RF0R_FMP0_Field := 16#0#;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- FULL0
FULL0 : Boolean := False;
-- FOVR0
FOVR0 : Boolean := False;
-- RFOM0
RFOM0 : Boolean := False;
-- unspecified
Reserved_6_31 : HAL.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RF0R_Register use record
FMP0 at 0 range 0 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
FULL0 at 0 range 3 .. 3;
FOVR0 at 0 range 4 .. 4;
RFOM0 at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-------------------
-- RF1R_Register --
-------------------
subtype RF1R_FMP1_Field is HAL.UInt2;
-- receive FIFO 1 register
type RF1R_Register is record
-- Read-only. FMP1
FMP1 : RF1R_FMP1_Field := 16#0#;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- FULL1
FULL1 : Boolean := False;
-- FOVR1
FOVR1 : Boolean := False;
-- RFOM1
RFOM1 : Boolean := False;
-- unspecified
Reserved_6_31 : HAL.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RF1R_Register use record
FMP1 at 0 range 0 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
FULL1 at 0 range 3 .. 3;
FOVR1 at 0 range 4 .. 4;
RFOM1 at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
------------------
-- IER_Register --
------------------
-- interrupt enable register
type IER_Register is record
-- TMEIE
TMEIE : Boolean := False;
-- FMPIE0
FMPIE0 : Boolean := False;
-- FFIE0
FFIE0 : Boolean := False;
-- FOVIE0
FOVIE0 : Boolean := False;
-- FMPIE1
FMPIE1 : Boolean := False;
-- FFIE1
FFIE1 : Boolean := False;
-- FOVIE1
FOVIE1 : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- EWGIE
EWGIE : Boolean := False;
-- EPVIE
EPVIE : Boolean := False;
-- BOFIE
BOFIE : Boolean := False;
-- LECIE
LECIE : Boolean := False;
-- unspecified
Reserved_12_14 : HAL.UInt3 := 16#0#;
-- ERRIE
ERRIE : Boolean := False;
-- WKUIE
WKUIE : Boolean := False;
-- SLKIE
SLKIE : Boolean := False;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
TMEIE at 0 range 0 .. 0;
FMPIE0 at 0 range 1 .. 1;
FFIE0 at 0 range 2 .. 2;
FOVIE0 at 0 range 3 .. 3;
FMPIE1 at 0 range 4 .. 4;
FFIE1 at 0 range 5 .. 5;
FOVIE1 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
EWGIE at 0 range 8 .. 8;
EPVIE at 0 range 9 .. 9;
BOFIE at 0 range 10 .. 10;
LECIE at 0 range 11 .. 11;
Reserved_12_14 at 0 range 12 .. 14;
ERRIE at 0 range 15 .. 15;
WKUIE at 0 range 16 .. 16;
SLKIE at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
------------------
-- ESR_Register --
------------------
subtype ESR_LEC_Field is HAL.UInt3;
subtype ESR_TEC_Field is HAL.Byte;
subtype ESR_REC_Field is HAL.Byte;
-- interrupt enable register
type ESR_Register is record
-- Read-only. EWGF
EWGF : Boolean := False;
-- Read-only. EPVF
EPVF : Boolean := False;
-- Read-only. BOFF
BOFF : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- LEC
LEC : ESR_LEC_Field := 16#0#;
-- unspecified
Reserved_7_15 : HAL.UInt9 := 16#0#;
-- Read-only. TEC
TEC : ESR_TEC_Field := 16#0#;
-- Read-only. REC
REC : ESR_REC_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ESR_Register use record
EWGF at 0 range 0 .. 0;
EPVF at 0 range 1 .. 1;
BOFF at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
LEC at 0 range 4 .. 6;
Reserved_7_15 at 0 range 7 .. 15;
TEC at 0 range 16 .. 23;
REC at 0 range 24 .. 31;
end record;
------------------
-- BTR_Register --
------------------
subtype BTR_BRP_Field is HAL.UInt10;
subtype BTR_TS1_Field is HAL.UInt4;
subtype BTR_TS2_Field is HAL.UInt3;
subtype BTR_SJW_Field is HAL.UInt2;
-- bit timing register
type BTR_Register is record
-- BRP
BRP : BTR_BRP_Field := 16#0#;
-- unspecified
Reserved_10_15 : HAL.UInt6 := 16#0#;
-- TS1
TS1 : BTR_TS1_Field := 16#0#;
-- TS2
TS2 : BTR_TS2_Field := 16#0#;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- SJW
SJW : BTR_SJW_Field := 16#0#;
-- unspecified
Reserved_26_29 : HAL.UInt4 := 16#0#;
-- LBKM
LBKM : Boolean := False;
-- SILM
SILM : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BTR_Register use record
BRP at 0 range 0 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
TS1 at 0 range 16 .. 19;
TS2 at 0 range 20 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
SJW at 0 range 24 .. 25;
Reserved_26_29 at 0 range 26 .. 29;
LBKM at 0 range 30 .. 30;
SILM at 0 range 31 .. 31;
end record;
-------------------
-- TI0R_Register --
-------------------
subtype TI0R_EXID_Field is HAL.UInt18;
subtype TI0R_STID_Field is HAL.UInt11;
-- TX mailbox identifier register
type TI0R_Register is record
-- TXRQ
TXRQ : Boolean := False;
-- RTR
RTR : Boolean := False;
-- IDE
IDE : Boolean := False;
-- EXID
EXID : TI0R_EXID_Field := 16#0#;
-- STID
STID : TI0R_STID_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TI0R_Register use record
TXRQ at 0 range 0 .. 0;
RTR at 0 range 1 .. 1;
IDE at 0 range 2 .. 2;
EXID at 0 range 3 .. 20;
STID at 0 range 21 .. 31;
end record;
--------------------
-- TDT0R_Register --
--------------------
subtype TDT0R_DLC_Field is HAL.UInt4;
subtype TDT0R_TIME_Field is HAL.Short;
-- mailbox data length control and time stamp register
type TDT0R_Register is record
-- DLC
DLC : TDT0R_DLC_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- TGT
TGT : Boolean := False;
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- TIME
TIME : TDT0R_TIME_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TDT0R_Register use record
DLC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TGT at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
TIME at 0 range 16 .. 31;
end record;
--------------------
-- TDL0R_Register --
--------------------
-- TDL0R_DATA array element
subtype TDL0R_DATA_Element is HAL.Byte;
-- TDL0R_DATA array
type TDL0R_DATA_Field_Array is array (0 .. 3) of TDL0R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data low register
type TDL0R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDL0R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDL0R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
--------------------
-- TDH0R_Register --
--------------------
-- TDH0R_DATA array element
subtype TDH0R_DATA_Element is HAL.Byte;
-- TDH0R_DATA array
type TDH0R_DATA_Field_Array is array (4 .. 7) of TDH0R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type TDH0R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDH0R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDH0R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- TI1R_Register --
-------------------
subtype TI1R_EXID_Field is HAL.UInt18;
subtype TI1R_STID_Field is HAL.UInt11;
-- mailbox identifier register
type TI1R_Register is record
-- TXRQ
TXRQ : Boolean := False;
-- RTR
RTR : Boolean := False;
-- IDE
IDE : Boolean := False;
-- EXID
EXID : TI1R_EXID_Field := 16#0#;
-- STID
STID : TI1R_STID_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TI1R_Register use record
TXRQ at 0 range 0 .. 0;
RTR at 0 range 1 .. 1;
IDE at 0 range 2 .. 2;
EXID at 0 range 3 .. 20;
STID at 0 range 21 .. 31;
end record;
--------------------
-- TDT1R_Register --
--------------------
subtype TDT1R_DLC_Field is HAL.UInt4;
subtype TDT1R_TIME_Field is HAL.Short;
-- mailbox data length control and time stamp register
type TDT1R_Register is record
-- DLC
DLC : TDT1R_DLC_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- TGT
TGT : Boolean := False;
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- TIME
TIME : TDT1R_TIME_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TDT1R_Register use record
DLC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TGT at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
TIME at 0 range 16 .. 31;
end record;
--------------------
-- TDL1R_Register --
--------------------
-- TDL1R_DATA array element
subtype TDL1R_DATA_Element is HAL.Byte;
-- TDL1R_DATA array
type TDL1R_DATA_Field_Array is array (0 .. 3) of TDL1R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data low register
type TDL1R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDL1R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDL1R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
--------------------
-- TDH1R_Register --
--------------------
-- TDH1R_DATA array element
subtype TDH1R_DATA_Element is HAL.Byte;
-- TDH1R_DATA array
type TDH1R_DATA_Field_Array is array (4 .. 7) of TDH1R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type TDH1R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDH1R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDH1R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- TI2R_Register --
-------------------
subtype TI2R_EXID_Field is HAL.UInt18;
subtype TI2R_STID_Field is HAL.UInt11;
-- mailbox identifier register
type TI2R_Register is record
-- TXRQ
TXRQ : Boolean := False;
-- RTR
RTR : Boolean := False;
-- IDE
IDE : Boolean := False;
-- EXID
EXID : TI2R_EXID_Field := 16#0#;
-- STID
STID : TI2R_STID_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TI2R_Register use record
TXRQ at 0 range 0 .. 0;
RTR at 0 range 1 .. 1;
IDE at 0 range 2 .. 2;
EXID at 0 range 3 .. 20;
STID at 0 range 21 .. 31;
end record;
--------------------
-- TDT2R_Register --
--------------------
subtype TDT2R_DLC_Field is HAL.UInt4;
subtype TDT2R_TIME_Field is HAL.Short;
-- mailbox data length control and time stamp register
type TDT2R_Register is record
-- DLC
DLC : TDT2R_DLC_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- TGT
TGT : Boolean := False;
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- TIME
TIME : TDT2R_TIME_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TDT2R_Register use record
DLC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TGT at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
TIME at 0 range 16 .. 31;
end record;
--------------------
-- TDL2R_Register --
--------------------
-- TDL2R_DATA array element
subtype TDL2R_DATA_Element is HAL.Byte;
-- TDL2R_DATA array
type TDL2R_DATA_Field_Array is array (0 .. 3) of TDL2R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data low register
type TDL2R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDL2R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDL2R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
--------------------
-- TDH2R_Register --
--------------------
-- TDH2R_DATA array element
subtype TDH2R_DATA_Element is HAL.Byte;
-- TDH2R_DATA array
type TDH2R_DATA_Field_Array is array (4 .. 7) of TDH2R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type TDH2R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : TDH2R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for TDH2R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- RI0R_Register --
-------------------
subtype RI0R_EXID_Field is HAL.UInt18;
subtype RI0R_STID_Field is HAL.UInt11;
-- receive FIFO mailbox identifier register
type RI0R_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit;
-- Read-only. RTR
RTR : Boolean;
-- Read-only. IDE
IDE : Boolean;
-- Read-only. EXID
EXID : RI0R_EXID_Field;
-- Read-only. STID
STID : RI0R_STID_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RI0R_Register use record
Reserved_0_0 at 0 range 0 .. 0;
RTR at 0 range 1 .. 1;
IDE at 0 range 2 .. 2;
EXID at 0 range 3 .. 20;
STID at 0 range 21 .. 31;
end record;
--------------------
-- RDT0R_Register --
--------------------
subtype RDT0R_DLC_Field is HAL.UInt4;
subtype RDT0R_FMI_Field is HAL.Byte;
subtype RDT0R_TIME_Field is HAL.Short;
-- mailbox data high register
type RDT0R_Register is record
-- Read-only. DLC
DLC : RDT0R_DLC_Field;
-- unspecified
Reserved_4_7 : HAL.UInt4;
-- Read-only. FMI
FMI : RDT0R_FMI_Field;
-- Read-only. TIME
TIME : RDT0R_TIME_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RDT0R_Register use record
DLC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
FMI at 0 range 8 .. 15;
TIME at 0 range 16 .. 31;
end record;
--------------------
-- RDL0R_Register --
--------------------
-- RDL0R_DATA array element
subtype RDL0R_DATA_Element is HAL.Byte;
-- RDL0R_DATA array
type RDL0R_DATA_Field_Array is array (0 .. 3) of RDL0R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type RDL0R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : RDL0R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for RDL0R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
--------------------
-- RDH0R_Register --
--------------------
-- RDH0R_DATA array element
subtype RDH0R_DATA_Element is HAL.Byte;
-- RDH0R_DATA array
type RDH0R_DATA_Field_Array is array (4 .. 7) of RDH0R_DATA_Element
with Component_Size => 8, Size => 32;
-- receive FIFO mailbox data high register
type RDH0R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : RDH0R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for RDH0R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- RI1R_Register --
-------------------
subtype RI1R_EXID_Field is HAL.UInt18;
subtype RI1R_STID_Field is HAL.UInt11;
-- mailbox data high register
type RI1R_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit;
-- Read-only. RTR
RTR : Boolean;
-- Read-only. IDE
IDE : Boolean;
-- Read-only. EXID
EXID : RI1R_EXID_Field;
-- Read-only. STID
STID : RI1R_STID_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RI1R_Register use record
Reserved_0_0 at 0 range 0 .. 0;
RTR at 0 range 1 .. 1;
IDE at 0 range 2 .. 2;
EXID at 0 range 3 .. 20;
STID at 0 range 21 .. 31;
end record;
--------------------
-- RDT1R_Register --
--------------------
subtype RDT1R_DLC_Field is HAL.UInt4;
subtype RDT1R_FMI_Field is HAL.Byte;
subtype RDT1R_TIME_Field is HAL.Short;
-- mailbox data high register
type RDT1R_Register is record
-- Read-only. DLC
DLC : RDT1R_DLC_Field;
-- unspecified
Reserved_4_7 : HAL.UInt4;
-- Read-only. FMI
FMI : RDT1R_FMI_Field;
-- Read-only. TIME
TIME : RDT1R_TIME_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RDT1R_Register use record
DLC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
FMI at 0 range 8 .. 15;
TIME at 0 range 16 .. 31;
end record;
--------------------
-- RDL1R_Register --
--------------------
-- RDL1R_DATA array element
subtype RDL1R_DATA_Element is HAL.Byte;
-- RDL1R_DATA array
type RDL1R_DATA_Field_Array is array (0 .. 3) of RDL1R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type RDL1R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : RDL1R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for RDL1R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
--------------------
-- RDH1R_Register --
--------------------
-- RDH1R_DATA array element
subtype RDH1R_DATA_Element is HAL.Byte;
-- RDH1R_DATA array
type RDH1R_DATA_Field_Array is array (4 .. 7) of RDH1R_DATA_Element
with Component_Size => 8, Size => 32;
-- mailbox data high register
type RDH1R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DATA as a value
Val : HAL.Word;
when True =>
-- DATA as an array
Arr : RDH1R_DATA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for RDH1R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- FMR_Register --
------------------
subtype FMR_CAN2SB_Field is HAL.UInt6;
-- filter master register
type FMR_Register is record
-- FINIT
FINIT : Boolean := True;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
-- CAN2SB
CAN2SB : FMR_CAN2SB_Field := 16#E#;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#A870#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FMR_Register use record
FINIT at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
CAN2SB at 0 range 8 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-------------------
-- FM1R_Register --
-------------------
--------------
-- FM1R.FBM --
--------------
-- FM1R_FBM array
type FM1R_FBM_Field_Array is array (0 .. 27) of Boolean
with Component_Size => 1, Size => 28;
-- Type definition for FM1R_FBM
type FM1R_FBM_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FBM as a value
Val : HAL.UInt28;
when True =>
-- FBM as an array
Arr : FM1R_FBM_Field_Array;
end case;
end record
with Unchecked_Union, Size => 28;
for FM1R_FBM_Field use record
Val at 0 range 0 .. 27;
Arr at 0 range 0 .. 27;
end record;
-- filter mode register
type FM1R_Register is record
-- Filter mode
FBM : FM1R_FBM_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FM1R_Register use record
FBM at 0 range 0 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- FS1R_Register --
-------------------
--------------
-- FS1R.FSC --
--------------
-- FS1R_FSC array
type FS1R_FSC_Field_Array is array (0 .. 27) of Boolean
with Component_Size => 1, Size => 28;
-- Type definition for FS1R_FSC
type FS1R_FSC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FSC as a value
Val : HAL.UInt28;
when True =>
-- FSC as an array
Arr : FS1R_FSC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 28;
for FS1R_FSC_Field use record
Val at 0 range 0 .. 27;
Arr at 0 range 0 .. 27;
end record;
-- filter scale register
type FS1R_Register is record
-- Filter scale configuration
FSC : FS1R_FSC_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS1R_Register use record
FSC at 0 range 0 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
--------------------
-- FFA1R_Register --
--------------------
---------------
-- FFA1R.FFA --
---------------
-- FFA1R_FFA array
type FFA1R_FFA_Field_Array is array (0 .. 27) of Boolean
with Component_Size => 1, Size => 28;
-- Type definition for FFA1R_FFA
type FFA1R_FFA_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FFA as a value
Val : HAL.UInt28;
when True =>
-- FFA as an array
Arr : FFA1R_FFA_Field_Array;
end case;
end record
with Unchecked_Union, Size => 28;
for FFA1R_FFA_Field use record
Val at 0 range 0 .. 27;
Arr at 0 range 0 .. 27;
end record;
-- filter FIFO assignment register
type FFA1R_Register is record
-- Filter FIFO assignment for filter 0
FFA : FFA1R_FFA_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FFA1R_Register use record
FFA at 0 range 0 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- FA1R_Register --
-------------------
---------------
-- FA1R.FACT --
---------------
-- FA1R_FACT array
type FA1R_FACT_Field_Array is array (0 .. 27) of Boolean
with Component_Size => 1, Size => 28;
-- Type definition for FA1R_FACT
type FA1R_FACT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FACT as a value
Val : HAL.UInt28;
when True =>
-- FACT as an array
Arr : FA1R_FACT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 28;
for FA1R_FACT_Field use record
Val at 0 range 0 .. 27;
Arr at 0 range 0 .. 27;
end record;
-- filter activation register
type FA1R_Register is record
-- Filter active
FACT : FA1R_FACT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FA1R_Register use record
FACT at 0 range 0 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
------------------
-- F0R_Register --
------------------
-- F0R1_FB array
type F0R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 0 register 1
type F0R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F0R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F0R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F1R_Register --
------------------
-- F1R1_FB array
type F1R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 1 register 1
type F1R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F1R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F1R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F2R_Register --
------------------
-- F2R1_FB array
type F2R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 2 register 1
type F2R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F2R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F2R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F3R_Register --
------------------
-- F3R1_FB array
type F3R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 3 register 1
type F3R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F3R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F3R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F4R_Register --
------------------
-- F4R1_FB array
type F4R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 4 register 1
type F4R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F4R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F4R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F5R_Register --
------------------
-- F5R1_FB array
type F5R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 5 register 1
type F5R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F5R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F5R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F6R_Register --
------------------
-- F6R1_FB array
type F6R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 6 register 1
type F6R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F6R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F6R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F7R_Register --
------------------
-- F7R1_FB array
type F7R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 7 register 1
type F7R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F7R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F7R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F8R_Register --
------------------
-- F8R1_FB array
type F8R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 8 register 1
type F8R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F8R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F8R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
------------------
-- F9R_Register --
------------------
-- F9R1_FB array
type F9R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 9 register 1
type F9R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F9R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F9R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F10R_Register --
-------------------
-- F10R1_FB array
type F10R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 10 register 1
type F10R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F10R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F10R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F11R_Register --
-------------------
-- F11R1_FB array
type F11R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 11 register 1
type F11R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F11R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F11R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F12R_Register --
-------------------
-- F12R1_FB array
type F12R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 4 register 1
type F12R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F12R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F12R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F13R_Register --
-------------------
-- F13R1_FB array
type F13R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 13 register 1
type F13R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F13R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F13R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F14R_Register --
-------------------
-- F14R1_FB array
type F14R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 14 register 1
type F14R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F14R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F14R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F15R_Register --
-------------------
-- F15R1_FB array
type F15R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 15 register 1
type F15R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F15R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F15R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F16R_Register --
-------------------
-- F16R1_FB array
type F16R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 16 register 1
type F16R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F16R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F16R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F17R_Register --
-------------------
-- F17R1_FB array
type F17R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 17 register 1
type F17R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F17R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F17R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F18R_Register --
-------------------
-- F18R1_FB array
type F18R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 18 register 1
type F18R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F18R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F18R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F19R_Register --
-------------------
-- F19R1_FB array
type F19R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 19 register 1
type F19R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F19R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F19R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F20R_Register --
-------------------
-- F20R1_FB array
type F20R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 20 register 1
type F20R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F20R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F20R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F21R_Register --
-------------------
-- F21R1_FB array
type F21R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 21 register 1
type F21R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F21R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F21R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F22R_Register --
-------------------
-- F22R1_FB array
type F22R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 22 register 1
type F22R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F22R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F22R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F23R_Register --
-------------------
-- F23R1_FB array
type F23R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 23 register 1
type F23R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F23R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F23R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F24R_Register --
-------------------
-- F24R1_FB array
type F24R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 24 register 1
type F24R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F24R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F24R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F25R_Register --
-------------------
-- F25R1_FB array
type F25R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 25 register 1
type F25R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F25R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F25R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F26R_Register --
-------------------
-- F26R1_FB array
type F26R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 26 register 1
type F26R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F26R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F26R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-------------------
-- F27R_Register --
-------------------
-- F27R1_FB array
type F27R1_FB_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Filter bank 27 register 1
type F27R_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FB as a value
Val : HAL.Word;
when True =>
-- FB as an array
Arr : F27R1_FB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for F27R_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Controller area network
type CAN_Peripheral is record
-- master control register
MCR : MCR_Register;
-- master status register
MSR : MSR_Register;
-- transmit status register
TSR : TSR_Register;
-- receive FIFO 0 register
RF0R : RF0R_Register;
-- receive FIFO 1 register
RF1R : RF1R_Register;
-- interrupt enable register
IER : IER_Register;
-- interrupt enable register
ESR : ESR_Register;
-- bit timing register
BTR : BTR_Register;
-- TX mailbox identifier register
TI0R : TI0R_Register;
-- mailbox data length control and time stamp register
TDT0R : TDT0R_Register;
-- mailbox data low register
TDL0R : TDL0R_Register;
-- mailbox data high register
TDH0R : TDH0R_Register;
-- mailbox identifier register
TI1R : TI1R_Register;
-- mailbox data length control and time stamp register
TDT1R : TDT1R_Register;
-- mailbox data low register
TDL1R : TDL1R_Register;
-- mailbox data high register
TDH1R : TDH1R_Register;
-- mailbox identifier register
TI2R : TI2R_Register;
-- mailbox data length control and time stamp register
TDT2R : TDT2R_Register;
-- mailbox data low register
TDL2R : TDL2R_Register;
-- mailbox data high register
TDH2R : TDH2R_Register;
-- receive FIFO mailbox identifier register
RI0R : RI0R_Register;
-- mailbox data high register
RDT0R : RDT0R_Register;
-- mailbox data high register
RDL0R : RDL0R_Register;
-- receive FIFO mailbox data high register
RDH0R : RDH0R_Register;
-- mailbox data high register
RI1R : RI1R_Register;
-- mailbox data high register
RDT1R : RDT1R_Register;
-- mailbox data high register
RDL1R : RDL1R_Register;
-- mailbox data high register
RDH1R : RDH1R_Register;
-- filter master register
FMR : FMR_Register;
-- filter mode register
FM1R : FM1R_Register;
-- filter scale register
FS1R : FS1R_Register;
-- filter FIFO assignment register
FFA1R : FFA1R_Register;
-- filter activation register
FA1R : FA1R_Register;
-- Filter bank 0 register 1
F0R1 : F0R_Register;
-- Filter bank 0 register 2
F0R2 : F0R_Register;
-- Filter bank 1 register 1
F1R1 : F1R_Register;
-- Filter bank 1 register 2
F1R2 : F1R_Register;
-- Filter bank 2 register 1
F2R1 : F2R_Register;
-- Filter bank 2 register 2
F2R2 : F2R_Register;
-- Filter bank 3 register 1
F3R1 : F3R_Register;
-- Filter bank 3 register 2
F3R2 : F3R_Register;
-- Filter bank 4 register 1
F4R1 : F4R_Register;
-- Filter bank 4 register 2
F4R2 : F4R_Register;
-- Filter bank 5 register 1
F5R1 : F5R_Register;
-- Filter bank 5 register 2
F5R2 : F5R_Register;
-- Filter bank 6 register 1
F6R1 : F6R_Register;
-- Filter bank 6 register 2
F6R2 : F6R_Register;
-- Filter bank 7 register 1
F7R1 : F7R_Register;
-- Filter bank 7 register 2
F7R2 : F7R_Register;
-- Filter bank 8 register 1
F8R1 : F8R_Register;
-- Filter bank 8 register 2
F8R2 : F8R_Register;
-- Filter bank 9 register 1
F9R1 : F9R_Register;
-- Filter bank 9 register 2
F9R2 : F9R_Register;
-- Filter bank 10 register 1
F10R1 : F10R_Register;
-- Filter bank 10 register 2
F10R2 : F10R_Register;
-- Filter bank 11 register 1
F11R1 : F11R_Register;
-- Filter bank 11 register 2
F11R2 : F11R_Register;
-- Filter bank 4 register 1
F12R1 : F12R_Register;
-- Filter bank 12 register 2
F12R2 : F12R_Register;
-- Filter bank 13 register 1
F13R1 : F13R_Register;
-- Filter bank 13 register 2
F13R2 : F13R_Register;
-- Filter bank 14 register 1
F14R1 : F14R_Register;
-- Filter bank 14 register 2
F14R2 : F14R_Register;
-- Filter bank 15 register 1
F15R1 : F15R_Register;
-- Filter bank 15 register 2
F15R2 : F15R_Register;
-- Filter bank 16 register 1
F16R1 : F16R_Register;
-- Filter bank 16 register 2
F16R2 : F16R_Register;
-- Filter bank 17 register 1
F17R1 : F17R_Register;
-- Filter bank 17 register 2
F17R2 : F17R_Register;
-- Filter bank 18 register 1
F18R1 : F18R_Register;
-- Filter bank 18 register 2
F18R2 : F18R_Register;
-- Filter bank 19 register 1
F19R1 : F19R_Register;
-- Filter bank 19 register 2
F19R2 : F19R_Register;
-- Filter bank 20 register 1
F20R1 : F20R_Register;
-- Filter bank 20 register 2
F20R2 : F20R_Register;
-- Filter bank 21 register 1
F21R1 : F21R_Register;
-- Filter bank 21 register 2
F21R2 : F21R_Register;
-- Filter bank 22 register 1
F22R1 : F22R_Register;
-- Filter bank 22 register 2
F22R2 : F22R_Register;
-- Filter bank 23 register 1
F23R1 : F23R_Register;
-- Filter bank 23 register 2
F23R2 : F23R_Register;
-- Filter bank 24 register 1
F24R1 : F24R_Register;
-- Filter bank 24 register 2
F24R2 : F24R_Register;
-- Filter bank 25 register 1
F25R1 : F25R_Register;
-- Filter bank 25 register 2
F25R2 : F25R_Register;
-- Filter bank 26 register 1
F26R1 : F26R_Register;
-- Filter bank 26 register 2
F26R2 : F26R_Register;
-- Filter bank 27 register 1
F27R1 : F27R_Register;
-- Filter bank 27 register 2
F27R2 : F27R_Register;
end record
with Volatile;
for CAN_Peripheral use record
MCR at 0 range 0 .. 31;
MSR at 4 range 0 .. 31;
TSR at 8 range 0 .. 31;
RF0R at 12 range 0 .. 31;
RF1R at 16 range 0 .. 31;
IER at 20 range 0 .. 31;
ESR at 24 range 0 .. 31;
BTR at 28 range 0 .. 31;
TI0R at 384 range 0 .. 31;
TDT0R at 388 range 0 .. 31;
TDL0R at 392 range 0 .. 31;
TDH0R at 396 range 0 .. 31;
TI1R at 400 range 0 .. 31;
TDT1R at 404 range 0 .. 31;
TDL1R at 408 range 0 .. 31;
TDH1R at 412 range 0 .. 31;
TI2R at 416 range 0 .. 31;
TDT2R at 420 range 0 .. 31;
TDL2R at 424 range 0 .. 31;
TDH2R at 428 range 0 .. 31;
RI0R at 432 range 0 .. 31;
RDT0R at 436 range 0 .. 31;
RDL0R at 440 range 0 .. 31;
RDH0R at 444 range 0 .. 31;
RI1R at 448 range 0 .. 31;
RDT1R at 452 range 0 .. 31;
RDL1R at 456 range 0 .. 31;
RDH1R at 460 range 0 .. 31;
FMR at 512 range 0 .. 31;
FM1R at 516 range 0 .. 31;
FS1R at 524 range 0 .. 31;
FFA1R at 532 range 0 .. 31;
FA1R at 540 range 0 .. 31;
F0R1 at 576 range 0 .. 31;
F0R2 at 580 range 0 .. 31;
F1R1 at 584 range 0 .. 31;
F1R2 at 588 range 0 .. 31;
F2R1 at 592 range 0 .. 31;
F2R2 at 596 range 0 .. 31;
F3R1 at 600 range 0 .. 31;
F3R2 at 604 range 0 .. 31;
F4R1 at 608 range 0 .. 31;
F4R2 at 612 range 0 .. 31;
F5R1 at 616 range 0 .. 31;
F5R2 at 620 range 0 .. 31;
F6R1 at 624 range 0 .. 31;
F6R2 at 628 range 0 .. 31;
F7R1 at 632 range 0 .. 31;
F7R2 at 636 range 0 .. 31;
F8R1 at 640 range 0 .. 31;
F8R2 at 644 range 0 .. 31;
F9R1 at 648 range 0 .. 31;
F9R2 at 652 range 0 .. 31;
F10R1 at 656 range 0 .. 31;
F10R2 at 660 range 0 .. 31;
F11R1 at 664 range 0 .. 31;
F11R2 at 668 range 0 .. 31;
F12R1 at 672 range 0 .. 31;
F12R2 at 676 range 0 .. 31;
F13R1 at 680 range 0 .. 31;
F13R2 at 684 range 0 .. 31;
F14R1 at 688 range 0 .. 31;
F14R2 at 692 range 0 .. 31;
F15R1 at 696 range 0 .. 31;
F15R2 at 700 range 0 .. 31;
F16R1 at 704 range 0 .. 31;
F16R2 at 708 range 0 .. 31;
F17R1 at 712 range 0 .. 31;
F17R2 at 716 range 0 .. 31;
F18R1 at 720 range 0 .. 31;
F18R2 at 724 range 0 .. 31;
F19R1 at 728 range 0 .. 31;
F19R2 at 732 range 0 .. 31;
F20R1 at 736 range 0 .. 31;
F20R2 at 740 range 0 .. 31;
F21R1 at 744 range 0 .. 31;
F21R2 at 748 range 0 .. 31;
F22R1 at 752 range 0 .. 31;
F22R2 at 756 range 0 .. 31;
F23R1 at 760 range 0 .. 31;
F23R2 at 764 range 0 .. 31;
F24R1 at 768 range 0 .. 31;
F24R2 at 772 range 0 .. 31;
F25R1 at 776 range 0 .. 31;
F25R2 at 780 range 0 .. 31;
F26R1 at 784 range 0 .. 31;
F26R2 at 788 range 0 .. 31;
F27R1 at 792 range 0 .. 31;
F27R2 at 796 range 0 .. 31;
end record;
-- Controller area network
CAN1_Periph : aliased CAN_Peripheral
with Import, Address => CAN1_Base;
-- Controller area network
CAN2_Periph : aliased CAN_Peripheral
with Import, Address => CAN2_Base;
end STM32_SVD.CAN;
|
francesco-bongiovanni/ewok-kernel | Ada | 5,742 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
pragma Restrictions (No_Elaboration_Code);
with ada.unchecked_conversion;
package m4.cpu
with spark_mode => on
is
-------------
-- Globals --
-------------
EXC_THREAD_MODE : constant unsigned_32 := 16#FFFF_FFFD#;
EXC_KERN_MODE : constant unsigned_32 := 16#FFFF_FFF9#;
EXC_HANDLER_MODE : constant unsigned_32 := 16#FFFF_FFF1#;
---------------
-- Registers --
---------------
--
-- CONTROL register
--
type t_SPSEL is (MSP, PSP) with size => 1;
for t_SPSEL use (MSP => 0, PSP => 1);
type t_PRIV is (PRIVILEGED, UNPRIVILEGED) with size => 1;
for t_PRIV use (PRIVILEGED => 0, UNPRIVILEGED => 1);
type t_control_register is record
nPRIV : t_PRIV; -- Thread mode is privileged (0), unprivileged (1)
SPSEL : t_SPSEL; -- Current stack pointer
end record
with size => 32;
for t_control_register use record
nPRIV at 0 range 0 .. 0;
SPSEL at 0 range 1 .. 1;
end record;
--
-- PSR register that aggregates (A)(I)(E)PSR registers
--
type t_PSR_register is record
ISR_NUMBER : unsigned_8;
ICI_IT_lo : bits_6;
GE : bits_4;
Thumb : bit;
ICI_IT_hi : bits_2;
DSP_overflow : bit; -- Q
Overflow : bit; -- V
Carry : bit;
Zero : bit;
Negative : bit;
end record
with size => 32;
for t_PSR_register use record
ISR_NUMBER at 0 range 0 .. 7;
ICI_IT_lo at 0 range 10 .. 15;
GE at 0 range 16 .. 19;
Thumb at 0 range 24 .. 24;
ICI_IT_hi at 0 range 25 .. 26;
DSP_overflow at 0 range 27 .. 27;
Overflow at 0 range 28 .. 28;
Carry at 0 range 29 .. 29;
Zero at 0 range 30 .. 30;
Negative at 0 range 31 .. 31;
end record;
function to_unsigned_32 is new ada.unchecked_conversion
(t_PSR_register, unsigned_32);
--
-- APSR register
--
type t_APSR_register is record
GE : bits_4;
DSP_overflow : bit;
Overflow : bit;
Carry : bit;
Zero : bit;
Negative : bit;
end record
with size => 32;
for t_APSR_register use record
GE at 0 range 16 .. 19;
DSP_overflow at 0 range 27 .. 27;
Overflow at 0 range 28 .. 28;
Carry at 0 range 29 .. 29;
Zero at 0 range 30 .. 30;
Negative at 0 range 31 .. 31;
end record;
function to_PSR_register is new ada.unchecked_conversion
(t_APSR_register, t_PSR_register);
--
-- IPSR register
--
type t_IPSR_register is record
ISR_NUMBER : unsigned_8;
end record
with size => 32;
function to_PSR_register is new ada.unchecked_conversion
(t_IPSR_register, t_PSR_register);
--
-- EPSR register
--
type t_EPSR_register is record
ICI_IT_lo : bits_6;
Thumb : bit;
ICI_IT_hi : bits_2;
end record
with size => 32;
for t_EPSR_register use record
ICI_IT_lo at 0 range 10 .. 15;
Thumb at 0 range 24 .. 24;
ICI_IT_hi at 0 range 25 .. 26;
end record;
function to_PSR_register is new ada.unchecked_conversion
(t_EPSR_register, t_PSR_register);
---------------
-- Functions --
---------------
-- Enable IRQs by clearing the I-bit in the CPSR.
-- (privileged mode)
procedure enable_irq
with inline;
-- Disable IRQs by setting the I-bit in the CPSR.
-- (privileged mode)
procedure disable_irq
with inline;
-- Get the Control register.
function get_control_register return t_control_register
with inline;
-- Set the Control register.
procedure set_control_register (cr : in t_control_register)
with inline;
-- Get the IPSR register.
function get_ipsr_register return t_ipsr_register
with inline;
-- Get the APSR register.
function get_apsr_register return t_apsr_register
with inline;
-- Get the EPSR register.
function get_epsr_register return t_epsr_register
with inline;
-- Get the LR register
function get_lr_register return unsigned_32
with inline;
-- Get the process stack pointer (PSP)
function get_psp_register return system_address
with inline;
-- Set the process stack pointer (PSP)
procedure set_psp_register (addr : in system_address)
with inline;
-- Get the main stack pointer (MSP)
function get_msp_register return system_address
with inline;
-- Set the main stack pointer (MSP)
procedure set_msp_register (addr : system_address)
with inline;
-- Get the priority mask value
function get_primask_register return unsigned_32
with inline;
-- Set the priority mask value
procedure set_primask_register (mask : in unsigned_32)
with inline;
end m4.cpu;
|
XMoose25X/Advanced-Dungeon-Assault | Ada | 1,806 | ads | with Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;
with Ada.Text_IO; Use Ada.Text_IO;
package inventory_list is
-- inventory system that stores items from items.dat in a linked-list
-- alphabetically.
KEY_ERROR : exception;
OVERFLOW : exception;
type List_Type is private;
type Node_Ptr is private;
type valueArray is array(1..3) of Integer;
subtype nameType is String (1..25);
type inventoryItem is record
itemID : Integer;
name : nameType;
itemType : Integer;
quantity : Integer;
effects : valueArray;
next : Node_Ptr;
end record;
procedure Clear (List : in out List_Type);
--Empties Inventory list
procedure Insert (key : in Integer; List : in out List_Type);
--Adds inventory item from item ID
procedure useItem (key : in Integer; List : in out List_Type; item : out inventoryItem);
--uses inventory item by returning the item and deleting item after usage
procedure Drop (key : in Integer; List : in out List_Type);
--deletes item from inventory
procedure DisplayList (List : in List_Type);
--Traverses thru inventory displaying each item on screen alphabetically
procedure readItem(itemID : in Integer; name : out nameType; itemType : out Integer; effects : out valueArray);
procedure saveInventory(List : in List_Type; File : File_Type);
function isEmpty (List : in List_Type) return Boolean;
--checks whether inventory is empty
function getName (itemID : in Integer) return NameType;
function getSlotName (List : in List_Type; slot : in integer) return String;
function getSlotId (List : in List_Type; slot : in integer) return Integer;
private
type Node_Ptr is access inventoryItem;
type List_Type is record
Head : Node_Ptr; -- Designates first node in the linked list
end record;
end inventory_list; |
optikos/oasis | Ada | 6,462 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Definitions;
with Program.Elements.Formal_Type_Definitions;
with Program.Elements.Aspect_Specifications;
with Program.Elements.Formal_Type_Declarations;
with Program.Element_Visitors;
package Program.Nodes.Formal_Type_Declarations is
pragma Preelaborate;
type Formal_Type_Declaration is
new Program.Nodes.Node
and Program.Elements.Formal_Type_Declarations.Formal_Type_Declaration
and Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Text
with private;
function Create
(Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Definitions.Definition_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Definition : not null Program.Elements.Formal_Type_Definitions
.Formal_Type_Definition_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Formal_Type_Declaration;
type Implicit_Formal_Type_Declaration is
new Program.Nodes.Node
and Program.Elements.Formal_Type_Declarations.Formal_Type_Declaration
with private;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Definitions.Definition_Access;
Definition : not null Program.Elements.Formal_Type_Definitions
.Formal_Type_Definition_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Type_Declaration
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Formal_Type_Declaration is
abstract new Program.Nodes.Node
and Program.Elements.Formal_Type_Declarations.Formal_Type_Declaration
with record
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Definitions.Definition_Access;
Definition : not null Program.Elements.Formal_Type_Definitions
.Formal_Type_Definition_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Formal_Type_Declaration'Class);
overriding procedure Visit
(Self : not null access Base_Formal_Type_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Formal_Type_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
overriding function Discriminant_Part
(Self : Base_Formal_Type_Declaration)
return Program.Elements.Definitions.Definition_Access;
overriding function Definition
(Self : Base_Formal_Type_Declaration)
return not null Program.Elements.Formal_Type_Definitions
.Formal_Type_Definition_Access;
overriding function Aspects
(Self : Base_Formal_Type_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
overriding function Is_Formal_Type_Declaration_Element
(Self : Base_Formal_Type_Declaration)
return Boolean;
overriding function Is_Declaration_Element
(Self : Base_Formal_Type_Declaration)
return Boolean;
type Formal_Type_Declaration is
new Base_Formal_Type_Declaration
and Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Text
with record
Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Formal_Type_Declaration_Text
(Self : aliased in out Formal_Type_Declaration)
return Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Text_Access;
overriding function Type_Token
(Self : Formal_Type_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Formal_Type_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function With_Token
(Self : Formal_Type_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Formal_Type_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Formal_Type_Declaration is
new Base_Formal_Type_Declaration
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Formal_Type_Declaration_Text
(Self : aliased in out Implicit_Formal_Type_Declaration)
return Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Type_Declaration)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Type_Declaration)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Type_Declaration)
return Boolean;
end Program.Nodes.Formal_Type_Declarations;
|
reznikmm/matreshka | Ada | 8,225 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.Element_Collections;
with AMF.Internals.Tables.OCL_Attribute_Mappings;
with AMF.Internals.Tables.OCL_Element_Table;
with AMF.Internals.Tables.OCL_Metamodel;
with AMF.Internals.Tables.UML_Metamodel;
package body AMF.Internals.Factories.OCL_Module_Factory is
procedure Construct_Union
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link);
--------------------
-- Connect_Extent --
--------------------
overriding procedure Connect_Extent
(Self : not null access constant OCL_Module_Factory;
Element : AMF.Internals.AMF_Element;
Extent : AMF.Internals.AMF_Extent)
is
pragma Unreferenced (Self);
begin
AMF.Internals.Tables.OCL_Element_Table.Table (Element).Extent := Extent;
end Connect_Extent;
----------------------
-- Connect_Link_End --
----------------------
overriding procedure Connect_Link_End
(Self : not null access constant OCL_Module_Factory;
Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link;
Other : AMF.Internals.AMF_Element)
is
pragma Unreferenced (Self);
use AMF.Internals.Tables;
use AMF.Internals.Tables.OCL_Attribute_Mappings;
use AMF.Internals.Tables.OCL_Metamodel;
use AMF.Internals.Tables.UML_Metamodel;
begin
-- Properties which comes from UML metamodel.
if Property in MB_UML .. ML_UML then
declare
PO : constant AMF.Internals.CMOF_Element := Property - MB_UML;
begin
if PO in UML_Collection_Offset'Range (2) then
AMF.Internals.Element_Collections.Internal_Append
(OCL_Element_Table.Table (Element).Member (0).Collection
+ UML_Collection_Offset
(OCL_Element_Table.Table (Element).Kind, PO),
Other,
Link);
elsif PO in UML_Member_Offset'Range (2)
and then UML_Member_Offset
(OCL_Element_Table.Table (Element).Kind, PO) /= 0
then
OCL_Element_Table.Table (Element).Member
(UML_Member_Offset
(OCL_Element_Table.Table (Element).Kind, PO)).Link := Link;
else
AMF.Internals.Element_Collections.Internal_Append
(OCL_Element_Table.Table (Element).Member (0).Collection,
Other,
Link);
end if;
end;
elsif Property in MB_OCL .. ML_OCL then
declare
PO : constant AMF.Internals.CMOF_Element := Property - MB_OCL;
begin
if PO in OCL_Collection_Offset'Range (2) then
AMF.Internals.Element_Collections.Internal_Append
(OCL_Element_Table.Table (Element).Member (0).Collection
+ OCL_Collection_Offset
(OCL_Element_Table.Table (Element).Kind, PO),
Other,
Link);
elsif PO in OCL_Member_Offset'Range (2)
and then OCL_Member_Offset
(OCL_Element_Table.Table (Element).Kind, PO) /= 0
then
OCL_Element_Table.Table (Element).Member
(OCL_Member_Offset
(OCL_Element_Table.Table (Element).Kind, PO)).Link := Link;
else
AMF.Internals.Element_Collections.Internal_Append
(OCL_Element_Table.Table (Element).Member (0).Collection,
Other,
Link);
end if;
end;
end if;
end Connect_Link_End;
---------------------
-- Construct_Union --
---------------------
procedure Construct_Union
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link) is separate;
--------------------------
-- Synchronize_Link_Set --
--------------------------
overriding procedure Synchronize_Link_Set
(Self : not null access constant OCL_Module_Factory;
Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link)
is
pragma Unreferenced (Self);
begin
-- Construct derived unions.
Construct_Union (Element, Property, Link);
end Synchronize_Link_Set;
----------------
-- To_Element --
----------------
overriding function To_Element
(Self : not null access constant OCL_Module_Factory;
Element : AMF.Internals.AMF_Element) return AMF.Elements.Element_Access
is
pragma Unreferenced (Self);
begin
return AMF.Internals.Tables.OCL_Element_Table.Table (Element).Proxy;
end To_Element;
end AMF.Internals.Factories.OCL_Module_Factory;
|
pchapin/augusta | Ada | 238 | adb | begin
X := A'Last - A'First;
X := A'Access;
X := A'Delta;
X := A'Digits;
X := A'Mod;
X := Character'Pos(X + 1);
for I in A'Range loop
null;
end loop;
for I in A'Range(2) loop
null;
end loop;
end;
|
tum-ei-rcs/StratoX | Ada | 80,193 | ads | -- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.USB_OTG_FS is
pragma Preelaborate;
---------------
-- Registers --
---------------
-------------------------
-- FS_GOTGCTL_Register --
-------------------------
-- OTG_FS control and status register (OTG_FS_GOTGCTL)
type FS_GOTGCTL_Register is record
-- Read-only. Session request success
SRQSCS : Boolean := False;
-- Session request
SRQ : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
-- Read-only. Host negotiation success
HNGSCS : Boolean := False;
-- HNP request
HNPRQ : Boolean := False;
-- Host set HNP enable
HSHNPEN : Boolean := False;
-- Device HNP enabled
DHNPEN : Boolean := True;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Read-only. Connector ID status
CIDSTS : Boolean := False;
-- Read-only. Long/short debounce time
DBCT : Boolean := False;
-- Read-only. A-session valid
ASVLD : Boolean := False;
-- Read-only. B-session valid
BSVLD : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GOTGCTL_Register use record
SRQSCS at 0 range 0 .. 0;
SRQ at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
HNGSCS at 0 range 8 .. 8;
HNPRQ at 0 range 9 .. 9;
HSHNPEN at 0 range 10 .. 10;
DHNPEN at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CIDSTS at 0 range 16 .. 16;
DBCT at 0 range 17 .. 17;
ASVLD at 0 range 18 .. 18;
BSVLD at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-------------------------
-- FS_GOTGINT_Register --
-------------------------
-- OTG_FS interrupt register (OTG_FS_GOTGINT)
type FS_GOTGINT_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Session end detected
SEDET : Boolean := False;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Session request success status change
SRSSCHG : Boolean := False;
-- Host negotiation success status change
HNSSCHG : Boolean := False;
-- unspecified
Reserved_10_16 : HAL.UInt7 := 16#0#;
-- Host negotiation detected
HNGDET : Boolean := False;
-- A-device timeout change
ADTOCHG : Boolean := False;
-- Debounce done
DBCDNE : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GOTGINT_Register use record
Reserved_0_1 at 0 range 0 .. 1;
SEDET at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
SRSSCHG at 0 range 8 .. 8;
HNSSCHG at 0 range 9 .. 9;
Reserved_10_16 at 0 range 10 .. 16;
HNGDET at 0 range 17 .. 17;
ADTOCHG at 0 range 18 .. 18;
DBCDNE at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-------------------------
-- FS_GAHBCFG_Register --
-------------------------
-- OTG_FS AHB configuration register (OTG_FS_GAHBCFG)
type FS_GAHBCFG_Register is record
-- Global interrupt mask
GINT : Boolean := False;
-- unspecified
Reserved_1_6 : HAL.UInt6 := 16#0#;
-- TxFIFO empty level
TXFELVL : Boolean := False;
-- Periodic TxFIFO empty level
PTXFELVL : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GAHBCFG_Register use record
GINT at 0 range 0 .. 0;
Reserved_1_6 at 0 range 1 .. 6;
TXFELVL at 0 range 7 .. 7;
PTXFELVL at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-------------------------
-- FS_GUSBCFG_Register --
-------------------------
subtype FS_GUSBCFG_TOCAL_Field is HAL.UInt3;
subtype FS_GUSBCFG_TRDT_Field is HAL.UInt4;
-- OTG_FS USB configuration register (OTG_FS_GUSBCFG)
type FS_GUSBCFG_Register is record
-- FS timeout calibration
TOCAL : FS_GUSBCFG_TOCAL_Field := 16#0#;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Write-only. Full Speed serial transceiver select
PHYSEL : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- SRP-capable
SRPCAP : Boolean := False;
-- HNP-capable
HNPCAP : Boolean := True;
-- USB turnaround time
TRDT : FS_GUSBCFG_TRDT_Field := 16#2#;
-- unspecified
Reserved_14_28 : HAL.UInt15 := 16#0#;
-- Force host mode
FHMOD : Boolean := False;
-- Force device mode
FDMOD : Boolean := False;
-- Corrupt Tx packet
CTXPKT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GUSBCFG_Register use record
TOCAL at 0 range 0 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
PHYSEL at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
SRPCAP at 0 range 8 .. 8;
HNPCAP at 0 range 9 .. 9;
TRDT at 0 range 10 .. 13;
Reserved_14_28 at 0 range 14 .. 28;
FHMOD at 0 range 29 .. 29;
FDMOD at 0 range 30 .. 30;
CTXPKT at 0 range 31 .. 31;
end record;
-------------------------
-- FS_GRSTCTL_Register --
-------------------------
subtype FS_GRSTCTL_TXFNUM_Field is HAL.UInt5;
-- OTG_FS reset register (OTG_FS_GRSTCTL)
type FS_GRSTCTL_Register is record
-- Core soft reset
CSRST : Boolean := False;
-- HCLK soft reset
HSRST : Boolean := False;
-- Host frame counter reset
FCRST : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- RxFIFO flush
RXFFLSH : Boolean := False;
-- TxFIFO flush
TXFFLSH : Boolean := False;
-- TxFIFO number
TXFNUM : FS_GRSTCTL_TXFNUM_Field := 16#0#;
-- unspecified
Reserved_11_30 : HAL.UInt20 := 16#40000#;
-- Read-only. AHB master idle
AHBIDL : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GRSTCTL_Register use record
CSRST at 0 range 0 .. 0;
HSRST at 0 range 1 .. 1;
FCRST at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
RXFFLSH at 0 range 4 .. 4;
TXFFLSH at 0 range 5 .. 5;
TXFNUM at 0 range 6 .. 10;
Reserved_11_30 at 0 range 11 .. 30;
AHBIDL at 0 range 31 .. 31;
end record;
-------------------------
-- FS_GINTSTS_Register --
-------------------------
-- OTG_FS core interrupt register (OTG_FS_GINTSTS)
type FS_GINTSTS_Register is record
-- Read-only. Current mode of operation
CMOD : Boolean := False;
-- Mode mismatch interrupt
MMIS : Boolean := False;
-- Read-only. OTG interrupt
OTGINT : Boolean := False;
-- Start of frame
SOF : Boolean := False;
-- Read-only. RxFIFO non-empty
RXFLVL : Boolean := False;
-- Read-only. Non-periodic TxFIFO empty
NPTXFE : Boolean := True;
-- Read-only. Global IN non-periodic NAK effective
GINAKEFF : Boolean := False;
-- Read-only. Global OUT NAK effective
GOUTNAKEFF : Boolean := False;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Early suspend
ESUSP : Boolean := False;
-- USB suspend
USBSUSP : Boolean := False;
-- USB reset
USBRST : Boolean := False;
-- Enumeration done
ENUMDNE : Boolean := False;
-- Isochronous OUT packet dropped interrupt
ISOODRP : Boolean := False;
-- End of periodic frame interrupt
EOPF : Boolean := False;
-- unspecified
Reserved_16_17 : HAL.UInt2 := 16#0#;
-- Read-only. IN endpoint interrupt
IEPINT : Boolean := False;
-- Read-only. OUT endpoint interrupt
OEPINT : Boolean := False;
-- Incomplete isochronous IN transfer
IISOIXFR : Boolean := False;
-- Incomplete periodic transfer(Host mode)/Incomplete isochronous OUT
-- transfer(Device mode)
IPXFR_INCOMPISOOUT : Boolean := False;
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Read-only. Host port interrupt
HPRTINT : Boolean := False;
-- Read-only. Host channels interrupt
HCINT : Boolean := False;
-- Read-only. Periodic TxFIFO empty
PTXFE : Boolean := True;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Connector ID status change
CIDSCHG : Boolean := False;
-- Disconnect detected interrupt
DISCINT : Boolean := False;
-- Session request/new session detected interrupt
SRQINT : Boolean := False;
-- Resume/remote wakeup detected interrupt
WKUPINT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GINTSTS_Register use record
CMOD at 0 range 0 .. 0;
MMIS at 0 range 1 .. 1;
OTGINT at 0 range 2 .. 2;
SOF at 0 range 3 .. 3;
RXFLVL at 0 range 4 .. 4;
NPTXFE at 0 range 5 .. 5;
GINAKEFF at 0 range 6 .. 6;
GOUTNAKEFF at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
ESUSP at 0 range 10 .. 10;
USBSUSP at 0 range 11 .. 11;
USBRST at 0 range 12 .. 12;
ENUMDNE at 0 range 13 .. 13;
ISOODRP at 0 range 14 .. 14;
EOPF at 0 range 15 .. 15;
Reserved_16_17 at 0 range 16 .. 17;
IEPINT at 0 range 18 .. 18;
OEPINT at 0 range 19 .. 19;
IISOIXFR at 0 range 20 .. 20;
IPXFR_INCOMPISOOUT at 0 range 21 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
HPRTINT at 0 range 24 .. 24;
HCINT at 0 range 25 .. 25;
PTXFE at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
CIDSCHG at 0 range 28 .. 28;
DISCINT at 0 range 29 .. 29;
SRQINT at 0 range 30 .. 30;
WKUPINT at 0 range 31 .. 31;
end record;
-------------------------
-- FS_GINTMSK_Register --
-------------------------
-- OTG_FS interrupt mask register (OTG_FS_GINTMSK)
type FS_GINTMSK_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Mode mismatch interrupt mask
MMISM : Boolean := False;
-- OTG interrupt mask
OTGINT : Boolean := False;
-- Start of frame mask
SOFM : Boolean := False;
-- Receive FIFO non-empty mask
RXFLVLM : Boolean := False;
-- Non-periodic TxFIFO empty mask
NPTXFEM : Boolean := False;
-- Global non-periodic IN NAK effective mask
GINAKEFFM : Boolean := False;
-- Global OUT NAK effective mask
GONAKEFFM : Boolean := False;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Early suspend mask
ESUSPM : Boolean := False;
-- USB suspend mask
USBSUSPM : Boolean := False;
-- USB reset mask
USBRST : Boolean := False;
-- Enumeration done mask
ENUMDNEM : Boolean := False;
-- Isochronous OUT packet dropped interrupt mask
ISOODRPM : Boolean := False;
-- End of periodic frame interrupt mask
EOPFM : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Endpoint mismatch interrupt mask
EPMISM : Boolean := False;
-- IN endpoints interrupt mask
IEPINT : Boolean := False;
-- OUT endpoints interrupt mask
OEPINT : Boolean := False;
-- Incomplete isochronous IN transfer mask
IISOIXFRM : Boolean := False;
-- Incomplete periodic transfer mask(Host mode)/Incomplete isochronous
-- OUT transfer mask(Device mode)
IPXFRM_IISOOXFRM : Boolean := False;
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Read-only. Host port interrupt mask
PRTIM : Boolean := False;
-- Host channels interrupt mask
HCIM : Boolean := False;
-- Periodic TxFIFO empty mask
PTXFEM : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Connector ID status change mask
CIDSCHGM : Boolean := False;
-- Disconnect detected interrupt mask
DISCINT : Boolean := False;
-- Session request/new session detected interrupt mask
SRQIM : Boolean := False;
-- Resume/remote wakeup detected interrupt mask
WUIM : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GINTMSK_Register use record
Reserved_0_0 at 0 range 0 .. 0;
MMISM at 0 range 1 .. 1;
OTGINT at 0 range 2 .. 2;
SOFM at 0 range 3 .. 3;
RXFLVLM at 0 range 4 .. 4;
NPTXFEM at 0 range 5 .. 5;
GINAKEFFM at 0 range 6 .. 6;
GONAKEFFM at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
ESUSPM at 0 range 10 .. 10;
USBSUSPM at 0 range 11 .. 11;
USBRST at 0 range 12 .. 12;
ENUMDNEM at 0 range 13 .. 13;
ISOODRPM at 0 range 14 .. 14;
EOPFM at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
EPMISM at 0 range 17 .. 17;
IEPINT at 0 range 18 .. 18;
OEPINT at 0 range 19 .. 19;
IISOIXFRM at 0 range 20 .. 20;
IPXFRM_IISOOXFRM at 0 range 21 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
PRTIM at 0 range 24 .. 24;
HCIM at 0 range 25 .. 25;
PTXFEM at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
CIDSCHGM at 0 range 28 .. 28;
DISCINT at 0 range 29 .. 29;
SRQIM at 0 range 30 .. 30;
WUIM at 0 range 31 .. 31;
end record;
--------------------------------
-- FS_GRXSTSR_Device_Register --
--------------------------------
subtype FS_GRXSTSR_Device_EPNUM_Field is HAL.UInt4;
subtype FS_GRXSTSR_Device_BCNT_Field is HAL.UInt11;
subtype FS_GRXSTSR_Device_DPID_Field is HAL.UInt2;
subtype FS_GRXSTSR_Device_PKTSTS_Field is HAL.UInt4;
subtype FS_GRXSTSR_Device_FRMNUM_Field is HAL.UInt4;
-- OTG_FS Receive status debug read(Device mode)
type FS_GRXSTSR_Device_Register is record
-- Read-only. Endpoint number
EPNUM : FS_GRXSTSR_Device_EPNUM_Field;
-- Read-only. Byte count
BCNT : FS_GRXSTSR_Device_BCNT_Field;
-- Read-only. Data PID
DPID : FS_GRXSTSR_Device_DPID_Field;
-- Read-only. Packet status
PKTSTS : FS_GRXSTSR_Device_PKTSTS_Field;
-- Read-only. Frame number
FRMNUM : FS_GRXSTSR_Device_FRMNUM_Field;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GRXSTSR_Device_Register use record
EPNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
FRMNUM at 0 range 21 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
------------------------------
-- FS_GRXSTSR_Host_Register --
------------------------------
subtype FS_GRXSTSR_Host_EPNUM_Field is HAL.UInt4;
subtype FS_GRXSTSR_Host_BCNT_Field is HAL.UInt11;
subtype FS_GRXSTSR_Host_DPID_Field is HAL.UInt2;
subtype FS_GRXSTSR_Host_PKTSTS_Field is HAL.UInt4;
subtype FS_GRXSTSR_Host_FRMNUM_Field is HAL.UInt4;
-- OTG_FS Receive status debug read(Host mode)
type FS_GRXSTSR_Host_Register is record
-- Read-only. Endpoint number
EPNUM : FS_GRXSTSR_Host_EPNUM_Field;
-- Read-only. Byte count
BCNT : FS_GRXSTSR_Host_BCNT_Field;
-- Read-only. Data PID
DPID : FS_GRXSTSR_Host_DPID_Field;
-- Read-only. Packet status
PKTSTS : FS_GRXSTSR_Host_PKTSTS_Field;
-- Read-only. Frame number
FRMNUM : FS_GRXSTSR_Host_FRMNUM_Field;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GRXSTSR_Host_Register use record
EPNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
FRMNUM at 0 range 21 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-------------------------
-- FS_GRXFSIZ_Register --
-------------------------
subtype FS_GRXFSIZ_RXFD_Field is HAL.Short;
-- OTG_FS Receive FIFO size register (OTG_FS_GRXFSIZ)
type FS_GRXFSIZ_Register is record
-- RxFIFO depth
RXFD : FS_GRXFSIZ_RXFD_Field := 16#200#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GRXFSIZ_Register use record
RXFD at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
----------------------------------
-- FS_GNPTXFSIZ_Device_Register --
----------------------------------
subtype FS_GNPTXFSIZ_Device_TX0FSA_Field is HAL.Short;
subtype FS_GNPTXFSIZ_Device_TX0FD_Field is HAL.Short;
-- OTG_FS non-periodic transmit FIFO size register (Device mode)
type FS_GNPTXFSIZ_Device_Register is record
-- Endpoint 0 transmit RAM start address
TX0FSA : FS_GNPTXFSIZ_Device_TX0FSA_Field := 16#200#;
-- Endpoint 0 TxFIFO depth
TX0FD : FS_GNPTXFSIZ_Device_TX0FD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GNPTXFSIZ_Device_Register use record
TX0FSA at 0 range 0 .. 15;
TX0FD at 0 range 16 .. 31;
end record;
--------------------------------
-- FS_GNPTXFSIZ_Host_Register --
--------------------------------
subtype FS_GNPTXFSIZ_Host_NPTXFSA_Field is HAL.Short;
subtype FS_GNPTXFSIZ_Host_NPTXFD_Field is HAL.Short;
-- OTG_FS non-periodic transmit FIFO size register (Host mode)
type FS_GNPTXFSIZ_Host_Register is record
-- Non-periodic transmit RAM start address
NPTXFSA : FS_GNPTXFSIZ_Host_NPTXFSA_Field := 16#200#;
-- Non-periodic TxFIFO depth
NPTXFD : FS_GNPTXFSIZ_Host_NPTXFD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GNPTXFSIZ_Host_Register use record
NPTXFSA at 0 range 0 .. 15;
NPTXFD at 0 range 16 .. 31;
end record;
--------------------------
-- FS_GNPTXSTS_Register --
--------------------------
subtype FS_GNPTXSTS_NPTXFSAV_Field is HAL.Short;
subtype FS_GNPTXSTS_NPTQXSAV_Field is HAL.Byte;
subtype FS_GNPTXSTS_NPTXQTOP_Field is HAL.UInt7;
-- OTG_FS non-periodic transmit FIFO/queue status register
-- (OTG_FS_GNPTXSTS)
type FS_GNPTXSTS_Register is record
-- Read-only. Non-periodic TxFIFO space available
NPTXFSAV : FS_GNPTXSTS_NPTXFSAV_Field;
-- Read-only. Non-periodic transmit request queue space available
NPTQXSAV : FS_GNPTXSTS_NPTQXSAV_Field;
-- Read-only. Top of the non-periodic transmit request queue
NPTXQTOP : FS_GNPTXSTS_NPTXQTOP_Field;
-- unspecified
Reserved_31_31 : HAL.Bit;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GNPTXSTS_Register use record
NPTXFSAV at 0 range 0 .. 15;
NPTQXSAV at 0 range 16 .. 23;
NPTXQTOP at 0 range 24 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-----------------------
-- FS_GCCFG_Register --
-----------------------
-- OTG_FS general core configuration register (OTG_FS_GCCFG)
type FS_GCCFG_Register is record
-- unspecified
Reserved_0_15 : HAL.Short := 16#0#;
-- Power down
PWRDWN : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Enable the VBUS sensing device
VBUSASEN : Boolean := False;
-- Enable the VBUS sensing device
VBUSBSEN : Boolean := False;
-- SOF output enable
SOFOUTEN : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_GCCFG_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PWRDWN at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
VBUSASEN at 0 range 18 .. 18;
VBUSBSEN at 0 range 19 .. 19;
SOFOUTEN at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
--------------------------
-- FS_HPTXFSIZ_Register --
--------------------------
subtype FS_HPTXFSIZ_PTXSA_Field is HAL.Short;
subtype FS_HPTXFSIZ_PTXFSIZ_Field is HAL.Short;
-- OTG_FS Host periodic transmit FIFO size register (OTG_FS_HPTXFSIZ)
type FS_HPTXFSIZ_Register is record
-- Host periodic TxFIFO start address
PTXSA : FS_HPTXFSIZ_PTXSA_Field := 16#600#;
-- Host periodic TxFIFO depth
PTXFSIZ : FS_HPTXFSIZ_PTXFSIZ_Field := 16#200#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HPTXFSIZ_Register use record
PTXSA at 0 range 0 .. 15;
PTXFSIZ at 0 range 16 .. 31;
end record;
-------------------------
-- FS_DIEPTXF_Register --
-------------------------
subtype FS_DIEPTXF1_INEPTXSA_Field is HAL.Short;
subtype FS_DIEPTXF1_INEPTXFD_Field is HAL.Short;
-- OTG_FS device IN endpoint transmit FIFO size register (OTG_FS_DIEPTXF2)
type FS_DIEPTXF_Register is record
-- IN endpoint FIFO2 transmit RAM start address
INEPTXSA : FS_DIEPTXF1_INEPTXSA_Field := 16#400#;
-- IN endpoint TxFIFO depth
INEPTXFD : FS_DIEPTXF1_INEPTXFD_Field := 16#200#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DIEPTXF_Register use record
INEPTXSA at 0 range 0 .. 15;
INEPTXFD at 0 range 16 .. 31;
end record;
----------------------
-- FS_HCFG_Register --
----------------------
subtype FS_HCFG_FSLSPCS_Field is HAL.UInt2;
-- OTG_FS host configuration register (OTG_FS_HCFG)
type FS_HCFG_Register is record
-- FS/LS PHY clock select
FSLSPCS : FS_HCFG_FSLSPCS_Field := 16#0#;
-- Read-only. FS- and LS-only support
FSLSS : Boolean := False;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HCFG_Register use record
FSLSPCS at 0 range 0 .. 1;
FSLSS at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-------------------
-- HFIR_Register --
-------------------
subtype HFIR_FRIVL_Field is HAL.Short;
-- OTG_FS Host frame interval register
type HFIR_Register is record
-- Frame interval
FRIVL : HFIR_FRIVL_Field := 16#EA60#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HFIR_Register use record
FRIVL at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------------
-- FS_HFNUM_Register --
-----------------------
subtype FS_HFNUM_FRNUM_Field is HAL.Short;
subtype FS_HFNUM_FTREM_Field is HAL.Short;
-- OTG_FS host frame number/frame time remaining register (OTG_FS_HFNUM)
type FS_HFNUM_Register is record
-- Read-only. Frame number
FRNUM : FS_HFNUM_FRNUM_Field;
-- Read-only. Frame time remaining
FTREM : FS_HFNUM_FTREM_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HFNUM_Register use record
FRNUM at 0 range 0 .. 15;
FTREM at 0 range 16 .. 31;
end record;
-------------------------
-- FS_HPTXSTS_Register --
-------------------------
subtype FS_HPTXSTS_PTXFSAVL_Field is HAL.Short;
subtype FS_HPTXSTS_PTXQSAV_Field is HAL.Byte;
subtype FS_HPTXSTS_PTXQTOP_Field is HAL.Byte;
-- OTG_FS_Host periodic transmit FIFO/queue status register
-- (OTG_FS_HPTXSTS)
type FS_HPTXSTS_Register is record
-- Periodic transmit data FIFO space available
PTXFSAVL : FS_HPTXSTS_PTXFSAVL_Field := 16#100#;
-- Read-only. Periodic transmit request queue space available
PTXQSAV : FS_HPTXSTS_PTXQSAV_Field := 16#8#;
-- Read-only. Top of the periodic transmit request queue
PTXQTOP : FS_HPTXSTS_PTXQTOP_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HPTXSTS_Register use record
PTXFSAVL at 0 range 0 .. 15;
PTXQSAV at 0 range 16 .. 23;
PTXQTOP at 0 range 24 .. 31;
end record;
--------------------
-- HAINT_Register --
--------------------
subtype HAINT_HAINT_Field is HAL.Short;
-- OTG_FS Host all channels interrupt register
type HAINT_Register is record
-- Read-only. Channel interrupts
HAINT : HAINT_HAINT_Field;
-- unspecified
Reserved_16_31 : HAL.Short;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HAINT_Register use record
HAINT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------------
-- HAINTMSK_Register --
-----------------------
subtype HAINTMSK_HAINTM_Field is HAL.Short;
-- OTG_FS host all channels interrupt mask register
type HAINTMSK_Register is record
-- Channel interrupt mask
HAINTM : HAINTMSK_HAINTM_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HAINTMSK_Register use record
HAINTM at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
----------------------
-- FS_HPRT_Register --
----------------------
subtype FS_HPRT_PLSTS_Field is HAL.UInt2;
subtype FS_HPRT_PTCTL_Field is HAL.UInt4;
subtype FS_HPRT_PSPD_Field is HAL.UInt2;
-- OTG_FS host port control and status register (OTG_FS_HPRT)
type FS_HPRT_Register is record
-- Read-only. Port connect status
PCSTS : Boolean := False;
-- Port connect detected
PCDET : Boolean := False;
-- Port enable
PENA : Boolean := False;
-- Port enable/disable change
PENCHNG : Boolean := False;
-- Read-only. Port overcurrent active
POCA : Boolean := False;
-- Port overcurrent change
POCCHNG : Boolean := False;
-- Port resume
PRES : Boolean := False;
-- Port suspend
PSUSP : Boolean := False;
-- Port reset
PRST : Boolean := False;
-- unspecified
Reserved_9_9 : HAL.Bit := 16#0#;
-- Read-only. Port line status
PLSTS : FS_HPRT_PLSTS_Field := 16#0#;
-- Port power
PPWR : Boolean := False;
-- Port test control
PTCTL : FS_HPRT_PTCTL_Field := 16#0#;
-- Read-only. Port speed
PSPD : FS_HPRT_PSPD_Field := 16#0#;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HPRT_Register use record
PCSTS at 0 range 0 .. 0;
PCDET at 0 range 1 .. 1;
PENA at 0 range 2 .. 2;
PENCHNG at 0 range 3 .. 3;
POCA at 0 range 4 .. 4;
POCCHNG at 0 range 5 .. 5;
PRES at 0 range 6 .. 6;
PSUSP at 0 range 7 .. 7;
PRST at 0 range 8 .. 8;
Reserved_9_9 at 0 range 9 .. 9;
PLSTS at 0 range 10 .. 11;
PPWR at 0 range 12 .. 12;
PTCTL at 0 range 13 .. 16;
PSPD at 0 range 17 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
------------------------
-- FS_HCCHAR_Register --
------------------------
subtype FS_HCCHAR0_MPSIZ_Field is HAL.UInt11;
subtype FS_HCCHAR0_EPNUM_Field is HAL.UInt4;
subtype FS_HCCHAR0_EPTYP_Field is HAL.UInt2;
subtype FS_HCCHAR0_MCNT_Field is HAL.UInt2;
subtype FS_HCCHAR0_DAD_Field is HAL.UInt7;
-- OTG_FS host channel-0 characteristics register (OTG_FS_HCCHAR0)
type FS_HCCHAR_Register is record
-- Maximum packet size
MPSIZ : FS_HCCHAR0_MPSIZ_Field := 16#0#;
-- Endpoint number
EPNUM : FS_HCCHAR0_EPNUM_Field := 16#0#;
-- Endpoint direction
EPDIR : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Low-speed device
LSDEV : Boolean := False;
-- Endpoint type
EPTYP : FS_HCCHAR0_EPTYP_Field := 16#0#;
-- Multicount
MCNT : FS_HCCHAR0_MCNT_Field := 16#0#;
-- Device address
DAD : FS_HCCHAR0_DAD_Field := 16#0#;
-- Odd frame
ODDFRM : Boolean := False;
-- Channel disable
CHDIS : Boolean := False;
-- Channel enable
CHENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HCCHAR_Register use record
MPSIZ at 0 range 0 .. 10;
EPNUM at 0 range 11 .. 14;
EPDIR at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
LSDEV at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
MCNT at 0 range 20 .. 21;
DAD at 0 range 22 .. 28;
ODDFRM at 0 range 29 .. 29;
CHDIS at 0 range 30 .. 30;
CHENA at 0 range 31 .. 31;
end record;
-----------------------
-- FS_HCINT_Register --
-----------------------
-- OTG_FS host channel-0 interrupt register (OTG_FS_HCINT0)
type FS_HCINT_Register is record
-- Transfer completed
XFRC : Boolean := False;
-- Channel halted
CHH : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- STALL response received interrupt
STALL : Boolean := False;
-- NAK response received interrupt
NAK : Boolean := False;
-- ACK response received/transmitted interrupt
ACK : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- Transaction error
TXERR : Boolean := False;
-- Babble error
BBERR : Boolean := False;
-- Frame overrun
FRMOR : Boolean := False;
-- Data toggle error
DTERR : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HCINT_Register use record
XFRC at 0 range 0 .. 0;
CHH at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STALL at 0 range 3 .. 3;
NAK at 0 range 4 .. 4;
ACK at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
TXERR at 0 range 7 .. 7;
BBERR at 0 range 8 .. 8;
FRMOR at 0 range 9 .. 9;
DTERR at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
--------------------------
-- FS_HCINTMSK_Register --
--------------------------
-- OTG_FS host channel-0 mask register (OTG_FS_HCINTMSK0)
type FS_HCINTMSK_Register is record
-- Transfer completed mask
XFRCM : Boolean := False;
-- Channel halted mask
CHHM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- STALL response received interrupt mask
STALLM : Boolean := False;
-- NAK response received interrupt mask
NAKM : Boolean := False;
-- ACK response received/transmitted interrupt mask
ACKM : Boolean := False;
-- response received interrupt mask
NYET : Boolean := False;
-- Transaction error mask
TXERRM : Boolean := False;
-- Babble error mask
BBERRM : Boolean := False;
-- Frame overrun mask
FRMORM : Boolean := False;
-- Data toggle error mask
DTERRM : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HCINTMSK_Register use record
XFRCM at 0 range 0 .. 0;
CHHM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STALLM at 0 range 3 .. 3;
NAKM at 0 range 4 .. 4;
ACKM at 0 range 5 .. 5;
NYET at 0 range 6 .. 6;
TXERRM at 0 range 7 .. 7;
BBERRM at 0 range 8 .. 8;
FRMORM at 0 range 9 .. 9;
DTERRM at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
------------------------
-- FS_HCTSIZ_Register --
------------------------
subtype FS_HCTSIZ0_XFRSIZ_Field is HAL.UInt19;
subtype FS_HCTSIZ0_PKTCNT_Field is HAL.UInt10;
subtype FS_HCTSIZ0_DPID_Field is HAL.UInt2;
-- OTG_FS host channel-0 transfer size register
type FS_HCTSIZ_Register is record
-- Transfer size
XFRSIZ : FS_HCTSIZ0_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : FS_HCTSIZ0_PKTCNT_Field := 16#0#;
-- Data PID
DPID : FS_HCTSIZ0_DPID_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_HCTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
DPID at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
----------------------
-- FS_DCFG_Register --
----------------------
subtype FS_DCFG_DSPD_Field is HAL.UInt2;
subtype FS_DCFG_DAD_Field is HAL.UInt7;
subtype FS_DCFG_PFIVL_Field is HAL.UInt2;
-- OTG_FS device configuration register (OTG_FS_DCFG)
type FS_DCFG_Register is record
-- Device speed
DSPD : FS_DCFG_DSPD_Field := 16#0#;
-- Non-zero-length status OUT handshake
NZLSOHSK : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Device address
DAD : FS_DCFG_DAD_Field := 16#0#;
-- Periodic frame interval
PFIVL : FS_DCFG_PFIVL_Field := 16#0#;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#1100#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DCFG_Register use record
DSPD at 0 range 0 .. 1;
NZLSOHSK at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DAD at 0 range 4 .. 10;
PFIVL at 0 range 11 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
----------------------
-- FS_DCTL_Register --
----------------------
subtype FS_DCTL_TCTL_Field is HAL.UInt3;
-- OTG_FS device control register (OTG_FS_DCTL)
type FS_DCTL_Register is record
-- Remote wakeup signaling
RWUSIG : Boolean := False;
-- Soft disconnect
SDIS : Boolean := False;
-- Read-only. Global IN NAK status
GINSTS : Boolean := False;
-- Read-only. Global OUT NAK status
GONSTS : Boolean := False;
-- Test control
TCTL : FS_DCTL_TCTL_Field := 16#0#;
-- Set global IN NAK
SGINAK : Boolean := False;
-- Clear global IN NAK
CGINAK : Boolean := False;
-- Set global OUT NAK
SGONAK : Boolean := False;
-- Clear global OUT NAK
CGONAK : Boolean := False;
-- Power-on programming done
POPRGDNE : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DCTL_Register use record
RWUSIG at 0 range 0 .. 0;
SDIS at 0 range 1 .. 1;
GINSTS at 0 range 2 .. 2;
GONSTS at 0 range 3 .. 3;
TCTL at 0 range 4 .. 6;
SGINAK at 0 range 7 .. 7;
CGINAK at 0 range 8 .. 8;
SGONAK at 0 range 9 .. 9;
CGONAK at 0 range 10 .. 10;
POPRGDNE at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
----------------------
-- FS_DSTS_Register --
----------------------
subtype FS_DSTS_ENUMSPD_Field is HAL.UInt2;
subtype FS_DSTS_FNSOF_Field is HAL.UInt14;
-- OTG_FS device status register (OTG_FS_DSTS)
type FS_DSTS_Register is record
-- Read-only. Suspend status
SUSPSTS : Boolean;
-- Read-only. Enumerated speed
ENUMSPD : FS_DSTS_ENUMSPD_Field;
-- Read-only. Erratic error
EERR : Boolean;
-- unspecified
Reserved_4_7 : HAL.UInt4;
-- Read-only. Frame number of the received SOF
FNSOF : FS_DSTS_FNSOF_Field;
-- unspecified
Reserved_22_31 : HAL.UInt10;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DSTS_Register use record
SUSPSTS at 0 range 0 .. 0;
ENUMSPD at 0 range 1 .. 2;
EERR at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
FNSOF at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-------------------------
-- FS_DIEPMSK_Register --
-------------------------
-- OTG_FS device IN endpoint common interrupt mask register
-- (OTG_FS_DIEPMSK)
type FS_DIEPMSK_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Timeout condition mask (Non-isochronous endpoints)
TOM : Boolean := False;
-- IN token received when TxFIFO empty mask
ITTXFEMSK : Boolean := False;
-- IN token received with EP mismatch mask
INEPNMM : Boolean := False;
-- IN endpoint NAK effective mask
INEPNEM : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DIEPMSK_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOM at 0 range 3 .. 3;
ITTXFEMSK at 0 range 4 .. 4;
INEPNMM at 0 range 5 .. 5;
INEPNEM at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-------------------------
-- FS_DOEPMSK_Register --
-------------------------
-- OTG_FS device OUT endpoint common interrupt mask register
-- (OTG_FS_DOEPMSK)
type FS_DOEPMSK_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- SETUP phase done mask
STUPM : Boolean := False;
-- OUT token received when endpoint disabled mask
OTEPDM : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DOEPMSK_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STUPM at 0 range 3 .. 3;
OTEPDM at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-----------------------
-- FS_DAINT_Register --
-----------------------
subtype FS_DAINT_IEPINT_Field is HAL.Short;
subtype FS_DAINT_OEPINT_Field is HAL.Short;
-- OTG_FS device all endpoints interrupt register (OTG_FS_DAINT)
type FS_DAINT_Register is record
-- Read-only. IN endpoint interrupt bits
IEPINT : FS_DAINT_IEPINT_Field;
-- Read-only. OUT endpoint interrupt bits
OEPINT : FS_DAINT_OEPINT_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DAINT_Register use record
IEPINT at 0 range 0 .. 15;
OEPINT at 0 range 16 .. 31;
end record;
--------------------------
-- FS_DAINTMSK_Register --
--------------------------
subtype FS_DAINTMSK_IEPM_Field is HAL.Short;
subtype FS_DAINTMSK_OEPINT_Field is HAL.Short;
-- OTG_FS all endpoints interrupt mask register (OTG_FS_DAINTMSK)
type FS_DAINTMSK_Register is record
-- IN EP interrupt mask bits
IEPM : FS_DAINTMSK_IEPM_Field := 16#0#;
-- OUT endpoint interrupt bits
OEPINT : FS_DAINTMSK_OEPINT_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DAINTMSK_Register use record
IEPM at 0 range 0 .. 15;
OEPINT at 0 range 16 .. 31;
end record;
-----------------------
-- DVBUSDIS_Register --
-----------------------
subtype DVBUSDIS_VBUSDT_Field is HAL.Short;
-- OTG_FS device VBUS discharge time register
type DVBUSDIS_Register is record
-- Device VBUS discharge time
VBUSDT : DVBUSDIS_VBUSDT_Field := 16#17D7#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DVBUSDIS_Register use record
VBUSDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------------
-- DVBUSPULSE_Register --
-------------------------
subtype DVBUSPULSE_DVBUSP_Field is HAL.UInt12;
-- OTG_FS device VBUS pulsing time register
type DVBUSPULSE_Register is record
-- Device VBUS pulsing time
DVBUSP : DVBUSPULSE_DVBUSP_Field := 16#5B8#;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DVBUSPULSE_Register use record
DVBUSP at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-------------------------
-- DIEPEMPMSK_Register --
-------------------------
subtype DIEPEMPMSK_INEPTXFEM_Field is HAL.Short;
-- OTG_FS device IN endpoint FIFO empty interrupt mask register
type DIEPEMPMSK_Register is record
-- IN EP Tx FIFO empty interrupt mask bits
INEPTXFEM : DIEPEMPMSK_INEPTXFEM_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPEMPMSK_Register use record
INEPTXFEM at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------------
-- FS_DIEPCTL0_Register --
--------------------------
subtype FS_DIEPCTL0_MPSIZ_Field is HAL.UInt2;
subtype FS_DIEPCTL0_EPTYP_Field is HAL.UInt2;
subtype FS_DIEPCTL0_TXFNUM_Field is HAL.UInt4;
-- OTG_FS device control IN endpoint 0 control register (OTG_FS_DIEPCTL0)
type FS_DIEPCTL0_Register is record
-- Maximum packet size
MPSIZ : FS_DIEPCTL0_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_2_14 : HAL.UInt13 := 16#0#;
-- Read-only. USB active endpoint
USBAEP : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Read-only. NAK status
NAKSTS : Boolean := False;
-- Read-only. Endpoint type
EPTYP : FS_DIEPCTL0_EPTYP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- STALL handshake
STALL : Boolean := False;
-- TxFIFO number
TXFNUM : FS_DIEPCTL0_TXFNUM_Field := 16#0#;
-- Write-only. Clear NAK
CNAK : Boolean := False;
-- Write-only. Set NAK
SNAK : Boolean := False;
-- unspecified
Reserved_28_29 : HAL.UInt2 := 16#0#;
-- Read-only. Endpoint disable
EPDIS : Boolean := False;
-- Read-only. Endpoint enable
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_DIEPCTL0_Register use record
MPSIZ at 0 range 0 .. 1;
Reserved_2_14 at 0 range 2 .. 14;
USBAEP at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
STALL at 0 range 21 .. 21;
TXFNUM at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
Reserved_28_29 at 0 range 28 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
----------------------
-- DIEPINT_Register --
----------------------
-- device endpoint-x interrupt register
type DIEPINT_Register is record
-- XFRC
XFRC : Boolean := False;
-- EPDISD
EPDISD : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- TOC
TOC : Boolean := False;
-- ITTXFE
ITTXFE : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- INEPNE
INEPNE : Boolean := False;
-- Read-only. TXFE
TXFE : Boolean := True;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPINT_Register use record
XFRC at 0 range 0 .. 0;
EPDISD at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOC at 0 range 3 .. 3;
ITTXFE at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
INEPNE at 0 range 6 .. 6;
TXFE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
------------------------
-- DIEPTSIZ0_Register --
------------------------
subtype DIEPTSIZ0_XFRSIZ_Field is HAL.UInt7;
subtype DIEPTSIZ0_PKTCNT_Field is HAL.UInt2;
-- device endpoint-0 transfer size register
type DIEPTSIZ0_Register is record
-- Transfer size
XFRSIZ : DIEPTSIZ0_XFRSIZ_Field := 16#0#;
-- unspecified
Reserved_7_18 : HAL.UInt12 := 16#0#;
-- Packet count
PKTCNT : DIEPTSIZ0_PKTCNT_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPTSIZ0_Register use record
XFRSIZ at 0 range 0 .. 6;
Reserved_7_18 at 0 range 7 .. 18;
PKTCNT at 0 range 19 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
----------------------
-- DTXFSTS_Register --
----------------------
subtype DTXFSTS0_INEPTFSAV_Field is HAL.Short;
-- OTG_FS device IN endpoint transmit FIFO status register
type DTXFSTS_Register is record
-- Read-only. IN endpoint TxFIFO space available
INEPTFSAV : DTXFSTS0_INEPTFSAV_Field;
-- unspecified
Reserved_16_31 : HAL.Short;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DTXFSTS_Register use record
INEPTFSAV at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------------
-- DIEPCTL1_Register --
-----------------------
subtype DIEPCTL1_MPSIZ_Field is HAL.UInt11;
subtype DIEPCTL1_EPTYP_Field is HAL.UInt2;
subtype DIEPCTL1_TXFNUM_Field is HAL.UInt4;
-- OTG device endpoint-1 control register
type DIEPCTL1_Register is record
-- MPSIZ
MPSIZ : DIEPCTL1_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- USBAEP
USBAEP : Boolean := False;
-- Read-only. EONUM/DPID
EONUM_DPID : Boolean := False;
-- Read-only. NAKSTS
NAKSTS : Boolean := False;
-- EPTYP
EPTYP : DIEPCTL1_EPTYP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Stall
Stall : Boolean := False;
-- TXFNUM
TXFNUM : DIEPCTL1_TXFNUM_Field := 16#0#;
-- Write-only. CNAK
CNAK : Boolean := False;
-- Write-only. SNAK
SNAK : Boolean := False;
-- Write-only. SD0PID/SEVNFRM
SD0PID_SEVNFRM : Boolean := False;
-- Write-only. SODDFRM/SD1PID
SODDFRM_SD1PID : Boolean := False;
-- EPDIS
EPDIS : Boolean := False;
-- EPENA
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPCTL1_Register use record
MPSIZ at 0 range 0 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
USBAEP at 0 range 15 .. 15;
EONUM_DPID at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
TXFNUM at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
SD0PID_SEVNFRM at 0 range 28 .. 28;
SODDFRM_SD1PID at 0 range 29 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
-----------------------
-- DIEPTSIZ_Register --
-----------------------
subtype DIEPTSIZ1_XFRSIZ_Field is HAL.UInt19;
subtype DIEPTSIZ1_PKTCNT_Field is HAL.UInt10;
subtype DIEPTSIZ1_MCNT_Field is HAL.UInt2;
-- device endpoint-1 transfer size register
type DIEPTSIZ_Register is record
-- Transfer size
XFRSIZ : DIEPTSIZ1_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : DIEPTSIZ1_PKTCNT_Field := 16#0#;
-- Multi count
MCNT : DIEPTSIZ1_MCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
MCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
----------------------
-- DIEPCTL_Register --
----------------------
subtype DIEPCTL2_MPSIZ_Field is HAL.UInt11;
subtype DIEPCTL2_EPTYP_Field is HAL.UInt2;
subtype DIEPCTL2_TXFNUM_Field is HAL.UInt4;
-- OTG device endpoint-2 control register
type DIEPCTL_Register is record
-- MPSIZ
MPSIZ : DIEPCTL2_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- USBAEP
USBAEP : Boolean := False;
-- Read-only. EONUM/DPID
EONUM_DPID : Boolean := False;
-- Read-only. NAKSTS
NAKSTS : Boolean := False;
-- EPTYP
EPTYP : DIEPCTL2_EPTYP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Stall
Stall : Boolean := False;
-- TXFNUM
TXFNUM : DIEPCTL2_TXFNUM_Field := 16#0#;
-- Write-only. CNAK
CNAK : Boolean := False;
-- Write-only. SNAK
SNAK : Boolean := False;
-- Write-only. SD0PID/SEVNFRM
SD0PID_SEVNFRM : Boolean := False;
-- Write-only. SODDFRM
SODDFRM : Boolean := False;
-- EPDIS
EPDIS : Boolean := False;
-- EPENA
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIEPCTL_Register use record
MPSIZ at 0 range 0 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
USBAEP at 0 range 15 .. 15;
EONUM_DPID at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
TXFNUM at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
SD0PID_SEVNFRM at 0 range 28 .. 28;
SODDFRM at 0 range 29 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
-----------------------
-- DOEPCTL0_Register --
-----------------------
subtype DOEPCTL0_MPSIZ_Field is HAL.UInt2;
subtype DOEPCTL0_EPTYP_Field is HAL.UInt2;
-- device endpoint-0 control register
type DOEPCTL0_Register is record
-- Read-only. MPSIZ
MPSIZ : DOEPCTL0_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_2_14 : HAL.UInt13 := 16#0#;
-- Read-only. USBAEP
USBAEP : Boolean := True;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Read-only. NAKSTS
NAKSTS : Boolean := False;
-- Read-only. EPTYP
EPTYP : DOEPCTL0_EPTYP_Field := 16#0#;
-- SNPM
SNPM : Boolean := False;
-- Stall
Stall : Boolean := False;
-- unspecified
Reserved_22_25 : HAL.UInt4 := 16#0#;
-- Write-only. CNAK
CNAK : Boolean := False;
-- Write-only. SNAK
SNAK : Boolean := False;
-- unspecified
Reserved_28_29 : HAL.UInt2 := 16#0#;
-- Read-only. EPDIS
EPDIS : Boolean := False;
-- Write-only. EPENA
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DOEPCTL0_Register use record
MPSIZ at 0 range 0 .. 1;
Reserved_2_14 at 0 range 2 .. 14;
USBAEP at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
SNPM at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
Reserved_28_29 at 0 range 28 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
----------------------
-- DOEPINT_Register --
----------------------
-- device endpoint-0 interrupt register
type DOEPINT_Register is record
-- XFRC
XFRC : Boolean := False;
-- EPDISD
EPDISD : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- STUP
STUP : Boolean := False;
-- OTEPDIS
OTEPDIS : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- B2BSTUP
B2BSTUP : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DOEPINT_Register use record
XFRC at 0 range 0 .. 0;
EPDISD at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STUP at 0 range 3 .. 3;
OTEPDIS at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
B2BSTUP at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
------------------------
-- DOEPTSIZ0_Register --
------------------------
subtype DOEPTSIZ0_XFRSIZ_Field is HAL.UInt7;
subtype DOEPTSIZ0_STUPCNT_Field is HAL.UInt2;
-- device OUT endpoint-0 transfer size register
type DOEPTSIZ0_Register is record
-- Transfer size
XFRSIZ : DOEPTSIZ0_XFRSIZ_Field := 16#0#;
-- unspecified
Reserved_7_18 : HAL.UInt12 := 16#0#;
-- Packet count
PKTCNT : Boolean := False;
-- unspecified
Reserved_20_28 : HAL.UInt9 := 16#0#;
-- SETUP packet count
STUPCNT : DOEPTSIZ0_STUPCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DOEPTSIZ0_Register use record
XFRSIZ at 0 range 0 .. 6;
Reserved_7_18 at 0 range 7 .. 18;
PKTCNT at 0 range 19 .. 19;
Reserved_20_28 at 0 range 20 .. 28;
STUPCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
----------------------
-- DOEPCTL_Register --
----------------------
subtype DOEPCTL1_MPSIZ_Field is HAL.UInt11;
subtype DOEPCTL1_EPTYP_Field is HAL.UInt2;
-- device endpoint-1 control register
type DOEPCTL_Register is record
-- MPSIZ
MPSIZ : DOEPCTL1_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- USBAEP
USBAEP : Boolean := False;
-- Read-only. EONUM/DPID
EONUM_DPID : Boolean := False;
-- Read-only. NAKSTS
NAKSTS : Boolean := False;
-- EPTYP
EPTYP : DOEPCTL1_EPTYP_Field := 16#0#;
-- SNPM
SNPM : Boolean := False;
-- Stall
Stall : Boolean := False;
-- unspecified
Reserved_22_25 : HAL.UInt4 := 16#0#;
-- Write-only. CNAK
CNAK : Boolean := False;
-- Write-only. SNAK
SNAK : Boolean := False;
-- Write-only. SD0PID/SEVNFRM
SD0PID_SEVNFRM : Boolean := False;
-- Write-only. SODDFRM
SODDFRM : Boolean := False;
-- EPDIS
EPDIS : Boolean := False;
-- EPENA
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DOEPCTL_Register use record
MPSIZ at 0 range 0 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
USBAEP at 0 range 15 .. 15;
EONUM_DPID at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
SNPM at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
SD0PID_SEVNFRM at 0 range 28 .. 28;
SODDFRM at 0 range 29 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
-----------------------
-- DOEPTSIZ_Register --
-----------------------
subtype DOEPTSIZ1_XFRSIZ_Field is HAL.UInt19;
subtype DOEPTSIZ1_PKTCNT_Field is HAL.UInt10;
subtype DOEPTSIZ1_RXDPID_STUPCNT_Field is HAL.UInt2;
-- device OUT endpoint-1 transfer size register
type DOEPTSIZ_Register is record
-- Transfer size
XFRSIZ : DOEPTSIZ1_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : DOEPTSIZ1_PKTCNT_Field := 16#0#;
-- Received data PID/SETUP packet count
RXDPID_STUPCNT : DOEPTSIZ1_RXDPID_STUPCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DOEPTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
RXDPID_STUPCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-------------------------
-- FS_PCGCCTL_Register --
-------------------------
-- OTG_FS power and clock gating control register
type FS_PCGCCTL_Register is record
-- Stop PHY clock
STPPCLK : Boolean := False;
-- Gate HCLK
GATEHCLK : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- PHY Suspended
PHYSUSP : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FS_PCGCCTL_Register use record
STPPCLK at 0 range 0 .. 0;
GATEHCLK at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
PHYSUSP at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type OTG_FS_Mode is
(
Host,
Device);
-- USB on the go full speed
type OTG_FS_GLOBAL_Peripheral
(Mode : OTG_FS_Mode := Host)
is record
-- OTG_FS control and status register (OTG_FS_GOTGCTL)
FS_GOTGCTL : FS_GOTGCTL_Register;
-- OTG_FS interrupt register (OTG_FS_GOTGINT)
FS_GOTGINT : FS_GOTGINT_Register;
-- OTG_FS AHB configuration register (OTG_FS_GAHBCFG)
FS_GAHBCFG : FS_GAHBCFG_Register;
-- OTG_FS USB configuration register (OTG_FS_GUSBCFG)
FS_GUSBCFG : FS_GUSBCFG_Register;
-- OTG_FS reset register (OTG_FS_GRSTCTL)
FS_GRSTCTL : FS_GRSTCTL_Register;
-- OTG_FS core interrupt register (OTG_FS_GINTSTS)
FS_GINTSTS : FS_GINTSTS_Register;
-- OTG_FS interrupt mask register (OTG_FS_GINTMSK)
FS_GINTMSK : FS_GINTMSK_Register;
-- OTG_FS Receive FIFO size register (OTG_FS_GRXFSIZ)
FS_GRXFSIZ : FS_GRXFSIZ_Register;
-- OTG_FS non-periodic transmit FIFO/queue status register
-- (OTG_FS_GNPTXSTS)
FS_GNPTXSTS : FS_GNPTXSTS_Register;
-- OTG_FS general core configuration register (OTG_FS_GCCFG)
FS_GCCFG : FS_GCCFG_Register;
-- core ID register
FS_CID : HAL.Word;
-- OTG_FS Host periodic transmit FIFO size register (OTG_FS_HPTXFSIZ)
FS_HPTXFSIZ : FS_HPTXFSIZ_Register;
-- OTG_FS device IN endpoint transmit FIFO size register
-- (OTG_FS_DIEPTXF2)
FS_DIEPTXF1 : FS_DIEPTXF_Register;
-- OTG_FS device IN endpoint transmit FIFO size register
-- (OTG_FS_DIEPTXF3)
FS_DIEPTXF2 : FS_DIEPTXF_Register;
-- OTG_FS device IN endpoint transmit FIFO size register
-- (OTG_FS_DIEPTXF4)
FS_DIEPTXF3 : FS_DIEPTXF_Register;
case Mode is
when Host =>
-- OTG_FS Receive status debug read(Host mode)
FS_GRXSTSR_Host : FS_GRXSTSR_Host_Register;
-- OTG_FS non-periodic transmit FIFO size register (Host mode)
FS_GNPTXFSIZ_Host : FS_GNPTXFSIZ_Host_Register;
when Device =>
-- OTG_FS Receive status debug read(Device mode)
FS_GRXSTSR_Device : FS_GRXSTSR_Device_Register;
-- OTG_FS non-periodic transmit FIFO size register (Device mode)
FS_GNPTXFSIZ_Device : FS_GNPTXFSIZ_Device_Register;
end case;
end record
with Unchecked_Union, Volatile;
for OTG_FS_GLOBAL_Peripheral use record
FS_GOTGCTL at 0 range 0 .. 31;
FS_GOTGINT at 4 range 0 .. 31;
FS_GAHBCFG at 8 range 0 .. 31;
FS_GUSBCFG at 12 range 0 .. 31;
FS_GRSTCTL at 16 range 0 .. 31;
FS_GINTSTS at 20 range 0 .. 31;
FS_GINTMSK at 24 range 0 .. 31;
FS_GRXFSIZ at 36 range 0 .. 31;
FS_GNPTXSTS at 44 range 0 .. 31;
FS_GCCFG at 56 range 0 .. 31;
FS_CID at 60 range 0 .. 31;
FS_HPTXFSIZ at 256 range 0 .. 31;
FS_DIEPTXF1 at 260 range 0 .. 31;
FS_DIEPTXF2 at 264 range 0 .. 31;
FS_DIEPTXF3 at 268 range 0 .. 31;
FS_GRXSTSR_Host at 28 range 0 .. 31;
FS_GNPTXFSIZ_Host at 40 range 0 .. 31;
FS_GRXSTSR_Device at 28 range 0 .. 31;
FS_GNPTXFSIZ_Device at 40 range 0 .. 31;
end record;
-- USB on the go full speed
OTG_FS_GLOBAL_Periph : aliased OTG_FS_GLOBAL_Peripheral
with Import, Address => OTG_FS_GLOBAL_Base;
-- USB on the go full speed
type OTG_FS_HOST_Peripheral is record
-- OTG_FS host configuration register (OTG_FS_HCFG)
FS_HCFG : FS_HCFG_Register;
-- OTG_FS Host frame interval register
HFIR : HFIR_Register;
-- OTG_FS host frame number/frame time remaining register (OTG_FS_HFNUM)
FS_HFNUM : FS_HFNUM_Register;
-- OTG_FS_Host periodic transmit FIFO/queue status register
-- (OTG_FS_HPTXSTS)
FS_HPTXSTS : FS_HPTXSTS_Register;
-- OTG_FS Host all channels interrupt register
HAINT : HAINT_Register;
-- OTG_FS host all channels interrupt mask register
HAINTMSK : HAINTMSK_Register;
-- OTG_FS host port control and status register (OTG_FS_HPRT)
FS_HPRT : FS_HPRT_Register;
-- OTG_FS host channel-0 characteristics register (OTG_FS_HCCHAR0)
FS_HCCHAR0 : FS_HCCHAR_Register;
-- OTG_FS host channel-0 interrupt register (OTG_FS_HCINT0)
FS_HCINT0 : FS_HCINT_Register;
-- OTG_FS host channel-0 mask register (OTG_FS_HCINTMSK0)
FS_HCINTMSK0 : FS_HCINTMSK_Register;
-- OTG_FS host channel-0 transfer size register
FS_HCTSIZ0 : FS_HCTSIZ_Register;
-- OTG_FS host channel-1 characteristics register (OTG_FS_HCCHAR1)
FS_HCCHAR1 : FS_HCCHAR_Register;
-- OTG_FS host channel-1 interrupt register (OTG_FS_HCINT1)
FS_HCINT1 : FS_HCINT_Register;
-- OTG_FS host channel-1 mask register (OTG_FS_HCINTMSK1)
FS_HCINTMSK1 : FS_HCINTMSK_Register;
-- OTG_FS host channel-1 transfer size register
FS_HCTSIZ1 : FS_HCTSIZ_Register;
-- OTG_FS host channel-2 characteristics register (OTG_FS_HCCHAR2)
FS_HCCHAR2 : FS_HCCHAR_Register;
-- OTG_FS host channel-2 interrupt register (OTG_FS_HCINT2)
FS_HCINT2 : FS_HCINT_Register;
-- OTG_FS host channel-2 mask register (OTG_FS_HCINTMSK2)
FS_HCINTMSK2 : FS_HCINTMSK_Register;
-- OTG_FS host channel-2 transfer size register
FS_HCTSIZ2 : FS_HCTSIZ_Register;
-- OTG_FS host channel-3 characteristics register (OTG_FS_HCCHAR3)
FS_HCCHAR3 : FS_HCCHAR_Register;
-- OTG_FS host channel-3 interrupt register (OTG_FS_HCINT3)
FS_HCINT3 : FS_HCINT_Register;
-- OTG_FS host channel-3 mask register (OTG_FS_HCINTMSK3)
FS_HCINTMSK3 : FS_HCINTMSK_Register;
-- OTG_FS host channel-3 transfer size register
FS_HCTSIZ3 : FS_HCTSIZ_Register;
-- OTG_FS host channel-4 characteristics register (OTG_FS_HCCHAR4)
FS_HCCHAR4 : FS_HCCHAR_Register;
-- OTG_FS host channel-4 interrupt register (OTG_FS_HCINT4)
FS_HCINT4 : FS_HCINT_Register;
-- OTG_FS host channel-4 mask register (OTG_FS_HCINTMSK4)
FS_HCINTMSK4 : FS_HCINTMSK_Register;
-- OTG_FS host channel-x transfer size register
FS_HCTSIZ4 : FS_HCTSIZ_Register;
-- OTG_FS host channel-5 characteristics register (OTG_FS_HCCHAR5)
FS_HCCHAR5 : FS_HCCHAR_Register;
-- OTG_FS host channel-5 interrupt register (OTG_FS_HCINT5)
FS_HCINT5 : FS_HCINT_Register;
-- OTG_FS host channel-5 mask register (OTG_FS_HCINTMSK5)
FS_HCINTMSK5 : FS_HCINTMSK_Register;
-- OTG_FS host channel-5 transfer size register
FS_HCTSIZ5 : FS_HCTSIZ_Register;
-- OTG_FS host channel-6 characteristics register (OTG_FS_HCCHAR6)
FS_HCCHAR6 : FS_HCCHAR_Register;
-- OTG_FS host channel-6 interrupt register (OTG_FS_HCINT6)
FS_HCINT6 : FS_HCINT_Register;
-- OTG_FS host channel-6 mask register (OTG_FS_HCINTMSK6)
FS_HCINTMSK6 : FS_HCINTMSK_Register;
-- OTG_FS host channel-6 transfer size register
FS_HCTSIZ6 : FS_HCTSIZ_Register;
-- OTG_FS host channel-7 characteristics register (OTG_FS_HCCHAR7)
FS_HCCHAR7 : FS_HCCHAR_Register;
-- OTG_FS host channel-7 interrupt register (OTG_FS_HCINT7)
FS_HCINT7 : FS_HCINT_Register;
-- OTG_FS host channel-7 mask register (OTG_FS_HCINTMSK7)
FS_HCINTMSK7 : FS_HCINTMSK_Register;
-- OTG_FS host channel-7 transfer size register
FS_HCTSIZ7 : FS_HCTSIZ_Register;
end record
with Volatile;
for OTG_FS_HOST_Peripheral use record
FS_HCFG at 0 range 0 .. 31;
HFIR at 4 range 0 .. 31;
FS_HFNUM at 8 range 0 .. 31;
FS_HPTXSTS at 16 range 0 .. 31;
HAINT at 20 range 0 .. 31;
HAINTMSK at 24 range 0 .. 31;
FS_HPRT at 64 range 0 .. 31;
FS_HCCHAR0 at 256 range 0 .. 31;
FS_HCINT0 at 264 range 0 .. 31;
FS_HCINTMSK0 at 268 range 0 .. 31;
FS_HCTSIZ0 at 272 range 0 .. 31;
FS_HCCHAR1 at 288 range 0 .. 31;
FS_HCINT1 at 296 range 0 .. 31;
FS_HCINTMSK1 at 300 range 0 .. 31;
FS_HCTSIZ1 at 304 range 0 .. 31;
FS_HCCHAR2 at 320 range 0 .. 31;
FS_HCINT2 at 328 range 0 .. 31;
FS_HCINTMSK2 at 332 range 0 .. 31;
FS_HCTSIZ2 at 336 range 0 .. 31;
FS_HCCHAR3 at 352 range 0 .. 31;
FS_HCINT3 at 360 range 0 .. 31;
FS_HCINTMSK3 at 364 range 0 .. 31;
FS_HCTSIZ3 at 368 range 0 .. 31;
FS_HCCHAR4 at 384 range 0 .. 31;
FS_HCINT4 at 392 range 0 .. 31;
FS_HCINTMSK4 at 396 range 0 .. 31;
FS_HCTSIZ4 at 400 range 0 .. 31;
FS_HCCHAR5 at 416 range 0 .. 31;
FS_HCINT5 at 424 range 0 .. 31;
FS_HCINTMSK5 at 428 range 0 .. 31;
FS_HCTSIZ5 at 432 range 0 .. 31;
FS_HCCHAR6 at 448 range 0 .. 31;
FS_HCINT6 at 456 range 0 .. 31;
FS_HCINTMSK6 at 460 range 0 .. 31;
FS_HCTSIZ6 at 464 range 0 .. 31;
FS_HCCHAR7 at 480 range 0 .. 31;
FS_HCINT7 at 488 range 0 .. 31;
FS_HCINTMSK7 at 492 range 0 .. 31;
FS_HCTSIZ7 at 496 range 0 .. 31;
end record;
-- USB on the go full speed
OTG_FS_HOST_Periph : aliased OTG_FS_HOST_Peripheral
with Import, Address => OTG_FS_HOST_Base;
-- USB on the go full speed
type OTG_FS_DEVICE_Peripheral is record
-- OTG_FS device configuration register (OTG_FS_DCFG)
FS_DCFG : FS_DCFG_Register;
-- OTG_FS device control register (OTG_FS_DCTL)
FS_DCTL : FS_DCTL_Register;
-- OTG_FS device status register (OTG_FS_DSTS)
FS_DSTS : FS_DSTS_Register;
-- OTG_FS device IN endpoint common interrupt mask register
-- (OTG_FS_DIEPMSK)
FS_DIEPMSK : FS_DIEPMSK_Register;
-- OTG_FS device OUT endpoint common interrupt mask register
-- (OTG_FS_DOEPMSK)
FS_DOEPMSK : FS_DOEPMSK_Register;
-- OTG_FS device all endpoints interrupt register (OTG_FS_DAINT)
FS_DAINT : FS_DAINT_Register;
-- OTG_FS all endpoints interrupt mask register (OTG_FS_DAINTMSK)
FS_DAINTMSK : FS_DAINTMSK_Register;
-- OTG_FS device VBUS discharge time register
DVBUSDIS : DVBUSDIS_Register;
-- OTG_FS device VBUS pulsing time register
DVBUSPULSE : DVBUSPULSE_Register;
-- OTG_FS device IN endpoint FIFO empty interrupt mask register
DIEPEMPMSK : DIEPEMPMSK_Register;
-- OTG_FS device control IN endpoint 0 control register
-- (OTG_FS_DIEPCTL0)
FS_DIEPCTL0 : FS_DIEPCTL0_Register;
-- device endpoint-x interrupt register
DIEPINT0 : DIEPINT_Register;
-- device endpoint-0 transfer size register
DIEPTSIZ0 : DIEPTSIZ0_Register;
-- OTG_FS device IN endpoint transmit FIFO status register
DTXFSTS0 : DTXFSTS_Register;
-- OTG device endpoint-1 control register
DIEPCTL1 : DIEPCTL1_Register;
-- device endpoint-1 interrupt register
DIEPINT1 : DIEPINT_Register;
-- device endpoint-1 transfer size register
DIEPTSIZ1 : DIEPTSIZ_Register;
-- OTG_FS device IN endpoint transmit FIFO status register
DTXFSTS1 : DTXFSTS_Register;
-- OTG device endpoint-2 control register
DIEPCTL2 : DIEPCTL_Register;
-- device endpoint-2 interrupt register
DIEPINT2 : DIEPINT_Register;
-- device endpoint-2 transfer size register
DIEPTSIZ2 : DIEPTSIZ_Register;
-- OTG_FS device IN endpoint transmit FIFO status register
DTXFSTS2 : DTXFSTS_Register;
-- OTG device endpoint-3 control register
DIEPCTL3 : DIEPCTL_Register;
-- device endpoint-3 interrupt register
DIEPINT3 : DIEPINT_Register;
-- device endpoint-3 transfer size register
DIEPTSIZ3 : DIEPTSIZ_Register;
-- OTG_FS device IN endpoint transmit FIFO status register
DTXFSTS3 : DTXFSTS_Register;
-- device endpoint-0 control register
DOEPCTL0 : DOEPCTL0_Register;
-- device endpoint-0 interrupt register
DOEPINT0 : DOEPINT_Register;
-- device OUT endpoint-0 transfer size register
DOEPTSIZ0 : DOEPTSIZ0_Register;
-- device endpoint-1 control register
DOEPCTL1 : DOEPCTL_Register;
-- device endpoint-1 interrupt register
DOEPINT1 : DOEPINT_Register;
-- device OUT endpoint-1 transfer size register
DOEPTSIZ1 : DOEPTSIZ_Register;
-- device endpoint-2 control register
DOEPCTL2 : DOEPCTL_Register;
-- device endpoint-2 interrupt register
DOEPINT2 : DOEPINT_Register;
-- device OUT endpoint-2 transfer size register
DOEPTSIZ2 : DOEPTSIZ_Register;
-- device endpoint-3 control register
DOEPCTL3 : DOEPCTL_Register;
-- device endpoint-3 interrupt register
DOEPINT3 : DOEPINT_Register;
-- device OUT endpoint-3 transfer size register
DOEPTSIZ3 : DOEPTSIZ_Register;
end record
with Volatile;
for OTG_FS_DEVICE_Peripheral use record
FS_DCFG at 0 range 0 .. 31;
FS_DCTL at 4 range 0 .. 31;
FS_DSTS at 8 range 0 .. 31;
FS_DIEPMSK at 16 range 0 .. 31;
FS_DOEPMSK at 20 range 0 .. 31;
FS_DAINT at 24 range 0 .. 31;
FS_DAINTMSK at 28 range 0 .. 31;
DVBUSDIS at 40 range 0 .. 31;
DVBUSPULSE at 44 range 0 .. 31;
DIEPEMPMSK at 52 range 0 .. 31;
FS_DIEPCTL0 at 256 range 0 .. 31;
DIEPINT0 at 264 range 0 .. 31;
DIEPTSIZ0 at 272 range 0 .. 31;
DTXFSTS0 at 280 range 0 .. 31;
DIEPCTL1 at 288 range 0 .. 31;
DIEPINT1 at 296 range 0 .. 31;
DIEPTSIZ1 at 304 range 0 .. 31;
DTXFSTS1 at 312 range 0 .. 31;
DIEPCTL2 at 320 range 0 .. 31;
DIEPINT2 at 328 range 0 .. 31;
DIEPTSIZ2 at 336 range 0 .. 31;
DTXFSTS2 at 344 range 0 .. 31;
DIEPCTL3 at 352 range 0 .. 31;
DIEPINT3 at 360 range 0 .. 31;
DIEPTSIZ3 at 368 range 0 .. 31;
DTXFSTS3 at 376 range 0 .. 31;
DOEPCTL0 at 768 range 0 .. 31;
DOEPINT0 at 776 range 0 .. 31;
DOEPTSIZ0 at 784 range 0 .. 31;
DOEPCTL1 at 800 range 0 .. 31;
DOEPINT1 at 808 range 0 .. 31;
DOEPTSIZ1 at 816 range 0 .. 31;
DOEPCTL2 at 832 range 0 .. 31;
DOEPINT2 at 840 range 0 .. 31;
DOEPTSIZ2 at 848 range 0 .. 31;
DOEPCTL3 at 864 range 0 .. 31;
DOEPINT3 at 872 range 0 .. 31;
DOEPTSIZ3 at 880 range 0 .. 31;
end record;
-- USB on the go full speed
OTG_FS_DEVICE_Periph : aliased OTG_FS_DEVICE_Peripheral
with Import, Address => OTG_FS_DEVICE_Base;
-- USB on the go full speed
type OTG_FS_PWRCLK_Peripheral is record
-- OTG_FS power and clock gating control register
FS_PCGCCTL : FS_PCGCCTL_Register;
end record
with Volatile;
for OTG_FS_PWRCLK_Peripheral use record
FS_PCGCCTL at 0 range 0 .. 31;
end record;
-- USB on the go full speed
OTG_FS_PWRCLK_Periph : aliased OTG_FS_PWRCLK_Peripheral
with Import, Address => OTG_FS_PWRCLK_Base;
end STM32_SVD.USB_OTG_FS;
|
rogermc2/GA_Ada | Ada | 1,186 | ads |
with GA_Maths;
with Metric;
with Multivectors;
package Multivector_Type is
type MV_Type is (Unspecified_MV_Type, Multivector_Type, Versor_MV, Blade_MV);
type Parity_Type is (Odd_Parity, Even_Parity, No_Parity);
type MV_Type_Record is private;
function Grade_Use (MV : MV_Type_Record) return GA_Maths.Grade_Usage;
function Init (MV : Multivectors.Multivector) return MV_Type_Record;
function Init (MV : Multivectors.Multivector; aMetric : Metric.Metric_Record;
Epsilon : Float := 0.0) return MV_Type_Record;
function MV_Grade (MV : MV_Type_Record) return Integer;
function MV_Kind (MV : MV_Type_Record) return MV_Type;
function Parity (MV : MV_Type_Record) return Parity_Type;
procedure Print_Multivector_Info (Name : String; Info : MV_Type_Record);
function Zero (MV : MV_Type_Record) return Boolean;
private
type MV_Type_Record is record
MV_Kind : MV_Type := Unspecified_MV_Type; -- type MV, Versor or Blade
Zero : Boolean := True;
Grade : Integer := 0; -- Top_Grade
Grade_Use : GA_Maths.Grade_Usage := 0;
Parity : Parity_Type := No_Parity;
end record;
end Multivector_Type;
|
dan76/Amass | Ada | 907 | ads | -- Copyright © by Jeff Foley 2017-2023. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
name = "PublicWWW"
type = "crawl"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
scrape(ctx, {url=build_url(domain, c.key)})
end
function build_url(domain, key)
return "https://publicwww.com/websites/%22." .. domain .. "%22/?export=csvu&key=" .. key
end
|
google-code/ada-util | Ada | 3,739 | adb | -----------------------------------------------------------------------
-- Util.Concurrent.Pools -- Concurrent Pools
-- Copyright (C) 2011, 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Util.Concurrent.Pools is
-- ------------------------------
-- Get an element instance from the pool.
-- Wait until one instance gets available.
-- ------------------------------
procedure Get_Instance (From : in out Pool;
Item : out Element_Type) is
begin
From.List.Get_Instance (Item);
end Get_Instance;
-- ------------------------------
-- Put the element back to the pool.
-- ------------------------------
procedure Release (Into : in out Pool;
Item : in Element_Type) is
begin
Into.List.Release (Item);
end Release;
-- ------------------------------
-- Set the pool size.
-- ------------------------------
procedure Set_Size (Into : in out Pool;
Capacity : in Positive) is
begin
Into.List.Set_Size (Capacity);
end Set_Size;
-- ------------------------------
-- Release the pool elements.
-- ------------------------------
overriding
procedure Finalize (Object : in out Pool) is
begin
Object.List.Set_Size (0);
end Finalize;
-- Pool of objects
protected body Protected_Pool is
-- ------------------------------
-- Get an element instance from the pool.
-- Wait until one instance gets available.
-- ------------------------------
entry Get_Instance (Item : out Element_Type) when Available > 0 is
begin
Item := Elements (Available);
Available := Available - 1;
end Get_Instance;
-- ------------------------------
-- Put the element back to the pool.
-- ------------------------------
procedure Release (Item : in Element_Type) is
begin
Available := Available + 1;
Elements (Available) := Item;
end Release;
-- ------------------------------
-- Set the pool size.
-- ------------------------------
procedure Set_Size (Capacity : in Natural) is
procedure Free is new Ada.Unchecked_Deallocation (Element_Array, Element_Array_Access);
begin
if Capacity = 0 then
Free (Elements);
elsif Elements = null then
Elements := new Element_Array (1 .. Capacity);
else
declare
New_Array : constant Element_Array_Access := new Element_Array (1 .. Capacity);
begin
if Capacity > Elements'Size then
New_Array (1 .. Elements'Last) := Elements (1 .. Elements'Last);
else
New_Array (1 .. Capacity) := Elements (1 .. Capacity);
end if;
Free (Elements);
Elements := New_Array;
end;
end if;
end Set_Size;
end Protected_Pool;
end Util.Concurrent.Pools;
|
reznikmm/matreshka | Ada | 7,583 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2018, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis.Declarations;
with Asis.Elements;
with Asis.Expressions;
with Properties.Tools;
package body Properties.Expressions.Indexed_Component is
-------------
-- Address --
-------------
function Address
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
Text : League.Strings.Universal_String;
Down : League.Strings.Universal_String;
List : constant Asis.Expression_List :=
Asis.Expressions.Index_Expressions (Element);
Prefix : constant Asis.Expression := Asis.Expressions.Prefix (Element);
begin
Down := Engine.Text.Get_Property
(Prefix, Name);
Text.Append (Down);
Text.Append (".A[");
Text.Append (Down);
Text.Append ("._index(");
for J in List'Range loop
Down := Engine.Text.Get_Property (List (J), Engines.Code);
Text.Append (Down);
if J /= List'Last then
Text.Append (", ");
end if;
end loop;
Text.Append (")");
Text.Append ("]");
return Text;
end Address;
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
Text : League.Strings.Universal_String;
Down : League.Strings.Universal_String;
List : constant Asis.Expression_List :=
Asis.Expressions.Index_Expressions (Element);
Prefix : constant Asis.Expression :=
Asis.Expressions.Prefix (Element);
Prefix_Tipe : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Prefix);
Element_Tipe : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Element);
Is_Simple_Type : constant Boolean :=
Engine.Boolean.Get_Property (Element_Tipe, Engines.Is_Simple_Type);
Is_Simple_Ref : constant Boolean :=
Engine.Boolean.Get_Property (Element, Engines.Is_Simple_Ref);
Is_Array_Buffer : Boolean := False;
begin
if not Asis.Elements.Is_Nil (Prefix_Tipe) then
Is_Array_Buffer := Properties.Tools.Is_Array_Buffer (Prefix_Tipe);
end if;
Down := Engine.Text.Get_Property (Prefix, Name);
Text.Append (Down);
if Is_Array_Buffer and not Is_Simple_Type then
Text.Append ("._get(");
else
Text.Append (".A[");
Text.Append (Down);
Text.Append ("._index(");
end if;
for J in List'Range loop
Down := Engine.Text.Get_Property (List (J), Name);
Text.Append (Down);
if J /= List'Last then
Text.Append (", ");
end if;
end loop;
Text.Append (")");
if not Is_Array_Buffer or else Is_Simple_Type then
Text.Append ("]");
if Is_Simple_Ref then
Text.Append (".all");
end if;
end if;
return Text;
end Code;
-------------------
-- Is_Simple_Ref --
-------------------
function Is_Simple_Ref
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Boolean_Property) return Boolean
is
Prefix : constant Asis.Expression :=
Asis.Expressions.Prefix (Element);
Prefix_Type : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Prefix);
View : Asis.Definition;
Component : Asis.Component_Definition;
begin
if Asis.Elements.Is_Nil (Prefix_Type) then
declare
Decl : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Name_Declaration (Prefix);
begin
View := Asis.Declarations.Object_Declaration_View (Decl);
end;
else
View := Properties.Tools.Type_Declaration_View (Prefix_Type);
end if;
Component := Properties.Tools.Array_Component_Definition (View);
return Engine.Boolean.Get_Property (Component, Name);
end Is_Simple_Ref;
end Properties.Expressions.Indexed_Component;
|
JeremyGrosser/clock3 | Ada | 21,561 | ads | pragma Style_Checks (Off);
-- Copyright (c) 2018 Microchip Technology Inc.
--
-- SPDX-License-Identifier: Apache-2.0
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- This spec has been automatically generated from ATSAMD21G18A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAMD21_SVD.AC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control A
type AC_CTRLA_Register is record
-- Write-only. Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- Low-Power Mux
LPMUX : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_CTRLA_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
RUNSTDBY at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
LPMUX at 0 range 7 .. 7;
end record;
-- AC_CTRLB_START array
type AC_CTRLB_START_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_CTRLB_START
type AC_CTRLB_START_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- START as a value
Val : HAL.UInt2;
when True =>
-- START as an array
Arr : AC_CTRLB_START_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_CTRLB_START_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Control B
type AC_CTRLB_Register is record
-- Write-only. Comparator 0 Start Comparison
START : AC_CTRLB_START_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_CTRLB_Register use record
START at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
-- AC_EVCTRL_COMPEO array
type AC_EVCTRL_COMPEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_EVCTRL_COMPEO
type AC_EVCTRL_COMPEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPEO as a value
Val : HAL.UInt2;
when True =>
-- COMPEO as an array
Arr : AC_EVCTRL_COMPEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_EVCTRL_COMPEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- AC_EVCTRL_COMPEI array
type AC_EVCTRL_COMPEI_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_EVCTRL_COMPEI
type AC_EVCTRL_COMPEI_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPEI as a value
Val : HAL.UInt2;
when True =>
-- COMPEI as an array
Arr : AC_EVCTRL_COMPEI_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_EVCTRL_COMPEI_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type AC_EVCTRL_Register is record
-- Comparator 0 Event Output Enable
COMPEO : AC_EVCTRL_COMPEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Window 0 Event Output Enable
WINEO0 : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- Comparator 0 Event Input
COMPEI : AC_EVCTRL_COMPEI_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_10_15 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for AC_EVCTRL_Register use record
COMPEO at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WINEO0 at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
COMPEI at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
end record;
-- AC_INTENCLR_COMP array
type AC_INTENCLR_COMP_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_INTENCLR_COMP
type AC_INTENCLR_COMP_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMP as a value
Val : HAL.UInt2;
when True =>
-- COMP as an array
Arr : AC_INTENCLR_COMP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_INTENCLR_COMP_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type AC_INTENCLR_Register is record
-- Comparator 0 Interrupt Enable
COMP : AC_INTENCLR_COMP_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Window 0 Interrupt Enable
WIN0 : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_INTENCLR_Register use record
COMP at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WIN0 at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- AC_INTENSET_COMP array
type AC_INTENSET_COMP_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_INTENSET_COMP
type AC_INTENSET_COMP_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMP as a value
Val : HAL.UInt2;
when True =>
-- COMP as an array
Arr : AC_INTENSET_COMP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_INTENSET_COMP_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type AC_INTENSET_Register is record
-- Comparator 0 Interrupt Enable
COMP : AC_INTENSET_COMP_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Window 0 Interrupt Enable
WIN0 : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_INTENSET_Register use record
COMP at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WIN0 at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- AC_INTFLAG_COMP array
type AC_INTFLAG_COMP_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_INTFLAG_COMP
type AC_INTFLAG_COMP_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMP as a value
Val : HAL.UInt2;
when True =>
-- COMP as an array
Arr : AC_INTFLAG_COMP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_INTFLAG_COMP_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type AC_INTFLAG_Register is record
-- Comparator 0
COMP : AC_INTFLAG_COMP_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Window 0
WIN0 : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_INTFLAG_Register use record
COMP at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WIN0 at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- AC_STATUSA_STATE array
type AC_STATUSA_STATE_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_STATUSA_STATE
type AC_STATUSA_STATE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- STATE as a value
Val : HAL.UInt2;
when True =>
-- STATE as an array
Arr : AC_STATUSA_STATE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_STATUSA_STATE_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Window 0 Current State
type STATUSA_WSTATE0Select is
(-- Signal is above window
ABOVE,
-- Signal is inside window
INSIDE,
-- Signal is below window
BELOW)
with Size => 2;
for STATUSA_WSTATE0Select use
(ABOVE => 0,
INSIDE => 1,
BELOW => 2);
-- Status A
type AC_STATUSA_Register is record
-- Read-only. Comparator 0 Current State
STATE : AC_STATUSA_STATE_Field;
-- unspecified
Reserved_2_3 : HAL.UInt2;
-- Read-only. Window 0 Current State
WSTATE0 : STATUSA_WSTATE0Select;
-- unspecified
Reserved_6_7 : HAL.UInt2;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_STATUSA_Register use record
STATE at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WSTATE0 at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- AC_STATUSB_READY array
type AC_STATUSB_READY_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_STATUSB_READY
type AC_STATUSB_READY_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- READY as a value
Val : HAL.UInt2;
when True =>
-- READY as an array
Arr : AC_STATUSB_READY_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_STATUSB_READY_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status B
type AC_STATUSB_Register is record
-- Read-only. Comparator 0 Ready
READY : AC_STATUSB_READY_Field;
-- unspecified
Reserved_2_6 : HAL.UInt5;
-- Read-only. Synchronization Busy
SYNCBUSY : Boolean;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_STATUSB_Register use record
READY at 0 range 0 .. 1;
Reserved_2_6 at 0 range 2 .. 6;
SYNCBUSY at 0 range 7 .. 7;
end record;
-- AC_STATUSC_STATE array
type AC_STATUSC_STATE_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for AC_STATUSC_STATE
type AC_STATUSC_STATE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- STATE as a value
Val : HAL.UInt2;
when True =>
-- STATE as an array
Arr : AC_STATUSC_STATE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for AC_STATUSC_STATE_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Window 0 Current State
type STATUSC_WSTATE0Select is
(-- Signal is above window
ABOVE,
-- Signal is inside window
INSIDE,
-- Signal is below window
BELOW)
with Size => 2;
for STATUSC_WSTATE0Select use
(ABOVE => 0,
INSIDE => 1,
BELOW => 2);
-- Status C
type AC_STATUSC_Register is record
-- Read-only. Comparator 0 Current State
STATE : AC_STATUSC_STATE_Field;
-- unspecified
Reserved_2_3 : HAL.UInt2;
-- Read-only. Window 0 Current State
WSTATE0 : STATUSC_WSTATE0Select;
-- unspecified
Reserved_6_7 : HAL.UInt2;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_STATUSC_Register use record
STATE at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WSTATE0 at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Window 0 Interrupt Selection
type WINCTRL_WINTSEL0Select is
(-- Interrupt on signal above window
ABOVE,
-- Interrupt on signal inside window
INSIDE,
-- Interrupt on signal below window
BELOW,
-- Interrupt on signal outside window
OUTSIDE)
with Size => 2;
for WINCTRL_WINTSEL0Select use
(ABOVE => 0,
INSIDE => 1,
BELOW => 2,
OUTSIDE => 3);
-- Window Control
type AC_WINCTRL_Register is record
-- Window 0 Mode Enable
WEN0 : Boolean := False;
-- Window 0 Interrupt Selection
WINTSEL0 : WINCTRL_WINTSEL0Select := SAMD21_SVD.AC.ABOVE;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_WINCTRL_Register use record
WEN0 at 0 range 0 .. 0;
WINTSEL0 at 0 range 1 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
end record;
-- Speed Selection
type COMPCTRL_SPEEDSelect is
(-- Low speed
LOW,
-- High speed
HIGH)
with Size => 2;
for COMPCTRL_SPEEDSelect use
(LOW => 0,
HIGH => 1);
-- Interrupt Selection
type COMPCTRL_INTSELSelect is
(-- Interrupt on comparator output toggle
TOGGLE,
-- Interrupt on comparator output rising
RISING,
-- Interrupt on comparator output falling
FALLING,
-- Interrupt on end of comparison (single-shot mode only)
EOC)
with Size => 2;
for COMPCTRL_INTSELSelect use
(TOGGLE => 0,
RISING => 1,
FALLING => 2,
EOC => 3);
-- Negative Input Mux Selection
type COMPCTRL_MUXNEGSelect is
(-- I/O pin 0
PIN0,
-- I/O pin 1
PIN1,
-- I/O pin 2
PIN2,
-- I/O pin 3
PIN3,
-- Ground
GND,
-- VDD scaler
VSCALE,
-- Internal bandgap voltage
BANDGAP,
-- DAC output
DAC)
with Size => 3;
for COMPCTRL_MUXNEGSelect use
(PIN0 => 0,
PIN1 => 1,
PIN2 => 2,
PIN3 => 3,
GND => 4,
VSCALE => 5,
BANDGAP => 6,
DAC => 7);
-- Positive Input Mux Selection
type COMPCTRL_MUXPOSSelect is
(-- I/O pin 0
PIN0,
-- I/O pin 1
PIN1,
-- I/O pin 2
PIN2,
-- I/O pin 3
PIN3)
with Size => 2;
for COMPCTRL_MUXPOSSelect use
(PIN0 => 0,
PIN1 => 1,
PIN2 => 2,
PIN3 => 3);
-- Output
type COMPCTRL_OUTSelect is
(-- The output of COMPn is not routed to the COMPn I/O port
OFF,
-- The asynchronous output of COMPn is routed to the COMPn I/O port
ASYNC,
-- The synchronous output (including filtering) of COMPn is routed to the
-- COMPn I/O port
SYNC)
with Size => 2;
for COMPCTRL_OUTSelect use
(OFF => 0,
ASYNC => 1,
SYNC => 2);
-- Filter Length
type COMPCTRL_FLENSelect is
(-- No filtering
OFF,
-- 3-bit majority function (2 of 3)
MAJ3,
-- 5-bit majority function (3 of 5)
MAJ5)
with Size => 3;
for COMPCTRL_FLENSelect use
(OFF => 0,
MAJ3 => 1,
MAJ5 => 2);
-- Comparator Control n
type AC_COMPCTRL_Register is record
-- Enable
ENABLE : Boolean := False;
-- Single-Shot Mode
SINGLE : Boolean := False;
-- Speed Selection
SPEED : COMPCTRL_SPEEDSelect := SAMD21_SVD.AC.LOW;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- Interrupt Selection
INTSEL : COMPCTRL_INTSELSelect := SAMD21_SVD.AC.TOGGLE;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Negative Input Mux Selection
MUXNEG : COMPCTRL_MUXNEGSelect := SAMD21_SVD.AC.PIN0;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Positive Input Mux Selection
MUXPOS : COMPCTRL_MUXPOSSelect := SAMD21_SVD.AC.PIN0;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Swap Inputs and Invert
SWAP : Boolean := False;
-- Output
OUT_k : COMPCTRL_OUTSelect := SAMD21_SVD.AC.OFF;
-- unspecified
Reserved_18_18 : HAL.Bit := 16#0#;
-- Hysteresis Enable
HYST : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- Filter Length
FLEN : COMPCTRL_FLENSelect := SAMD21_SVD.AC.OFF;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AC_COMPCTRL_Register use record
ENABLE at 0 range 0 .. 0;
SINGLE at 0 range 1 .. 1;
SPEED at 0 range 2 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
INTSEL at 0 range 5 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
MUXNEG at 0 range 8 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
MUXPOS at 0 range 12 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
SWAP at 0 range 15 .. 15;
OUT_k at 0 range 16 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
HYST at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
FLEN at 0 range 24 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Comparator Control n
type AC_COMPCTRL_Registers is array (0 .. 1) of AC_COMPCTRL_Register;
subtype AC_SCALER_VALUE_Field is HAL.UInt6;
-- Scaler n
type AC_SCALER_Register is record
-- Scaler Value
VALUE : AC_SCALER_VALUE_Field := 16#0#;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for AC_SCALER_Register use record
VALUE at 0 range 0 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Scaler n
type AC_SCALER_Registers is array (0 .. 1) of AC_SCALER_Register;
-----------------
-- Peripherals --
-----------------
-- Analog Comparators
type AC_Peripheral is record
-- Control A
CTRLA : aliased AC_CTRLA_Register;
-- Control B
CTRLB : aliased AC_CTRLB_Register;
-- Event Control
EVCTRL : aliased AC_EVCTRL_Register;
-- Interrupt Enable Clear
INTENCLR : aliased AC_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased AC_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased AC_INTFLAG_Register;
-- Status A
STATUSA : aliased AC_STATUSA_Register;
-- Status B
STATUSB : aliased AC_STATUSB_Register;
-- Status C
STATUSC : aliased AC_STATUSC_Register;
-- Window Control
WINCTRL : aliased AC_WINCTRL_Register;
-- Comparator Control n
COMPCTRL : aliased AC_COMPCTRL_Registers;
-- Scaler n
SCALER : aliased AC_SCALER_Registers;
end record
with Volatile;
for AC_Peripheral use record
CTRLA at 16#0# range 0 .. 7;
CTRLB at 16#1# range 0 .. 7;
EVCTRL at 16#2# range 0 .. 15;
INTENCLR at 16#4# range 0 .. 7;
INTENSET at 16#5# range 0 .. 7;
INTFLAG at 16#6# range 0 .. 7;
STATUSA at 16#8# range 0 .. 7;
STATUSB at 16#9# range 0 .. 7;
STATUSC at 16#A# range 0 .. 7;
WINCTRL at 16#C# range 0 .. 7;
COMPCTRL at 16#10# range 0 .. 63;
SCALER at 16#20# range 0 .. 15;
end record;
-- Analog Comparators
AC_Periph : aliased AC_Peripheral
with Import, Address => AC_Base;
end SAMD21_SVD.AC;
|
MinimSecure/unum-sdk | Ada | 867 | adb | -- Copyright 2012-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
I : Integer := Ident (10); -- STOP
Obj : Base;
begin
Obj.X := I;
Do_Nothing (Obj.X'Address);
end Foo;
|
Fabien-Chouteau/Ada_Drivers_Library | Ada | 5,288 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with HAL.UART; use HAL.UART;
with nRF51.GPIO; use nRF51.GPIO;
with NRF51_SVD.UART;
package nRF51.UART is
type UART_Device (Periph : not null access NRF51_SVD.UART.UART_Peripheral)
is
new HAL.UART.UART_Port with private;
type Baud_Rate is (Baud1200, Baud2400, Baud4800, Baud9600, Baud14400,
Baud19200, Baud28800, Baud38400, Baud57600, Baud76800,
Baud115200, Baud230400, Baud250000, Baud460800,
Baud921600, Baud1M);
procedure Configure (This : in out UART_Device;
Baud : Baud_Rate;
Parity : Boolean);
procedure Enable (This : in out UART_Device;
Tx, Rx : GPIO_Pin_Index);
-- Connects the GPIOs and enable device
procedure Disable (This : in out UART_Device);
-- Disable the device and disconects the GPIOs
procedure Enable_Flow_Control (This : in out UART_Device;
RTS, CTS : GPIO_Pin_Index);
-- Connects the GPIOs used for flow control and enable it
procedure Disable_Flow_Control (This : in out UART_Device);
-- Disable flow control and disconnects the GPIOs
-- HAL.GPIO --
overriding
function Data_Size (Port : UART_Device) return UART_Data_Size
is (HAL.UART.Data_Size_8b);
-- Only 8-bit is supported
overriding
procedure Transmit
(This : in out UART_Device;
Data : UART_Data_8b;
Status : out UART_Status;
Timeout : Natural := 1000);
overriding
procedure Receive
(This : in out UART_Device;
Data : out UART_Data_8b;
Status : out UART_Status;
Timeout : Natural := 1000);
overriding
procedure Transmit
(This : in out UART_Device;
Data : UART_Data_9b;
Status : out UART_Status;
Timeout : Natural := 1000);
-- Will raise Program_Error
overriding
procedure Receive
(This : in out UART_Device;
Data : out UART_Data_9b;
Status : out UART_Status;
Timeout : Natural := 1000);
-- Will raise Program_Error
private
type UART_Device (Periph : not null access NRF51_SVD.UART.UART_Peripheral)
is
new HAL.UART.UART_Port with record
Do_Stop_Sequence : Boolean := True;
end record;
for Baud_Rate use
(Baud1200 => 16#0004F000#,
Baud2400 => 16#0009D000#,
Baud4800 => 16#0013B000#,
Baud9600 => 16#00275000#,
Baud14400 => 16#003B0000#,
Baud19200 => 16#004EA000#,
Baud28800 => 16#0075F000#,
Baud38400 => 16#009D5000#,
Baud57600 => 16#00EBF000#,
Baud76800 => 16#013A9000#,
Baud115200 => 16#01D7E000#,
Baud230400 => 16#03AFB000#,
Baud250000 => 16#04000000#,
Baud460800 => 16#075F7000#,
Baud921600 => 16#0EBEDFA4#,
Baud1M => 16#10000000#);
end nRF51.UART;
|
PThierry/ewok-kernel | Ada | 6,509 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.exported;
with ewok.exported.gpios;
with ewok.gpio;
with soc.gpio;
with soc.usart; use soc.usart;
with soc.usart.interfaces;
#if CONFIG_KERNEL_PANIC_WIPE
with soc;
with soc.layout; use soc.layout;
#end if;
#if not CONFIG_KERNEL_PANIC_FREEZE
with m4;
with m4.scb;
#end if;
package body ewok.debug
with spark_mode => off
is
kernel_usart_id : unsigned_8;
TX_pin_config : aliased ewok.exported.gpios.t_gpio_config;
USART1_TX_pin_config : constant ewok.exported.gpios.t_gpio_config :=
(settings => ewok.exported.gpios.t_gpio_settings'(others => true),
kref => ewok.exported.gpios.t_gpio_ref'
(pin => 6,
port => soc.gpio.GPIO_PB),
mode => ewok.exported.gpios.GPIO_AF,
pupd => ewok.exported.gpios.GPIO_PULLUP,
otype => ewok.exported.gpios.GPIO_PUSH_PULL,
ospeed => ewok.exported.gpios.GPIO_HIGH_SPEED,
af => ewok.exported.gpios.GPIO_AF_USART1,
bsr_r => 0,
bsr_s => 0,
lck => 0,
exti_trigger => ewok.exported.gpios.GPIO_EXTI_TRIGGER_NONE,
exti_lock => ewok.exported.gpios.GPIO_EXTI_UNLOCKED,
exti_handler => 16#0000_0000#);
USART4_TX_pin_config : constant ewok.exported.gpios.t_gpio_config :=
(settings => ewok.exported.gpios.t_gpio_settings'(others => true),
#if CONFIG_WOOKEY
kref => ewok.exported.gpios.t_gpio_ref'
(pin => 0,
port => soc.gpio.GPIO_PA),
#else
kref => ewok.exported.gpios.t_gpio_ref'
(pin => 6,
port => soc.gpio.GPIO_PB),
#end if;
mode => ewok.exported.gpios.GPIO_AF,
pupd => ewok.exported.gpios.GPIO_PULLUP,
otype => ewok.exported.gpios.GPIO_PUSH_PULL,
ospeed => ewok.exported.gpios.GPIO_HIGH_SPEED,
af => ewok.exported.gpios.GPIO_AF_UART4,
bsr_r => 0,
bsr_s => 0,
lck => 0,
exti_trigger => ewok.exported.gpios.GPIO_EXTI_TRIGGER_NONE,
exti_lock => ewok.exported.gpios.GPIO_EXTI_UNLOCKED,
exti_handler => 16#0000_0000#);
USART6_TX_pin_config : constant ewok.exported.gpios.t_gpio_config :=
(settings => ewok.exported.gpios.t_gpio_settings'(others => true),
kref => ewok.exported.gpios.t_gpio_ref'
(pin => 6,
port => soc.gpio.GPIO_PC),
mode => ewok.exported.gpios.GPIO_AF,
pupd => ewok.exported.gpios.GPIO_PULLUP,
otype => ewok.exported.gpios.GPIO_PUSH_PULL,
ospeed => ewok.exported.gpios.GPIO_HIGH_SPEED,
af => ewok.exported.gpios.GPIO_AF_USART6,
bsr_r => 0,
bsr_s => 0,
lck => 0,
exti_trigger => ewok.exported.gpios.GPIO_EXTI_TRIGGER_NONE,
exti_lock => ewok.exported.gpios.GPIO_EXTI_UNLOCKED,
exti_handler => 16#0000_0000#);
procedure init
(usart : in unsigned_8)
is
ok : boolean;
begin
kernel_usart_id := usart;
case kernel_usart_id is
when 1 =>
TX_pin_config := USART1_TX_pin_config;
when 4 =>
TX_pin_config := USART4_TX_pin_config;
when 6 =>
TX_pin_config := USART6_TX_pin_config;
when others =>
raise program_error;
end case;
ewok.gpio.register (ID_KERNEL, ID_DEV_UNUSED, TX_pin_config'access, ok);
if not ok then
raise program_error;
end if;
ewok.gpio.config (TX_pin_config'access);
soc.usart.interfaces.configure
(kernel_usart_id, 115_200, DATA_9BITS, PARITY_ODD, STOP_1, ok);
if not ok then
raise program_error;
end if;
log (INFO,
"EwoK: USART" & unsigned_8'image (kernel_usart_id) & " initialized");
newline;
end init;
procedure putc (c : character)
is
begin
#if CONFIG_KERNEL_SERIAL
soc.usart.interfaces.transmit (kernel_usart_id, character'pos (c));
#else
null;
#end if;
end putc;
procedure log (s : string; nl : boolean := true)
is
begin
for i in s'range loop
putc (s(i));
end loop;
if nl then
putc (ASCII.CR);
putc (ASCII.LF);
end if;
end log;
procedure log (level : t_level; s : string)
is
begin
case level is
when DEBUG =>
log (BG_COLOR_ORANGE & s & BG_COLOR_BLACK);
when INFO =>
log (BG_COLOR_BLUE & s & BG_COLOR_BLACK);
when WARNING =>
log (BG_COLOR_ORANGE & s & BG_COLOR_BLACK);
when ERROR .. ALERT =>
log (BG_COLOR_RED & s & BG_COLOR_BLACK);
end case;
end log;
procedure alert (s : string)
is
begin
log (BG_COLOR_RED & s & BG_COLOR_BLACK, false);
end alert;
procedure newline
is
begin
log ("");
end newline;
procedure panic (s : string)
is
begin
log (BG_COLOR_RED & "panic: " & s & BG_COLOR_BLACK);
#if CONFIG_KERNEL_PANIC_FREEZE
loop null; end loop;
#end if;
#if CONFIG_KERNEL_PANIC_REBOOT
m4.scb.reset;
#end if;
#if CONFIG_KERNEL_PANIC_WIPE
declare
sram : array (0 .. soc.layout.USER_RAM_SIZE) of types.byte
with address => to_address(USER_RAM_BASE);
begin
-- Wiping the user applications in RAM before reseting. Kernel data
-- and bss are not cleared because the are in use and there should
-- be no sensible content in kernel data (secrets are hold by user tasks).
-- TODO: Clearing IPC content
sram := (others => 0);
m4.scb.reset;
end;
#end if;
end panic;
end ewok.debug;
|
stcarrez/ada-keystore | Ada | 6,134 | ads | -----------------------------------------------------------------------
-- keystore-io -- IO low level operation for the keystore
-- Copyright (C) 2019, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
with Util.Encoders.AES;
with Keystore.Buffers;
with Keystore.Marshallers;
private package Keystore.IO is
use Ada.Streams;
-- Data block size defined to a 4K to map system page.
Block_Size : constant := Buffers.Block_Size;
BT_HMAC_HEADER_SIZE : constant := 32;
BT_TYPE_HEADER_SIZE : constant := 16;
-- Block type magic values.
BT_WALLET_UNUSED : constant := 16#0000#;
BT_WALLET_HEADER : constant := 16#0101#;
BT_WALLET_DIRECTORY : constant := 16#0202#;
BT_WALLET_DATA : constant := 16#0303#;
SIZE_U16 : constant := 2;
SIZE_U32 : constant := 4;
SIZE_U64 : constant := 8;
SIZE_DATE : constant := SIZE_U64;
SIZE_HMAC : constant := BT_HMAC_HEADER_SIZE;
SIZE_KIND : constant := SIZE_U32;
SIZE_BLOCK : constant := SIZE_U32;
SIZE_SECRET : constant := 32;
SIZE_IV : constant := 16;
type Block_Kind is (MASTER_BLOCK, DIRECTORY_BLOCK, DATA_BLOCK);
subtype Buffer_Size is Buffers.Buffer_Size;
subtype Block_Index is Buffers.Block_Index;
subtype Block_Type is Buffers.Block_Type;
subtype IO_Block_Type is Buffers.IO_Block_Type;
subtype Block_Count is Buffers.Block_Count;
subtype Block_Number is Buffers.Block_Number;
subtype Storage_Block is Buffers.Storage_Block;
subtype Storage_Identifier is Buffers.Storage_Identifier;
subtype Marshaller is Marshallers.Marshaller;
BT_HEADER_START : constant Block_Index := Block_Index'First;
BT_DATA_START : constant Block_Index := BT_HEADER_START + BT_TYPE_HEADER_SIZE;
BT_DATA_LENGTH : constant Block_Index := Block_Index'Last - BT_DATA_START + 1;
BT_HMAC_HEADER_POS : constant Stream_Element_Offset := Block_Index'Last + 1;
HEADER_BLOCK_NUM : constant Block_Number := 1;
DEFAULT_STORAGE_ID : constant Storage_Identifier := 0;
type Wallet_Stream is limited interface;
type Wallet_Stream_Access is access all Wallet_Stream'Class;
-- Returns true if the block number is allocated.
function Is_Used (Stream : in out Wallet_Stream;
Block : in Storage_Block) return Boolean is abstract;
-- Read from the wallet stream the block identified by the number and
-- call the `Process` procedure with the data block content.
procedure Read (Stream : in out Wallet_Stream;
Block : in Storage_Block;
Process : not null access
procedure (Data : in IO_Block_Type)) is abstract;
-- Write in the wallet stream the block identified by the block number.
procedure Write (Stream : in out Wallet_Stream;
Block : in Storage_Block;
Process : not null access
procedure (Data : out IO_Block_Type)) is abstract;
-- Allocate a new block and return the block number in `Block`.
procedure Allocate (Stream : in out Wallet_Stream;
Kind : in Block_Kind;
Block : out Storage_Block) is abstract;
-- Release the block number.
procedure Release (Stream : in out Wallet_Stream;
Block : in Storage_Block) is abstract;
-- Close the wallet stream and release any resource.
procedure Close (Stream : in out Wallet_Stream) is abstract;
-- Set some header data in the keystore file.
procedure Set_Header_Data (Stream : in out Wallet_Stream;
Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array) is abstract;
-- Get the header data information from the keystore file.
procedure Get_Header_Data (Stream : in out Wallet_Stream;
Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is abstract;
-- Read the block from the wallet IO stream and decrypt the block content using
-- the decipher object. The decrypted content is stored in the marshaller which
-- is ready to read the start of the block header.
procedure Read (Stream : in out Wallet_Stream'Class;
Decipher : in out Util.Encoders.AES.Decoder;
Sign : in Secret_Key;
Decrypt_Size : out Block_Index;
Into : in out Buffers.Storage_Buffer);
-- Write the block in the wallet IO stream. Encrypt the block data using the
-- cipher object. Sign the header and encrypted data using HMAC-256 and the
-- given signature.
procedure Write (Stream : in out Wallet_Stream'Class;
Encrypt_Size : in Block_Index := BT_DATA_LENGTH;
Cipher : in out Util.Encoders.AES.Encoder;
Sign : in Secret_Key;
From : in out Buffers.Storage_Buffer) with
Pre => Encrypt_Size mod 16 = 0 and then Encrypt_Size <= BT_DATA_LENGTH;
end Keystore.IO;
|
vasil-sd/ada-tlsf | Ada | 74 | ads | package TLSF.Proof with SPARK_Mode, Pure, Preelaborate is
end TLSF.Proof;
|
zrmyers/VulkanAda | Ada | 1,848 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides a single precision floating point matrix with 4 rows
--< and 4 columns.
--------------------------------------------------------------------------------
package Vulkan.Math.Mat4x4.Test is
-- Test Harness for Mat4x3 regression tests
procedure Test_Mat4x4;
end Vulkan.Math.Mat4x4.Test;
|
stcarrez/ada-awa | Ada | 2,241 | ads | -----------------------------------------------------------------------
-- awa-commands-user -- Simple user management
-- Copyright (C) 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with GNAT.Command_Line;
with AWA.Commands.Drivers;
with AWA.Applications;
with ASF.Locales;
generic
with package Command_Drivers is new AWA.Commands.Drivers (<>);
package AWA.Commands.User is
type Command_Type is new Command_Drivers.Application_Command_Type with record
Bundle : ASF.Locales.Bundle;
Register : aliased Boolean := False;
Enable : aliased Boolean := False;
Disable : aliased Boolean := False;
No_Email : aliased Boolean := False;
end record;
-- Add, disable, enable a user.
overriding
procedure Execute (Command : in out Command_Type;
Application : in out AWA.Applications.Application'Class;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Setup the command before parsing the arguments and executing it.
overriding
procedure Setup (Command : in out Command_Type;
Config : in out GNAT.Command_Line.Command_Line_Configuration;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type);
Command : aliased Command_Type;
end AWA.Commands.User;
|
charlie5/cBound | Ada | 1,385 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_button_iterator_t is
-- Item
--
type Item is record
data : access xcb.xcb_button_t;
the_rem : aliased Interfaces.C.int;
index : aliased Interfaces.C.int;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_button_iterator_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_button_iterator_t.Item,
Element_Array => xcb.xcb_button_iterator_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_button_iterator_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_button_iterator_t.Pointer,
Element_Array => xcb.xcb_button_iterator_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_button_iterator_t;
|
xeenta/learning-ada | Ada | 335 | adb | with My_Pack;
with Suppack;
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Init is
begin
Put_Line (Integer'Image (My_Pack.Get));
My_Pack.Set (100);
Put_Line (Integer'Image (My_Pack.Get));
Put_Line (Integer'Image (My_Pack.Get_Count));
Suppack.Print;
Put_Line (Integer'Image (My_Pack.Get_Count));
end Test_Init;
|
rveenker/sdlada | Ada | 4,046 | adb | with SDL;
with SDL.Error;
with SDL.Events.Events;
with SDL.Events.Keyboards;
with SDL.Inputs.Mice;
with SDL.Log;
with SDL.Video.Palettes;
with SDL.Video.Pixel_Formats;
with SDL.Video.Renderers.Makers;
with SDL.Video.Textures.Makers;
with SDL.Video.Windows.Makers;
with SDL.Versions;
procedure Mouse is
use type SDL.Dimension;
use type SDL.Positive_Sizes;
Window_Size : constant SDL.Positive_Sizes := SDL.Positive_Sizes'(800, 640);
W : SDL.Video.Windows.Window;
Renderer : SDL.Video.Renderers.Renderer;
Texture : SDL.Video.Textures.Texture;
begin
SDL.Log.Set (Category => SDL.Log.Application, Priority => SDL.Log.Debug);
if SDL.Initialise = True then
SDL.Video.Windows.Makers.Create (Win => W,
Title => "Mouse",
Position => SDL.Natural_Coordinates'(X => 300, Y => 300),
Size => Window_Size,
Flags => SDL.Video.Windows.Resizable);
SDL.Video.Renderers.Makers.Create (Renderer, W);
SDL.Video.Textures.Makers.Create (Tex => Texture,
Renderer => Renderer,
Format => SDL.Video.Pixel_Formats.Pixel_Format_ARGB_8888,
Kind => SDL.Video.Textures.Streaming,
Size => Window_Size);
-- Main loop.
declare
Event : SDL.Events.Events.Events;
Finished : Boolean := False;
Mouse_Shown : Boolean := True;
Warp_Rel : Boolean := True;
Warp_Screen : Boolean := False;
use type SDL.Events.Event_Types;
use type SDL.Events.Keyboards.Key_Codes;
use type SDL.Events.Keyboards.Scan_Codes;
begin
loop
while SDL.Events.Events.Poll (Event) loop
case Event.Common.Event_Type is
when SDL.Events.Quit =>
Finished := True;
when SDL.Events.Keyboards.Key_Down =>
case Event.Keyboard.Key_Sym.Key_Code is
when SDL.Events.Keyboards.Code_Escape =>
Finished := True;
when SDL.Events.Keyboards.Code_M =>
Mouse_Shown := not Mouse_Shown;
SDL.Inputs.Mice.Show_Cursor (Mouse_Shown);
SDL.Log.Put_Debug ("Mouse Shown : " & Boolean'Image (Mouse_Shown));
when SDL.Events.Keyboards.Code_R =>
Warp_Rel := True;
SDL.Log.Put_Debug ("Mouse warp relative: " & Boolean'Image (Warp_Rel));
when SDL.Events.Keyboards.Code_A =>
Warp_Rel := False;
SDL.Log.Put_Debug ("Mouse warp relative: " & Boolean'Image (Warp_Rel));
when SDL.Events.Keyboards.Code_W =>
SDL.Log.Put_Debug ("Warping mouse!");
if Warp_Screen then
SDL.Inputs.Mice.Warp ((0, 0));
else
SDL.Inputs.Mice.Warp (W, (0, 0));
end if;
when SDL.Events.Keyboards.Code_S =>
Warp_Screen := not Warp_Screen;
SDL.Log.Put_Debug ("Mouse warp to " & (if Warp_Screen then "screen!" else "window!"));
when others =>
null;
end case;
when others =>
null;
end case;
end loop;
Renderer.Clear;
Renderer.Copy (Texture);
Renderer.Present;
exit when Finished;
end loop;
end;
W.Finalize;
SDL.Finalise;
end if;
end Mouse;
|
skordal/databases | Ada | 12,449 | adb | -- Databases - A simple database library for Ada applications
-- (c) Kristian Klomsten Skordal 2019 <[email protected]>
-- Report bugs and issues on <https://github.com/skordal/databases/issues>
-- vim:ts=3:sw=3:et:si:sta
with Ada.Text_IO;
with Interfaces.C.Pointers;
package body Databases.Sqlite is
function Get_Value (This : in Column_Data) return Databases.Sql_Integer is
function Sqlite3_Value_Int (Value : in Sqlite_Value_Pointer) return C.long;
pragma Import (C, Sqlite3_Value_Int);
Value : constant C.long := Sqlite3_Value_Int (This.Value_Object);
begin
return Databases.Sql_Integer (Value);
end Get_Value;
function Get_Value (This : in Column_Data) return Databases.Sql_Float is
function Sqlite3_Value_Double (Value : in Sqlite_Value_Pointer) return C.double;
pragma Import (C, Sqlite3_Value_Double);
Value : constant C.double := Sqlite3_Value_Double (This.Value_Object);
begin
return Databases.Sql_Float (Value);
end Get_Value;
function Get_Value (This : in Column_Data) return Databases.Sql_Data_Array is
package Byte_Array_Pointers is new Interfaces.C.Pointers (
Index => Natural, Element => Interfaces.Unsigned_8, Element_Array => Databases.Sql_Data_Array, Default_Terminator => 0);
function Sqlite3_Value_Bytes (Value : in Sqlite_Value_Pointer) return C.ptrdiff_t;
pragma Import (C, Sqlite3_Value_Bytes);
function Sqlite3_Value_Blob (Value : in Sqlite_Value_Pointer) return Byte_Array_Pointers.Pointer;
pragma Import (C, Sqlite3_Value_Blob);
Blob_Pointer : constant Byte_Array_Pointers.Pointer := Sqlite3_Value_Blob (This.Value_Object);
begin
return Byte_Array_Pointers.Value (Blob_Pointer, Sqlite3_Value_Bytes (This.Value_Object));
end Get_Value;
function Get_Value (This : in Column_Data) return String is
package Char_Array_Pointers is new Interfaces.C.Pointers (
Index => C.size_t, Element => C.char, Element_Array => C.char_array, Default_Terminator => C.nul);
function Sqlite3_Value_Text (Value : in Sqlite_Value_Pointer) return Char_Array_Pointers.Pointer;
pragma Import (C, Sqlite3_Value_Text);
Text_Pointer : constant Char_Array_Pointers.Pointer := Sqlite3_Value_Text (This.Value_Object);
begin
return C.To_Ada (Char_Array_Pointers.Value (Text_Pointer));
end Get_Value;
procedure Finalize (This : in out Column_Data) is
procedure Sqlite3_Value_Free (Value : in Sqlite_Value_Pointer);
pragma Import (C, Sqlite3_Value_Free);
begin
Sqlite3_Value_Free (This.Value_Object);
end Finalize;
function Get_Column_Count (This : in Row_Data) return Natural is
begin
return Natural (This.Columns.Length);
end Get_Column_Count;
function Get_Column (This : in Row_Data; Index : in Positive) return Column_Data_Access is
begin
if Index > Natural (This.Columns.Length) then
raise Databases.Invalid_Column_Index;
else
return This.Columns.Element (Index);
end if;
end Get_Column;
procedure Finalize (This : in out Row_Data) is
begin
for Col of This.Columns loop
Databases.Free (Col);
end loop;
end Finalize;
function Get_Row (This : in Statement_Result; Row : in Positive) return Row_Data_Access is
begin
if Row > Natural (This.Rows.Length) then
raise Invalid_Row_Index;
else
return This.Rows.Element (Row);
end if;
end Get_Row;
function Get_Status (This : in Statement_Result) return Databases.Statement_Execution_Status is
begin
return This.Result_Status;
end Get_Status;
function Get_Returned_Row_Count (This : in Statement_Result) return Natural is
begin
return Natural (This.Rows.Length);
end Get_Returned_Row_Count;
procedure Finalize (This : in out Statement_Result) is
begin
for Row of This.Rows loop
Databases.Free (Row);
end loop;
end Finalize;
procedure Bind (This : in out Prepared_Statement; Index : in Positive; Value : in Sql_Integer) is
function Sqlite3_Bind_Int64 (Statement : in Sqlite_Prepared_Statement_Pointer;
Index : in C.int;
Value : in C.long)
return Sqlite_Status_Code;
pragma Import (C, Sqlite3_Bind_Int64);
Status_Code : constant Sqlite_Status_Code := Sqlite3_Bind_Int64 (
This.Stmt_Instance, C.int (Index), C.long (Value));
begin
Handle_Sqlite_Status_Code (Status_Code);
end Bind;
procedure Bind (This : in out Prepared_Statement; Index : in Positive; Value : in Sql_Float) is
function Sqlite3_Bind_Double (Statement : in Sqlite_Prepared_Statement_Pointer;
Index : in C.int;
Value : in C.double)
return Sqlite_Status_Code;
pragma Import (C, Sqlite3_Bind_Double);
Status_Code : constant Sqlite_Status_Code := Sqlite3_Bind_Double (
This.Stmt_Instance, C.int (Index), C.double (Value));
begin
Handle_Sqlite_Status_Code (Status_Code);
end Bind;
procedure Bind (This : in out Prepared_Statement; Index : in Positive; Value : in Boolean) is
begin
if Value then
Bind (This, Index, 1);
else
Bind (This, Index, 0);
end if;
end Bind;
procedure Bind (This : in out Prepared_Statement; Index : in Positive; Value : in String) is
function Sqlite_Wrapper_Bind_String (Statement : in Sqlite_Prepared_Statement_Pointer;
Index : in C.int;
Value : in C.char_array)
return Sqlite_Status_Code;
pragma Import (C, Sqlite_Wrapper_Bind_String);
Status_Code : constant Sqlite_Status_Code := Sqlite_Wrapper_Bind_String (
This.Stmt_Instance, C.int (Index), C.To_C (Value));
begin
Handle_Sqlite_Status_Code (Status_Code);
end Bind;
procedure Clear (This : in out Prepared_Statement) is
function Sqlite3_Clear_Bindings (Statement : in Sqlite_Prepared_Statement_Pointer) return Sqlite_Status_Code;
pragma Import (C, Sqlite3_Clear_Bindings);
Status_Code : constant Sqlite_Status_Code := Sqlite3_Clear_Bindings (This.Stmt_Instance);
begin
Handle_Sqlite_Status_Code (Status_Code);
end Clear;
procedure Reset (This : in out Prepared_Statement) is
function Sqlite3_Reset (Statement : in Sqlite_Prepared_Statement_Pointer) return Sqlite_Status_Code;
pragma Import (C, Sqlite3_Reset);
Status_Code : constant Sqlite_Status_Code := Sqlite3_Reset (This.Stmt_Instance);
begin
Handle_Sqlite_Status_Code (Status_Code);
end Reset;
function Execute (This : in out Prepared_Statement) return Statement_Result_Access is
use type Interfaces.C.int;
function Sqlite3_Step (Statement : in Sqlite_Prepared_Statement_Pointer) return Sqlite_Status_Code;
pragma Import (C, Sqlite3_Step);
function Sqlite3_Column_Count (Statement : in Sqlite_Prepared_Statement_Pointer) return C.int;
pragma Import (C, Sqlite3_Column_Count);
function Sqlite3_Column_Value (Statement : in Sqlite_Prepared_Statement_Pointer; Col : in C.int) return Sqlite_Value_Pointer;
pragma Import (C, Sqlite3_Column_Value);
function Sqlite3_Value_Dup (Value : in Sqlite_Value_Pointer) return Sqlite_Value_Pointer;
pragma Import (C, Sqlite3_Value_Dup);
Status_Code : Sqlite_Status_Code;
Return_Value : constant Statement_Result_Access := new Statement_Result'(Ada.Finalization.Controlled
with Result_Status => Failure, Rows => Row_Data_Vectors.Empty_Vector);
begin
loop
Status_Code := Sqlite3_Step (This.Stmt_Instance);
case Status_Code is
when Sqlite_Done =>
Statement_Result (Return_Value.all).Result_Status := Success;
exit;
when Sqlite_Row =>
-- FIXME: For SQLite, all results must be read and stored here to be accessible, as the SQLite API does
-- FIXME: not provide a separate results object that allows reading objects separately from the statement.
declare
Row : constant Row_Data_Access := new Row_Data;
begin
for Col in 0 .. Sqlite3_Column_Count(This.Stmt_Instance) - 1 loop
declare
Column : constant Column_Data_Access := new Column_Data;
begin
Column_Data (Column.all).Value_Object := Sqlite3_Value_Dup (Sqlite3_Column_Value (This.Stmt_Instance, Col));
Row_Data (Row.all).Columns.Append (Column);
end;
end loop;
Statement_Result (Return_Value.all).Rows.Append (Row);
end;
when others =>
Handle_Sqlite_Status_Code (Status_Code);
end case;
end loop;
return Return_Value;
end Execute;
function Execute (This : in out Prepared_Statement) return Statement_Execution_Status is
Results : Statement_Result_Access := This.Execute;
Return_Value : constant Statement_Execution_Status := Results.Get_Status;
begin
Databases.Free (Results);
return Return_Value;
end Execute;
procedure Finalize (This : in out Prepared_Statement) is
procedure Sqlite_Wrapper_Free_Prepared_Statement (Statement : in Sqlite_Prepared_Statement_Pointer);
pragma Import (C, Sqlite_Wrapper_Free_Prepared_Statement);
begin
Sqlite_Wrapper_Free_Prepared_Statement (This.Stmt_Instance);
end Finalize;
function Open (Filename : in String; Create : in Boolean := False) return Databases.Database_Access is
function Sqlite_Wrapper_Open (Filename : in C.char_array;
Create_File : in C.int;
Status : out Sqlite_Status_Code)
return Sqlite_Instance_Pointer;
pragma Import (C, Sqlite_Wrapper_Open);
Create_File : constant C.int := (if Create then 1 else 0);
Status_Code : Sqlite_Status_Code;
Db_Instance : constant Sqlite_Instance_Pointer := Sqlite_Wrapper_Open (C.To_C (Filename), Create_File, Status_Code);
begin
Handle_Sqlite_Status_Code (Status_Code);
return new Database'(Instance => Db_Instance);
end Open;
procedure Close (This : in out Database) is
procedure Sqlite_Wrapper_Close (Instance : in Sqlite_Instance_Pointer);
pragma Import (C, Sqlite_Wrapper_Close);
begin
Sqlite_Wrapper_Close (This.Instance);
This.Instance := null;
end Close;
function Is_Open (This : in Database) return Boolean is
begin
return This.Instance /= null;
end Is_Open;
function Prepare (This : in out Database; Statement : in String)
return Databases.Prepared_Statement_Access is
function Sqlite_Wrapper_Prepare (Instance : in Sqlite_Instance_Pointer;
Statement : in C.char_array;
Statement_Length : in C.int;
Status_Code : out Sqlite_Status_Code)
return Sqlite_Prepared_Statement_Pointer;
pragma Import (C, Sqlite_Wrapper_Prepare);
Status_Code : Sqlite_Status_Code;
Statement_Instance : constant Sqlite_Prepared_Statement_Pointer :=
Sqlite_Wrapper_Prepare (This.Instance, C.To_C (Statement), C.int (Statement'Length), Status_Code);
begin
Handle_Sqlite_Status_Code (Status_Code);
return new Prepared_Statement'(Ada.Finalization.Controlled with Db_Instance => This.Instance,
Stmt_Instance => Statement_Instance);
end Prepare;
procedure Handle_Sqlite_Status_Code (Status : in Sqlite_Status_Code) is
begin
case Status is
when Sqlite_Ok =>
return;
when Sqlite_IOErr =>
raise Databases.IO_Error;
when Sqlite_Cant_Open =>
raise Databases.File_Error;
when others =>
Ada.Text_IO.Put_Line ("Databases.Sqlite: Got unknown error code: " & Sqlite_Status_Code'Image (Status));
raise Databases.Unspecified_Error;
end case;
end Handle_Sqlite_Status_Code;
end Databases.Sqlite;
|
reznikmm/matreshka | Ada | 5,196 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.UML.Exception_Handlers.Collections is
pragma Preelaborate;
package UML_Exception_Handler_Collections is
new AMF.Generic_Collections
(UML_Exception_Handler,
UML_Exception_Handler_Access);
type Set_Of_UML_Exception_Handler is
new UML_Exception_Handler_Collections.Set with null record;
Empty_Set_Of_UML_Exception_Handler : constant Set_Of_UML_Exception_Handler;
type Ordered_Set_Of_UML_Exception_Handler is
new UML_Exception_Handler_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Exception_Handler : constant Ordered_Set_Of_UML_Exception_Handler;
type Bag_Of_UML_Exception_Handler is
new UML_Exception_Handler_Collections.Bag with null record;
Empty_Bag_Of_UML_Exception_Handler : constant Bag_Of_UML_Exception_Handler;
type Sequence_Of_UML_Exception_Handler is
new UML_Exception_Handler_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Exception_Handler : constant Sequence_Of_UML_Exception_Handler;
private
Empty_Set_Of_UML_Exception_Handler : constant Set_Of_UML_Exception_Handler
:= (UML_Exception_Handler_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Exception_Handler : constant Ordered_Set_Of_UML_Exception_Handler
:= (UML_Exception_Handler_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Exception_Handler : constant Bag_Of_UML_Exception_Handler
:= (UML_Exception_Handler_Collections.Bag with null record);
Empty_Sequence_Of_UML_Exception_Handler : constant Sequence_Of_UML_Exception_Handler
:= (UML_Exception_Handler_Collections.Sequence with null record);
end AMF.UML.Exception_Handlers.Collections;
|
bkold/RISC-CPU-Assembler | Ada | 1,143 | ads | with Ada.Containers.Multiway_Trees;
package Improved_Trie is
type Element_Type is record
A : Character;
B : Integer;
end record;
function "=" (Left, Right : Element_Type) return Boolean is
(Left.A = Right.A);
--the Ada Multiway tree package backend to be used
package Trie is new Ada.Containers.Multiway_Trees (Element_Type=>Element_Type, "="=>"=");
use Trie;
--searches the Trie for the input string.
--returns the associated integer, returns -1 if not found
function Find_String (T : Tree; Input : String) return Integer;
--adds the input string into the Trie
--returns whether it is successful or not
function Add_String (T : in out Tree; Input : String; Address : Integer) return Boolean;
private
--finds the child of a node
--returns the found child node, No_Element if not found
function Find_Immediate_Child (Parent : Cursor; Element : Element_Type) return Cursor;
--moves the input node to the found child node
--returns if found or not.
--if not found, Parent is not changed
function Find_Move_Immediate_Child (Parent : in out Cursor; Element : Element_Type) return Boolean;
end Improved_Trie; |
DrenfongWong/tkm-rpc | Ada | 3,871 | adb | package body Tkmrpc.Contexts.esa
is
pragma Warnings
(Off, "* already use-visible through previous use type clause");
use type Types.esa_id_type;
use type Types.ae_id_type;
use type Types.ea_id_type;
use type Types.sp_id_type;
pragma Warnings
(On, "* already use-visible through previous use type clause");
type esa_FSM_Type is record
State : esa_State_Type;
ae_id : Types.ae_id_type;
ea_id : Types.ea_id_type;
sp_id : Types.sp_id_type;
end record;
-- ESP SA Context
Null_esa_FSM : constant esa_FSM_Type
:= esa_FSM_Type'
(State => clean,
ae_id => Types.ae_id_type'First,
ea_id => Types.ea_id_type'First,
sp_id => Types.sp_id_type'First);
type Context_Array_Type is
array (Types.esa_id_type) of esa_FSM_Type;
Context_Array : Context_Array_Type := Context_Array_Type'
(others => (Null_esa_FSM));
-------------------------------------------------------------------------
function Get_State
(Id : Types.esa_id_type)
return esa_State_Type
is
begin
return Context_Array (Id).State;
end Get_State;
-------------------------------------------------------------------------
function Has_ae_id
(Id : Types.esa_id_type;
ae_id : Types.ae_id_type)
return Boolean
is (Context_Array (Id).ae_id = ae_id);
-------------------------------------------------------------------------
function Has_ea_id
(Id : Types.esa_id_type;
ea_id : Types.ea_id_type)
return Boolean
is (Context_Array (Id).ea_id = ea_id);
-------------------------------------------------------------------------
function Has_sp_id
(Id : Types.esa_id_type;
sp_id : Types.sp_id_type)
return Boolean
is (Context_Array (Id).sp_id = sp_id);
-------------------------------------------------------------------------
function Has_State
(Id : Types.esa_id_type;
State : esa_State_Type)
return Boolean
is (Context_Array (Id).State = State);
-------------------------------------------------------------------------
pragma Warnings
(Off, "condition can only be False if invalid values present");
function Is_Valid (Id : Types.esa_id_type) return Boolean
is (Context_Array'First <= Id and Id <= Context_Array'Last);
pragma Warnings
(On, "condition can only be False if invalid values present");
-------------------------------------------------------------------------
procedure create
(Id : Types.esa_id_type;
ae_id : Types.ae_id_type;
ea_id : Types.ea_id_type;
sp_id : Types.sp_id_type)
is
begin
Context_Array (Id).ae_id := ae_id;
Context_Array (Id).ea_id := ea_id;
Context_Array (Id).sp_id := sp_id;
Context_Array (Id).State := active;
end create;
-------------------------------------------------------------------------
procedure invalidate
(Id : Types.esa_id_type)
is
begin
Context_Array (Id).State := invalid;
end invalidate;
-------------------------------------------------------------------------
procedure reset
(Id : Types.esa_id_type)
is
begin
Context_Array (Id).ae_id := Types.ae_id_type'First;
Context_Array (Id).ea_id := Types.ea_id_type'First;
Context_Array (Id).sp_id := Types.sp_id_type'First;
Context_Array (Id).State := clean;
end reset;
-------------------------------------------------------------------------
procedure select_sa
(Id : Types.esa_id_type)
is
begin
Context_Array (Id).State := selected;
end select_sa;
-------------------------------------------------------------------------
procedure unselect_sa
(Id : Types.esa_id_type)
is
begin
Context_Array (Id).State := active;
end unselect_sa;
end Tkmrpc.Contexts.esa;
|
charlie5/cBound | Ada | 1,664 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_motion_events_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
window : aliased xcb.xcb_window_t;
start : aliased xcb.xcb_timestamp_t;
stop : aliased xcb.xcb_timestamp_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_motion_events_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_motion_events_request_t.Item,
Element_Array => xcb.xcb_get_motion_events_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_motion_events_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_motion_events_request_t.Pointer,
Element_Array => xcb.xcb_get_motion_events_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_motion_events_request_t;
|
io7m/coreland-openal-ada | Ada | 1,386 | adb | with OpenAL.Context.Error;
with OpenAL.Context;
with OpenAL.Extension.EFX;
with Test;
procedure efx_001 is
package ALC renames OpenAL.Context;
package ALC_Error renames OpenAL.Context.Error;
package AL_EFX renames OpenAL.Extension.EFX;
Device : ALC.Device_t;
Context : ALC.Context_t;
OK : Boolean;
Loaded : Boolean;
EFX : AL_EFX.Extension_t;
TC : Test.Context_t;
use type ALC.Device_t;
use type ALC.Context_t;
use type ALC_Error.Error_t;
procedure Finish is
begin
ALC.Destroy_Context (Context);
ALC.Close_Device (Device);
end Finish;
procedure Init is
begin
Device := ALC.Open_Default_Device;
pragma Assert (Device /= ALC.Invalid_Device);
Context := ALC.Create_Context (Device);
pragma Assert (Context /= ALC.Invalid_Context);
OK := ALC.Make_Context_Current (Context);
pragma Assert (OK);
end Init;
begin
Test.Initialize
(Test_Context => TC,
Program => "efx_001",
Test_DB => "TEST_DB",
Test_Results => "TEST_RESULTS");
Init;
Loaded := True;
if AL_EFX.Is_Present (Device) then
begin
EFX := AL_EFX.Load_Extension;
pragma Assert (EFX'Size > 0);
exception
when others => Loaded := False;
end;
Test.Check (TC, 55, Loaded, "Loaded");
else
Test.Satisfy (TC, 55, Test.Unsupported);
end if;
Finish;
end efx_001;
|
AdaCore/libadalang | Ada | 96 | adb | separate (Baz.Qux)
procedure Bar is
begin
null;
end Bar;
--% node.p_previous_part_for_decl()
|
reznikmm/matreshka | Ada | 3,754 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Text_Align_Source_Attributes is
pragma Preelaborate;
type ODF_Style_Text_Align_Source_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Text_Align_Source_Attribute_Access is
access all ODF_Style_Text_Align_Source_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Text_Align_Source_Attributes;
|
RREE/ada-util | Ada | 4,974 | adb | -----------------------------------------------------------------------
-- util-beans-objects-time -- Helper conversion for Ada Calendar Time
-- Copyright (C) 2010, 2013, 2016, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces.C;
with Ada.Calendar.Formatting;
with Ada.Calendar.Conversions;
package body Util.Beans.Objects.Time is
use Ada.Calendar;
Epoch : constant Ada.Calendar.Time :=
Ada.Calendar.Time_Of (Year => Year_Number'First,
Month => 1,
Day => 1,
Seconds => 12 * 3600.0);
-- ------------------------------
-- Time Type
-- ------------------------------
type Time_Type_Def is new Duration_Type_Def with null record;
-- Get the type name
function Get_Name (Type_Def : Time_Type_Def) return String;
-- Convert the value into a string.
function To_String (Type_Def : in Time_Type_Def;
Value : in Object_Value) return String;
Time_Type : aliased constant Time_Type_Def := Time_Type_Def '(null record);
-- ------------------------------
-- Get the type name
-- ------------------------------
function Get_Name (Type_Def : in Time_Type_Def) return String is
pragma Unreferenced (Type_Def);
begin
return "Time";
end Get_Name;
-- ------------------------------
-- Convert the value into a string.
-- ------------------------------
function To_String (Type_Def : in Time_Type_Def;
Value : in Object_Value) return String is
pragma Unreferenced (Type_Def);
begin
return Ada.Calendar.Formatting.Image (Epoch + Value.Time_Value);
end To_String;
-- ------------------------------
-- Create an object from the given value.
-- ------------------------------
function To_Object (Value : in Ada.Calendar.Time) return Object is
begin
return Object '(Controlled with
V => Object_Value '(Of_Type => TYPE_TIME,
Time_Value => Value - Epoch),
Type_Def => Time_Type'Access);
end To_Object;
function To_Object (Value : in Nullables.Nullable_Time) return Object is
begin
if Value.Is_Null then
return Null_Object;
else
return To_Object (Value.Value);
end if;
end To_Object;
-- ------------------------------
-- Convert the object into a time.
-- Raises Constraint_Error if the object cannot be converter to the target type.
-- ------------------------------
function To_Time (Value : in Object) return Ada.Calendar.Time is
begin
case Value.V.Of_Type is
when TYPE_TIME =>
return Value.V.Time_Value + Epoch;
when TYPE_STRING | TYPE_WIDE_STRING =>
declare
T : constant String := Value.Type_Def.To_String (Value.V);
begin
return Ada.Calendar.Formatting.Value (T);
exception
-- Last chance, try to convert a Unix time displayed as an integer.
when Constraint_Error =>
return Ada.Calendar.Conversions.To_Ada_Time (Interfaces.C.long'Value (T));
end;
when others =>
raise Constraint_Error with "Conversion to a date is not possible";
end case;
end To_Time;
function To_Time (Value : in Object) return Nullables.Nullable_Time is
begin
if Is_Null (Value) then
return Nullables.Nullable_Time '(Is_Null => True, Value => Epoch);
else
return Nullables.Nullable_Time '(Is_Null => False, Value => To_Time (Value));
end if;
end To_Time;
-- ------------------------------
-- Force the object to be a time.
-- ------------------------------
function Cast_Time (Value : Object) return Object is
begin
case Value.V.Of_Type is
when TYPE_TIME =>
return Value;
when TYPE_STRING | TYPE_WIDE_STRING =>
return Time.To_Object (Formatting.Value (Value.Type_Def.To_String (Value.V)));
when others =>
raise Constraint_Error with "Conversion to a date is not possible";
end case;
end Cast_Time;
end Util.Beans.Objects.Time;
|
charlie5/lace | Ada | 6,337 | ads | with
ada.Calendar;
private
with
ada.Strings.unbounded,
ada.Containers.indefinite_Vectors;
package lace.Environ.Paths
--
-- A singleton which models an operating system paths, folders and files.
--
is
function expand_GLOB (GLOB : in String) return String;
---------
--- Paths
--
type Path is abstract tagged private;
function to_String (Self : in Path'Class) return String;
function "+" (Self : in Path'Class) return String renames to_String;
procedure change_Mode (Self : in Path; To : in String);
procedure change_Owner (Self : in Path; To : in String);
procedure link (Self : in Path; To : in Path);
function Exists (Self : in Path) return Boolean;
function modify_Time (Self : in Path) return ada.Calendar.Time;
function Name (Self : in Path) return String;
function Simple (Self : in Path) return String;
function is_Folder (Self : in Path) return Boolean;
function is_File (Self : in Path) return Boolean;
function is_Special (Self : in Path) return Boolean;
function is_Absolute (Self : in Path) return Boolean;
function is_Relative (Self : in Path) return Boolean;
-----------
--- Folders
--
type Folder is new Path with private;
no_Folder : constant Folder;
function to_Folder (Name : in String) return Folder;
function "+" (Name : in String) return Folder renames to_Folder;
function "+" (Left : in Folder;
Right : in Folder) return Folder;
function current_Folder return Folder;
procedure go_to_Folder (Self : in Folder;
lock : in Boolean := False); -- When true, blocks further folder changes until 'unlock_Folder' is called.
procedure unlock_Folder;
procedure rid_Folder (Self : in Folder);
procedure copy_Folder (Self : in Folder; To : in Folder);
procedure move_Folder (Self : in Folder; To : in Folder);
procedure rename_Folder (Self : in Folder; To : in Folder);
procedure ensure_Folder (Self : in Folder); -- Ensure that the folder exists.
function is_Empty (Self : in Folder) return Boolean;
function contents_Count (Self : in Folder; -- Does not include the "." and ".." folders.
recurse : in Boolean := False) return Natural;
function Parent (Self : in Path'Class) return Folder; -- Returns 'no_Folder' if 'Self' has no parent.
function Relative (Self : in Folder; to : in Folder'Class) return Folder;
-------------------
--- Folder Contexts
--
type folder_Context is limited private;
procedure push_Folder (Context : in out folder_Context;
goto_Folder : in Folder'Class);
--
-- Store the current folder and move to the 'goto_Folder'.
procedure pop_Folder (Context : in out folder_Context);
--
-- Return to the previously pushed folder.
-- Raises 'Error' if no previous folder has been pushed.
procedure pop_All (Context : in out folder_Context);
--
-- Return to the initial current folder.
-- Raises 'Error' if no previous folder has been pushed.
---------
--- Files
--
type File is new Path with private;
type File_Extension is new String;
function to_File (Name : in String) return File;
function "+" (Name : in String) return File renames to_File;
function "+" (Left : in Folder'Class;
Right : in File 'Class) return File;
function "+" (Left : in File'Class;
Right : in File_Extension) return File;
function Extension (Self : in File) return File_Extension;
procedure save (Self : in File; Text : in String;
Binary : in Boolean := False);
procedure save (Self : in File; Data : in environ.Data);
function load (Self : in File) return String; -- Raises 'Error' if the file does not exist.
function load (Self : in File) return Data; -- Raises 'Error' if the file does not exist.
procedure copy_File (Self : in File; To : in File);
procedure copy_Files (Named : in String; To : in Folder);
--
-- 'Named' can contain an asterix GLOB such as "*" or "*.txt".
procedure move_File (Self : in File; To : in File);
procedure move_Files (Named : in String; To : in Folder);
--
-- 'Named' can contain an asterix GLOB such as "*" or "*.txt".
procedure rid_File (Self : in File);
procedure rid_Files (Named : in String);
--
-- 'Named' can contain an asterix GLOB such as "*" or "*.txt".
procedure append (Self : in File; Text : in String);
procedure append_File (Self : in File; To : in File);
procedure touch (Self : in File);
function Relative (Self : in File; To : in Folder'Class) return File;
function rid_Extension (Self : in File) return File;
--- Compression
--
type compress_Format is (Tar, Tar_Bz2, Tar_Gz, Tar_Xz, Bz2, Gz, Xz);
subtype folder_compress_Format is compress_Format range Tar .. Tar_Xz;
type compress_Level is range 1 .. 9; -- Higher levels result in greater compression.
procedure compress (the_Path : in Path'Class;
the_Format : in compress_Format := Tar_Xz;
the_Level : in compress_Level := 6);
procedure decompress (Name : in File);
function format_Suffix (Format : in compress_Format) return String;
private
use ada.Strings.unbounded;
type Path is abstract tagged
record
Name : unbounded_String;
end record;
type Folder is new Path with null record;
type File is new Path with null record;
no_Folder : constant Folder := (Name => null_unbounded_String);
--- Folder Contexts
--
use ada.Containers;
package Folder_Vectors is new indefinite_Vectors (Positive, Folder);
subtype Folder_Vector is Folder_Vectors.Vector;
type folder_Context is limited
record
folder_Stack : Folder_Vector;
end record;
end lace.Environ.Paths;
|
BrickBot/Bound-T-H8-300 | Ada | 43,388 | adb | -- Arithmetic.Algebra (body)
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.17 $
-- $Date: 2015/10/24 20:05:44 $
--
-- $Log: arithmetic-algebra.adb,v $
-- Revision 1.17 2015/10/24 20:05:44 niklas
-- Moved to free licence.
--
-- Revision 1.16 2010-01-02 20:28:07 niklas
-- BT-CH-0211: Corrected operations on Bounded_Sum_T.
--
-- Revision 1.15 2010-01-01 12:36:23 niklas
-- BT-CH-0209: Add_Combined_Terms uses correct widths internally.
--
-- Revision 1.14 2009-11-27 11:28:06 niklas
-- BT-CH-0184: Bit-widths, Word_T, failed modular analysis.
--
-- Revision 1.13 2009/04/16 16:29:23 niklas
-- BT-CH-0171: Stack pointers in call effects.
--
-- Revision 1.12 2009/03/04 13:05:07 niklas
-- Corrected Find_Difference (Cell, Expr, ..) to consider the trivial
-- case where the expression is just the cell itself (zero difference).
--
-- Revision 1.11 2008/06/18 20:52:54 niklas
-- BT-CH-0130: Data pointers relative to initial-value cells.
--
-- Revision 1.10 2007/10/12 18:19:25 niklas
-- Added function Plus_Difference, for cleaner updates of coupled
-- cells such as stack-height cells. Added procedure Add_Coupled_Update
-- for such purposes (where Update_Couple does not fit in). Modified
-- Update_Couple to use Add_Coupled_Update. Note that this now uses
-- Plus_Difference instead of Difference.
--
-- Revision 1.9 2007/07/26 11:08:52 niklas
-- BT-CH-0066. Fracture assignments.
--
-- Revision 1.8 2007/07/21 18:18:39 niklas
-- BT-CH-0064. Support for AVR/IAR switch-handler analysis.
--
-- Revision 1.7 2007/05/02 09:30:34 niklas
-- Added procedure Find_Difference.
--
-- Revision 1.6 2007/03/09 13:52:22 niklas
-- Added function Difference and procedure Update_Couple to help with
-- coupled cells such as a stack pointer and the local stack height.
--
-- Revision 1.5 2006/10/24 08:44:29 niklas
-- BT-CH-0028.
--
-- Revision 1.4 2006/08/22 12:42:06 niklas
-- Added functions Same_Offset and Opposite_Offset.
--
-- Revision 1.3 2006/02/27 09:53:00 niklas
-- Added the function Combine_Terms to simplify a given expression
-- by combining similar terms (constant terms and variable terms)
-- both on the top level and in subexpressions.
-- To support Combine_Terms, extended Bounded_Sum_T to detect if
-- the sum contains combined terms or Unknown terms.
-- Changed To_Expr (Bounded_Sum_T) to return Unknown if the
-- sum has an Unknown term.
--
-- Revision 1.2 2005/03/24 18:19:17 niklas
-- Added simplification of affine expressions by combining terms
-- with the same variable (Cell or Ref). This is implemented by the
-- types Bounded_Sum_T, Term_T, Terms_T and the related operations.
--
-- Revision 1.1 2004/04/25 16:54:25 niklas
-- First version.
--
with Arithmetic.Algebra.Opt;
with Output;
package body Arithmetic.Algebra is
use type Value_T, Word_T;
--
--- Checking for additions and subtractions of constants (offsets)
--
function Plus_Or_Minus (Expr : Expr_Ref) return Boolean
--
-- Whether the Expr is a binary "+" or a binary "-"-
--
is
begin
return Expr.Kind = Binary_Kind
and then (Expr.Binary = Plus
or Expr.Binary = Minus);
end Plus_Or_Minus;
function Constant_Offset (
From : Cell_T;
To : Expr_Ref)
return Expr_Ref
is
begin
if not Plus_Or_Minus (To) then
-- Not of the form X +- Y.
return Unknown;
elsif To.L_Expr = From and To.R_Expr.Kind = Const then
-- From +- Const
if To.Binary = Plus then
-- From + Const.
return To.R_Expr;
else
-- From - Const.
-- The offset is -Const.
return Const (
Value => - Signed_Value (To.R_Expr),
Width => To.R_Expr.Width,
Signed => True);
end if;
elsif Is_Constant (To.L_Expr) and To.R_Expr = From
and Op_Is (Plus, To)
then
-- Const + From
return To.L_Expr;
else
-- The form of To is not recognized as From + Offset.
return Unknown;
end if;
end Constant_Offset;
function Same_Offset (
From : Storage.Cell_T;
To : Expr_Ref;
Base : Expr_Ref)
return Expr_Ref
is
begin
if not Plus_Or_Minus (To) then
-- Not of the form X +- Y.
return Unknown;
elsif To.L_Expr = From then
-- From +- Offset
if To.Binary = Plus then
-- From + Offset.
return Base + To.R_Expr;
else
-- From - Offset.
return Base - To.R_Expr;
end if;
elsif To.R_Expr = From
and Op_Is (Plus, To)
then
-- Offset + From
return To.L_Expr + Base;
else
-- The form of To is not recognized as From + Offset.
return Unknown;
end if;
end Same_Offset;
function Opposite_Offset (
From : Storage.Cell_T;
To : Expr_Ref;
Base : Expr_Ref)
return Expr_Ref
is
begin
if not Plus_Or_Minus (To) then
-- Not of the form X +- Y.
return Unknown;
elsif To.L_Expr = From then
-- From +- Offset
if To.Binary = Plus then
-- From + Offset.
return Base - To.R_Expr;
else
-- From - Offset.
return Base + To.R_Expr;
end if;
elsif To.R_Expr = From
and Op_Is (Plus, To)
then
-- Offset + From
return Base - To.L_Expr;
else
-- The form of To is not recognized as From + Offset.
return Unknown;
end if;
end Opposite_Offset;
procedure Split_Affine (
Expr : in Expr_Ref;
Addend : out Value_T;
Multiplier : out Value_T;
Multiplicand : out Expr_Ref)
is
Residue : Expr_Ref := Expr;
-- Progressively deconstructed Expr.
begin
-- Pessimistic initial values:
Addend := 0;
Multiplier := 1;
-- Is the whole expression constant?
if Residue.Kind = Const then
-- Const.
Addend := Signed_Value (Expr);
Multiplier := 0;
Residue := Zero (Expr.Width);
end if;
-- Is there a constant addend?
if Plus_Or_Minus (Residue) then
-- <something> +- <something>
if Residue.L_Expr.Kind = Const then
-- Const +- <more>
Addend := Signed_Value (Residue.L_Expr);
if Residue.Binary = Minus then
-- Invert the sign of the multiplier for the R_Expr.
Multiplier := -Multiplier;
end if;
Residue := Residue.R_Expr;
elsif Residue.R_Expr.Kind = Const then
-- <more> +- Const
Addend := Signed_Value (Residue.R_Expr);
if Residue.Binary = Minus then
-- The addend is a subtrahend.
Addend := -Addend;
end if;
Residue := Residue.L_Expr;
end if;
end if;
-- Is there a constant multiplier?
if Op_Is (Muls, Residue) then
-- <something> * <something>
if Residue.L_Expr.Kind = Const then
-- Const * <more>
Multiplier := Multiplier * Signed_Value (Residue.L_Expr);
Residue := Residue.R_Expr;
elsif Residue.R_Expr.Kind = Const then
-- <more> * Const
Multiplier := Multiplier * Signed_Value (Residue.R_Expr);
Residue := Residue.L_Expr;
end if;
elsif Can_Shift_By_Mul (Residue) then
-- <Left> slz <Right> = 2**Right * Left
Multiplier := Multiplier * (2 ** Natural (Residue.R_Expr.Value));
Residue := Residue.L_Expr;
end if;
-- Whatever is left:
Multiplicand := Residue;
end Split_Affine;
--
--- Simplification of sums of terms
--
function "*" (Factor : Value_T; Variable : Expr_Ref) return Term_T
is
begin
return (Variable => Variable, Factor => Factor);
end "*";
function Image (Item : Term_T) return String
is
begin
return '[' & Image (Item.Factor) & '*' & Image (Item.Variable) & ']';
end Image;
function Image (Item : Terms_T) return String
is
begin
if Item'Length = 0 then
return "none";
elsif Item'Length = 1 then
return Image (Item(Item'First));
else
return Image (Item(Item'First))
& " + "
& Image (Item(Item'First + 1 .. Item'Last));
end if;
end Image;
function Image (Item : Bounded_Sum_T) return String
--
-- For human consumption.
--
is
begin
return
"Bounded_Sum,"
& Width_T'Image (Item.Width)
& " bits, max"
& Natural'Image (Item.Max_Terms)
& " terms, opaque "
& Boolean'Image (Item.Opaque)
& ", has const "
& Boolean'Image (Item.Has_Const)
& ", combined "
& Boolean'Image (Item.Combined)
& ", const "
& Image (Item.Const)
& ", terms "
& Image (Item.Terms(1 .. Item.Length));
end Image;
function Not_Null (Sum : Bounded_Sum_T) return Boolean
is
begin
return Sum.Opaque
or Sum.Has_Const
or Sum.Length > 0;
end Not_Null;
function Is_Opaque (Sum : Bounded_Sum_T) return Boolean
is
begin
return Sum.Opaque;
end Is_Opaque;
function Is_Combined (Within : Bounded_Sum_T) return Boolean
is
begin
return Within.Combined;
end Is_Combined;
function Is_Const (Sum : Bounded_Sum_T) return Boolean
is
Const : Boolean := not Sum.Opaque;
-- The result, initially only showing that an opaque
-- value is not constant.
begin
for T in 1 .. Sum.Length loop
exit when not Const;
-- No need to look further.
Const := Const and Sum.Terms(T).Factor = 0;
end loop;
return Const;
end Is_Const;
function Value (Sum : Bounded_Sum_T) return Word_T
is
begin
return Sum.Const;
end Value;
function Signed_Value (Sum : Bounded_Sum_T) return Value_T
is
begin
return Signed_Value (Sum.Const, Sum.Width);
end Signed_Value;
procedure Add_Opaque_Term (To : in out Bounded_Sum_T)
is
begin
if Not_Null (To) then
-- There are already some terms in the sum.
-- Adding an opaque term is considered to "combine" terms.
To.Combined := True;
end if;
To.Opaque := True;
end Add_Opaque_Term;
procedure Add (
Const : in Word_T;
To : in out Bounded_Sum_T)
is
begin
To.Const := (To.Const + Const) and Max_Word (To.Width);
if To.Has_Const or To.Opaque then
-- The sum already has a constant term or an opaque term.
To.Combined := True;
else
To.Has_Const := True;
end if;
end Add;
procedure Add (
Factor : in Value_T;
Const : in Word_T;
To : in out Bounded_Sum_T)
--
-- Adds Factor * Const To the sum.
--
is
Abs_Add : constant Word_T :=
Unsigned_Word (abs Factor, To.Width) * Const;
-- The absolute value of the addend.
begin
if Factor > 0 then
Add (
Const => Abs_Add,
To => To);
else
-- Factor < 0.
Add (
Const => Opposite_Sign (Abs_Add, To.Width),
To => To);
end if;
end Add;
function Same (X, Y : Variable_T) return Boolean
--
-- Whether the two variables X, Y and "identical" in the sense
-- defined for combining two Terms (see the description of the
-- operation Add (Term_T, Bounded_Sum_T)).
--
is
begin
return X = Y or else X.all = Y.all;
--
-- The first condition (X = Y) checks for reference equality.
-- The second condition (X.all = Y.all) covers the case of
-- Cells and Refs, but may also show that other expressions are
-- the same, for example two expressions that are computed by
-- the same operator from the same (reference-equal) operands.
end Same;
procedure Add (
Term : in Term_T;
To : in out Bounded_Sum_T)
is
Combined : Boolean := False;
-- Whether the Term was combined with an existing term.
begin
if Term.Variable.Kind = Opaque then
-- Adding an opaque term.
Add_Opaque_Term (To => To);
elsif To.Opaque then
-- Adding any term to an opaque sum is considered
-- to "combine terms".
To.Combined := True;
else
-- Adding a non-opaque term to a non-opaque sum.
-- Try to combine with an existing term:
for T in 1 .. To.Length loop
if Same (Term.Variable, To.Terms(T).Variable) then
Combined := True;
To.Terms(T).Factor := To.Terms(T).Factor + Term.Factor;
exit;
end if;
end loop;
if Combined then
-- The Term was combined with an existing similar Term.
To.Combined := True;
elsif To.Length < To.Max_Terms then
-- The Term has a new Variable for this sum, and
-- the sum has room for this new Term.
To.Length := To.Length + 1;
To.Terms(To.Length) := Term;
else
-- The Term has a new Variable for this sum, but
-- the sum does not have room for this new Term.
Output.Fault (
Location => "Arithmetic.Algebra.Add",
Text =>
"No room to add "
& Image (Term)
& " to "
& Image (To));
raise Too_Many_Terms;
end if;
end if;
end Add;
procedure Add (
Terms : in Terms_T;
To : in out Bounded_Sum_T)
is
begin
for T in Terms'Range loop
Add (Term => Terms(T), To => To);
end loop;
end Add;
procedure Add (
Sum : in Bounded_Sum_T;
To : in out Bounded_Sum_T)
is
begin
if Sum.Opaque or To.Opaque then
-- The result is opaque.
if (To.Opaque and Not_Null (Sum))
or (Sum.Opaque and Not_Null (To ))
then
-- Adding something to an opaque sum is
-- considered to "combine terms".
To.Combined := True;
end if;
To.Opaque := True;
else
-- Adding two non-opaque sums.
if Sum.Has_Const then
Add (
Const => Sum.Const,
To => To);
end if;
for T in 1 .. Sum.Length loop
Add (
Term => Sum.Terms(T),
To => To);
end loop;
if Sum.Combined then
To.Combined := True;
end if;
end if;
end Add;
procedure Add (
Factor : in Value_T;
Expr : in Expr_Ref;
Term : in Expr_Ref;
To : in out Bounded_Sum_T;
Rest : in out Expr_Ref)
is
R_Factor : Value_T;
-- The factor for the right sub-expression of Plus or Minus.
procedure All_To_Rest
--
-- Adds Factor * Expr to Rest, because nothing could be
-- added To the sum.
--
is
begin
if Term /= null then
-- We already have Term = Factor * Expr.
Accumulate (
Factor => 1,
Expr => Term,
Sum => Rest);
else
-- We may have to compute Factor * Expr.
Accumulate (
Factor => Factor,
Expr => Expr,
Sum => Rest);
end if;
end All_To_Rest;
begin -- Add
if Factor = 0 then
-- Nothing to add. To and Rest are unchanged.
null;
else
case Expr.Kind is
when Opaque =>
Rest := Unknown;
-- This is the same as Rest + Factor * Expr.
when Const =>
Add (Factor => Factor, Const => Expr.Value, To => To);
when Cell | Ref =>
Add (Term => Factor * Expr, To => To);
when Unary_Kind =>
case Expr.Unary is
when Notx | EqZero | EqOne | Signw =>
Output.Fault (
Location => "Arithmetic.Algebra.Add",
Text =>
"Expression contains Boolean operator"
& Output.Field_Separator
& Image (Expr));
when Notw | Exts | Extz | Trunl | Trunh =>
All_To_Rest;
end case;
when Binary_Kind =>
case Expr.Binary is
when Mulu | Muls =>
if Expr.L_Expr.Kind = Const then
Add (
Factor => Signed_Value (Expr.L_Expr) * Factor,
Expr => Expr.R_Expr,
Term => Expr,
To => To,
Rest => Rest);
elsif Expr.R_Expr.Kind = Const then
Add (
Factor => Signed_Value (Expr.R_Expr) * Factor,
Expr => Expr.L_Expr,
Term => Expr,
To => To,
Rest => Rest);
else
-- Here we could improve the implementation by algebraically
-- expanding the product of the left and right terms. TBA.
All_To_Rest;
end if;
when Slz =>
if Can_Shift_By_Mul (Expr) then
-- The Expr is equivalent to 2**R_Expr * L_Expr.
Add (
Factor => (2 ** Natural (Expr.R_Expr.Value)) * Factor,
Expr => Expr.L_Expr,
Term => Expr,
To => To,
Rest => Rest);
else
All_To_Rest;
end if;
when Conc =>
if Can_Shift_By_Mul (Word_T (Width_Of (Expr.R_Expr))) then
-- The Expr is equivalent to W * L_Expr + R_Expr,
-- where W is 2**Width_Of (R_Expr).
Add (
Factor => (2 ** Natural (Width_Of (Expr.R_Expr))) * Factor,
Expr => Extz (Expr.L_Expr, Expr.Width),
Term => null,
To => To,
Rest => Rest);
Add (
Factor => Factor,
Expr => Extz (Expr.R_Expr, Expr.Width),
Term => null,
To => To,
Rest => Rest);
else
All_To_Rest;
end if;
when Plus | Minus =>
if Expr.Binary = Plus then R_Factor := Factor;
else R_Factor := - Factor;
end if;
Add (
Factor => Factor,
Expr => Expr.L_Expr,
Term => null,
To => To,
Rest => Rest);
Add (
Factor => R_Factor,
Expr => Expr.R_Expr,
Term => null,
To => To,
Rest => Rest);
when Binary_Boolean_Op_T =>
Output.Fault (
Location => "Arithmetic.Algebra.Add",
Text =>
"Expression contains Boolean operator"
& Output.Field_Separator
& Image (Expr));
when Andw | Orw | Xorw | Srz | Sra | Rotl | Rotr =>
-- Cannot (in general) add anything To the sum.
-- TBD TBC Sra as division of Factor by 2**N, if no remainder.
All_To_Rest;
end case;
when Ternary_Kind =>
case Expr.Ternary is
when Plus =>
-- Left + Right:
Add (
Factor => Factor,
Expr => Expr.L3_Expr,
Term => null,
To => To,
Rest => Rest);
Add (
Factor => Factor,
Expr => Expr.R3_Expr,
Term => null,
To => To,
Rest => Rest);
-- ... + Carry:
Add (
Factor => Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
Term => null,
To => To,
Rest => Rest);
when Minus_With_B =>
-- Left - Right:
Add (
Factor => Factor,
Expr => Expr.L3_Expr,
Term => null,
To => To,
Rest => Rest);
Add (
Factor => - Factor,
Expr => Expr.R3_Expr,
Term => null,
To => To,
Rest => Rest);
-- ... - Borrow:
Add (
Factor => - Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
Term => null,
To => To,
Rest => Rest);
when Minus_With_C =>
-- Left - Right:
Add (
Factor => Factor,
Expr => Expr.L3_Expr,
Term => null,
To => To,
Rest => Rest);
Add (
Factor => - Factor,
Expr => Expr.R3_Expr,
Term => null,
To => To,
Rest => Rest);
-- ... + Carry - 1:
Add (
Factor => Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
Term => null,
To => To,
Rest => Rest);
Add (Factor => - Factor, Const => 1, To => To);
when Ternary_Boolean_Op_T =>
Output.Fault (
Location => "Arithmetic.Algebra.Add",
Text =>
"Expression contains Boolean operator"
& Output.Field_Separator
& Image (Expr));
end case;
end case;
end if;
end Add;
function To_Expr (Sum : Bounded_Sum_T) return Expr_Ref
is
Result : Expr_Ref;
-- The cumulated result.
begin -- To_Expr
if Sum.Opaque then
-- The result is opaque.
Result := Unknown;
else
-- No opaque terms.
Result := Zero (Sum.Width);
-- Add the variable terms:
for T in 1 .. Sum.Length loop
Accumulate (
Factor => Sum.Terms(T).Factor,
Expr => Sum.Terms(T).Variable,
Sum => Result);
end loop;
-- Add the constant term:
if Sum.Const /= 0 then
-- Some constant term to add.
Accumulate (
Factor => Sign (Sum.Const, Sum.Width),
Expr => Const (
Value => Abs_Value (Sum.Const, Sum.Width),
Width => Sum.Width,
Signed => False),
Sum => Result);
end if;
end if;
return Result;
end To_Expr;
function Length (Terms : Terms_T) return Natural
--
-- The total length of the term expressions.
--
is
Total : Natural := 0;
-- The total length.
begin
for T in Terms'Range loop
Total := Total + Length (Terms(T).Variable);
end loop;
return Total;
end Length;
function To_Expr (
Terms : Terms_T;
Const : Word_T := 0;
Width : Width_T)
return Expr_Ref
is
Sum : Bounded_Sum_T (Width => Width, Max_Terms => Length (Terms));
-- A working sum.
Rest : Expr_Ref := Zero (Width);
-- The total remainder of the added Terms.
Result : Expr_Ref;
-- The result, Sum + Rest.
begin
Add (Const => Const, To => Sum);
for T in Terms'Range loop
Add (
Factor => Terms(T).Factor,
Expr => Terms(T).Variable,
Term => null,
To => Sum,
Rest => Rest);
end loop;
Result := To_Expr (Sum);
if Rest /= Value_T'(0) then
-- Something could not be put in the Sum.
Result := Result + Rest;
end if;
return Result;
exception
when X : Too_Many_Terms =>
Output.Exception_Info (
Text =>
"Arithmetic.Algebra.To_Expr (Terms)"
& Output.Field_Separator
& Image (Terms),
Occurrence => X);
raise;
end To_Expr;
function Possibly_Combined_Terms (
Expr : Expr_Ref;
Sum : Bounded_Sum_T)
return Expr_Ref
--
-- Given an Expression and the Sum that represents an attempt
-- to combine terms in the Expression, returns either the
-- simplified expression from Sum, if some terms could be
-- combined, or otherwise the original Expression.
--
is
begin
if Is_Combined (Sum) then
-- Some terms could be combined when the Sum was
-- added up, so Sum should be simpler than Expr.
return To_Expr (Sum);
else
-- No terms could be combined, Expr is a simple as
-- we can make it.
return Expr;
end if;
end Possibly_Combined_Terms;
procedure Add_Combined_Terms (
Factor : in Value_T;
Expr : in Expr_Ref;
To : in out Bounded_Sum_T)
--
-- Simplifies the expression V = To + Factor * Expr by combining
-- similar terms in the subpexpressions of Expr, and then adding
-- the result, times Factor, To the given sum, again combining
-- similar terms. On return, To = V.
--
is
Multiply : constant Boolean := Op_Is (Mulu, Expr) or Op_Is (Muls, Expr);
-- The top operator is multiplication.
R_Factor : Value_T;
-- The factor for the right sub-expression of Plus or Minus.
begin
case Expr.Kind is
when Opaque =>
Add_Opaque_Term (To => To);
when Const =>
Add (Factor => Factor, Const => Expr.Value, To => To);
when Cell | Ref =>
Add (Term => Factor * Expr, To => To);
when Unary_Kind =>
-- Simplify the operand and apply the unary operator.
declare
Sum : Bounded_Sum_T (Expr.Expr.Width, To.Max_Terms);
-- The sum generated from the operand.
Sub_Expr : Expr_Ref;
-- The possibly simplified operand.
begin
-- Simplify the operand:
Add_Combined_Terms (
Factor => 1,
Expr => Expr.Expr,
To => Sum);
Sub_Expr := Possibly_Combined_Terms (
Expr => Expr.Expr,
Sum => Sum);
if Is_Opaque (Sum) then
-- An opaque result.
Add_Opaque_Term (To => To);
elsif Sub_Expr = Expr.Expr then
-- No simplification.
Add (Term => Factor * Expr, To => To);
else
-- The operand was simplified. Add a term
-- that applies the same unary operation to
-- the simplified operand.
Add (
Term => Factor * Unary (
Operation => Expr.Unary,
Operand => Sub_Expr,
Width => Expr.Width),
To => To);
end if;
end;
when Binary_Kind =>
case Expr.Binary is
when Plus | Minus =>
-- We can continue to add both subexpressions To
-- the same sum, but may only have to change the
-- sign of the right subexpression.
if Expr.Binary = Plus then R_Factor := Factor;
else R_Factor := - Factor;
end if;
Add_Combined_Terms (
Factor => Factor,
Expr => Expr.L_Expr,
To => To);
Add_Combined_Terms (
Factor => R_Factor,
Expr => Expr.R_Expr,
To => To);
when others =>
-- Binary operator other than Plus or Minus.
-- Simplify the operands, then (for Mulu and Muls) see
-- if one factor is constant and try to combine the expanded
-- product into To.
declare
L_Sum : Bounded_Sum_T (Expr.L_Expr.Width, To.Max_Terms);
R_Sum : Bounded_Sum_T (Expr.R_Expr.Width, To.Max_Terms);
-- The sums generated from the operands.
L_Expr : Expr_Ref;
R_Expr : Expr_Ref;
-- The possibly simplified operands.
Simple : Expr_Ref;
-- The possibly simplified Expr.
begin
-- Simplify the operands:
Add_Combined_Terms (
Factor => 1,
Expr => Expr.L_Expr,
To => L_Sum);
Add_Combined_Terms (
Factor => 1,
Expr => Expr.R_Expr,
To => R_Sum);
if Is_Opaque (L_Sum) or Is_Opaque (R_Sum) then
-- An opaque result.
Add_Opaque_Term (To => To);
elsif Multiply and Is_Const (L_Sum) then
-- A constant times a subexpression, so we can
-- continue to build the same sum.
Add_Combined_Terms (
Factor => Factor * Signed_Value (L_Sum),
Expr => Possibly_Combined_Terms (
Expr => Expr.R_Expr,
Sum => R_Sum),
To => To);
elsif Multiply and Is_Const (R_Sum) then
-- A subexpression times a constant, so we can
-- continue to build the same sum.
Add_Combined_Terms (
Factor => Factor * Signed_Value (R_Sum),
Expr => Possibly_Combined_Terms (
Expr => Expr.L_Expr,
Sum => L_Sum),
To => To);
else
-- The Expr will be one term in To, because we
-- cannot decompose it into smaller terms.
--
-- TBA: Cancel like terms on both sides of a
-- Relation_Kind_T operation.
L_Expr := Possibly_Combined_Terms (
Expr => Expr.L_Expr,
Sum => L_Sum);
R_Expr := Possibly_Combined_Terms (
Expr => Expr.R_Expr,
Sum => R_Sum);
if L_Expr = Expr.L_Expr
and R_Expr = Expr.R_Expr
then
-- No change in the operands, so we keep
-- the same Expr.
Simple := Expr;
else
-- One or both operands were simplified, so we
-- make a new Simple expression with the same
-- operation as in Expr but with the simpler
-- operands.
Simple := Binary (
Operation => Expr.Binary,
Left => L_Expr,
Right => R_Expr,
Width => Expr.Width);
end if;
Add (Term => Factor * Simple, To => To);
end if;
end;
end case;
when Ternary_Kind =>
case Expr.Ternary is
when Plus =>
-- Left + Right + Carry:
Add_Combined_Terms (
Factor => Factor,
Expr => Expr.L3_Expr,
To => To);
Add_Combined_Terms (
Factor => Factor,
Expr => Expr.R3_Expr,
To => To);
Add_Combined_Terms (
Factor => Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
To => To);
when Minus_With_B =>
-- Left - Right - Borrow:
Add_Combined_Terms (
Factor => Factor,
Expr => Expr.L3_Expr,
To => To);
Add_Combined_Terms (
Factor => - Factor,
Expr => Expr.R3_Expr,
To => To);
Add_Combined_Terms (
Factor => - Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
To => To);
when Minus_With_C =>
-- Left - Right + Carry - 1:
Add_Combined_Terms (
Factor => Factor,
Expr => Expr.L3_Expr,
To => To);
Add_Combined_Terms (
Factor => - Factor,
Expr => Expr.R3_Expr,
To => To);
Add_Combined_Terms (
Factor => Factor,
Expr => Extz (Expr.C3_Expr, To.Width),
To => To);
Add (Factor => - Factor, Const => 1, To => To);
when Ternary_Boolean_Op_T =>
-- No simplification is possible.
Add (Term => Factor * Expr, To => To);
end case;
end case;
end Add_Combined_Terms;
function Combine_Terms (Expr : Expr_Ref) return Expr_Ref
is
Sum : Bounded_Sum_T (Width => Expr.Width, Max_Terms => Length (Expr));
-- The Expr as a sum of terms, with similar terms combined.
begin
if Opt.Combine_Terms then
-- Do it.
Add_Combined_Terms (
Factor => 1,
Expr => Expr,
To => Sum);
return Possibly_Combined_Terms (
Expr => Expr,
Sum => Sum);
else
-- Don't do it.
return Expr;
end if;
exception
when X : Too_Many_Terms =>
Output.Exception_Info (
Text =>
"Arithmetic.Algebra.Combine_Terms"
& Output.Field_Separator
& Image (Expr),
Occurrence => X);
raise;
end Combine_Terms;
procedure Find_Difference (
From : in Expr_Ref;
To : in Expr_Ref;
Const : out Boolean;
Diff : out Value_T)
is
Sum : Bounded_Sum_T (
Width => From.Width,
Max_Terms => Length (To) + Length (From));
-- To - From as a sum of terms, with similar terms combined.
-- We implicitly assume From.Width = To.Width.
begin
Add_Combined_Terms (
Factor => 1,
Expr => To,
To => Sum);
Add_Combined_Terms (
Factor => -1,
Expr => From,
To => Sum);
-- Sum is now To - From.
Const := Is_Const (Sum);
if Const then
Diff := Signed_Value (Sum);
else
Diff := 0;
end if;
end Find_Difference;
procedure Find_Difference (
From : in Storage.Cell_T;
To : in Expr_Ref;
Const : out Boolean;
Diff : out Value_T)
is
use type Storage.Cell_T;
begin
Const := True;
-- Optimistic, sadly may be changed below.
if To.Kind = Cell
and then To.Cell = From
then
-- Just From.
Diff := 0;
elsif Op_Is (Plus, To)
and then (To.L_Expr = From
and To.R_Expr.Kind = Arithmetic.Const)
then
-- From + Const.
Diff := Signed_Value (To.R_Expr);
elsif Op_Is (Minus, To)
and then (To.L_Expr = From
and To.R_Expr.Kind = Arithmetic.Const)
then
-- From - Const.
-- The offset is -Const.
Diff := - Signed_Value (To.R_Expr);
elsif Op_Is (Plus, To)
and then (To.L_Expr.Kind = Arithmetic.Const
and To.R_Expr = From)
then
-- Const + From
Diff := Signed_Value (To.L_Expr);
else
-- The form of To is not recognized as From + Offset.
Const := False;
Diff := 0;
end if;
end Find_Difference;
--
--- Updating cells that change by the same or opposite amounts
--
function Difference (
Var : Variable_T;
Expr : Expr_Ref;
Way : Coupling_T)
return Expr_Ref
is
begin
case Way is
when Same =>
return To_Expr (
Terms => ( 1 * Expr, (-1) * Var),
Const => 0,
Width => Expr.Width);
when Opposite =>
return To_Expr (
Terms => ( 1 * Var, (-1) * Expr),
Const => 0,
Width => Expr.Width);
end case;
end Difference;
function Plus_Difference (
Base : Variable_T;
Var : Variable_T;
Expr : Expr_Ref;
Way : Coupling_T)
return Expr_Ref
is
begin
case Way is
when Same =>
return To_Expr (
Terms => ( 1 * Expr, (-1) * Var, 1 * Base),
Const => 0,
Width => Expr.Width);
when Opposite =>
return To_Expr (
Terms => ( 1 * Var, (-1) * Expr, 1 * Base),
Const => 0,
Width => Expr.Width);
end case;
end Plus_Difference;
procedure Add_Coupled_Update (
Absolute : in Assignment_T;
Relative : in Variable_T;
Coupling : in Coupling_T;
To : in out Assignment_Set_T)
is
New_Rel, New_Rel1, New_Rel2 : Expr_Ref;
-- Expressions for the new value of Relative.
Rel_Ass : Assignment_T;
-- The updating assignment to Relative, if one is needed.
begin
case Defining_Kind_T (Absolute.Kind) is
when Regular =>
New_Rel := Plus_Difference (
Base => Relative,
Var => Absolute.Target,
Expr => Absolute.Value,
Way => Coupling);
Rel_Ass := Set (
Target => Relative,
Value => New_Rel);
when Conditional =>
New_Rel1 := Plus_Difference (
Base => Relative,
Var => Absolute.Target,
Expr => Absolute.Value1,
Way => Coupling);
New_Rel2 := Plus_Difference (
Base => Relative,
Var => Absolute.Target,
Expr => Absolute.Value2,
Way => Coupling);
Rel_Ass := Set (
Target => Relative,
Cond => Absolute.Cond,
Value1 => New_Rel1,
Value2 => New_Rel2);
when Fracture =>
Rel_Ass := Fracture (Target => Relative);
end case;
Add (To => To, More => Rel_Ass);
end Add_Coupled_Update;
procedure Update_Couple (
Absolute : in Variable_T;
Relative : in Variable_T;
Coupling : in Coupling_T;
Within : in out Assignment_Set_T)
is
Abs_Ass_Index: Natural;
-- The index of the assignment to Absolute, if any, else zero.
begin
-- Find the assignment to Absolute if any:
Find (
Target => Absolute.Cell,
Within => Within,
Index => Abs_Ass_Index);
-- Add assignment to Relative if needed:
if Abs_Ass_Index > 0 then
-- The effect has a defining assignment to Absolute.
Add_Coupled_Update (
Absolute => Element (Within, Abs_Ass_Index),
Relative => Relative,
Coupling => Coupling,
To => Within);
end if;
end Update_Couple;
--
--- Finding updates of variables in effects
--
procedure Find_Update (
Target : in Storage.Cell_T;
Within : in Assignment_Set_T;
Found : out Boolean;
Op : out Binary_Op_T;
Other : out Expr_Ref)
is
use type Storage.Cell_T;
Asg : Assignment_T;
-- One of the assignments Within the effect.
begin
for W in 1 .. Length (Within) loop
Asg := Element (Within, W);
if (Asg.Kind = Regular
and Asg.Target.Kind = Cell)
and then (Asg.Target.Cell = Target
and Asg.Value.Kind = Binary_Kind)
and then Asg.Value.L_Expr.Kind = Cell
and then Asg.Value.L_Expr.Cell = Target
then
-- Match.
Found := True;
Op := Asg.Value.Binary;
Other := Asg.Value.R_Expr;
return;
end if;
end loop;
-- No match.
Found := False;
Op := Binary_Op_T'First;
Other := Unknown;
end Find_Update;
end Arithmetic.Algebra;
|
persan/a-cups | Ada | 2,396 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
with Interfaces.C.Strings;
private package CUPS.xlocale_h is
-- Definition of locale datatype.
-- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <[email protected]>, 1997.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>.
-- Structure for reentrant locale using functions. This is an
-- (almost) opaque type for the user level programs. The file and
-- this data structure is not standardized. Don't rely on it. It can
-- go away without warning.
-- Note: LC_ALL is not a valid index into this array.
-- 13 = __LC_LAST.
type uu_locale_struct_uu_locales_array is array (0 .. 12) of System.Address;
type uu_locale_struct_uu_names_array is array (0 .. 12) of Interfaces.C.Strings.chars_ptr;
type uu_locale_struct is record
uu_locales : uu_locale_struct_uu_locales_array; -- xlocale.h:30
uu_ctype_b : access unsigned_short; -- xlocale.h:33
uu_ctype_tolower : access int; -- xlocale.h:34
uu_ctype_toupper : access int; -- xlocale.h:35
uu_names : uu_locale_struct_uu_names_array; -- xlocale.h:38
end record;
pragma Convention (C_Pass_By_Copy, uu_locale_struct); -- xlocale.h:27
-- skipped empty struct uu_locale_data
-- To increase the speed of this solution we add some special members.
-- Note: LC_ALL is not a valid index into this array.
type uu_locale_t is access all uu_locale_struct; -- xlocale.h:39
-- POSIX 2008 makes locale_t official.
subtype locale_t is uu_locale_t; -- xlocale.h:42
end CUPS.xlocale_h;
|
reznikmm/matreshka | Ada | 3,589 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This package provides component to resolve names.
------------------------------------------------------------------------------
package Matreshka.XML_Schema.Name_Resolvers is
pragma Preelaborate;
end Matreshka.XML_Schema.Name_Resolvers;
|
charlie5/lace | Ada | 1,438 | ads | package openGL.Impostor.terrain
--
-- Handles impostoring of terrain 'visuals', which has greater image precision needs, to help avoid border cracks.
--
is
type Item is new Impostor.item with private;
type View is access all Item'Class;
overriding
procedure set_Target (Self : in out Item; Target : in openGL.Visual.view);
overriding
function current_Camera_look_at_Rotation
(Self : in Item) return Matrix_3x3;
overriding
function update_Required (Self : access Item; the_Camera : access Camera.item'Class) return Boolean;
overriding
procedure update (Self : in out Item; the_Camera : access Camera.item'Class;
texture_Pool : in Texture.Pool_view);
overriding
procedure pre_update (Self : in out Item; the_Camera : access Camera.item'Class);
overriding
procedure post_update (Self : in out Item; the_Camera : access Camera.item'Class);
procedure free (Self : in out View);
private
type Item is new Impostor.item with
record
current_Complete : Boolean;
prior_copy_Width : gl.glSizeI := 0;
prior_copy_Height : gl.glSizeI := 0;
prior_Complete : Boolean := False;
current_Camera_look_at_Rotation : Matrix_3x3 := Identity_3x3;
end record;
end openGL.Impostor.terrain;
|
reznikmm/matreshka | Ada | 3,659 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Office_Chart_Elements is
pragma Preelaborate;
type ODF_Office_Chart is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Office_Chart_Access is
access all ODF_Office_Chart'Class
with Storage_Size => 0;
end ODF.DOM.Office_Chart_Elements;
|
reznikmm/matreshka | Ada | 3,981 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Office_Value_Attributes;
package Matreshka.ODF_Office.Value_Attributes is
type Office_Value_Attribute_Node is
new Matreshka.ODF_Office.Abstract_Office_Attribute_Node
and ODF.DOM.Office_Value_Attributes.ODF_Office_Value_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Office_Value_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Office_Value_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Office.Value_Attributes;
|
Rodeo-McCabe/orka | Ada | 1,010 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.Loggers.Terminal is
function Logger return Logger_Ptr;
-- Return a logger that logs messages to the terminal
function Create_Logger (Level : Severity := Debug) return Logger_Ptr;
-- Create and return a logger that only logs messages to the terminal
-- with the minimum specified severity
end Orka.Loggers.Terminal;
|
druzzt/NIEZAWODNE_SYSTEMY_INFORMATYCZNE | Ada | 4,040 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Railway; use Railway;
procedure Main is
OK : Boolean;
-- change TRYB to check for different possibilities of crash situation:
-- TRYB = 0 => From Left to Right - no crash.
-- TRYB = 1 => From Right to Left - no crash.
-- TRYB = 2 => Simulated crash in the middle, RightTrain waits on middle for LeftTrain.
-- TRYB = 3 => Train starts from Left, moves to the Middle, then back to Left,
-- and then to the Middle, next to the Right, back to the Middle,
-- and then again to the Right and at last Leaves at the right side the segments.
TRYB : Integer := 3;
begin
if TRYB = 0 then
--Od lewej do prawej
Put_Line("Normal -> Left -> Middle -> Right:");
Open_Route ( Route_Enter_Left, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Enter_Left, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Middle_Right, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Middle_Right, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Leave_Right, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Leave_Right, OK ); Put_Line(Boolean'Image(OK));
elsif TRYB = 1 then
-- A teraz w druga strone
Put_Line("Normal -> Right -> Middle -> Left:");
Open_Route ( Route_Enter_Right, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Enter_Right, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Right_Middle, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Right_Middle, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Middle_Left, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Middle_Left, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Leave_Left, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Leave_Left, OK ); Put_Line(Boolean'Image(OK));
elsif TRYB = 2 then
-- A teraz wymuszone zderzenie
Put_Line("Simulated crash -> Right -> Middle");
Put_Line("----------with-- -> Left -> Middle:");
Open_Route ( Route_Enter_Right, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Enter_Right, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Enter_Left, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Enter_Left, OK ); Put_Line(Boolean'Image(OK));
Open_Route ( Route_Right_Middle, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Right_Middle, OK ); Put_Line(Boolean'Image(OK));
Put_Line("RightTrain is now on Middle. LeftTrain aproaching Middle. Has trains crashed?");
Open_Route ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
Move_Train ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
if OK=True then Put_Line("CRASH!");
else Put_Line("TRAFFIC STOPPED, possibility of crash");
end if;
elsif TRYB = 3 then
-- teraz kilka szybkich testow dwójkami
Put_Line("Back and forth:");
Put_Line("-> Left -> Middle");
Train ( Route_Enter_Left, OK ); Put_Line(Boolean'Image(OK));
Train ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
Put_Line(" Left <- Middle ");
Train ( Route_Middle_Left, OK ); Put_Line(Boolean'Image(OK));
Put_Line(" Left -> Middle -> Right");
Train ( Route_Left_Middle, OK ); Put_Line(Boolean'Image(OK));
Train ( Route_Middle_Right, OK ); Put_Line(Boolean'Image(OK));
Put_Line(" Middle <- Right");
Train ( Route_Right_Middle, OK ); Put_Line(Boolean'Image(OK));
Put_Line(" Middle -> Right -> ");
Train ( Route_Middle_Right, OK ); Put_Line(Boolean'Image(OK));
Train ( Route_Leave_Right, OK ); Put_Line(Boolean'Image(OK));
if OK = True then Put_Line("Train exited segments successfuly!");
else Put_Line("Train met some problems");
end if;
elsif TRYB = 4 then
null;
else
Put_Line("Podany tryb jest niepoprawny");
end if;
end Main;
|
reznikmm/matreshka | Ada | 3,759 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Presentation_Class_Names_Attributes is
pragma Preelaborate;
type ODF_Presentation_Class_Names_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Presentation_Class_Names_Attribute_Access is
access all ODF_Presentation_Class_Names_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Presentation_Class_Names_Attributes;
|
reznikmm/matreshka | Ada | 3,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Index_Name_Attributes is
pragma Preelaborate;
type ODF_Text_Index_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Index_Name_Attribute_Access is
access all ODF_Text_Index_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Index_Name_Attributes;
|
stcarrez/ada-awa | Ada | 47,066 | ads | -----------------------------------------------------------------------
-- AWA.Storages.Models -- AWA.Storages.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with ASF.Parts;
with AWA.Users.Models;
with AWA.Workspaces.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package AWA.Storages.Models is
pragma Style_Checks ("-mrIu");
type Storage_Type is (DATABASE, FILE, URL, TMP);
for Storage_Type use (DATABASE => 0, FILE => 1, URL => 2, TMP => 3);
package Storage_Type_Objects is
new Util.Beans.Objects.Enums (Storage_Type);
type Nullable_Storage_Type is record
Is_Null : Boolean := True;
Value : Storage_Type;
end record;
type Storage_Data_Ref is new ADO.Objects.Object_Ref with null record;
type Storage_Folder_Ref is new ADO.Objects.Object_Ref with null record;
type Storage_Ref is new ADO.Objects.Object_Ref with null record;
type Store_Local_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The storage data is created only if the storage type
-- is set to DATABASE. It holds the file content in the blob.
-- --------------------
-- Create an object key for Storage_Data.
function Storage_Data_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Storage_Data from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Storage_Data_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Storage_Data : constant Storage_Data_Ref;
function "=" (Left, Right : Storage_Data_Ref'Class) return Boolean;
-- Set the storage data identifier
procedure Set_Id (Object : in out Storage_Data_Ref;
Value : in ADO.Identifier);
-- Get the storage data identifier
function Get_Id (Object : in Storage_Data_Ref)
return ADO.Identifier;
--
function Get_Version (Object : in Storage_Data_Ref)
return Integer;
-- Set the storage content
procedure Set_Data (Object : in out Storage_Data_Ref;
Value : in ADO.Blob_Ref);
-- Get the storage content
function Get_Data (Object : in Storage_Data_Ref)
return ADO.Blob_Ref;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Storage_Data_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Storage_Data_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
STORAGE_DATA_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Storage_Data_Ref);
-- Copy of the object.
procedure Copy (Object : in Storage_Data_Ref;
Into : in out Storage_Data_Ref);
-- Create an object key for Storage_Folder.
function Storage_Folder_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Storage_Folder from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Storage_Folder_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Storage_Folder : constant Storage_Folder_Ref;
function "=" (Left, Right : Storage_Folder_Ref'Class) return Boolean;
-- Set the storage folder identifier
procedure Set_Id (Object : in out Storage_Folder_Ref;
Value : in ADO.Identifier);
-- Get the storage folder identifier
function Get_Id (Object : in Storage_Folder_Ref)
return ADO.Identifier;
--
function Get_Version (Object : in Storage_Folder_Ref)
return Integer;
-- Set the folder creation date
procedure Set_Create_Date (Object : in out Storage_Folder_Ref;
Value : in Ada.Calendar.Time);
-- Get the folder creation date
function Get_Create_Date (Object : in Storage_Folder_Ref)
return Ada.Calendar.Time;
--
procedure Set_Name (Object : in out Storage_Folder_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Storage_Folder_Ref;
Value : in String);
--
function Get_Name (Object : in Storage_Folder_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Storage_Folder_Ref)
return String;
--
procedure Set_Workspace (Object : in out Storage_Folder_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class);
--
function Get_Workspace (Object : in Storage_Folder_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class;
--
procedure Set_Owner (Object : in out Storage_Folder_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_Owner (Object : in Storage_Folder_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Storage_Folder_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Storage_Folder_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
STORAGE_FOLDER_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Storage_Folder_Ref);
-- Copy of the object.
procedure Copy (Object : in Storage_Folder_Ref;
Into : in out Storage_Folder_Ref);
-- --------------------
-- The uri member holds the URI if the storage type is URL.
-- When storage is FILE, the local file path is built by using
-- the workspace identifier and the storage identifier.
-- --------------------
-- Create an object key for Storage.
function Storage_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Storage from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Storage_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Storage : constant Storage_Ref;
function "=" (Left, Right : Storage_Ref'Class) return Boolean;
-- Set the storage type which defines where the content is stored
procedure Set_Storage (Object : in out Storage_Ref;
Value : in Storage_Type);
-- Get the storage type which defines where the content is stored
function Get_Storage (Object : in Storage_Ref)
return Storage_Type;
-- Set the storage creation date
procedure Set_Create_Date (Object : in out Storage_Ref;
Value : in Ada.Calendar.Time);
-- Get the storage creation date
function Get_Create_Date (Object : in Storage_Ref)
return Ada.Calendar.Time;
-- Set the file name
procedure Set_Name (Object : in out Storage_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Storage_Ref;
Value : in String);
-- Get the file name
function Get_Name (Object : in Storage_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Storage_Ref)
return String;
-- Set the file size
procedure Set_File_Size (Object : in out Storage_Ref;
Value : in Integer);
-- Get the file size
function Get_File_Size (Object : in Storage_Ref)
return Integer;
-- Set the mime type
procedure Set_Mime_Type (Object : in out Storage_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Mime_Type (Object : in out Storage_Ref;
Value : in String);
-- Get the mime type
function Get_Mime_Type (Object : in Storage_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Mime_Type (Object : in Storage_Ref)
return String;
-- Set the storage URI
procedure Set_Uri (Object : in out Storage_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Uri (Object : in out Storage_Ref;
Value : in String);
-- Get the storage URI
function Get_Uri (Object : in Storage_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Uri (Object : in Storage_Ref)
return String;
--
function Get_Version (Object : in Storage_Ref)
return Integer;
-- Set the storage identifier
procedure Set_Id (Object : in out Storage_Ref;
Value : in ADO.Identifier);
-- Get the storage identifier
function Get_Id (Object : in Storage_Ref)
return ADO.Identifier;
-- Set whether the document is public or not.
procedure Set_Is_Public (Object : in out Storage_Ref;
Value : in Boolean);
-- Get whether the document is public or not.
function Get_Is_Public (Object : in Storage_Ref)
return Boolean;
--
procedure Set_Original (Object : in out Storage_Ref;
Value : in Storage_Ref'Class);
--
function Get_Original (Object : in Storage_Ref)
return Storage_Ref'Class;
--
procedure Set_Store_Data (Object : in out Storage_Ref;
Value : in Storage_Data_Ref'Class);
--
function Get_Store_Data (Object : in Storage_Ref)
return Storage_Data_Ref'Class;
--
procedure Set_Owner (Object : in out Storage_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_Owner (Object : in Storage_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Workspace (Object : in out Storage_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class);
--
function Get_Workspace (Object : in Storage_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class;
--
procedure Set_Folder (Object : in out Storage_Ref;
Value : in Storage_Folder_Ref'Class);
--
function Get_Folder (Object : in Storage_Ref)
return Storage_Folder_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Storage_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Storage_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
STORAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Storage_Ref);
-- Copy of the object.
procedure Copy (Object : in Storage_Ref;
Into : in out Storage_Ref);
-- --------------------
-- The local store record is created when a copy of the data is needed on the local file system.
-- The creation date refers to the date when the data was copied to the local file system.
-- The expiration date indicates a date after which the local file can be removed
-- from the local file system.
-- --------------------
-- Create an object key for Store_Local.
function Store_Local_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Store_Local from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Store_Local_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Store_Local : constant Store_Local_Ref;
function "=" (Left, Right : Store_Local_Ref'Class) return Boolean;
-- Set the local store identifier
procedure Set_Id (Object : in out Store_Local_Ref;
Value : in ADO.Identifier);
-- Get the local store identifier
function Get_Id (Object : in Store_Local_Ref)
return ADO.Identifier;
--
function Get_Version (Object : in Store_Local_Ref)
return Integer;
--
procedure Set_Store_Version (Object : in out Store_Local_Ref;
Value : in Integer);
--
function Get_Store_Version (Object : in Store_Local_Ref)
return Integer;
-- Set the shared flag which indicates whether this local store can be shared by several clients.
procedure Set_Shared (Object : in out Store_Local_Ref;
Value : in Boolean);
-- Get the shared flag which indicates whether this local store can be shared by several clients.
function Get_Shared (Object : in Store_Local_Ref)
return Boolean;
-- Set the local store path
procedure Set_Path (Object : in out Store_Local_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Path (Object : in out Store_Local_Ref;
Value : in String);
-- Get the local store path
function Get_Path (Object : in Store_Local_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Path (Object : in Store_Local_Ref)
return String;
-- Set the local store expiration date
procedure Set_Expire_Date (Object : in out Store_Local_Ref;
Value : in Ada.Calendar.Time);
-- Get the local store expiration date
function Get_Expire_Date (Object : in Store_Local_Ref)
return Ada.Calendar.Time;
-- Set the creation date
procedure Set_Create_Date (Object : in out Store_Local_Ref;
Value : in Ada.Calendar.Time);
-- Get the creation date
function Get_Create_Date (Object : in Store_Local_Ref)
return Ada.Calendar.Time;
--
procedure Set_Storage (Object : in out Store_Local_Ref;
Value : in Storage_Ref'Class);
--
function Get_Storage (Object : in Store_Local_Ref)
return Storage_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Store_Local_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Store_Local_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
STORE_LOCAL_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Store_Local_Ref);
-- Copy of the object.
procedure Copy (Object : in Store_Local_Ref;
Into : in out Store_Local_Ref);
Query_Storage_Get_Data : constant ADO.Queries.Query_Definition_Access;
Query_Storage_Get_Local : constant ADO.Queries.Query_Definition_Access;
Query_Storage_Get_Storage : constant ADO.Queries.Query_Definition_Access;
Query_Storage_Delete_Local : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- The list of folders.
-- --------------------
type Folder_Info is
new Util.Beans.Basic.Bean with record
-- the folder identifier.
Id : ADO.Identifier;
-- the folder name.
Name : Ada.Strings.Unbounded.Unbounded_String;
-- the blog creation date.
Create_Date : Ada.Calendar.Time;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Folder_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Folder_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Folder_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Folder_Info);
package Folder_Info_Vectors renames Folder_Info_Beans.Vectors;
subtype Folder_Info_List_Bean is Folder_Info_Beans.List_Bean;
type Folder_Info_List_Bean_Access is access all Folder_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Folder_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Folder_Info_Vector is Folder_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Folder_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Storage_Folder_List : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- The information about a document.
-- --------------------
type Storage_Bean is abstract
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the document folder identifier.
Folder_Id : ADO.Identifier;
-- the document folder name.
Folder_Name : Ada.Strings.Unbounded.Unbounded_String;
-- the document file identifier.
Id : ADO.Identifier;
-- the document file name.
Name : Ada.Strings.Unbounded.Unbounded_String;
-- the file creation date.
Create_Date : Ada.Calendar.Time;
-- the file storage URI.
Uri : Ada.Strings.Unbounded.Unbounded_String;
-- the file storage URI.
Storage : Storage_Type;
-- the file mime type.
Mime_Type : Ada.Strings.Unbounded.Unbounded_String;
-- the file size.
File_Size : Integer;
-- whether the document is public.
Is_Public : Boolean;
-- the image width.
Width : Integer;
-- the image height.
Height : Integer;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Storage_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Storage_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Storage_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Storage_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
-- Read in the object the data from the query result and prepare to read the next row.
-- If there is no row, raise the ADO.NOT_FOUND exception.
procedure Read (Into : in out Storage_Bean;
Stmt : in out ADO.Statements.Query_Statement'Class);
-- Run the query controlled by <b>Context</b> and load the result in <b>Object</b>.
procedure Load (Object : in out Storage_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Storage_Info : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- The list of documents for a given folder.
-- --------------------
type Storage_Info is
new Util.Beans.Basic.Bean with record
-- the storage identifier.
Id : ADO.Identifier;
-- the file name.
Name : Ada.Strings.Unbounded.Unbounded_String;
-- the file creation date.
Create_Date : Ada.Calendar.Time;
-- the file storage URI.
Uri : Ada.Strings.Unbounded.Unbounded_String;
-- the file storage URI.
Storage : Storage_Type;
-- the file mime type.
Mime_Type : Ada.Strings.Unbounded.Unbounded_String;
-- the file size.
File_Size : Integer;
-- whether the document is public or not.
Is_Public : Boolean;
-- the user name who uploaded the document.
User_Name : Ada.Strings.Unbounded.Unbounded_String;
-- the image thumbnail width (or 0).
Thumb_Width : Integer;
-- the image thumbnail height (or 0).
Thumb_Height : Integer;
-- the image thumbnail identifier.
Thumbnail_Id : ADO.Identifier;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Storage_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Storage_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Storage_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Storage_Info);
package Storage_Info_Vectors renames Storage_Info_Beans.Vectors;
subtype Storage_Info_List_Bean is Storage_Info_Beans.List_Bean;
type Storage_Info_List_Bean_Access is access all Storage_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Storage_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Storage_Info_Vector is Storage_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Storage_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Storage_List : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- bean method to upload a document.
-- --------------------
type Upload_Bean is abstract new AWA.Storages.Models.Storage_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Upload_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Upload_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Upload (Bean : in out Upload_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Delete (Bean : in out Upload_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Publish (Bean : in out Upload_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Save_Part (Bean : in out Upload_Bean;
Part : in ASF.Parts.Part'Class) is abstract;
type Storage_List_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Storage_List_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Storage_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Storage_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Storage_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
type Folder_Bean is abstract new AWA.Storages.Models.Storage_Folder_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Folder_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Folder_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Save (Bean : in out Folder_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
STORAGE_DATA_NAME : aliased constant String := "awa_storage_data";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "data";
STORAGE_DATA_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => STORAGE_DATA_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access)
);
STORAGE_DATA_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= STORAGE_DATA_DEF'Access;
Null_Storage_Data : constant Storage_Data_Ref
:= Storage_Data_Ref'(ADO.Objects.Object_Ref with null record);
type Storage_Data_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => STORAGE_DATA_DEF'Access)
with record
Version : Integer;
Data : ADO.Blob_Ref;
end record;
type Storage_Data_Access is access all Storage_Data_Impl;
overriding
procedure Destroy (Object : access Storage_Data_Impl);
overriding
procedure Find (Object : in out Storage_Data_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Storage_Data_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Storage_Data_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Storage_Data_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Storage_Data_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Storage_Data_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Storage_Data_Ref'Class;
Impl : out Storage_Data_Access);
STORAGE_FOLDER_NAME : aliased constant String := "awa_storage_folder";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "version";
COL_2_2_NAME : aliased constant String := "create_date";
COL_3_2_NAME : aliased constant String := "name";
COL_4_2_NAME : aliased constant String := "workspace_id";
COL_5_2_NAME : aliased constant String := "owner_id";
STORAGE_FOLDER_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 6,
Table => STORAGE_FOLDER_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access,
6 => COL_5_2_NAME'Access)
);
STORAGE_FOLDER_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= STORAGE_FOLDER_DEF'Access;
Null_Storage_Folder : constant Storage_Folder_Ref
:= Storage_Folder_Ref'(ADO.Objects.Object_Ref with null record);
type Storage_Folder_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => STORAGE_FOLDER_DEF'Access)
with record
Version : Integer;
Create_Date : Ada.Calendar.Time;
Name : Ada.Strings.Unbounded.Unbounded_String;
Workspace : AWA.Workspaces.Models.Workspace_Ref;
Owner : AWA.Users.Models.User_Ref;
end record;
type Storage_Folder_Access is access all Storage_Folder_Impl;
overriding
procedure Destroy (Object : access Storage_Folder_Impl);
overriding
procedure Find (Object : in out Storage_Folder_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Storage_Folder_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Storage_Folder_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Storage_Folder_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Storage_Folder_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Storage_Folder_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Storage_Folder_Ref'Class;
Impl : out Storage_Folder_Access);
STORAGE_NAME : aliased constant String := "awa_storage";
COL_0_3_NAME : aliased constant String := "storage";
COL_1_3_NAME : aliased constant String := "create_date";
COL_2_3_NAME : aliased constant String := "name";
COL_3_3_NAME : aliased constant String := "file_size";
COL_4_3_NAME : aliased constant String := "mime_type";
COL_5_3_NAME : aliased constant String := "uri";
COL_6_3_NAME : aliased constant String := "version";
COL_7_3_NAME : aliased constant String := "id";
COL_8_3_NAME : aliased constant String := "is_public";
COL_9_3_NAME : aliased constant String := "original_id";
COL_10_3_NAME : aliased constant String := "store_data_id";
COL_11_3_NAME : aliased constant String := "owner_id";
COL_12_3_NAME : aliased constant String := "workspace_id";
COL_13_3_NAME : aliased constant String := "folder_id";
STORAGE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 14,
Table => STORAGE_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access,
5 => COL_4_3_NAME'Access,
6 => COL_5_3_NAME'Access,
7 => COL_6_3_NAME'Access,
8 => COL_7_3_NAME'Access,
9 => COL_8_3_NAME'Access,
10 => COL_9_3_NAME'Access,
11 => COL_10_3_NAME'Access,
12 => COL_11_3_NAME'Access,
13 => COL_12_3_NAME'Access,
14 => COL_13_3_NAME'Access)
);
STORAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= STORAGE_DEF'Access;
Null_Storage : constant Storage_Ref
:= Storage_Ref'(ADO.Objects.Object_Ref with null record);
type Storage_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => STORAGE_DEF'Access)
with record
Storage : Storage_Type;
Create_Date : Ada.Calendar.Time;
Name : Ada.Strings.Unbounded.Unbounded_String;
File_Size : Integer;
Mime_Type : Ada.Strings.Unbounded.Unbounded_String;
Uri : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Is_Public : Boolean;
Original : Storage_Ref;
Store_Data : Storage_Data_Ref;
Owner : AWA.Users.Models.User_Ref;
Workspace : AWA.Workspaces.Models.Workspace_Ref;
Folder : Storage_Folder_Ref;
end record;
type Storage_Access is access all Storage_Impl;
overriding
procedure Destroy (Object : access Storage_Impl);
overriding
procedure Find (Object : in out Storage_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Storage_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Storage_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Storage_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Storage_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Storage_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Storage_Ref'Class;
Impl : out Storage_Access);
STORE_LOCAL_NAME : aliased constant String := "awa_store_local";
COL_0_4_NAME : aliased constant String := "id";
COL_1_4_NAME : aliased constant String := "version";
COL_2_4_NAME : aliased constant String := "store_version";
COL_3_4_NAME : aliased constant String := "shared";
COL_4_4_NAME : aliased constant String := "path";
COL_5_4_NAME : aliased constant String := "expire_date";
COL_6_4_NAME : aliased constant String := "create_date";
COL_7_4_NAME : aliased constant String := "storage_id";
STORE_LOCAL_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 8,
Table => STORE_LOCAL_NAME'Access,
Members => (
1 => COL_0_4_NAME'Access,
2 => COL_1_4_NAME'Access,
3 => COL_2_4_NAME'Access,
4 => COL_3_4_NAME'Access,
5 => COL_4_4_NAME'Access,
6 => COL_5_4_NAME'Access,
7 => COL_6_4_NAME'Access,
8 => COL_7_4_NAME'Access)
);
STORE_LOCAL_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= STORE_LOCAL_DEF'Access;
Null_Store_Local : constant Store_Local_Ref
:= Store_Local_Ref'(ADO.Objects.Object_Ref with null record);
type Store_Local_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => STORE_LOCAL_DEF'Access)
with record
Version : Integer;
Store_Version : Integer;
Shared : Boolean;
Path : Ada.Strings.Unbounded.Unbounded_String;
Expire_Date : Ada.Calendar.Time;
Create_Date : Ada.Calendar.Time;
Storage : Storage_Ref;
end record;
type Store_Local_Access is access all Store_Local_Impl;
overriding
procedure Destroy (Object : access Store_Local_Impl);
overriding
procedure Find (Object : in out Store_Local_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Store_Local_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Store_Local_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Store_Local_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Store_Local_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Store_Local_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Store_Local_Ref'Class;
Impl : out Store_Local_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "storage-queries.xml",
Sha1 => "9B2B599473F75F92CB5AB5045675E4CCEF926543");
package Def_Storage_Get_Data is
new ADO.Queries.Loaders.Query (Name => "storage-get-data",
File => File_1.File'Access);
Query_Storage_Get_Data : constant ADO.Queries.Query_Definition_Access
:= Def_Storage_Get_Data.Query'Access;
package Def_Storage_Get_Local is
new ADO.Queries.Loaders.Query (Name => "storage-get-local",
File => File_1.File'Access);
Query_Storage_Get_Local : constant ADO.Queries.Query_Definition_Access
:= Def_Storage_Get_Local.Query'Access;
package Def_Storage_Get_Storage is
new ADO.Queries.Loaders.Query (Name => "storage-get-storage",
File => File_1.File'Access);
Query_Storage_Get_Storage : constant ADO.Queries.Query_Definition_Access
:= Def_Storage_Get_Storage.Query'Access;
package Def_Storage_Delete_Local is
new ADO.Queries.Loaders.Query (Name => "storage-delete-local",
File => File_1.File'Access);
Query_Storage_Delete_Local : constant ADO.Queries.Query_Definition_Access
:= Def_Storage_Delete_Local.Query'Access;
package File_2 is
new ADO.Queries.Loaders.File (Path => "folder-queries.xml",
Sha1 => "4A3EAF58F54C45825D96AED13FE40DD0EB97D591");
package Def_Folderinfo_Storage_Folder_List is
new ADO.Queries.Loaders.Query (Name => "storage-folder-list",
File => File_2.File'Access);
Query_Storage_Folder_List : constant ADO.Queries.Query_Definition_Access
:= Def_Folderinfo_Storage_Folder_List.Query'Access;
package File_3 is
new ADO.Queries.Loaders.File (Path => "storage-info.xml",
Sha1 => "91766026921B59D0C5801C51A45BE3FF65799682");
package Def_Storagebean_Storage_Info is
new ADO.Queries.Loaders.Query (Name => "storage-info",
File => File_3.File'Access);
Query_Storage_Info : constant ADO.Queries.Query_Definition_Access
:= Def_Storagebean_Storage_Info.Query'Access;
package File_4 is
new ADO.Queries.Loaders.File (Path => "storage-list.xml",
Sha1 => "F8592003BD552D8745BD53B46E9CC11D85820AC6");
package Def_Storageinfo_Storage_List is
new ADO.Queries.Loaders.Query (Name => "storage-list",
File => File_4.File'Access);
Query_Storage_List : constant ADO.Queries.Query_Definition_Access
:= Def_Storageinfo_Storage_List.Query'Access;
end AWA.Storages.Models;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.