syslynx.c

来自「cpc-1631的BSP包for VxWorks操作系统」· C语言 代码 · 共 52 行

C
52
字号
/* sysLynx.c - bsp initialization code for pcPentium and pcPentiumpro */

/*
modification history
--------------------
01a,29jun01,dmh first draft released to the wild
*/

#include <vxWorks.h>
#include <intLib.h>
#define SILICONMOTION_VENDOR_ID 0x126f
#define LYNX_DEVICE_ID          0x0712

extern STATUS  sysMmuMapAdd (void * address, UINT len,
                             UINT initialStateMask,
                             UINT initialState);

extern int * smiBaseAddress;

/* must be called after pciConfigLibInit and before sysSerialHwInit
   (well before mmuLibInit but that's getting picky) */

void sysLynxInit() 
{
    int bus, device, function;
    int bar0;

	/*I/O command*/
	vt82c686PciConfigWrite( 0,18,0,0x4,1,0x1f);
	/*FrameBuffer base address*/
	vt82c686PciConfigWrite( 0,18,0,0x10,4,PCI_SM712_MEMADDR);

	
    if(pciFindDevice (SILICONMOTION_VENDOR_ID, LYNX_DEVICE_ID, 0,
		      &bus, &device, &function) != ERROR)
	{
	    pciConfigInLong(bus, device, function,
			    PCI_CFG_BASE_ADDRESS_0, &bar0);

	    sysMmuMapAdd((int*)bar0, 0x1000000,
			 VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE 
			 | VM_STATE_MASK_CACHEABLE,
			 VM_STATE_VALID | VM_STATE_WRITABLE 
			 | VM_STATE_CACHEABLE_NOT);
            smiBaseAddress = (int*)bar0;

	}
	
	/*smiBaseAddress = (int*)PCI_SM712_MEMADDR;*/

}

⌨️ 快捷键说明

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