📄 ac48drhw.h
字号:
/************************************************************************/
/* * AudioCodes Ltd. * Copyright (c) 1998 * */
/************************************************************************/
/* File Name: Ac48DrHw.h */
/************************************************************************/
/* DRIVERS PACKET VERSION: 481(1.30) / 480(1.60) / 483(1.00) */
/************************************************************************/
/* 4804 OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.60 (December 1999) and above */
/************************************************************************/
/* 481xx OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.30 (October 1999) and above */
/************************************************************************/
/* 4830x OPERATION SOFTWARE VERSION SUPPORT: */
/* V 1.00 (March 2000) and above */
/************************************************************************/
/* PURPOSE : This header file contain the declarations of two macros */
/* However, most users will prefer not to deal directly */
/* with this level, as the macros or functions may need to */
/* be rewritten according to the hardware configurations */
/* */
/* COMMENTS : The "extern unsigned int FirstAc48xxHPIAddress" shall be */
/* initialize by the user from the application directory. */
/* */
/* DATE : May 1998 */
/* UPDATE REASON TO UPDATE */
/* ====== ================ */
/* 1.99 add PCI AVP DRIVER */
/************************************************************************/
#ifndef HWDrv_h
#define HWDrv_h
#include <DOS.H>
#include "Ac48DrUs.h"
#include "Ac48DrDf.h"
//#include "Dummy.h"
//#include "Pcif.h"
/* The following tables provide cross reference between the
communication macros and the AC4804A-C manual:
"Communication Routines", Section 3.6 :
Call to Macro | Read/Write
----------------+-------------
AC48xxHostWrite | 0 (W)
AC48xxHostRead | 1 (R)
Register | HRS1 HRS0
----------+-------------
HPIC | 0 0
HPID | 0 1
HPIA | 1 0
HPIDL | 1 1
Byte | HI/LO
-------+------
First | 0
Second | 1
HPI holds 16 addresses:
HPIC holds 4: writing to offsets 0, 1 Reading from offsets 2, 3
HPID holds 4: writing to offsets 4, 5 Reading from offsets 6, 7
HPIA holds 4: writing to offsets 8, 9 Reading from offsets 10,11
HPID holds 4: writing to offsets 12,13 Reading from offsets 14,15
*/
struct TShort /* for RISC: __packed struct TShort */
{
unsigned char First; /* first byte (offset=0) */
unsigned char Second; /* second byte (offset=1) */
};
struct TDualShort /* for RISC: __packed struct TShort */
{
struct TShort Write; /* Write two bytes (offset + 0) */
struct TShort Read; /* Read two bytes (offset + 2) */
};
struct TAC4804IF /* for RISC: __packed struct TShort */
{
struct TDualShort HPIC; /* Control Register (offset + 0) */
struct TDualShort HPID; /* Data register (offset + 4) */
/* HPID transfer Data with Post-increment Address */
/* after reading and pre-increment Address before writing */
struct TDualShort HPIA; /* Address Register (offset + 8) */
struct TDualShort HPIDL; /* Data Latches register (offset + 12) */
};
/* define IFs to all AC4804 on board */
#define AC4804IF_BASE_ADDRESS 0
typedef struct TAC4804IF TAllAC4804IF[];
#define AC4804 (*(volatile TAllAC4804IF *) AC4804IF_BASE_ADDRESS)
/* AC4804 points to first memory cell */
/* COMMUNICATION MACROS:
/*======================================================================*/
/* Name : Ac48xxHostWrite */
/*======================================================================*/
/* Purpose : The AC48HostWrite is a macro which writes one byte to */
/* the HPI of the AC48. */
/* */
/* Inputs : Data Writes a character into the HPI of the AC48 */
/* DeviceIndex An integer, performing the device index. */
/* Destination One of the HPI registers: */
/* HPIC - Control Register */
/* HPID - Incremented-address Data Register */
/* HPIA - Address Register */
/* HPIDL - Address-latched Data Register */
/* Byte Because the AC48xxHostWrite macro always has to */
/* be called as a pair, to write two bytes to the */
/* AC48, the first is called with the */
/* value:- 'First', and the second called with the */
/* value:- 'Second'. */
/*======================================================================*/
/*======================================================================*/
/* Name : Ac48xxHostRead */
/*======================================================================*/
/* Purpose : The AC48HostRead is a macro which reads a character */
/* from the HPI of the AC48. */
/* */
/* Inputs : DeviceIndex: An integer, performing the device index. */
/* Source: One of the HPI registers: */
/* HPIC - Control Register */
/* HPID - Incremented-address Data Register */
/* HPIA - Address Register */
/* HPIDL - Address-latched Data Register */
/* Byte: Because the AC48xxHostRead macro always has to */
/* be called as a pair, to read two bytes from */
/* the AC48 */
/* */
/* Output : Char Reads one character from the AC48. */
/*======================================================================*/
#if AC4804IF_TYPE == IO_MAPPING
/* If you call inportb or outportb when DOS.H has been included,*/
/* they are treated as macros that expand to inline code. */
/* FirstAc48xxHPIAddress shall be initialize by the user!!! */
extern unsigned int FirstAc48xxHPIAddress;
#define Ac48xxHostWrite(Data, Index, Destination, Byte) outportb((int)&AC4804[Index+FirstAc48xxHPIAddress].Destination.Write.Byte, Data)
#define Ac48xxHostRead(Index, Source, Byte) inportb((int)&AC4804[Index+FirstAc48xxHPIAddress].Source.Read.Byte)
#elif AC4804IF_TYPE == AC4804IF_DIRECT_ACCESS
#define Ac48xxHostWrite(Data, Index, Destination, Byte) AC4804[Index+FirstAc48xxHPIAddress].Destination.Write.Byte=Data
#define Ac48xxHostRead(Index, Source, Byte) AC4804[Index+FirstAc48xxHPIAddress].Source.Read.Byte
/* #define ReadByteAC4804(Index,Addr) AC4804[Index]->Addr */
#elif AC4804IF_TYPE == AC48_ISA_IF_WINDOWS_DRIVER
/* Writing/Reading from AC4804 - using ISA driver for win95/winNT */
extern unsigned int AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER;
#define Ac48xxHostWrite(Data, Index, Destination, Byte) IO_WriteByte(((unsigned long)&AC4804[Index+FirstAc48xxHPIAddress].Destination.Write.Byte)-AC4804IF_BASE_ADDRESS+AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER, Data)
#define Ac48xxHostRead(Index, Source, Byte) IO_ReadByte(((unsigned long)&AC4804[Index+FirstAc48xxHPIAddress].Source.Read.Byte)-AC4804IF_BASE_ADDRESS+AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER)
#elif (AC4804IF_TYPE == AC48_PCI_IF_WINDOWS_PC04_DRIVER) || (AC4804IF_TYPE == AC4804IF_WINDOWS_PCI_AVP_DRIVER)
/* Writing/Reading from AC4804 - using PCI driver for win95/winNT */
#define PCI_CS0_OFFSET 0x00000000
#define PCI_CS1_OFFSET 0x00010000 /* PCI_CS1_OFFSET = 0x1000 * sizeof(TAC4804IF) */
#define PCI_CS3_OFFSET 0x00020000
#define HPI_INDEX_OFFSET 12 /* 0x1000 = 1<<12 */
#define PCI_CARD_INDEX 0
extern void IO_WriteByte(unsigned long dwIOAddr, unsigned char bData, int PciCardId);
extern unsigned char IO_ReadByte(unsigned long dwIOAddr, int PciCardId);
#define Ac48xxHostWrite(Data, Index, Destination, Byte) IO_WriteByte((unsigned long)&AC4804[Index<<HPI_INDEX_OFFSET].Destination.Write.Byte, (unsigned char)Data, (int)PCI_CARD_INDEX)
#define Ac48xxHostRead(Index, Source, Byte) IO_ReadByte((unsigned long)&AC4804[Index<<HPI_INDEX_OFFSET].Source.Read.Byte, (int)PCI_CARD_INDEX)
/*#elif AC4804IF_TYPE == AC4804IF_DIRECT_ACCESS
#define Ac48xxHostWrite(Data, Index, Destination, Byte) AC4804[Index+FirstAc48xxHPIAddress].Destination.Write.Byte=Data
#define Ac48xxHostRead(Index, Source, Byte) AC4804[Index+FirstAc48xxHPIAddress].Source.Read.Byte
/* #define ReadByteAC4804(Index,Addr) AC4804[Index]->Addr */
/*#elif AC4804IF_TYPE == AC4804IF_WINDOWS_DRIVER
/* Writing/Reading from AC4804 - using driver for win95/winNT */
/* extern unsigned int AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER;
#define Ac48xxHostWrite(Data, Index, Destination, Byte) IO_WriteByte(((unsigned long)&(AC4804[Index+FirstAc48xxHPIAddress].Destination.Write.Byte))-AC4804IF_BASE_ADDRESS+AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER, Data)
#define Ac48xxHostRead(Index, Source, Byte) IO_ReadByte(((unsigned long)&(AC4804[Index+FirstAc48xxHPIAddress].Source.Read.Byte)) - AC4804IF_BASE_ADDRESS+AC4804IF_BASE_ADDRESS_WINDOWS_DRIVER)
*/
#endif
#endif /* HWDrv_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -