]> begriffs open source - cmsis-freertos/blob - Demo/CORTEX_LM3S102_GCC/hw_include/gpio.h
Initial commit
[cmsis-freertos] / Demo / CORTEX_LM3S102_GCC / hw_include / gpio.h
1 //*****************************************************************************
2 //
3 // gpio.h - Defines and Macros for GPIO API.
4 //
5 // Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
6 //
7 // Software License Agreement
8 //
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10 // exclusively on LMI's Stellaris Family of microcontroller products.
11 //
12 // The software is owned by LMI and/or its suppliers, and is protected under
13 // applicable copyright laws.  All rights are reserved.  Any use in violation
14 // of the foregoing restrictions may subject the user to criminal sanctions
15 // under applicable laws, as well as to civil liability for the breach of the
16 // terms and conditions of this license.
17 //
18 // THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23 //
24 // This is part of revision 523 of the Stellaris Driver Library.
25 //
26 //*****************************************************************************
27
28 #ifndef __GPIO_H__
29 #define __GPIO_H__
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 //*****************************************************************************
37 //
38 // The following values define the bit field for the ucPins argument to several
39 // of the APIs.
40 //
41 //*****************************************************************************
42 #define GPIO_PIN_0              0x00000001  // GPIO pin 0
43 #define GPIO_PIN_1              0x00000002  // GPIO pin 1
44 #define GPIO_PIN_2              0x00000004  // GPIO pin 2
45 #define GPIO_PIN_3              0x00000008  // GPIO pin 3
46 #define GPIO_PIN_4              0x00000010  // GPIO pin 4
47 #define GPIO_PIN_5              0x00000020  // GPIO pin 5
48 #define GPIO_PIN_6              0x00000040  // GPIO pin 6
49 #define GPIO_PIN_7              0x00000080  // GPIO pin 7
50
51 //*****************************************************************************
52 //
53 // Values that can be passed to GPIODirModeSet as the ulPinIO parameter, and
54 // returned from GPIODirModeGet.
55 //
56 //*****************************************************************************
57 #define GPIO_DIR_MODE_IN        0x00000000  // Pin is a GPIO input
58 #define GPIO_DIR_MODE_OUT       0x00000001  // Pin is a GPIO output
59 #define GPIO_DIR_MODE_HW        0x00000002  // Pin is a peripheral function
60
61 //*****************************************************************************
62 //
63 // Values that can be passed to GPIOIntTypeSet as the ulIntType parameter, and
64 // returned from GPIOIntTypeGet.
65 //
66 //*****************************************************************************
67 #define GPIO_FALLING_EDGE       0x00000000  // Interrupt on falling edge
68 #define GPIO_RISING_EDGE        0x00000004  // Interrupt on rising edge
69 #define GPIO_BOTH_EDGES         0x00000001  // Interrupt on both edges
70 #define GPIO_LOW_LEVEL          0x00000002  // Interrupt on low level
71 #define GPIO_HIGH_LEVEL         0x00000007  // Interrupt on high level
72
73 //*****************************************************************************
74 //
75 // Values that can be passed to GPIOPadConfigSet as the ulStrength parameter,
76 // and returned by GPIOPadConfigGet in the *pulStrength parameter.
77 //
78 //*****************************************************************************
79 #define GPIO_STRENGTH_2MA       0x00000001  // 2mA drive strength
80 #define GPIO_STRENGTH_4MA       0x00000002  // 4mA drive strength
81 #define GPIO_STRENGTH_8MA       0x00000004  // 8mA drive strength
82 #define GPIO_STRENGTH_8MA_SC    0x0000000C  // 8mA drive with slew rate control
83
84 //*****************************************************************************
85 //
86 // Values that can be passed to GPIOPadConfigSet as the ulPadType parameter,
87 // and returned by GPIOPadConfigGet in the *pulPadType parameter.
88 //
89 //*****************************************************************************
90 #define GPIO_PIN_TYPE_STD       0x00000008  // Push-pull
91 #define GPIO_PIN_TYPE_STD_WPU   0x0000000A  // Push-pull with weak pull-up
92 #define GPIO_PIN_TYPE_STD_WPD   0x0000000C  // Push-pull with weak pull-down
93 #define GPIO_PIN_TYPE_OD        0x00000009  // Open-drain
94 #define GPIO_PIN_TYPE_OD_WPU    0x0000000B  // Open-drain with weak pull-up
95 #define GPIO_PIN_TYPE_OD_WPD    0x0000000D  // Open-drain with weak pull-down
96 #define GPIO_PIN_TYPE_ANALOG    0x00000000  // Analog comparator
97
98 //*****************************************************************************
99 //
100 // Prototypes for the APIs.
101 //
102 //*****************************************************************************
103 extern void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
104                            unsigned long ulPinIO);
105 extern unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin);
106 extern void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
107                            unsigned long ulIntType);
108 extern unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin);
109 extern void GPIOPadConfigSet(unsigned long ulPort, unsigned char ucPins,
110                              unsigned long ulStrength,
111                              unsigned long ulPadType);
112 extern void GPIOPadConfigGet(unsigned long ulPort, unsigned char ucPin,
113                              unsigned long *pulStrength,
114                              unsigned long *pulPadType);
115 extern void GPIOPinIntEnable(unsigned long ulPort, unsigned char ucPins);
116 extern void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins);
117 extern long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked);
118 extern void GPIOPinIntClear(unsigned long ulPort, unsigned char ucPins);
119 extern void GPIOPortIntRegister(unsigned long ulPort,
120                                 void (*pfIntHandler)(void));
121 extern void GPIOPortIntUnregister(unsigned long ulPort);
122 extern long GPIOPinRead(unsigned long ulPort, unsigned char ucPins);
123 extern void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins,
124                          unsigned char ucVal);
125 extern void GPIOPinTypeComparator(unsigned long ulPort, unsigned char ucPins);
126 extern void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins);
127 extern void GPIOPinTypeSSI(unsigned long ulPort, unsigned char ucPins);
128 extern void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins);
129 extern void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins);
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135 #endif //  __GPIO_H__