libpruio  0.2
Input/Output driver for digital/analog lines on Beagleboard hardware
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pruio_gpio.bi
Go to the documentation of this file.
1 /'* \file pruio_gpio.bi
2 \brief FreeBASIC header file for GPIO component of libpruio.
3 
4 Header file for including in to libpruio. It contains the declarations
5 for the GPIO component of the library.
6 
7 '/
8 
9 
10 /'* \brief Structure for GPIO subsystem registers.
11 
12 This UDT contains a set of all GPIO subsystem registers. Is used to
13 store the initial configuration of the four subsystems in the AM33xx
14 CPU, and to hold their current configurations for the next call to
15 function PruIo::config().
16 
17 \since 0.2
18 '/
19 TYPE GpioSet
20  AS UInt32 _
21  DeAd _ '*< Device address.
22  , ClAd _ '*< Clock address.
23  , ClVa '*< Clock value (defaults to 2 = enabled, set to 0 = disabled).
24 
25  AS UInt32 _
26  REVISION _ '*< Register at offset 00h (see \ArmRef{25.4.1.1} ).
27  , SYSCONFIG _ '*< Register at offset 10h (see \ArmRef{25.4.1.2} ).
28  , EOI _ '*< Register at offset 20h (see \ArmRef{25.4.1.3} ).
29  , IRQSTATUS_RAW_0 _ '*< Register at offset 24h (see \ArmRef{25.4.1.4} ).
30  , IRQSTATUS_RAW_1 _ '*< Register at offset 28h (see \ArmRef{25.4.1.5} ).
31  , IRQSTATUS_0 _ '*< Register at offset 2Ch (see \ArmRef{25.4.1.6} ).
32  , IRQSTATUS_1 _ '*< Register at offset 30h (see \ArmRef{25.4.1.7} ).
33  , IRQSTATUS_SET_0 _ '*< Register at offset 34h (see \ArmRef{25.4.1.8} ).
34  , IRQSTATUS_SET_1 _ '*< Register at offset 38h (see \ArmRef{25.4.1.9} ).
35  , IRQSTATUS_CLR_0 _ '*< Register at offset 3Ch (see \ArmRef{25.4.1.10} ).
36  , IRQSTATUS_CLR_1 _ '*< Register at offset 40h (see \ArmRef{25.4.1.11} ).
37  , IRQWAKEN_0 _ '*< Register at offset 44h (see \ArmRef{25.4.1.12} ).
38  , IRQWAKEN_1 _ '*< Register at offset 48h (see \ArmRef{25.4.1.13} ).
39  , SYSSTATUS _ '*< Register at offset 114h (see \ArmRef{25.4.1.14} ).
40  , CTRL _ '*< Register at offset 130h (see \ArmRef{25.4.1.15} ).
41  , OE _ '*< Register at offset 134h (see \ArmRef{25.4.1.16} ).
42  , DATAIN _ '*< Register at offset 138h (see \ArmRef{25.4.1.17} ).
43  , DATAOUT _ '*< Register at offset 13Ch (see \ArmRef{25.4.1.18} ).
44  , LEVELDETECT0 _ '*< Register at offset 140h (see \ArmRef{25.4.1.19} ).
45  , LEVELDETECT1 _ '*< Register at offset 144h (see \ArmRef{25.4.1.20} ).
46  , RISINGDETECT _ '*< Register at offset 148h (see \ArmRef{25.4.1.21} ).
47  , FALLINGDETECT _ '*< Register at offset 14Ch (see \ArmRef{25.4.1.22} ).
48  , DEBOUNCENABLE _ '*< Register at offset 150h (see \ArmRef{25.4.1.23} ).
49  , DEBOUNCINGTIME _ '*< Register at offset 154h (see \ArmRef{25.4.1.24} ).
50  , CLEARDATAOUT _ '*< Register at offset 190h (see \ArmRef{25.4.1.25} ).
51  , SETDATAOUT '*< Register at offset 194h (see \ArmRef{25.4.1.26} ).
52 END TYPE
53 
54 /'* \brief UDT for GPIO data, fetched in IO & RB mode.
55 
56 This UDT is used to fetch the current register data from the GPIO
57 modules in IO and RB mode.
58 
59 '/
60 TYPE GpioArr
61  AS UInt32 _
62  DeAd '*< Base address of GPIO subsystem + 0x100.
63  AS UInt32 _
64  DATAIN _ '*< Current Value of DATAIN register (IO).
65  , DATAOUT _ '*< Current Value of DATAOUT register (IO).
66  , Mix '*< Current state of pins (IN&OUT mixed).
67 END TYPE
68 
69 
70 /'* \brief Structure for GPIO subsystem features, containing all
71 functions and variables to handle the subsystems.
72 
73 This UDT contains the member function to control the features in each
74 of the four GPIO subsystems included in the AM33xx CPU and the related
75 variables.
76 
77 \since 0.2
78 '/
79 TYPE GpioUdt
80  AS Pruio_ PTR Top '*< Pointer to the calling PruIo instance.
81  AS GpioSet PTR _
82  Init(PRUIO_AZ_GPIO) _ '*< Initial subsystem configuration, used in the destructor PruIo::~PruIo.
83  , Conf(PRUIO_AZ_GPIO) '*< Current subsystem configuration, used in PruIo::config().
84  AS GpioArr PTR _
85  Raw(PRUIO_AZ_GPIO) '*< Pointer to current raw subsystem data (IO), all 32 bits.
86  AS UInt32 InitParA '*< Offset to read data block offset.
87  AS ZSTRING PTR _
88  E0 = @"GPIO subsystem not enabled" _ '*< Common error message.
89  , E1 = @"no GPIO pin" '*< Common error message.
90 
91  DECLARE CONSTRUCTOR (BYVAL AS Pruio_ PTR)
92  DECLARE FUNCTION initialize CDECL() AS ZSTRING PTR
93  DECLARE FUNCTION config CDECL( _
94  BYVAL AS UInt8 _
95  , BYVAL AS UInt8 = CAST(UInt8, PRUIO_GPIO_IN_0)) AS ZSTRING PTR
96  DECLARE FUNCTION Value CDECL( _
97  BYVAL AS UInt8) AS Int32
98  DECLARE FUNCTION setValue CDECL( _
99  BYVAL AS UInt8 _
100  , BYVAL AS UInt8 = 0) AS ZSTRING PTR
101 END TYPE
102