⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 davincihd_gpio.h

📁 用于dm6467 开发平台的uboot源码
💻 H
字号:
/*
 *  Copyright 2007 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 */

/*
 *  GPIO header file
 *
 */

#ifndef GPIO_
#define GPIO_

#ifdef __cplusplus
extern "C" {
#endif

#include "davincihd.h"

/* ------------------------------------------------------------------------ *
 *  Direction                                                               *
 * ------------------------------------------------------------------------ */
#define GPIO_IN                 1
#define GPIO_OUT                0

/* ------------------------------------------------------------------------ *
 *  GPIO ID                                                                 *
 * ------------------------------------------------------------------------ */
#define GPIO0                   0x00
#define GPIO1                   0x01
#define GPIO2                   0x02
#define GPIO3                   0x03
#define GPIO4                   0x04
#define GPIO5                   0x05
#define GPIO6                   0x06
#define GPIO7                   0x07
#define GPIO8                   0x08
#define GPIO9                   0x09

#define GPIO10                  0x0A
#define GPIO11                  0x0B
#define GPIO12                  0x0C
#define GPIO13                  0x0D
#define GPIO14                  0x0E
#define GPIO15                  0x0F
#define GPIO16                  0x10
#define GPIO17                  0x11
#define GPIO18                  0x12
#define GPIO19                  0x13

#define GPIO20                  0x14
#define GPIO21                  0x15
#define GPIO22                  0x16
#define GPIO23                  0x17
#define GPIO24                  0x18
#define GPIO25                  0x19
#define GPIO26                  0x1A
#define GPIO27                  0x1B
#define GPIO28                  0x1C
#define GPIO29                  0x1D

#define GPIO30                  0x1E
#define GPIO31                  0x1F
#define GPIO32                  0x20
#define GPIO33                  0x21
#define GPIO34                  0x22
#define GPIO35                  0x23
#define GPIO36                  0x24
#define GPIO37                  0x25
#define GPIO38                  0x26
#define GPIO39                  0x27

#define GPIO40                  0x28
#define GPIO41                  0x29
#define GPIO42                  0x2A
#define GPIO43                  0x2B
#define GPIO44                  0x2C
#define GPIO45                  0x2D
#define GPIO46                  0x2E
#define GPIO47                  0x2F

/* ------------------------------------------------------------------------ *
 *  GPIO Controller                                                         *
 * ------------------------------------------------------------------------ */
#define GPIO_BASE               0x01c67000
#define GPIO_PCR                *( volatile Uint32* )( GPIO_BASE + 0x4 )
#define GPIO_BINTEN             *( volatile Uint32* )( GPIO_BASE + 0x8 )

/* ------------------------------------------------------------------------ *
 *  GPIO[0:31]                                                              *
 * ------------------------------------------------------------------------ */
#define GPIO_01_BASE            ( GPIO_BASE + 0x10 )
#define GPIO_DIR01              *( volatile Uint32* )( GPIO_01_BASE + 0x00 )
#define GPIO_OUT_DATA01         *( volatile Uint32* )( GPIO_01_BASE + 0x04 )
#define GPIO_SET_DATA01         *( volatile Uint32* )( GPIO_01_BASE + 0x08 )
#define GPIO_CLR_DATA01         *( volatile Uint32* )( GPIO_01_BASE + 0x0c )
#define GPIO_IN_DATA01          *( volatile Uint32* )( GPIO_01_BASE + 0x10 )
#define GPIO_SET_RIS_TRIG01     *( volatile Uint32* )( GPIO_01_BASE + 0x14 )
#define GPIO_CLR_RIS_TRIG01     *( volatile Uint32* )( GPIO_01_BASE + 0x18 )
#define GPIO_SET_FAL_TRIG01     *( volatile Uint32* )( GPIO_01_BASE + 0x1c )
#define GPIO_CLR_FAL_TRIG01     *( volatile Uint32* )( GPIO_01_BASE + 0x20 )
#define GPIO_INSTAT01           *( volatile Uint32* )( GPIO_01_BASE + 0x24 )

/* ------------------------------------------------------------------------ *
 *  GPIO[32:47]                                                             *
 * ------------------------------------------------------------------------ */
#define GPIO_23_BASE            ( GPIO_01_BASE + 0x28 )
#define GPIO_DIR23              *( volatile Uint32* )( GPIO_23_BASE + 0x00 )
#define GPIO_OUT_DATA23         *( volatile Uint32* )( GPIO_23_BASE + 0x04 )
#define GPIO_SET_DATA23         *( volatile Uint32* )( GPIO_23_BASE + 0x08 )
#define GPIO_CLR_DATA23         *( volatile Uint32* )( GPIO_23_BASE + 0x0c )
#define GPIO_IN_DATA23          *( volatile Uint32* )( GPIO_23_BASE + 0x10 )
#define GPIO_SET_RIS_TRIG23     *( volatile Uint32* )( GPIO_23_BASE + 0x14 )
#define GPIO_CLR_RIS_TRIG23     *( volatile Uint32* )( GPIO_23_BASE + 0x18 )
#define GPIO_SET_FAL_TRIG23     *( volatile Uint32* )( GPIO_23_BASE + 0x1c )
#define GPIO_CLR_FAL_TRIG23     *( volatile Uint32* )( GPIO_23_BASE + 0x20 )
#define GPIO_INSTAT23           *( volatile Uint32* )( GPIO_23_BASE + 0x24 )

/* ------------------------------------------------------------------------ *
 *  GPIO Interface                                                          *
 * ------------------------------------------------------------------------ */
typedef struct {
    volatile Uint32 DIR;
    volatile Uint32 OUT_DATA;
    volatile Uint32 SET_DATA;
    volatile Uint32 CLR_DATA;
    volatile Uint32 IN_DATA;
    volatile Uint32 SET_RIS_TRIG;
    volatile Uint32 CLR_RIS_TRIG;
    volatile Uint32 SET_FAL_TRIG;
    volatile Uint32 CLR_FAL_TRIG;
    volatile Uint32 INTSTAT;
} GPIO_REGS;

typedef struct {
    GPIO_REGS* regs;
} GPIO_OBJ;

static GPIO_OBJ GPIO_MODULE_01 = { ( GPIO_REGS* )GPIO_01_BASE };
static GPIO_OBJ GPIO_MODULE_23 = { ( GPIO_REGS* )GPIO_23_BASE };

typedef GPIO_OBJ* GPIO_Handle;

/* ------------------------------------------------------------------------ *
 *  Prototypes                                                              *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIHD_GPIO_init         ( );
Int16 DAVINCIHD_GPIO_setDirection ( Uint16 number, Uint8 direction );
Int16 DAVINCIHD_GPIO_setOutput    ( Uint16 number, Uint8 output );
Int16 DAVINCIHD_GPIO_getInput     ( Uint16 number );

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -