📄 rtal.c
字号:
/*----------------------------------------------------------------------------
COPYRIGHT (c) 1997 by Philips Semiconductors
THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED AND COPIED IN
ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH A LICENSE AND WITH THE
INCLUSION OF THE THIS COPY RIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COPIES
OF THIS SOFTWARE MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER
PERSON. THE OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED.
THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT ANY PRIOR NOTICE
AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY Philips Semiconductor.
PHILIPS ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF THIS SOFTWARE
ON PLATFORMS OTHER THAN THE ONE ON WHICH THIS SOFTWARE IS FURNISHED.
----------------------------------------------------------------------------*/
/*
FILE : RTAL.c
HISTORY
960510 Tilakraj Roy Created
ABSTRACT
Contains support functions that are OS / Platform dependent.
This file should be in the platform specific directories,
However most platforms can use this file exactly as it is,
so this file is kept in the common area.
Platforms that require these functions to be overridden can
ignore this file and make a local platform specific copy in
the platform specific directory.
*/
/*----------------------------------------------------------------------------
SYSTEM INCLUDE FILES
----------------------------------------------------------------------------*/
/* tm1 specific includes */
#include "ntddk.h"
#include "tmtypes.h"
#include "stdio.h"
#include "stdarg.h"
Pointer memAllocate( UInt32 Size )
{
Pointer Memory;
Memory = (Pointer)ExAllocatePool(NonPagedPool, Size );
RtlZeroMemory (Memory, Size);
return Memory;
}
void memFree( Pointer Memory )
{
ExFreePool ( Memory );
}
void memCopy( Pointer Destination, Pointer Source, UInt32 Size )
{
RtlCopyMemory ( Destination, Source, Size );
}
void memSet ( Pointer Memory, UInt8 Value, UInt32 Size )
{
RtlFillMemory ( Memory, Size, (UInt8)Value );
}
// functions for dealing with ANSI strings.
UInt32 strCmp ( Pointer String1, Pointer String2 )
{
while ( *((UInt8*)String1) )
{
if ( *((UInt8*)String1) == *((UInt8*)String2) )
{
((UInt8*)String1)++;
((UInt8*)String2)++;
continue;
}
return ( *((UInt8*)String1) - *((UInt8*)String2) );
}
return 0;
}
Pointer strCopy ( Pointer Destination, Pointer Source )
{
while ( *((UInt8*)Destination)++ = *((UInt8*)Source)++ );
*((UInt8*)Destination)++ = *((UInt8*)Source)++;
return Destination;
}
UInt32 strLen ( Pointer String )
{
UInt32 Length = 0;
while ( *((UInt8*)String)++ ) Length++;
return ( Length + 1 );
}
void strSprintf (
Int8* BufferString,
Int8* FormatString,
... )
{
va_list va;
va_start(va, FormatString);
vsprintf( BufferString, FormatString, va);
va_end(va);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -