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

📄 gumio.h

📁 老外的一个开源项目
💻 H
字号:
// Copyright (c) David Vescovi.  All rights reserved.
// Part of Project DrumStix
// Windows Embedded Developers Interest Group (WE-DIG) community project.
// http://www.we-dig.org
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------
//
//  Header: gumio.h
//
//  Defines common Gumstix IO associated types and constants.
//
//------------------------------------------------------------------------------
#ifndef _GUMIO_H_
#define _GUMIO_H_

#if __cplusplus
extern "C" {
#endif

typedef enum
{
	LED_OFF = 0,
    LED_ON,
    LED_TOGGLE
} DEBUG_LED_TYPE;

// The debug LED defined by me .. not Gumstix
// This LED is also used as the notification LED if the 
// LED notification driver is included.
#define DEBUG_LED_GPIO		GPIO_82			// Must be between GPIO_64 and GPIO_84!
#define NOTIFY_LED0_GPIO	GPIO_82			// debug and notify led is the same Must be between GPIO_64 and GPIO_84!
// Debug LED must be wired like this:
// Rx should be approx 15Oohms for Vcc of 3.3v
/*
     +VCC /
          |
          |
          --  
          \/
         ----
          |
		  \
		  / Rx
		  \
		  /
		  |
   GPIO --
*/


//
// GPIO used in the system
// defined by Gumstix for peripheral support
//

// CF use
// slot 0
#define GPIO_4_S0_BVD1			GPIO_4			// input (mostly)
#define GPIO_36_S0_BVD2			GPIO_36			// input (mostly)
#define GPIO_8_CFRESET			GPIO_8			// output
#define GPIO_11_S0_nCARD_DETECT	GPIO_11			// input
#define GPIO_26_S0_READY_nIREQ	GPIO_26			// input

// slot 1
#define GPIO_18_S1_BVD1			GPIO_18			// input (mostly)
// S1_BVD2 not used
#define GPIO_27_S1_READY_nIREQ	GPIO_27			// input

// Note: other GPIO used as set in alt config as needed to support
// Card Bus implementation.


// MMC use
// clock is brought out in two places. GPIO 53 and 6
// 6 is local to the gumstix basic CPU board,
// 53 is for connex CPU (used with netMMC and netDUO).
// netMMC uses GPIO 54 as Card Detect.
// basic uses GPIO 22 (6 WP?)
//
//Note: There are multiple problems in trying to get hardware card detect to
// work across all combonations of hardware so I settled on a software 
// sense method. No support for "hot" inserting anymore. DV 12/19/06
#define GPIO_54_nCDMMC			GPIO_54			// input
#define GPIO_22_nCDMMC			GPIO_22			// input
// 8 is CS0
// Note: other GPIO used as set in alt config as needed to support
// MMC implementation.
//  
// SD_DAT1   GPIO[21]
// SD_DAT2   GPIO[12]
// SD_CD     GPIO[11]
// MM_CS0    GPIO[8]
// MM_CLK    GPIO[6] or GPIO[53]
// MM_CMD    MM_CMD
// MM_DAT    MM_DAT
  


// Eth1
//uses CS1 GPIO_15
//nPWE GPIO_49
#define GPIO_36_E1INTR			GPIO_36		// input
#define GPIO_80_E1RESET			GPIO_80		// output

// Eth2
//uses CS2 GPIO_78
//nPWE GPIO_49
#define GPIO_27_E2INTR			GPIO_27		// input
#define GPIO_52_E2RESET			GPIO_52		// output

// Note:CS1 and CS2 timing set in startup.s see gumstix.inc
#define MSCX_ETHTIMING			(0x128C)	// Chip select timing

// USB
#define GPIO_35_CABLE_DETECT	GPIO_35		// input
//(GPIOn)
#define GPIO_41_USB_CONTROL		GPIO_41		// input then output
//(GPIOx)

// BT
#define GPIO_7_nBTRESET			GPIO_7		// output
#define GPIO_12_BT32khzCLK		GPIO_12		// 32khz clock output

// Audio
#define GPIO_16_AUINTR			GPIO_16		// input


// function prototypes
// Driver inits
BOOL OEMInitCF(BOOL dualSlot); 
BOOL OEMInitMMC(BOOL netMMC); 
BOOL OEMInitEth(UINT32 GumEthDevice); 
BOOL OEMInitUart(UINT32 UARTPhysAddr);
BOOL OEMInitBT(UINT32 btModule); 
BOOL OEMInitUSBFN(void); 
BOOL OEMInitAC97(void);
BOOL OEMInitLCD(void);
BOOL OEMInitPWM(UINT32 PwmDevice); 

// Common IO
void OEMReset(void);
BOOL OEMGetRealTime(LPSYSTEMTIME pSysTime);
BOOL OEMResetEth(UINT32 GumEthDevice); 
BOOL OEMInitLED(void);
void OEMInitDebugLED(void);
void OALStall(UINT32 microSeconds);
void OALSpinForever(void);

// debugserial
void InitDebugSerial(UINT32 DbgSerPhysAddr); 
void SpinForDebugKey(void);


//AC97 bus
// Name of mutex for shared ac97 bus registers access
#define AC97_MUTEX_NAME			TEXT("AC97_MUTEX")	

BOOL InitAC97(BOOL InPowerHandler);
BOOL DeInitAC97(BOOL InPowerHandler);
BOOL GetAC97Lock(void);
BOOL ReleaseAC97Lock(void);
BOOL WriteAC97(UINT8 Offset, UINT16 Data);
BOOL ReadAC97(UINT8 Offset, UINT16 *pData);
BOOL ColdResetAC97(void);
BOOL WriteAC97Raw(UINT8 Offset, UINT16 Data);
BOOL ReadAC97Raw(UINT8 Offset, UINT16 *pData);

// UCB1400 GPIO
BOOL UcbIoInit(void);
BOOL UcbIoDeinit(void);
BOOL UcbIoGetDirection(UINT16 *val);
BOOL UcbIoSetDirection(UINT16 mask, UINT16 OUTin);
BOOL UcbIoGetLevel(UINT16 *val);
BOOL UcbIoSetLevel(UINT16 mask, UINT16 HIlo);


// DMA channels
#define DMA_CH_OUT 1
#define DMA_CH_RCV 4
#define DMA_CH_MIC 5
#define DMA_CHMAP_AC97_MIC       8          // DRCMR8  - map dma channel for AC97 microphone
#define DMA_CHMAP_AC97_MDMRCV    9          // DRCMR9  - map dma channel for AC97 modem receive
#define DMA_CHMAP_AC97_MDMOUT   10          // DRCMR10 - map dma channel for AC97 modem out
#define DMA_CHMAP_AC97_RCV      11          // DRCMR11 - map dma channel for AC97 pcm receive
#define DMA_CHMAP_AC97_OUT      12          // DRCMR12 - map dma channel for AC97 pcm output

#define DMAC_AC97AUDIOXMIT  (0x1 << DMA_CH_OUT)
#define DMAC_AC97AUDIORCV   (0x1 << DMA_CH_RCV)
#define DMAC_AC97MIC        (0x1 << DMA_CH_MIC)

#define DMA_AUDIO_INTR      (DMAC_AC97AUDIOXMIT | DMAC_AC97AUDIORCV | DMAC_AC97MIC)
#define DMA_BVDCI_INTR      (0x1 << DMA_CH_CAM)


//------------------------------------------------------------------------------

#if __cplusplus
}
#endif

#endif 

⌨️ 快捷键说明

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