⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tmmanlib.h

📁 PNX系列设备驱动 PNX系列设备驱动
💻 H
📖 第 1 页 / 共 2 页
字号:
	UInt32 ClientHandle );

TMStatus	memoryCreate(
	UInt32	MemoryManagerHandle,
	Pointer	ListHead,
	Int8*	Name,
	UInt32	Length, 
	Pointer* AddressPointer,
	UInt32*	MemoryHandlePointer );

TMStatus	memoryDestroy ( 
	UInt32 MemoryHandle );

TMStatus  memoryOpen ( 
	UInt32 MemoryManagerHandle, 
	Pointer	ListHead,
	Int8* Name,
	UInt32* LengthPtr,
	Pointer* AddressPointer,
	UInt32*	MemoryHandlePointer );

TMStatus  memoryClose (
	UInt32	MemoryHandle );

TMStatus	memoryGetAddress ( 
	UInt32 MemoryHandle,
	UInt32* AddressPointer );

TMStatus	memoryGetHalHandle ( 
	UInt32 MemoryHandle,
	UInt32* HalHandle );

/*
	Scatter Gather Buffer Functions
*/

typedef struct tagsgbufferManagerParameters
{
	UInt32		SGBufferCount;
	UInt32		HalHandle;
	UInt32		MemoryManagerHandle;
	UInt32		NameSpaceManagerHandle;
}	sgbufferManagerParameters;

UInt32	sgbufferSharedDataSize ( 
	UInt32 SGBufferCount );

TMStatus	sgbufferManagerReset ( 
	UInt32 SGBufferManagerHandle );

TMStatus	sgbufferManagerCreate (
	sgbufferManagerParameters*	Parameters,
	UInt32*	SGBufferManagerHandlePointer );

TMStatus	sgbufferManagerDestroy ( 
	UInt32	SGBufferManagerHandle );

TMStatus	sgbufferManagerDestroySGBufferByClient ( 
	UInt32 SGBufferManagerHandle,
	UInt32 ClientHandle );

TMStatus	sgbufferCreate (
	UInt32	SGBufferManagerHandle,
	Pointer	ListHead,
	Int8*	Name,
	UInt32	BufferAddress,
	UInt32	BufferSize,
	UInt32	Flags,
	UInt32*	SGBufferHandlePointer );

TMStatus	sgbufferDestroy ( 
	UInt32 SGBufferHandle );

TMStatus	sgbufferOpen ( 
	UInt32	SGBufferManagerHandle, 
	Pointer	ListHead,
	Int8*	Name,
	UInt32*	EntryCountPointer,
	UInt32* SizePointer,
	UInt32*	SGBufferHandlePointer );

TMStatus	sgbufferClose (
	UInt32	SGBufferHandle );

TMStatus	sgbufferFirstBlock ( 
	UInt32	SGBufferHandle,
	UInt32* OffsetPointer, 
	UInt32* AddressPointer, 
	UInt32* SizePointer );

TMStatus	sgbufferNextBlock ( 
	UInt32	SGBufferHandle,
	UInt32* OffsetPointer, 
	UInt32* AddressPointer, 
	UInt32* SizePointer );

TMStatus	sgbufferCopy ( 
	UInt32	SGBufferHandle,
	UInt32	Offset,
	UInt32	Address, 
	UInt32	Size, 
	UInt32	Direction );

/*
	NAME SPACE FUNCTIONS
*/

typedef struct	tagnamespaceManagerParameters
{
	UInt32	NameSpaceCount; 
	Pointer	SharedData; 
	UInt32	HalHandle;
}	namespaceManagerParameters;

UInt32	namespaceSharedDataSize ( 
	UInt32 NameSpaceCount );

TMStatus	namespaceManagerCreate ( 
	namespaceManagerParameters* Parameters,
	UInt32* NameSpaceManagerHandle );

TMStatus	namespaceManagerDestroy ( 
	UInt32 NameSpaceManagerHandle );

TMStatus	namespaceManagerReset ( 
	UInt32 NameSpaceManagerHandle  );

TMStatus	namespaceCreate (
	UInt32	NameSpaceManagerHandle,						
	UInt32	NameSpaceObjectType,
	Int8*	NameSpaceName,
	UInt32*	ObjectIdPointer,
	UInt32* NameSpaceHandlePointer );

TMStatus	namespaceDestroy ( 
	UInt32 NameSpaceHandle );


/* MISCLANEOUS PLATFORM SPECIFIC FUNCTIONS */
/* 
	Note that these functions do not operate on a specific
	board object and they don't require any specific board 
	information.
*/

/*	DEBUGGING ROUTINES	*/
/*
	Define the shared Debug structure here, since it will
	be shared by the host and the DSP.
*/

typedef struct tagDebugControl
{
	UInt8	szMagic[constDebugMagicSize]; /* starts at 64 byte boundary */
	UInt32	Wrapped;		/* has wrap-around occured */
	UInt8*	AllocBase;		/* ptr to the unaligned memory for malloc & free */
	UInt32	BufLen;		/* length of trace buffer */
	UInt32	BufPos;		/* position in trace buffer */
	UInt8*	Buffer;		/* pointer to trace buffer */
}	DebugControl;

typedef struct tagdebugParameters
{
    UInt32  TraceBufferSize;
    UInt32  LevelBitmap;
    UInt32	Type;
}	debugParameters;

Bool	debugInit(
	/* platform specific implementation */					  
	debugParameters* Parameters );	

void	debugPrintf( 
	Int8* FormatString, 
	... );

Bool	debugExit( 
	void );

UInt32	debugLevel(
	UInt32 LevelBitmap );

Bool	debugCheckLevel(
	UInt32 Level );

Bool	debugDPBuffers (
	UInt32	HalHandle,
	UInt8 **ppFirstHalfPtr, 
	UInt32 *pFirstHalfSize, 
	UInt8 **ppSecondHalfPtr, 
	UInt32 *pSecondHalfSize );

Bool	debugTargetBuffers (
	UInt32	HalHandle,
	UInt8 **ppFirstHalfPtr, 
	UInt32 *pFirstHalfSize, 
	UInt8 **ppSecondHalfPtr, 
	UInt32 *pSecondHalfSize );

/* get the debug buffer on the host(this)processor */
Bool	debugHostBuffers (
	UInt8 **ppFirstHalfPtr, 
	UInt32 *pFirstHalfSize, 
	UInt8 **ppSecondHalfPtr, 
	UInt32 *pSecondHalfSize );


#define	DPF(_l_,_x_)	if(debugCheckLevel(1<<(_l_))) debugPrintf _x_



/* Ciritcal Section Exclusion Routines */
/*
	NOTE THAT THESE HAVE TO CLAIMED FOR A VERY SHORT TIME.
	SINCE INTERRUPT HANDLERS MAY BE BLOCKING ON THESE TOO.
	while we access data structures we need to protect them
	from the following conditions :
	1.	Another processor ( on NT SMP )
	2.	Another thread on the same processor ( context switch )
	3.	Our own interrupt on the same processor ( peer interrupt )

	Here are the protection mechanism for the above conditions
	TM1
		1. Not applicable
		2. Not applicable
		3. HAL_disable_interrupt - Hal_enable_interrupt
	TM1-pSOS
		1. Not applicable
		2. App_Model_Suspend_Scheduling
		3. HAL_disable_all_interrupts - if we use this 2. is not required
	NTSMP
		1. & 2. & 3.KeAcquireSpinLock - KeReleaseSpinLock running at DISPATCH_LEVEL

	Win9X	
		1. Not applicable
		2. & 3. pushf cli - popf

	Win32.
		1. Not applicable
		2. & 3.EnterCriticalSection & LeaveCriticalSection
*/
Bool	critsectCreate ( 
	UInt32* CriticalSectionHandlePointer );

Bool	critsectDestroy ( 
	UInt32 CriticalSectionHandle );

Bool	critsectEnter ( 
	UInt32 CriticalSectionHandle, Pointer NestedContext );

Bool	critsectLeave ( 
	UInt32 CriticalSectionHandle, Pointer NestedContext );

/* Synchronization Object Abstraction Functions */
Bool	syncobjCreate ( 
	UInt32 SynchronizationFlags,
	UInt32	OSSynchronizationHandle,
	UInt32 *SynchronizationHandlePointer,
	Int8* SynchronizationObjectName );

Bool	syncobjSignal ( 
	UInt32 SynchronizationHandle );

Bool	syncobjBlock ( 
	UInt32 SynchronizationHandle );

Bool	syncobjDestroy ( 
	UInt32 SynchronizationHandle );

/*
	FIFO manipulation routines 
*/

/* Queue Abstraction Function - Genrcic Implementation */
Bool	queueCreate ( 
	UInt32	ItemSize, 
	UInt32	HalHandle,
	UInt32* QueueHandlePointer );

Bool	queueDestroy ( 
	UInt32 QueueHandle );

/* 
	retrieves an element without deleting it 
	successive calls the queueRetrieve without calling
	queueDelete returns the same result
*/
Bool	queueRetrieve ( 
	UInt32 QueueHandle, 
	Pointer Item );

Bool	queueInsert ( 
	UInt32 QueueHandle, 
	Pointer Item );

/* destructive retrieve */
Bool	queueDelete ( 
	UInt32 QueueHandle, 
	Pointer Item );

/* page table manipulation functions */
typedef struct	tagPageTableEntry 
{
	UInt32		PhysicalAddress;
	UInt32		RunLength;
}	PageTableEntry;

/*
pagetableGetTempBufferSize

PARAMETERS :

	BufferDescription	
		Pointer to the platform dependent structure that describes the 
		buffer that needs to be page locked and the page table needs to be
		passed to the target.

RETURNS :
	The number of bytes of temporary buffer space require to perform the 
	page locking and retrieve the page table entries.

*/

UInt32	pagetableGetTempBufferSize ( 
	UInt32 BufferAddress, UInt32 BufferSize );
/*
pagetableCreate

PARAMETERS :

	BufferDescription
		Pointer to the platform dependent structure that describes the 
		buffer that needs to be page locked and the page table needs to be
		passed to the target. Note that in case of NT this buffer
		contains a Pointer to the Irp, in case of 95 it contains the 
		BufferAddress and the Size.

	TempBuffer
		Caller allocated this buffer of the size returned by 
		pagetableGetTempBufferSize(). The allocated buffer
		can be freed after the page table has been copied to the
		shared address space.

	PageTablePointer 
		Address of the variable that receives the local page table base 
		address.
		Note that this is different from TempBuffer since , platform specific
		implementations may require to store persistent infomration  as a headre
		before the actual scatter gather table starts. However *PageTablePointer
		will always point to a location within the TempBuffer.

	PageTableEntryCountPointer
		Address of the variable that receives the number of valid page
		table entries starting from *PageTablePointer

	BufferSizePointer
		Address of the variable that receives the Size of the buffer that 
		was just locked. This parameter is passed back because the 
		BufferDescription is assumed to be transparent to sgbuffer.

	BufferAddressPointer
		Address of the variable that receives the address of the buffer that 
		was just locked. This parameter is passed back because the 
		BufferDexcription is assumed to be transparent to sgbuffer.

	PageTableHandlePointer
		Address of the variable that receives the hadnle to the page table 
		that was just allocated. This parameter is required to free the
		page table.
*/
Bool	pagetableCreate ( 
	UInt32 BufferAddress,
	UInt32 BufferSize,
	Pointer TempBuffer,
	UInt32	HalHandle,
	PageTableEntry	**PageTablePointer,
	UInt32 *PageTableEntryCountPointer,
	UInt32 *PageTableHandlePointer );

Bool	pagetableDestroy ( 
	UInt32 PageTableHandle );

	
/*
	MISC C RUN TIME ROUTINES
*/
Pointer	memAllocate( 
	UInt32 Size );

void	memFree( 
	Pointer Memory );

void	memCopy( 
	Pointer Destination, 
	Pointer Source, 
	UInt32 Size );

void    memSet ( 
	Pointer Memory, 
	UInt8  Value, 
	UInt32 Size );

UInt32	strCmp ( 
	Pointer String1, 
	Pointer String2 );

Pointer	strCopy ( 
	Pointer Destination, 
	Pointer Source );

UInt32	strLen ( 
	Pointer String );

void  strSprintf ( 
	Int8* BufferString,
	Int8* FormatString, 
	... );

/*
	OBJECT LIST MANIPULATION FUNCTIONS 
*/
UInt32 objectlistCreate ( 
	Pointer ObjectListPointer, 
	UInt32 Count );

void objectlistDestroy ( 
	Pointer ObjectListPointer );

UInt32 objectlistInsert ( 
	Pointer ObjectListPointer, 
	Pointer Object,
	UInt32	Number );

Pointer objectlistGetObject (
	Pointer ObjectListPointer, 
	UInt32	Number );

void objectlistDelete ( 
	Pointer ObjectListPointer, 
	Pointer Object,
	UInt32 Number );

/*
	GENERIC OBJECT MANIPULATION 
*/
Pointer	objectAllocate ( 
	UInt32 Size, 
	UInt32 FourCCID );

UInt32	objectValidate ( 
	Pointer Object, 
	UInt32 FourCCID );

void	objectFree ( 
	Pointer Object );


/* DOUBLY LINKED LIST MANIPULATION FUNCTIONS */

typedef struct tagListStruct 
{
   struct	tagListStruct * volatile Flink;
   struct	tagListStruct * volatile Blink;
} ListStruct;


void listInitializeHead ( 
	ListStruct* ListHead );

Bool listIsEmpty (
	ListStruct* ListHead );

ListStruct* listRemoveHead (
	ListStruct* ListHead );

ListStruct* listRemoveTail (
	ListStruct* ListHead );

void listRemoveEntry(
	ListStruct* Entry);

void listInsertTail (
	ListStruct* ListHead,
	ListStruct* Entry ); 

void listInsertHead (
	ListStruct* ListHead,
	ListStruct* Entry );


#endif	/* _TMMANLIB_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -