#include <windows.h>
#include <ceddk.h>
#include <nkintr.h>
#include <DrvLib.h>
//#include "oal_intr.h"
#include <s3c6410.h> // for 6410
//#include <s3c6410_gpio.h>
//#include <s3c6410_base_regs.h>
//#include <s3c6410_spi.h>
//#include "pmplatform.h"
//#include "Pkfuncs.h"
//#include <bsp.h>
#include "SPI.h"
#define SPI0_POWER_ON (1<<21)
#define SPI1_POWER_ON (1<<22)
#define SPI_SCLK_ON (1<<20)
#define CPOL_RISING (0<<3)
#define CPOL_FALLING (1<<3)
#define CPHA_FORMAT_A (0<<2)
#define CPHA_FORMAT_B (1<<2)
#define HIGH_SPEED_MASK (1<<6)
#define HIGH_SPEED_DIS (0<<6)
#define HIGH_SPEED_EN (1<<6)
#define SPI_CLKSEL (0<<9)
#define SPI_ENCLK (1<<8)
#define SPI_SCALER (0x07)
#define MODE_DEFAULT 0x00000000
#define SW_RST (1<<5)
#define SPI_MASTER (0<<4)
#define SPI_SLAVE (1<<4)
#define ENCLK_DISABLE (0<<8)
#define CH_WIDTH_16BIT (0x1<<29)
#define BUS_WIDTH_16BIT (0x1<<17)
#define CH_WIDTH_32BIT (0x2<<29)
#define BUS_WIDTH_32BIT (0xe<<17)
#define SPI0 0
#define SPI1 1
#define SPI_SELECT SPI1
volatile S3C6410_GPIO_REG *pGPIOregs;
volatile S3C6410_SPI_REG *pSPIregs;
volatile S3C6410_SYSCON_REG *pSYSCONregs;
int g_iBusWidth=8; //位宽,8/16/32
PUCHAR readtempUCHAR; //8bit
PUCHAR writetempUCHAR; //8bit
PUSHORT readtempUSHORT; //16bit
PUSHORT writetempUSHORT; //16bit
PULONG readtempULONG; //32bit
PULONG writetempULONG; //32bit
BOOL WINAPI
DllEntry(HANDLE hinstDLL,
DWORD dwReason,
LPVOID Reserved/* lpvReserved */)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
DEBUGREGISTER((HINSTANCE)hinstDLL);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
#ifdef UNDER_CE
case DLL_PROCESS_EXITING:
break;
case DLL_SYSTEM_STARTED:
break;
#endif
}
return TRUE;
}
[ 此帖被danlei0120在2012-10-25 09:53重新编辑 ]