collab/mm20
git clone https://git.julia.blue/collab/mm20
39a929c
firmware
1#include <stdbool.h> 2#include <stdint.h> 3//***************************************************************************** 4// 5// gpio.h - Defines and Macros for GPIO API. 6// 7// Copyright (c) 2005-2017 Texas Instruments Incorporated. All rights reserved. 8// Software License Agreement 9// 10// Redistribution and use in source and binary forms, with or without 11// modification, are permitted provided that the following conditions 12// are met: 13// 14// Redistributions of source code must retain the above copyright 15// notice, this list of conditions and the following disclaimer. 16// 17// Redistributions in binary form must reproduce the above copyright 18// notice, this list of conditions and the following disclaimer in the 19// documentation and/or other materials provided with the 20// distribution. 21// 22// Neither the name of Texas Instruments Incorporated nor the names of 23// its contributors may be used to endorse or promote products derived 24// from this software without specific prior written permission. 25// 26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37// 38// This is part of revision 2.1.4.178 of the Tiva Peripheral Driver Library. 39// 40//***************************************************************************** 41 42#ifndef __DRIVERLIB_GPIO_H__ 43#define __DRIVERLIB_GPIO_H__ 44 45//***************************************************************************** 46// 47// If building with a C++ compiler, make all of the definitions in this header 48// have a C binding. 49// 50//***************************************************************************** 51#ifdef __cplusplus 52extern "C" 53{ 54#endif 55 56//***************************************************************************** 57// 58// The following values define the bit field for the ui8Pins argument to 59// several of the APIs. 60// 61//***************************************************************************** 62#define GPIO_PIN_0 0x00000001 // GPIO pin 0 63#define GPIO_PIN_1 0x00000002 // GPIO pin 1 64#define GPIO_PIN_2 0x00000004 // GPIO pin 2 65#define GPIO_PIN_3 0x00000008 // GPIO pin 3 66#define GPIO_PIN_4 0x00000010 // GPIO pin 4 67#define GPIO_PIN_5 0x00000020 // GPIO pin 5 68#define GPIO_PIN_6 0x00000040 // GPIO pin 6 69#define GPIO_PIN_7 0x00000080 // GPIO pin 7 70 71//***************************************************************************** 72// 73// Values that can be passed to GPIODirModeSet as the ui32PinIO parameter, and 74// returned from GPIODirModeGet. 75// 76//***************************************************************************** 77#define GPIO_DIR_MODE_IN 0x00000000 // Pin is a GPIO input 78#define GPIO_DIR_MODE_OUT 0x00000001 // Pin is a GPIO output 79#define GPIO_DIR_MODE_HW 0x00000002 // Pin is a peripheral function 80 81//***************************************************************************** 82// 83// Values that can be passed to GPIOIntTypeSet as the ui32IntType parameter, 84// and returned from GPIOIntTypeGet. 85// 86//***************************************************************************** 87#define GPIO_FALLING_EDGE 0x00000000 // Interrupt on falling edge 88#define GPIO_RISING_EDGE 0x00000004 // Interrupt on rising edge 89#define GPIO_BOTH_EDGES 0x00000001 // Interrupt on both edges 90#define GPIO_LOW_LEVEL 0x00000002 // Interrupt on low level 91#define GPIO_HIGH_LEVEL 0x00000006 // Interrupt on high level 92#define GPIO_DISCRETE_INT 0x00010000 // Interrupt for individual pins 93 94//***************************************************************************** 95// 96// Values that can be passed to GPIOPadConfigSet as the ui32Strength parameter, 97// and returned by GPIOPadConfigGet in the *pui32Strength parameter. 98// 99//***************************************************************************** 100#define GPIO_STRENGTH_2MA 0x00000001 // 2mA drive strength 101#define GPIO_STRENGTH_4MA 0x00000002 // 4mA drive strength 102#define GPIO_STRENGTH_6MA 0x00000065 // 6mA drive strength 103#define GPIO_STRENGTH_8MA 0x00000066 // 8mA drive strength 104#define GPIO_STRENGTH_8MA_SC 0x0000006E // 8mA drive with slew rate control 105#define GPIO_STRENGTH_10MA 0x00000075 // 10mA drive strength 106#define GPIO_STRENGTH_12MA 0x00000077 // 12mA drive strength 107 108//***************************************************************************** 109// 110// Values that can be passed to GPIOPadConfigSet as the ui32PadType parameter, 111// and returned by GPIOPadConfigGet in the *pui32PadType parameter. 112// 113//***************************************************************************** 114#define GPIO_PIN_TYPE_STD 0x00000008 // Push-pull 115#define GPIO_PIN_TYPE_STD_WPU 0x0000000A // Push-pull with weak pull-up 116#define GPIO_PIN_TYPE_STD_WPD 0x0000000C // Push-pull with weak pull-down 117#define GPIO_PIN_TYPE_OD 0x00000009 // Open-drain 118#define GPIO_PIN_TYPE_ANALOG 0x00000000 // Analog comparator 119#define GPIO_PIN_TYPE_WAKE_HIGH 0x00000208 // Hibernate wake, high 120#define GPIO_PIN_TYPE_WAKE_LOW 0x00000108 // Hibernate wake, low 121 122//***************************************************************************** 123// 124// Values that can be passed to GPIOIntEnable() and GPIOIntDisable() functions 125// in the ui32IntFlags parameter. 126// 127//***************************************************************************** 128#define GPIO_INT_PIN_0 0x00000001 129#define GPIO_INT_PIN_1 0x00000002 130#define GPIO_INT_PIN_2 0x00000004 131#define GPIO_INT_PIN_3 0x00000008 132#define GPIO_INT_PIN_4 0x00000010 133#define GPIO_INT_PIN_5 0x00000020 134#define GPIO_INT_PIN_6 0x00000040 135#define GPIO_INT_PIN_7 0x00000080 136#define GPIO_INT_DMA 0x00000100 137 138//***************************************************************************** 139// 140// Prototypes for the APIs. 141// 142//***************************************************************************** 143extern void GPIODirModeSet (uint32_t ui32Port ,uint8_t ui8Pins , 144uint32_t ui32PinIO ); 145extern uint32_t GPIODirModeGet (uint32_t ui32Port ,uint8_t ui8Pin ); 146extern void GPIOIntTypeSet (uint32_t ui32Port ,uint8_t ui8Pins , 147uint32_t ui32IntType ); 148extern uint32_t GPIOIntTypeGet (uint32_t ui32Port ,uint8_t ui8Pin ); 149extern void GPIOPadConfigSet (uint32_t ui32Port ,uint8_t ui8Pins , 150uint32_t ui32Strength ,uint32_t ui32PadType ); 151extern void GPIOPadConfigGet (uint32_t ui32Port ,uint8_t ui8Pin , 152uint32_t * pui32Strength ,uint32_t * pui32PadType ); 153extern void GPIOIntEnable (uint32_t ui32Port ,uint32_t ui32IntFlags ); 154extern void GPIOIntDisable (uint32_t ui32Port ,uint32_t ui32IntFlags ); 155extern uint32_t GPIOIntStatus (uint32_t ui32Port ,bool bMasked ); 156extern void GPIOIntClear (uint32_t ui32Port ,uint32_t ui32IntFlags ); 157extern void GPIOIntRegister (uint32_t ui32Port ,void (* pfnIntHandler )(void )); 158extern void GPIOIntUnregister (uint32_t ui32Port ); 159extern void GPIOIntRegisterPin (uint32_t ui32Port ,uint32_t ui32Pin , 160void (* pfnIntHandler )(void )); 161extern void GPIOIntUnregisterPin (uint32_t ui32Port ,uint32_t ui32Pin ); 162extern int32_t GPIOPinRead (uint32_t ui32Port ,uint8_t ui8Pins ); 163extern void GPIOPinWrite (uint32_t ui32Port ,uint8_t ui8Pins ,uint8_t ui8Val ); 164extern void GPIOPinConfigure (uint32_t ui32PinConfig ); 165extern void GPIOPinTypeADC (uint32_t ui32Port ,uint8_t ui8Pins ); 166extern void GPIOPinTypeCAN (uint32_t ui32Port ,uint8_t ui8Pins ); 167extern void GPIOPinTypeComparator (uint32_t ui32Port ,uint8_t ui8Pins ); 168extern void GPIOPinTypeComparatorOutput (uint32_t ui32Port ,uint8_t ui8Pins ); 169extern void GPIOPinTypeDIVSCLK (uint32_t ui32Port ,uint8_t ui8Pins ); 170extern void GPIOPinTypeEPI (uint32_t ui32Port ,uint8_t ui8Pins ); 171extern void GPIOPinTypeEthernetLED (uint32_t ui32Port ,uint8_t ui8Pins ); 172extern void GPIOPinTypeEthernetMII (uint32_t ui32Port ,uint8_t ui8Pins ); 173extern void GPIOPinTypeGPIOInput (uint32_t ui32Port ,uint8_t ui8Pins ); 174extern void GPIOPinTypeGPIOOutput (uint32_t ui32Port ,uint8_t ui8Pins ); 175extern void GPIOPinTypeGPIOOutputOD (uint32_t ui32Port ,uint8_t ui8Pins ); 176extern void GPIOPinTypeHibernateRTCCLK (uint32_t ui32Port ,uint8_t ui8Pins ); 177extern void GPIOPinTypeI2C (uint32_t ui32Port ,uint8_t ui8Pins ); 178extern void GPIOPinTypeI2CSCL (uint32_t ui32Port ,uint8_t ui8Pins ); 179extern void GPIOPinTypeLCD (uint32_t ui32Port ,uint8_t ui8Pins ); 180extern void GPIOPinTypeOneWire (uint32_t ui32Port ,uint8_t ui8Pins ); 181extern void GPIOPinTypePWM (uint32_t ui32Port ,uint8_t ui8Pins ); 182extern void GPIOPinTypeQEI (uint32_t ui32Port ,uint8_t ui8Pins ); 183extern void GPIOPinTypeSSI (uint32_t ui32Port ,uint8_t ui8Pins ); 184extern void GPIOPinTypeTimer (uint32_t ui32Port ,uint8_t ui8Pins ); 185extern void GPIOPinTypeTrace (uint32_t ui32Port ,uint8_t ui8Pins ); 186extern void GPIOPinTypeUART (uint32_t ui32Port ,uint8_t ui8Pins ); 187extern void GPIOPinTypeUSBAnalog (uint32_t ui32Port ,uint8_t ui8Pins ); 188extern void GPIOPinTypeUSBDigital (uint32_t ui32Port ,uint8_t ui8Pins ); 189extern void GPIOPinTypeWakeHigh (uint32_t ui32Port ,uint8_t ui8Pins ); 190extern void GPIOPinTypeWakeLow (uint32_t ui32Port ,uint8_t ui8Pins ); 191extern uint32_t GPIOPinWakeStatus (uint32_t ui32Port ); 192extern void GPIODMATriggerEnable (uint32_t ui32Port ,uint8_t ui8Pins ); 193extern void GPIODMATriggerDisable (uint32_t ui32Port ,uint8_t ui8Pins ); 194extern void GPIOADCTriggerEnable (uint32_t ui32Port ,uint8_t ui8Pins ); 195extern void GPIOADCTriggerDisable (uint32_t ui32Port ,uint8_t ui8Pins ); 196 197//***************************************************************************** 198// 199// Mark the end of the C bindings section for C++ compilers. 200// 201//***************************************************************************** 202#ifdef __cplusplus 203} 204#endif 205 206#endif // __DRIVERLIB_GPIO_H__