//***************************************************************************** // // gpio.h - Defines and Macros for GPIO API. // // Copyright (c) 2005-2011 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 8264 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __GPIO_H__ #define __GPIO_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // The following values define the bit field for the ucPins argument to several // of the APIs. // //***************************************************************************** #define GPIO_PIN_0 0x00000001 // GPIO pin 0 #define GPIO_PIN_1 0x00000002 // GPIO pin 1 #define GPIO_PIN_2 0x00000004 // GPIO pin 2 #define GPIO_PIN_3 0x00000008 // GPIO pin 3 #define GPIO_PIN_4 0x00000010 // GPIO pin 4 #define GPIO_PIN_5 0x00000020 // GPIO pin 5 #define GPIO_PIN_6 0x00000040 // GPIO pin 6 #define GPIO_PIN_7 0x00000080 // GPIO pin 7 //***************************************************************************** // // Values that can be passed to GPIODirModeSet as the ulPinIO parameter, and // returned from GPIODirModeGet. // //***************************************************************************** #define GPIO_DIR_MODE_IN 0x00000000 // Pin is a GPIO input #define GPIO_DIR_MODE_OUT 0x00000001 // Pin is a GPIO output #define GPIO_DIR_MODE_HW 0x00000002 // Pin is a peripheral function //***************************************************************************** // // Values that can be passed to GPIOIntTypeSet as the ulIntType parameter, and // returned from GPIOIntTypeGet. // //***************************************************************************** #define GPIO_FALLING_EDGE 0x00000000 // Interrupt on falling edge #define GPIO_RISING_EDGE 0x00000004 // Interrupt on rising edge #define GPIO_BOTH_EDGES 0x00000001 // Interrupt on both edges #define GPIO_LOW_LEVEL 0x00000002 // Interrupt on low level #define GPIO_HIGH_LEVEL 0x00000007 // Interrupt on high level #define GPIO_DISCRETE_INT 0x00010000 // Interrupt for individual pins //***************************************************************************** // // Values that can be passed to GPIOPadConfigSet as the ulStrength parameter, // and returned by GPIOPadConfigGet in the *pulStrength parameter. // //***************************************************************************** #define GPIO_STRENGTH_2MA 0x00000001 // 2mA drive strength #define GPIO_STRENGTH_4MA 0x00000002 // 4mA drive strength #define GPIO_STRENGTH_8MA 0x00000004 // 8mA drive strength #define GPIO_STRENGTH_8MA_SC 0x0000000C // 8mA drive with slew rate control //***************************************************************************** // // Values that can be passed to GPIOPadConfigSet as the ulPadType parameter, // and returned by GPIOPadConfigGet in the *pulPadType parameter. // //***************************************************************************** #define GPIO_PIN_TYPE_STD 0x00000008 // Push-pull #define GPIO_PIN_TYPE_STD_WPU 0x0000000A // Push-pull with weak pull-up #define GPIO_PIN_TYPE_STD_WPD 0x0000000C // Push-pull with weak pull-down #define GPIO_PIN_TYPE_OD 0x00000009 // Open-drain #define GPIO_PIN_TYPE_OD_WPU 0x0000000B // Open-drain with weak pull-up #define GPIO_PIN_TYPE_OD_WPD 0x0000000D // Open-drain with weak pull-down #define GPIO_PIN_TYPE_ANALOG 0x00000000 // Analog comparator //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO); extern unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin); extern void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType); extern unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin); extern void GPIOPadConfigSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulStrength, unsigned long ulPadType); extern void GPIOPadConfigGet(unsigned long ulPort, unsigned char ucPin, unsigned long *pulStrength, unsigned long *pulPadType); extern void GPIOPinIntEnable(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins); extern long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked); extern void GPIOPinIntClear(unsigned long ulPort, unsigned char ucPins); extern void GPIOPortIntRegister(unsigned long ulPort, void (*pfnIntHandler)(void)); extern void GPIOPortIntUnregister(unsigned long ulPort); extern long GPIOPinRead(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal); extern void GPIOPinConfigure(unsigned long ulPinConfig); extern void GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeCAN(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeComparator(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeEPI(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeEthernetLED(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeEthernetMII(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeFan(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOInput(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOOutputOD(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeI2CSCL(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeI2S(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeLPC(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypePECIRx(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypePECITx(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypePWM(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeQEI(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeSSI(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeUSBAnalog(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeUSBDigital(unsigned long ulPort, unsigned char ucPins); extern void GPIODMATriggerEnable(unsigned long ulPort, unsigned char ucPins); extern void GPIODMATriggerDisable(unsigned long ulPort, unsigned char ucPins); extern void GPIOADCTriggerEnable(unsigned long ulPort, unsigned char ucPins); extern void GPIOADCTriggerDisable(unsigned long ulPort, unsigned char ucPins); //**************************************************************************** // // The definitions for GPIOPinConfigure previously resided in this file but // have been moved to pin_map.h and made part-specific (in other words, only // those definitions that are valid based on the selected part, as defined by // PART_, will be made available). For backwards compatibility, // pin_map.h is included here so that the expected definitions will still be // available (though part-specific now, so some that were previously available // but inappropriate for the given part will not be available). // //***************************************************************************** #ifndef DEPRECATED #include "pin_map.h" #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __GPIO_H__