📄 wmdmacontext.h
字号:
/*-----------------------------------------------------------------------------
* Copyright (c) Wolfson Microelectronics plc. All rights reserved.
*
* This software as well as any related documentation is furnished under
* license and may only be used or copied in accordance with the terms of the
* license. The information in this file is furnished for informational use
* only, is subject to change without notice, and should not be construed as
* a commitment by Wolfson Microelectronics plc. Wolfson Microelectronics plc
* assumes no responsibility or liability for any errors or inaccuracies that
* may appear in this document or any software that may be provided in
* association with this document.
*
* Except as permitted by such license, no part of this document may be
* reproduced, stored in a retrieval system, or transmitted in any form or by
* any means without the express written consent of Wolfson Microelectronics plc.
*
* $Id: WMDMAContext.h 2460 2005-11-28 15:03:58Z ian $
*
* This file contains XScale specific DMA functionality for the
* Wolfson chips.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
*---------------------------------------------------------------------------*/
#ifndef __WMDMACONTEXT_H__
#define __WMDMACONTEXT_H__
/*
* Include files
*/
#include "WMPlatform_Raw.h"
#include "WMAudioInternal.h"
#include "WMPlatform_OS.h"
/*
* Only build this if we're doing Audio support.
*/
#if WM_AUDIO_STREAM
/*
* Definitions
*/
#define DESC_ADDRESS_MASK 0xFFFFFFF0
#define FORCE_64BIT_ALIGNMENT 0xFFFFFFFC
#define FORCE_128BIT_ALIGNMENT 0xFFFFFFF8
/*
* DMA channel event name prefix
*/
#define DMA_CHANNEL_PREFIX "DMA_CHANNEL_"
/*
* Length of DMA Event name string
*/
#define WM_DMA_EVENT_STRING WM_EVENT_STRING
/*
* flags field defines (zero flags help in the population of fields)
*/
#define WM_INPUT 0x0001
#define WM_OUTPUT 0x0000 /* Not input */
#define WM_STEREO 0x0002
#define WM_MONO 0x0000 /* Not stereo */
#define WM_WIDE 0x0004
/*
* A structure holding the static details of the DMA channels.
*/
typedef struct tagDMA_CHANNEL_DETAILS
{
WMAUDIO_CHANNEL APIChannel;
void *channelAddr;
unsigned int flags;
unsigned int nBytesPerSample;
unsigned int nBurstSize;
XLLP_DMAC_DRCMR_T DMADevice;
} DMA_CHANNEL_DETAILS;
/*
* Structure for holding the dynamic details about an audio channel.
*/
typedef struct tagChannelDef
{
WMAUDIO_CHANNEL APIChannel;
XLLP_DMAC_CHANNEL_T DMAChannel;
void *buffer1;
void *buffer1Physical;
XLLP_DMAC_DESCRIPTOR_T *desc1;
XLLP_DMAC_DESCRIPTOR_T *desc1Physical;
void *buffer2;
void *buffer2Physical;
XLLP_DMAC_DESCRIPTOR_T *desc2;
XLLP_DMAC_DESCRIPTOR_T *desc2Physical;
unsigned int flags;
const DMA_CHANNEL_DETAILS *pDetails;
} ChannelDef;
/*
* Structure for the DMA Context.
*/
typedef struct tagDMAContext
{
WM_BOOL initialised;
ChannelDef *pDMAChannels;
const DMA_CHANNEL_DETAILS *pChannelDetails;
void *pDMABuffers_Virtual;
void *pDMABuffers_Physical;
XLLP_DMAC_DESCRIPTOR_T *pDMADescriptors_Virtual;
XLLP_DMAC_DESCRIPTOR_T *pDMADescriptors_Physical;
} DMAContext;
/*
* Global data.
*/
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* Function: WMInitDMAContext
*
* Initialises the DMA and returns a pointer to the DMA context for passing
* to the device context.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* ppContext a variable to receive the pointer to the context structure.
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMInitDMAContext( WM_DEVICE_HANDLE hDevice, DMAContext **ppContext );
/*-----------------------------------------------------------------------------
* Function: WMDMAGetChannelDetails
*
* Returns a pointer to the requested DMA channel details.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* APIchannel the API channel ID
*
* Returns: DMA_CHANNEL_DETAILS
*---------------------------------------------------------------------------*/
const DMA_CHANNEL_DETAILS *WMDMAGetChannelDetails( WM_DEVICE_HANDLE hDevice,
WMAUDIO_CHANNEL APIChannel
);
/*-----------------------------------------------------------------------------
* Function: WMDMAGetChannelDef
*
* Returns a pointer to the requested Audio DMA channel.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* APIchannel the API channel ID
*
* Returns: ChannelDef *
*---------------------------------------------------------------------------*/
ChannelDef *WMDMAGetChannelDef( WM_DEVICE_HANDLE hDevice,
WMAUDIO_CHANNEL APIChannel
);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* WM_AUDIO_STREAM */
#endif /* __WMDMACONTEXT_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -