csl_gpio.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 518 行 · 第 1/2 页
H
518 行
/** @mainpage GPIO CSL 3.x
*
* @section Introduction
*
* @subsection xxx Purpose and Scope
* The purpose of this document is to describe the common API's and data
* structures for the GPIO module.
*
* @subsection aaa Terms and Abbreviations
* -# CSL: Chip Support Library
* -# API: Application Programmer Interface
*
* @subsection References
* -# CSL-001-DES, CSL 3.x Design Specification DocumentVersion 1.02
* -# Chapter 21, General Purpose Input Output, OMAP 1611/12 TRM
*
*/
/** @file csl_gpio.h
*
* @brief Header file for functional layer of CSL
*
* Description
* - The different enumerations, structure definitions
* and function declarations
*
* Modification 1
* - modified on: 15/06/2004
* - reason: Created the sources
*
* @date 15th June, 2004
* @author Prakash V. Gudnavar.
*
*/
#ifndef _CSL_GPIO_H_
#define _CSL_GPIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl.h>
#include <cslr_gpio.h>
/**************************************************************************\
* GPIO global macro declarations
\**************************************************************************/
#define CSL_GPIO_DIR_INPUT 1
#define CSL_GPIO_DIR_OUTPUT 0
#define CSL_GPIO_PIN1 0x1
#define CSL_GPIO_PIN2 0x2
#define CSL_GPIO_PIN3 0x4
#define CSL_GPIO_PIN4 0x8
#define CSL_GPIO_PIN5 0x10
#define CSL_GPIO_PIN6 0x20
#define CSL_GPIO_PIN7 0x40
#define CSL_GPIO_PIN8 0x80
#define CSL_GPIO_PIN9 0x100
#define CSL_GPIO_PIN10 0x200
#define CSL_GPIO_PIN11 0x400
#define CSL_GPIO_PIN12 0x800
#define CSL_GPIO_PIN13 0x1000
#define CSL_GPIO_PIN14 0x2000
#define CSL_GPIO_PIN15 0x4000
#define CSL_GPIO_PIN16 0x8000
#define CSL_GPIO_PINALL 0xffff
/**************************************************************************\
* GPIO global typedef declarations
\**************************************************************************/
/**
* @brief The config-structure
*
* Used to configure the GPIO using CSL_gpioHwSetupRaw(..)
*/
typedef struct {
Uint32 SYSCONFIG;
Uint32 IRQENABLE1;
Uint32 IRQENABLE2;
Uint32 WAKEUPENABLE;
Uint32 DATAOUT;
Uint32 DIRECTION;
Uint32 EDGE_CTRL1;
Uint32 EDGE_CTRL2;
} CSL_GpioConfig;
/**
* @brief Default values for the config-structure
*/
#define CSL_GPIO_CONFIG_DEFAULTS { \
CSL_GPIO_SYSCONFIG_RESETVAL, \
CSL_GPIO_IRQENABLE1_RESETVAL, \
CSL_GPIO_IRQENABLE2_RESETVAL, \
CSL_GPIO_WAKEUPENABLE_RESETVAL, \
CSL_GPIO_DATAOUT_RESETVAL, \
CSL_GPIO_DIRECTION_RESETVAL, \
CSL_GPIO_EDGE_CTRL1_RESETVAL, \
CSL_GPIO_EDGE_CTRL2_RESETVAL, \
}
/** @brief This object contains the reference to the instance of GPIO opened
* using the @a CSL_gpioOpen().
*
* The pointer to this, is passed to all GPIO CSL APIs.
*/
typedef struct CSL_GpioObj {
/** This is a pointer to the registers of the instance of GPIO
* referred to by this object
*/
CSL_GpioRegsOvly regs;
/** This is the instance of GPIO being referred to by this object */
CSL_InstNum perNum;
} CSL_GpioObj;
typedef struct CSL_GpioObj *CSL_GpioHandle;
/** @brief This will have the base-address information for the peripheral
* instance
*/
typedef struct {
/** Base-address of the Configuration registers of the peripheral
*/
CSL_GpioRegsOvly regs;
} CSL_GpioBaseAddress;
/** @brief Module specific parameters. Present implementation doesn't have
* any module specific parameters.
*/
typedef struct{
/** Bit mask to be used for module specific parameters.
* The below declaration is just a place-holder for future
* implementation.
*/
CSL_BitMask16 flags;
} CSL_GpioParam;
/** @brief Module specific context information. Present implementation doesn't have
* any Context information.
*/
typedef struct {
/** Context information of GPIO.
* The below declaration is just a place-holder for future
* implementation.
*/
Uint16 contextInfo;
} CSL_GpioContext;
/** @brief Enumeration for idle modes
*
* This is used to set GPIO idle mode through CSL_GPIO_CMD_SET_IDLE_MODE command.
*/
typedef enum {
/** An idle is acknowledged unconditionally. */
CSL_GPIO_IDLEMODE_FORCE_IDLE = 0,
/** An idle request is never acknowledged. */
CSL_GPIO_IDLEMODE_NO_IDLE ,
/** The acknowledgement to an idle request is given based on the internal activity. */
CSL_GPIO_IDLEMODE_SMART_IDLE
} CSL_GpioIdleMode;
/** @brief Enumeration for queries passed to @a CSL_gpioGetHwStatus()
*
* This is used to get the status of different operations or to get the
* existing setup of GPIO.
*/
typedef enum {
/** Get GPIO revision (response type: @a Uint16 *)*/
CSL_GPIO_QUERY_REVISION = 1,
/** Get the reset status (response type: @a CSL_GpioResetStatus *) */
CSL_GPIO_QUERY_RESET_STATUS ,
/** Get the interrupt status (line 1) (response type: @a CSL_BitMask16 *) */
CSL_GPIO_QUERY_IRQ_STATUS1 ,
/** Get the interrupt status (line 2)(response type: @a CSL_BitMask16 *) */
CSL_GPIO_QUERY_IRQ_STATUS2,
/** Get IN data (response type: @a Uint16 * ; Use CSL_GPIO_PIN<n> macro to get data on pin n) */
CSL_GPIO_QUERY_DATAIN
} CSL_GpioHwStatusQuery;
/** @brief Enumeration for GPIO reset status.
*
*/
typedef enum {
/** Internal reset is ongoing */
CSL_GPIO_RESETSTATUS_ONGOING = 0,
/** Reset complete */
CSL_GPIO_RESETSTATUS_COMPLETE
} CSL_GpioResetStatus ;
/** @brief Enumeration for edge control type.
*
*/
typedef enum {
/** No edge detection */
CSL_GPIO_EDGE_NONE = 0,
/** Falling edge detection */
CSL_GPIO_EDGE_FALLING,
/** Rising edge detection */
CSL_GPIO_EDGE_RISING,
/** Both edges detection */
CSL_GPIO_EDGE_BOTH
} CSL_GpioEdge ;
/** @brief Structure that represents pin vector and edge control type.
*
* This is passed to @a CSL_gpioGetHwControl() when command is CSL_GPIO_CMD_SET_EDGE
*/
typedef struct {
Uint16 pinVector;
CSL_GpioEdge detect_type;
} CSL_GpioEdgeCtrl ;
/** @brief Enumeration for queries passed to @a CSL_gpioHwControl()
*
* This is used to select the commands to control the operations
* existing setup of GPIO. The arguments to be passed with each
* enumeration if any are specified next to the enumeration.
*/
typedef enum {
/** Reset the GPIO : no argument */
CSL_GPIO_CMD_RESET = 1,
/** Enable wakeup (Global): no argument */
CSL_GPIO_CMD_ENABLE_WAKEUP_GLOBAL ,
/** Disable wakeup (Global): no argument */
CSL_GPIO_CMD_DISABLE_WAKEUP_GLOBAL ,
/** Set the IDLE mode : argument @a (CSL_GpioIdleMode *) */
CSL_GPIO_CMD_SET_IDLE_MODE ,
/** Set the direction as IN for the pin vector : argument @a (Uint16 *) */
CSL_GPIO_CMD_SET_DIRECTION_IN ,
/** Set the direction as OUT for the pin vector: argument @a (Uint16 *) */
CSL_GPIO_CMD_SET_DIRECTION_OUT ,
/** Set data on a pin : argument @a (Uint16 *) */
CSL_GPIO_CMD_SET_DATA ,
/** Clear data on a pin : argument @a (Uint16 *) */
CSL_GPIO_CMD_CLEAR_DATA ,
/** Enable interrupts on line 1 : argument @a (Uint16 *) */
CSL_GPIO_CMD_ENABLE_INTERRUPT_LINE1 ,
/** Enable interrupts on line 2 : argument @a (Uint16 *) */
CSL_GPIO_CMD_ENABLE_INTERRUPT_LINE2 ,
/** Enable wakeup signal generation on pins: argument @a (Uint16 *) */
CSL_GPIO_CMD_ENABLE_WAKEUP ,
/** Disable wakeup signal generation on pins: argument @a (Uint16 *) */
CSL_GPIO_CMD_DISABLE_WAKEUP ,
/** Disable interrupts on line 1 : argument @a (Uint16 *) */
CSL_GPIO_CMD_DISABLE_INTERRUPT_LINE1 ,
/** Disble interrupts on line 2 : argument @a (Uint16 *) */
CSL_GPIO_CMD_DISABLE_INTERRUPT_LINE2 ,
/** Set edge control on pins: argument @a (CSL_GpioEdgeCtrl *) */
CSL_GPIO_CMD_SET_EDGE
} CSL_GpioHwControlCmd;
/**************************************************************************\
* GPIO global function declarations
\**************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?