📄 docapp.c
字号:
#include "vxWorks.h"
#include "config.h"
#include "blkIo.h"
#include "ioLib.h"
#include "iosLib.h"
#include "memLib.h"
#include "errnoLib.h"
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "dosFsLib.h"
#include "stat.h"
#include "time.h"
#include "usrLib.h"
#include "blkIo.h"
#include "../../rmm/include/boardInit.h"
/* DiskOnChip driver's configuration variables. See Chapter 4
in driver's Readme for details */
/* #include "docsys.h" */
/* #include "docsysp.h" */
extern unsigned char flUse8bit;
extern unsigned char flUseNFTLCache;
extern int fl_useDebug;
extern int flMplusAccessType;
extern int flDocAccessType;
extern int flBufferAlignment;
extern void tffsSetup (int diskonchips, long *addressRange);
extern STATUS msystems_tffsDrv (void);
extern BLK_DEV * msystems_tffsDevCreate (int deviceNo, int removableMediaFlag);
/* forward declarations */
void devSplit (char *fullFileName, char *devName);
extern unsigned msystems_noOfDrives;
#define TFFS_OPT_8BIT_ACCESS 2 /* TRUE or FALSE (default) */
#define TFFS_OPT_NO_ADDR_SHIFT 0x00000000
#define TFFS_OPT_BUS_8BIT_ACCESS 0x00000001
#define TFFS_OPT_ACCESS_TYPE 13 /* see allowed values below */
extern STATUS tffsSetOption (int option, void *pVal);
extern STATUS tffsSetSocketOption (int socNo, int option, void *pVal);
/* long tffsAddresses1[] = { 0xff000000, 0xff001fff }; */
/* extern long tffsAddresses[]; */
#define UBYTE unsigned char
extern ULONG GetDevBaseAddr(ULONG ulDevIndex, ULONG *p_ulBaseAddr);
/* long tffsAddresses[]; */
STATUS docinit(int value, unsigned long *tffsAddresses)
{
int totalSockets;
int iSocket;
int iDisk;
int handle;
int flags;
int val;
int tmp;
/* int xxx; */ /* mask by zoutl 2003-3-21 10:25*/
unsigned long ocAddress,docSize ;
BLK_DEV * tffs_blk_dev;
DOS_VOL_DESC * dosFs_vol;
iSocket = 0;
iDisk = 0;
/*
if (OK != GetDevBaseAddr(DEV_FLASH, (unsigned long *)&xxx))
{
return(ERROR);
}
tffsAddresses[0]=xxx;
tffsAddresses[1]=xxx;
*/ /* mask by zoutl 2003-3-21 10:33 */
tffsSetup (1, tffsAddresses);
tmp = TRUE;
if( tffsSetOption(TFFS_OPT_8BIT_ACCESS, &tmp) == ERROR)
{
printf("TFFS_OPT_8BIT_ACCESS is error!\n");
}
val = TFFS_OPT_NO_ADDR_SHIFT | TFFS_OPT_BUS_8BIT_ACCESS ;
if( tffsSetSocketOption(0, TFFS_OPT_ACCESS_TYPE, &val) != OK )
{
printf("tffsSetSocketOption fail !\n") ;
return(ERROR) ;
/* error */
}
if( msystems_tffsDrv() != OK )
{
printf("msystem is error when run msystems_tffsDrv!!!");
return (ERROR);
}
if(value==1)
{
if( msystems_tffsDevFormat(0, 0) != OK )
{
printf("msystems_tffsDevFormat is error \n");
}
}
/*printf("msystems_tffsDevFormat is over\n");*/
/* make TFFS handle */
/* handle = tffsMakeHandle (iSocket, iDisk);*/
/* specify 'flags' */
/* flags = 0 */ /* FL_CHK_FORMAT | FL_VERIFY_WRITE2 */;
/*totalSockets = tffsSockets ();*/
/*
* Assuming support for long file names has not been enabled,
* create 'block device' for iDisk of iSocket
*/
/* if(pci1200==1)
dosFsInit (NUM_DOSFS_FILES);*/
tffs_blk_dev = msystems_tffsDevCreate (0, 0);
/* 'tffs_blk_dev' has been defined in Section 2.12.1 */
dosFs_vol = dosFsDevInit ("/msys0/", tffs_blk_dev, NULL);
dosFsVolOptionsSet (dosFs_vol,
dosFs_vol->dosvd_options | DOS_OPT_CHANGENOWARN);
/* dosFsConfigShow("/msys0/");*/
/* if( tffsDiskFormat(0, 0) != OK )
{
printf("tffsDiskFormat is error \n");
} */
}
void testDOC(void)
{
int jj,i,xxx;
unsigned char * docAdrr;
unsigned char temp,temp1,temp2,temp3;
unsigned char read[256];
UBYTE *DOC_REG1000;
UBYTE *DOC_REG1002;
UBYTE *DOC_REG1004;
UBYTE *DOC_REG1006;
UBYTE *DOC_REG1008;
UBYTE *DOC_REG1046;
UBYTE *DOC_REG1076;
UBYTE *DOC_REG1FFF;
UBYTE *DOC_DATA0000;
/*docAdrr =(unsigned char * ) 0xff001fff;
temp = *docAdrr;
temp =*docAdrr;
temp =*docAdrr;
temp =*docAdrr;*/
if (OK != GetDevBaseAddr(DEV_FLASH, (unsigned long *)&xxx))
{
return(ERROR);
}
DOC_DATA0000 = (UBYTE *)(xxx);
DOC_REG1000=(UBYTE *)(xxx+0x1000);
DOC_REG1002=(UBYTE *)(xxx+0x1002);
DOC_REG1004=(UBYTE *)(xxx+0x1004);
DOC_REG1006=(UBYTE *)(xxx+0x1006);
DOC_REG1008=(UBYTE *)(xxx+0x1008);
DOC_REG1046=(UBYTE *)(xxx+0x1046);
DOC_REG1076=(UBYTE *)(xxx+0x1076);
DOC_REG1FFF=(UBYTE *)(xxx+0x1FFF);
/*for(jj = 0; jj < 100000 ; jj++ );*/
/* Set DiskOnChip Millennium Plus to reset mode */
/* *DOC_REG1006=0x1c; *//* to DiskOnChip Control Register */
/* *DOC_REG1076=0xe3; *//* to DiskOnChip Control Confirmation Register */
/* Set DiskOnChip Millennium Plus to Normal mode */
*DOC_REG1006=0x1d; /* to DiskOnChip Control Register */
*DOC_REG1076=0xe2; /* to DiskOnChip Control Confirmation Register */
/* Verify that DiskOnChip is in Normal mode. */
temp=*DOC_REG1006;
printf("DOC ID is :%d \r\n",temp ) ;
temp1 = *DOC_REG1046 ;
temp2 = *DOC_REG1046 ;
temp3 = *DOC_REG1046 ;
printf("temp1 = %d ,temp2 = %d ,temp3= %d \r\n",temp1,temp2,temp3) ;
for(i=0;i<256;i++)
read[i]=*(DOC_REG1000+i);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -