]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/rpp/include/sys/ti_drv_gio.h
6406b620cf04c2244bc62fea6c67d8a046ab608c
[pes-rpp/rpp-test-sw.git] / rpp / lib / rpp / include / sys / ti_drv_gio.h
1 /** @file gio.h
2 *   @brief GIO Driver Definition File
3 *   @date 15.Mar.2012
4 *   @version 03.01.00
5 *
6 */
7
8 /* (c) Texas Instruments 2009-2012, All rights reserved. */
9
10 #include "base.h"
11
12 #ifndef __GIO_H__
13 #define __GIO_H__
14
15 /** @enum Loopbacktype
16 *   @brief Loopback type definition
17 */
18 /** @typedef Loopbacktype_t
19 *   @brief Loopback type Type Definition
20 *
21 *   This type is used to select the module Loopback type Digital or Analog loopback.
22 */
23 typedef enum Loopbacktype {
24
25     Digital = 0,
26     Analog = 1
27
28 } Loopbacktype_t;
29
30 /** @struct gioBase
31 *   @brief GIO Base Register Definition
32 *
33 *   This structure is used to access the GIO module egisters.
34 */
35 /** @typedef gioBASE_t
36 *   @brief GIO Register Frame Type Definition
37 *
38 *   This type is used to access the GIO Registers.
39 */
40 typedef volatile struct gioBase
41 {
42     uint32_t GCR0;      /**< 0x0000: Global Control Register */
43     uint32_t PWDN;      /**< 0x0004: Power Down Register */
44     uint32_t INTDET;    /**< 0x0008: Interrupt Detect Regsiter*/
45     uint32_t POL;       /**< 0x000C: Interrupt Polarity Register */
46     uint32_t INTENASET; /**< 0x0010: Interrupt Enable Set Register */
47     uint32_t INTENACLR; /**< 0x0014: Interrupt Enable Clear Register */
48     uint32_t LVLSET;    /**< 0x0018: Interrupt Priority Set Register */
49     uint32_t LVLCLR;    /**< 0x001C: Interrupt Priority Clear Register */
50     uint32_t FLG;       /**< 0x0020: Interrupt Flag Register */
51     uint32_t OFFSET0;   /**< 0x0024: Interrupt Offset A Register */
52     uint32_t OFFSET1;   /**< 0x0028: Interrupt Offset B Register */
53 } gioBASE_t;
54
55
56 /** @struct gioPort
57 *   @brief GIO Port Register Definition
58 */
59 /** @typedef gioPORT_t
60 *   @brief GIO Port Register Type Definition
61 *
62 *   This type is used to access the GIO Port Registers.
63 */
64 typedef volatile struct gioPort
65 {
66     uint32_t DIR;    /**< 0x0000: Data Direction Register */
67     uint32_t DIN;    /**< 0x0004: Data Input Register */
68     uint32_t DOUT;   /**< 0x0008: Data Output Register */
69     uint32_t DSET;   /**< 0x000C: Data Output Set Register */
70     uint32_t DCLR;   /**< 0x0010: Data Output Clear Register */
71     uint32_t PDR;    /**< 0x0014: Open Drain Regsiter */
72     uint32_t PULDIS; /**< 0x0018: Pullup Disable Register */
73     uint32_t PSL;    /**< 0x001C: Pull Up/Down Selection Register */
74 } gioPORT_t;
75
76
77 /** @def gioREG
78 *   @brief GIO Register Frame Pointer
79 *
80 *   This pointer is used by the GIO driver to access the gio module registers.
81 */
82 #define gioREG   ((gioBASE_t *)0xFFF7BC00U)
83
84 /** @def gioPORTA
85 *   @brief GIO Port (A) Register Pointer
86 *
87 *   Pointer used by the GIO driver to access PORTA
88 */
89 #define gioPORTA ((gioPORT_t *)0xFFF7BC34U)
90
91 /** @def gioPORTB
92 *   @brief GIO Port (B) Register Pointer
93 *
94 *   Pointer used by the GIO driver to access PORTB
95 */
96 #define gioPORTB ((gioPORT_t *)0xFFF7BC54U)
97
98
99 /* GIO Interface Functions */
100 void gioInit(void);
101 void gioSetDirection(gioPORT_t *port, uint32_t dir);
102 void gioSetBit(gioPORT_t *port, uint32_t bit, uint32_t value);
103 void gioSetPort(gioPORT_t *port, uint32_t value);
104 uint32_t gioGetBit(gioPORT_t *port, uint32_t bit);
105 uint32_t gioGetPort(gioPORT_t *port);
106 void gioToggleBit(gioPORT_t *port, uint32_t bit);
107 void gioEnableNotification(uint32_t bit);
108 void gioDisableNotification(uint32_t bit);
109 void gioNotification(int bit);
110
111 #endif