📄 hal4hc.c
字号:
/*
//*************************************************************************
//
// P H I L I P S P R O P R I E T A R Y
//
// COPYRIGHT (c) 2000 BY PHILIPS SINGAPORE.
// -- ALL RIGHTS RESERVED --
//
// File Name: HAL4Hc.c
// Author: ZhenYu Zhang
// Created: Jun. 8, 2000
// Modified:
// Revision: 0.0
//
//*************************************************************************
// Notes:
// Hal4Hc_xx : Hardware Abstraction Layer
//
//*************************************************************************
*/
#include <stdio.h>
#include <dos.h>
#include "BasicTyp.h"
#include "common.h"
#include "SysCnfg.h"
#include "hal4sys.h"
#include "hal4ISA.h"
#include "hal4Hc.h"
/*
//*************************************************************************
// Public static data
//*************************************************************************
*/
extern UCHAR bVerbose;
extern UCHAR bIRQL;
/*
//*************************************************************************
// Private static data
//*************************************************************************
*/
/*
//*************************************************************************
// Subroutines - Hal4Hc_xx
//*************************************************************************
*/
void Hal4Hc_RegOutW(USHORT wCommand, USHORT wData)
{
if(bIRQL ==0)
RaiseIRQL();
Hal4ISA_CommandOutW4HC(wCommand|0x80);
Hal4Hc_Wait4DataPhase();
Hal4ISA_DataOutW4HC(wData);
if(bIRQL ==0)
LowerIRQL();
#ifdef DBG_MODE
if(bVerbose)
printf("Write 0x%x to 0x%x;\n",wData,wCommand);
#endif
}
void Hal4Hc_RegOutDW(USHORT wCommand, ULONG dwData)
{
USHORT wData;
wData = (USHORT) dwData&0xffff;
if(bIRQL ==0)
RaiseIRQL();
Hal4ISA_CommandOutW4HC(wCommand|0x80);
Hal4Hc_Wait4DataPhase();
Hal4ISA_DataOutW4HC( wData);
wData = (USHORT) (dwData>>16)&0xffff;
Hal4Hc_Wait4DataPhase();
Hal4ISA_DataOutW4HC( wData);
if(bIRQL ==0)
LowerIRQL();
#ifdef DBG_MODE
if(bVerbose)
printf("Write 0x%lx to 0x%x;\n",dwData,wCommand);
#endif
}
USHORT Hal4Hc_RegInW(USHORT wCommand)
{
USHORT wData;
if(bIRQL ==0)
RaiseIRQL();
Hal4ISA_CommandOutW4HC(wCommand&0x7F);
Hal4Hc_Wait4DataPhase();
wData = Hal4ISA_DataInW4HC();
if(bIRQL ==0)
LowerIRQL();
#ifdef DBG_MODE
if(bVerbose)
printf("Read 0x%x from 0x%x;\n",wData,wCommand);
#endif
return wData;
}
ULONG Hal4Hc_RegInDW(USHORT wCommand)
{
USHORT wData;
ULONG dwData;
if(bIRQL ==0)
RaiseIRQL();
Hal4ISA_CommandOutW4HC(wCommand&0x7F);
Hal4Hc_Wait4DataPhase();
wData = Hal4ISA_DataInW4HC();
dwData = (ULONG)wData;
Hal4Hc_Wait4DataPhase();
wData = Hal4ISA_DataInW4HC();
dwData += ((ULONG)wData)<<16L;
if(bIRQL ==0)
LowerIRQL();
#ifdef DBG_MODE
if(bVerbose)
printf("Read 0x%lx from 0x%x;\n",dwData,wCommand);
#endif
return dwData;
}
void Hal4Hc_Wait4DataPhase(void)
{
/*#ifdef ISP1161_AT_48MHZ
Hal4Sys_WaitinUS(1);
#endif
#ifdef ISP1161_AT_24MHZ
Hal4Sys_WaitinUS(1);
#endif
#ifdef ISP1161_AT_12MHZ
Hal4Sys_WaitinUS(2);
#endif
#ifdef ISP1161_AT_6MHZ
Hal4Sys_WaitinUS(4);
#endif*/
Hal4Sys_WaitinUS(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -