📄 drvfs_io.c
字号:
//---------------------------------------------------------------------------------
//
// Copyright (C) SEIKO EPSON CORP. 2004
//
// GROUP : SEE LSI
// FILE : drvFS_IO.c
// MODULE : storage module
// Function description : Driver-IO
// Revision history :
// Date userName Description
// 2004/04/15 David start
//
// Notes :
//
//---------------------------------------------------------------------------------
#include "drvFS_IO.h"
#include "c33l11.h"
#include "smt_ctl.h"
#include "smt.h"
extern unsigned char bSmtType;
/* MACRO define */
#define IO_PD5_SEL *(volatile unsigned char*)0x300F47
/****************************************************************************
DrvFS_IO_InitSmt()
----------------------------------------------------------------------------
description:
argument: (none)
return: (none)
input: (none)
output: (none)
flag: (none)
global: (none)
comment: (none)
****************************************************************************/
void DrvFS_IO_InitSmt(unsigned char ubSmtType)
{
/* CE14 as GPIO, output high, sdram operation will not affect */
IO_P54_SEL0 = 1;
IO_P54_DAT = 1;
IO_P54_CTL = 1;
IO_P24_SEL0 = 0; // CLE
IO_P24_SEL1 = 0;
IO_P24_DAT = 0;
IO_P24_CTL = 1;
IO_P25_SEL0 = 0; // ALE
IO_P25_SEL1 = 0;
IO_P25_DAT = 0;
IO_P25_CTL = 1;
IO_PD5_SEL &= 0xdf; // R/B
IO_P40_SEL0 = 1; // WP
IO_P40_CTL = 0;
IO_P34_SEL1 = 1; // #SMWE
IO_P35_SEL1 = 1; // #SMRE
if((ubSmtType == SMT_T_MCP) | (ubSmtType == SMT_T_ADV)){
IO_P51_SEL0 = 0; // MCP CE as CE15
//Device type inital
*(volatile unsigned char*)0x300103 = 0x01; // 1: 16bits 0: 8bits
*(volatile unsigned char* )0x48120 = 0x02; // Area 15-16 16bit
}
else{
//
IO_P51_SEL0 = 1; // CE15 as GPIO high
IO_P51_DAT = 1;
IO_P51_CTL = 1;
//Device type inital
*(volatile unsigned char*)0x300103 = 0x00; // 1: 16bits 0: 8bits
*(volatile unsigned char* )0x48120 = 0x42; // Area 15-16 8bit
}
/* select area15 as SMT/MCP mapping address */
IO_SMT_CE_SEL = 0;
}
/**** End of function *******************************************************/
/****************************************************************************
DrvFS_IO_SelSmt()
----------------------------------------------------------------------------
description:
SmatrMedia Device Selection
argument: (none)
return: (none)
input: (none)
output: (none)
flag: (none)
global: (none)
comment: (none)
****************************************************************************/
void DrvFS_IO_SelSmt(unsigned char ubSmtType )
{
/* SmartMedia*/
if((ubSmtType == SMT_T_MCP)|(ubSmtType == SMT_T_ADV)){
IO_P51_SEL0 = 0; // MCP CE as CE15
*(volatile unsigned char*)0x300103 = 0x01; // 1: 16bits 0: 8bits
*(volatile unsigned char* )0x48120 = 0x02; // Area 15-16 16bit
}
else{
IO_P51_SEL0 = 1; // CE15 as GPIO high
IO_P51_DAT = 1;
IO_P51_CTL = 1;
*(volatile unsigned char*)0x300103 = 0x00; // 1: 16bits 0: 8bits
*(volatile unsigned char* )0x48120 = 0x42; // Area 15-16 8bit
}
IO_P34_SEL1 = 1; // select #SMWE
IO_P35_SEL1 = 1; // select #SMRE
}
/**** End of function *******************************************************/
/**** End of file ***********************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -