?? mckernel.h
字號:
BOOLEAN bLatched);
// get the hardware specific portion of the device extension
PVOID GetHWInfo(PDEVICE_INFO);
// get card information stored for user retrieval
LONG atol(PCHAR s,PCHAR *ep); // like strtol
int GetRomDate(PDEVICE_INFO pDevInfo);
int GetRomVersion(PDEVICE_INFO pDevInfo);
BOOL GetLinkList(PDEVICE_INFO pDevInfo);
BOOL GetLDSList(PDEVICE_INFO pDevInfo);
int GetIVariableStr(PDEVICE_INFO pDevInfo,PCHAR str,UINT maxchar,UINT num);
int GetPmacType(PDEVICE_INFO pDevInfo);
DWORD SetMaxMotors(PDEVICE_INFO pDevInfo);
LONG GetIVariableLong(PDEVICE_INFO pDevInfo,ULONG num,LONG def);
BOOL SetIVariableLong(PDEVICE_INFO pDevInfo,ULONG num,LONG val);
BOOL GetScales(PDEVICE_INFO pDevInfo);
int GetDPRAMAddress(PDEVICE_INFO pDevInfo,PDWORD adr);
BOOL ConfigureDPRAM(PDEVICE_INFO pDevInfo);
int SaveConfiguration(PDEVICE_INFO pDevInfo);
//============================================================================
// PORT Related macro,defines and functions
#define PORT_STALL_USEC 5 // usec stall per retry period
// determine if PMAC card can be found on this port address
BOOL CardOnPort(PDEVICE_INFO pDevInfo);
//----------------------------------------------------------------------------------
// Specialized flush, determines if PMAC is in the bus.
// THEORY: If no card exists in bus at the specified i/o address then it
// will appear that there is an infinite amount of characters of type
// 0xFF to be stripped. This function is useful to initiate communication
// on the bus since a deadlock situation may occur otherwise.
//----------------------------------------------------------------------------------
BOOL PmacPingAndClean(PDEVICE_INFO pDevInfo);
// output one byte from the port at bOffset offset from the port base address
VOID Outp(PDEVICE_INFO pDevInfo, BYTE bOffset, BYTE bData);
// input one byte from the port at bOffset offset from the port base address
BYTE Inp(PDEVICE_INFO pDevInfo, BYTE bOffset);
// flush bus port
void FlushPort(PDEVICE_INFO pDevInfo);
// write a character to PMAC bus port
int WriteCharPort(PDEVICE_INFO pDevInfo, UCHAR outchar);
// write buffer to bus port
int WriteLinePort(PDEVICE_INFO pDevInfo,PUCHAR str);
// see if port has a read ready
BOOL PortIsReadReady(PDEVICE_INFO pDevInfo);
// read bus port into buffer until eol with wait
int ReadLinePort(PDEVICE_INFO pDevInfo,PUCHAR str,UINT maxchar);
// send a command then read bus port into buffer until eot or err or timeout
int GetResponsePort(PDEVICE_INFO pDevInfo,PUCHAR s,UINT maxchar,
PUCHAR outstr);
// Get response to control characters
int GetControlResponse(PDEVICE_INFO pDevInfo ,CHAR inChar,
PCHAR outStr,DWORD maxChars);
//============================================================================
// MEMORY Related macro,defines and functions
#define MEM_STALL_USEC 5 // usec stall per retry period
/*
The macros below are based on this PMAC DPRAM ASCII structure
struct ascii {
unsigned short sendready:1; // Y:$D18B output control word 0x62C
unsigned short pad:15;
unsigned short ctrlchar; // X:$D18B control character
char outstr[MAXAOUT]; // $D18C - $D1B3 output string buffer
unsigned short instatus; // Y:$D1B4 input control word 0x6D0
unsigned short charcount; // X:$D1B4 input character count
char instr[MAXAIN]; // $D1B5 - $D1F4 input string buffer
};
*/
// Turbo ASCII memory port macros ---------------------------------------------
// Base = 0x0E9C
#define SENDREADY_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xE9C)) == 0)
#define NOT_SENDREADY_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xE9C)) > 0)
#define SET_SENDREADY_T (WRITE_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xE9C),1))
#define CTRL_CHAR_T (PUCHAR)(pDevInfo->FrameBase + 0xE9E)
#define READREADY_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) > 0)
#define NOT_READREADY_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) == 0)
#define FLUSH_ACK_READY_T ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) & 0x001F) == 0x0018)
#define SET_READREADY_T (WRITE_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40),0))
#define ERROR_SET_T ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) & 0x8000) > 0)
#define ERROR_T (((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40))) & 0x0F) + \
(((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40))) >> 4) & 0x0F) * 10)
#define NUM_CHARS_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF42)) - 1)
#define MEM_ACK_T ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) & 0x000F) == 0x0006)
#define MEM_CR_T ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) & 0x000F) == 0x000D)
#define MEM_PMACREADY_T (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)))
#define MEM_USR_T ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0xF40)) & 0x0300) != 0)
// Pmac1/2 ASCII memory port macros ---------------------------------------------
// Base = 0x062C
#define SENDREADY (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x62C)) == 0)
#define NOT_SENDREADY (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x62C)) > 0)
#define SET_SENDREADY (WRITE_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x62C),1))
#define CTRL_CHAR (PUCHAR)(pDevInfo->FrameBase + 0x62E)
#define READREADY (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) > 0)
#define NOT_READREADY (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) == 0)
#define FLUSH_ACK_READY ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) & 0x001F) == 0x0018)
#define SET_READREADY (WRITE_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0),0))
#define ERROR_SET ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) & 0x8000) > 0)
#define ERROR2 (((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0))) & 0x0F) + \
(((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0))) >> 4) & 0x0F) * 10)
#define NUM_CHARS (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D2)) - 1)
#define MEM_ACK ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) & 0x000F) == 0x0006)
#define MEM_CR ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) & 0x000F) == 0x000D)
#define MEM_PMACREADY (READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)))
#define MEM_USR ((READ_REGISTER_USHORT((PUSHORT)(pDevInfo->FrameBase + 0x6D0)) & 0x0300) != 0)
// determine if PMAC card has DPRAM and can communicate through it
BOOL CardHasMem(PDEVICE_INFO pDevInfo);
// configure card memory address
void ConfigureMem(PDEVICE_INFO pDevInfo);
// Get a portion of DPRAM
UINT GetMem(PDEVICE_INFO pDevInfo,PBYTE pbData,WORD wDprOffset,WORD wLength);
// Set a portion of DPRAM
UINT SetMem(PDEVICE_INFO pDevInfo,PBYTE pbData,WORD wDprOffset,WORD wLength);
// Get a bit from DPRAM DWORD
UINT GetMemBit(PDEVICE_INFO pDevInfo,PMEM_BUFFER_BIT pMemBufferBits);
// Set a bit DPRAM DWORD
UINT SetMemBit(PDEVICE_INFO pDevInfo,PMEM_BUFFER_BIT pMemBufferBits);
// Get a bit range of DPRAM DWORD
UINT GetMemBits(PDEVICE_INFO pDevInfo,PMEM_BUFFER_BITS pMemBufferBits);
// Set a bit range of DPRAM DWORD
UINT SetMemBits(PDEVICE_INFO pDevInfo,PMEM_BUFFER_BITS pMemBufferBits);
// flush mem port
void FlushMem(PDEVICE_INFO pDevInfo);
// write a character to pmac dpram ascii port (ie. 'ch' + '\0')
UINT WriteCharMem(PDEVICE_INFO pDevInfo,UCHAR outchar);
// write a control character to pmac dpram ascii port
UINT WriteCtrlCharMem(PDEVICE_INFO pDevInfo,UCHAR outchar);
// write a character to frame ASCII buffer
UINT WriteLineMem(PDEVICE_INFO pDevInfo,PUCHAR str);
// see if dpram port has a read ready
BOOL MemIsReadReady(PDEVICE_INFO pDevInfo);
//----------------------------------------------------------------------------
// see what DPRAM is ready with, send,cmd,ack,err
//----------------------------------------------------------------------------
WORD MemIsReadReadyEx(PDEVICE_INFO pDevInfo);
// read frame memory into buffer until eol with wait
int ReadLineMem(PDEVICE_INFO pDevInfo,PUCHAR str);
//----------------------------------------------------------------------------------
// This function sends the requested control character between 1 - 26 to the
// PMAC. If the request is known not to return any characters it sets the EOT
// status bit then exits immediately to avoid any timeout. If the request is known
// to return "1" line of data the function grabs the data then returns with EOT set.
// If the funtion returns "n" lines of data the function doesn't attempt to grab
// any data and doesn't set the EOT status so it is up to the caller to grab the data
//-----------------------------------------------------------------------------------
int GetControlResponseMem(PDEVICE_INFO pDevInfo ,CHAR inChar,PCHAR outStr,DWORD maxChars);
/*
* i/o memory on adapter cards such as the frame buffer memory cannot
* be accessed like ordinary memory on all processors (especially alpha).
* You must read and write this memory using the following macros. These are
* wrappers for the appropriate NT macros.
*/
// return one ULONG from the frame buffer at p
#ifdef i386
#define ReadIOMemoryULONG(p) ( * (DWORD volatile *)p)
// return a word from the frame buffer at p
#define ReadIOMemoryUSHORT(p) ( * (USHORT volatile *)p)
// return a byte from the frame buffer at p
#define ReadIOMemoryBYTE(p) ( * (unsigned char volatile *) p)
#else
#define ReadIOMemoryULONG(p) READ_REGISTER_ULONG((PUCHAR)p)
// return a word from the frame buffer at p
#define ReadIOMemoryUSHORT(p) READ_REGISTER_USHORT((PUCHAR)p)
// return a byte from the frame buffer at p
#define ReadIOMemoryBYTE(p) READ_REGISTER_UCHAR(p)
#endif
// read a block of c bytes from the frame buffer at s to memory at d
#define ReadIOMemoryUCHAR(d, s, c) READ_REGISTER_BUFFER_UCHAR(s, d, c)
// write a byte b to the frame buffer at p
#define WriteIOMemoryBYTE(p, b) WRITE_REGISTER_UCHAR(p, b)
// write a word w to the frame buffer at p
#define WriteIOMemoryUSHORT(p, w) WRITE_REGISTER_USHORT((PUSHORT)p, w)
// write a ULONG l to the frame buffer at p
#define WriteIOMemoryULONG(p, l) WRITE_REGISTER_ULONG((PULONG)p, l)
// write a block of c bytes to the frame buffer d from memory at s
#define WriteIOMemoryUCHAR(d, s, c) WRITE_REGISTER_BUFFER_UCHAR(d, s, c)
P_CALLBACK GetCallbackTable(PDEVICE_INFO);
/* get a pointer to the frame buffer mapped into system memory */
PUCHAR GetFrameBuffer(PDEVICE_INFO);
/* this function is a wrapper for KeSynchronizeExecution (at least in the NT
* version). It will call back the function specified with the context
* argument specified, having first disabled the video interrupt in
* a multi-processor safe way.
*/
typedef BOOLEAN (*PSYNC_ROUTINE)(PVOID);
BOOLEAN SynchronizeExecution(PDEVICE_INFO, PSYNC_ROUTINE, PVOID);
/*
* This function can be used like SynchronizeExecution(), to sync
* between the captureservice routine and the passive-level requests. This
* will not necessarily disable interrupts. On win-16, this function may be
* the same as SynchronizeExecution(). On NT, the CaptureService func
* runs as a DPC, at a lower interrupt priority than the isr itself, and
* so can be protected using this (spinlock-based) function without having
* to disable all interrupts.
*/
BOOLEAN SynchronizeDPC(PDEVICE_INFO, PSYNC_ROUTINE, PVOID);
/*
* AccessData() gives access to the data in kernel mode in a safe way.
* It calls the given function with the address and size of the buffer
* after any necessary mapping, and wrapped in exception handlers
* as necessary.
*
* This function cannot be called from the InterruptAcknowledge or
* ServiceCapture call back functions - it must be running in the
* context of the calling thread (in kernel mode).
*/
typedef BOOLEAN (*PACCESS_ROUTINE)(PDEVICE_INFO, PUCHAR, ULONG, PVOID);
BOOLEAN AccessData(PDEVICE_INFO, PUCHAR, ULONG, PACCESS_ROUTINE, PVOID);
/* these functions allocate and free non-paged memory for use
* in kernel mode, including at interrupt time.
*/
PVOID AllocMem(PDEVICE_INFO, ULONG);
VOID FreeMem(PDEVICE_INFO, PVOID, ULONG);
/*
* delay for a number of milliseconds. This is accurate only to
* +- 15msecs at best.
*/
VOID Delay(int nMillisecs);
/* block for given number of microseconds by polling. Not recommended
* for more than 25 usecs.
*/
VOID Stall(int nMicrosecs);
#endif // _MCKERNEL_
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -