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

📄 nwait.c

📁 这是三星公司的arm7 s3c44b0x芯片的所有外设中断程序
💻 C
字号:
//44BTEST : nwait.c
#include <string.h>
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\idle.h"
void WaitRd8(void);
void WaitWr8(void);
void WaitRd32(void);
void WaitWr32(void);
void WaitRd16(void);
void WaitWr16(void);
#define BUS8 (0)
#define BUS16 (1)
#define BUS32 (2)
#define ENWAIT (1)
#define SRAMBE03 (1)
#define B2_Tacs (0x0) //0clk
#define B2_Tcos (0x0) //0clk
#define B2_Tacc (0x2) //3clk
#define B2_Tcoh (0x0) //0clk
#define B2_Tah (0x0) //0clk
#define B2_Tacp (0x0) //2clk
#define B2_PMC (0x0) //no page mode
// Work-around with nWAIT.
void Test_WaitPin(void)
{
	rPCONF=rPCONF&(~(3<<4))|(2<<4); //nWAIT pin is selected.
	rPUPF=0x0;
	rPCONE=rPCONE&(~(3))|(3); //PE0=CLKOUT
	//WaitRd32();
	//WaitWr32();
	//WaitRd16();
	//WaitWr16();
	WaitRd8();
	//WaitWr8();
}
void WaitRd8(void)
{
	U8 readVal;
	int i;
	Uart_Printf("nGCS2,8-bit,read,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS8<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	readVal=(*(volatile U8 *)0x4000000);
	Uart_Printf("read_data=%x\n",readVal);
}
void WaitWr8(void)
{
	U8 writeVal=0xaa;
	int i;
	Uart_Printf("nGCS2,8-bit,write,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS8<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	*((volatile U8 *)0x4000000)=writeVal;
}
void WaitRd16(void)
{
	U16 readVal;
	int i;
	Uart_Printf("nGCS2,16-bit,read,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS16<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	readVal=(*(volatile U16 *)0x4000000);
	Uart_Printf("read_data=%x\n",readVal);
}
void WaitWr16(void)
{
	U32 writeVal=0xaaaa;
	int i;
	Uart_Printf("nGCS2,16-bit,write,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS16<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	*((volatile U16 *)0x4000000)=writeVal;
}
void WaitRd32(void)
{
	U32 readVal;
	int i;
	Uart_Printf("nGCS2,32-bit,read,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS32<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	readVal=(*(volatile U32 *)0x4000000);
	Uart_Printf("read_data=%x\n",readVal);
}
void WaitWr32(void)
{
	U32 writeVal=0xaaaa;
	int i;
	Uart_Printf("nGCS2,32-bit,write,nWAIT Test.\n");
	Uart_Printf("nWAIT/PF2 pin is configured as nWAIT pin.\n");
	rBWSCON=rBWSCON & ~(0xf<<8)|(BUS32<<8)|(ENWAIT<<10); //nGCS2
	rBANKCON2=((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC));
	rNCACHBE0=( (0x6000000>>12)<<16 )|(0x4000000>>12);
	for(i=0;i<2;i++); //wait until the bank configuration is in effect.
	*((volatile U32 *)0x4000000)=writeVal;
}

⌨️ 快捷键说明

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