📄 pingpongdma.h
字号:
//**********************************************************************
//
// Filename: pingpongdma.h
//
// Description: Ping Pong DMA class
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Use of this source code is subject to the terms of the Cirrus end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to
// use this source code. For a copy of the EULA, please see the
// EULA.RTF on your install media.
//
// Copyright(c) Cirrus Logic Corporation 2003, All Rights Reserved
//
//**********************************************************************
#ifndef _H_DMA_DRIVER
#define _H_DMA_DRIVER
typedef void DMA_PINGPONG_CALLBACK(HANDLE, BOOL);
class PingPongDma
{
public:
PingPongDma(void);
~PingPongDma(void);
MMRESULT Initialize
(
volatile ULONG *pulDmaChannel,
ULONG ulPeripheral,
ULONG ulBufferSize
);
MMRESULT Start(void);
MMRESULT Stop(void);
MMRESULT Pause(void);
void Flush(void);
ULONG CurrentPosition(void);
ULONG GetPhysBuffAddress(void) {return m_ulPhysBuff;}
void * GetVirtBuffAddress(void) {return m_pBuffer;}
void SetCallBack(DMA_PINGPONG_CALLBACK *pfn, HANDLE m_hCallBackHandle);
BOOL IsDmaOn(void) {return m_bPlaying;}
private:
static DWORD WINAPI IST(LPVOID lpParam);
CRITICAL_SECTION m_Critsec;
void * m_pBuffer;
ULONG m_ulPhysBuff;
//int m_ulChannel;
ULONG m_ulBufferSize;
volatile ULONG * m_pulDma;
ULONG m_ulPeriph;
ULONG m_ulCurrentPos;
ULONG m_ulSysIntr;
BOOL m_bPlaying;
BOOL m_bExitThread;
HANDLE m_hEvent;
HANDLE m_hThread;
DMA_PINGPONG_CALLBACK * m_pfnCallBack;
HANDLE m_hCallBackHandle;
BOOL m_bOrder;
};
#define NUM_DMA_CHANNELS 10
#endif // _H_DMA_DRIVER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -