📄 omap730_gspx.h
字号:
#ifndef _OMAP730_GSPX_H_
#define _OMAP730_GSPX_H_
#include <windows.h>
#include <omap730.h>
#include <ceddk.h>
#include <ceddkex.h>
#include <gpio.h>
#include <NKintr.h>
#define GPIO_SPI_CS 132
#define GPIO_SPI_INT 133
#define BSP_GPIO_WlanPower 134
#define BSP_GPIO_WlanPowerDown 142
#define BSP_GPIO_WlanReset 68
#define BSP_GPIO_WlanIRQ 144
#ifdef DEBUG
#define DBG_DEFAULT_DX 0xffff
#define DBG_MSG_MARKER TEXT("GSPX")
#define MAX_BUF_DUMP_SIZE 256
// WindowsCE debug zones
#define ZONE_INIT DEBUGZONE(0)
#define ZONE_INTR DEBUGZONE(1)
#define ZONE_XMIT DEBUGZONE(2)
#define ZONE_RCV DEBUGZONE(3)
#define ZONE_FUNC DEBUGZONE(4)
#define ZONE_MISC DEBUGZONE(5)
#define ZONE_XX06 DEBUGZONE(6)
#define ZONE_XX07 DEBUGZONE(7)
#define ZONE_XX08 DEBUGZONE(8)
#define ZONE_XX09 DEBUGZONE(9)
#define ZONE_XX10 DEBUGZONE(10)
#define ZONE_XX11 DEBUGZONE(11)
#define ZONE_XX12 DEBUGZONE(12)
#define ZONE_XX13 DEBUGZONE(13)
#define ZONE_WARN DEBUGZONE(14)
#define ZONE_ERROR DEBUGZONE(15)
#ifdef DBG_LOG_FILE
#define DEBUG_INIT() {LogFile =_wfreopen(TEXT("GspxDbg.txt"), TEXT("w"), stdout);}
#define DEBUG_HALT() if (LogFile) {fflush(LogFile); fclose(LogFile);}
#define DEBUG_FLUSH_FILE() {if (LogFile) fflush(LogFile);}
#undef DEBUGMSG
#define DEBUGMSG(cond, printf_exp) \
if (cond) { \
_tprintf(DBG_MSG_MARKER TEXT(" %d "), GetTickCount()); \
_tprintf printf_exp; \
}
#else // DBG_LOG_FILE
#define DEBUG_INIT()
#define DEBUG_HALT()
#define DEBUG_FLUSH_FILE()
#endif // DBG_LOG_FILE
static __inline DEBUGBUF(UINT cond, TCHAR *msg, PUCHAR buf, int size)
{
if (cond)
{
char str[3*MAX_BUF_DUMP_SIZE+1];
UCHAR *p = (PUCHAR)buf;
char *q = str;
int i;
for (i = 1; i <= min(size, MAX_BUF_DUMP_SIZE); i++)
{
if ((i & 0x0f) == 0) //16 bytes per line
sprintf(q, "%02x\n", *p++);
else
sprintf(q, "%02x ", *p++);
q += 3;
}
*(--q) = 0;
if (size > 16)
{
DEBUGMSG(cond, (TEXT("%s\n%hs\n"), msg, str));
}
else
{
DEBUGMSG(cond, (TEXT("%s %hs\n"), msg, str));
}
}
}
#else // DEBUG
#define DEBUG_INIT()
#define DEBUG_HALT()
#define DEBUG_FLUSH_FILE()
#define DEBUGBUF(cond, msg, buf, size)
#endif // DEBUG
typedef BOOL (*ISTFUNC) (LPVOID pIstParam);
//Interrupt service information
//
typedef struct _INTS_INFO
{
HANDLE hIntrEvent;
HANDLE hIstThread;
DWORD dwSysIntID;
BOOL bQuitIst;
LPVOID pIstParam; //parameter
ISTFUNC istFunc; //IST function pointer
BOOL bDriverShutdown; //The driver shutdown or not. FALSE: No, TRUE:Yes
}INTS_INFO, *PINTS_INFO;
//inferrupt call back
typedef int (*ISRFUNC) (void* hIsrParam);
// Hardware parameters structure.
//
typedef struct _GSPI_HW_INFO
{
// spi controller registers.
OMAP730_SPI_REGS *pSPIRegs;
OMAP730_CONFIG_REGS *pConfigRegs;
HANDLE hGPIO;
DWORD SysIntr;
INTS_INFO IntsInfo;
HANDLE hIsrParam;
ISRFUNC isrFunc;
}GSPI_HW_INFO, *PGSPI_HW_INFO;
void ClearInterrupt(PINTS_INFO pIntrInfo);
int Omap_interrupt_initialize(PGSPI_HW_INFO pHC);
PVOID Omap_gspx_init(VOID);
void Omap_gspx_deinit(PVOID pHC);
void Omap730_PowerDownWlan(void);
void Omap730_PowerOnWlan(void);
int Omap_gspx_read_reg16(PVOID pHC, USHORT reg, USHORT *data);
int Omap_gspx_write_reg16(PVOID pHC, USHORT reg, USHORT data);
BOOL Omap_gspx_read_reg32(PVOID pHC, USHORT reg, ULONG *data);
BOOL Omap_gspx_write_reg32(PVOID pHC, USHORT reg, ULONG data);
void Omap_gspx_read_mem(PVOID pHC, USHORT reg, USHORT size, UCHAR *data);
void Omap_gspx_write_mem(PVOID pHC, USHORT reg, USHORT size, UCHAR *data);
ULONG Omap_gspx_get_sysintr(void);
DWORD Omap_gspi_register_isr( PGSPI_HW_INFO pGspiHwIfo, void* Adapter, ISRFUNC isrFunc);
#endif //_OMAP730_GSPX_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -