Sync with trunk head (part 1 of 2)
[reactos.git] / include / xdk / halfuncs.h
1
2 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
3 FORCEINLINE
4 PVOID
5 NTAPI
6 HalAllocateCommonBuffer(
7 IN PDMA_ADAPTER DmaAdapter,
8 IN ULONG Length,
9 OUT PPHYSICAL_ADDRESS LogicalAddress,
10 IN BOOLEAN CacheEnabled)
11 {
12 PALLOCATE_COMMON_BUFFER allocateCommonBuffer;
13 PVOID commonBuffer;
14
15 allocateCommonBuffer = *(DmaAdapter)->DmaOperations->AllocateCommonBuffer;
16 ASSERT( allocateCommonBuffer != NULL );
17 commonBuffer = allocateCommonBuffer( DmaAdapter, Length, LogicalAddress, CacheEnabled );
18 return commonBuffer;
19 }
20
21 FORCEINLINE
22 VOID
23 NTAPI
24 HalFreeCommonBuffer(
25 IN PDMA_ADAPTER DmaAdapter,
26 IN ULONG Length,
27 IN PHYSICAL_ADDRESS LogicalAddress,
28 IN PVOID VirtualAddress,
29 IN BOOLEAN CacheEnabled)
30 {
31 PFREE_COMMON_BUFFER freeCommonBuffer;
32
33 freeCommonBuffer = *(DmaAdapter)->DmaOperations->FreeCommonBuffer;
34 ASSERT( freeCommonBuffer != NULL );
35 freeCommonBuffer( DmaAdapter, Length, LogicalAddress, VirtualAddress, CacheEnabled );
36 }
37
38 FORCEINLINE
39 ULONG
40 NTAPI
41 HalReadDmaCounter(
42 IN PDMA_ADAPTER DmaAdapter)
43 {
44 PREAD_DMA_COUNTER readDmaCounter;
45 ULONG counter;
46
47 readDmaCounter = *(DmaAdapter)->DmaOperations->ReadDmaCounter;
48 ASSERT( readDmaCounter != NULL );
49 counter = readDmaCounter( DmaAdapter );
50 return counter;
51 }
52
53 #endif
54