📄 pdd_audio.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft 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 LICENSE.RTF on your
// install media.
//
// Release Status:OS005-SW-70002-r0p0-00REL0
// $Copyright:
// ----------------------------------------------------------------
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
// (C) COPYRIGHT 2004 ARM Limited
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorised
// copies and copies may only be made to the extent permitted
// by a licensing agreement from ARM Limited.
// ----------------------------------------------------------------
// File: pdd_audio.c,v
// Revision: 1.3
// ----------------------------------------------------------------
// $
//
// Define the entry point for the DLL
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// -----------------------------------------------------------------------------
//
// PDD_AUDIO.C - AACI (PL041) - CE Native mode driver
//
// This driver takes care of all the communication to the audio hardware
// through calls to the OS independent/AACI hardware specific interface.
//
// -----------------------------------------------------------------------------
#include <windows.h>
#include <types.h>
#include <waveddsi.h>
#include <wavedbg.h>
#include <nkintr.h>
#include <pkfuncs.h>
#include <ceddk.h>
#include <mmreg.h>
#include "platform.h"
#include "wavmsg.h"
#include "pdd_audio.h"
#include <oalintr.h>
// Watermark info
const PTCHAR part_name = { TEXT("Windows CE .NET PL041 AACI (Advanced Audio CODEC Interface)") };
const PTCHAR part_num = { TEXT("OS005-SW-70002-r0p0-00REL0") };
// -----------------------------------------------------------------------------
// PDD_AudioInitialize
// -----------------------------------------------------------------------------
BOOL PDD_AudioInitialize(DWORD dwIndex)
{
UINT Irq, SysIntr, IoBase;
DEBUGMSG( TRUE, (TEXT("MODULE NAME: %s\r\n"),part_name) );
DEBUGMSG( TRUE, (TEXT("MODULE VERSION: %s\r\n"),part_num) );
Irq = LOGINTR_AUDIO;
SysIntr = SYSINTR_AUDIO;
IoBase = PHYS_AACI_BASE;
//
// Initialize the device with the resources allocated
//
if(!AACI_Initialize (Irq, SysIntr, IoBase))
{
ERRMSG1("WAVEDEV.DLL : Intialization FAILED - dwIndex:%d", dwIndex);
return FALSE;
}
return TRUE;
}
// -----------------------------------------------------------------------------
// PDD_AudioDeinitialize
// -----------------------------------------------------------------------------
VOID PDD_AudioDeinitialize(VOID)
{
AACI_Deinitialize();
}
// -----------------------------------------------------------------------------
// PDD_AudioGetInterruptType
// -----------------------------------------------------------------------------
AUDIO_STATE
PDD_AudioGetInterruptType(VOID)
{
return AACI_GetInterruptType();
}
// -----------------------------------------------------------------------------
// PDD_AudioMessage
// -----------------------------------------------------------------------------
DWORD PDD_AudioMessage (UINT uMsg,
DWORD dwParam1,
DWORD dwParam2)
{
DWORD dwRet = MMSYSERR_NOERROR;
//
// Handle any custom WAVEIN or WAVEOUT messages here
//
FUNC_WPDD("+PDD_AudioMessage");
PRINTMSG(ZONE_VERBOSE, (TEXT("CODEC Message (%d)\r\n"),uMsg));
switch (uMsg)
{
#ifdef TEST_API
case TESTTX_FIFOSIZE:
case TESTTX_COMPLETE:
case TESTTX_HALFEMPTY:
dwRet = TestTransmit(uMsg);
break;
case TESTRX_OVERRUN:
case TESTRX_HALFFULL:
case TESTRX_RUNAWAY:
dwRet = TestReceive(uMsg);
break;
#endif
default:
dwRet = MMSYSERR_NOTSUPPORTED;
break;
}
FUNC_WPDD("-PDD_AudioMessage");
return(dwRet);
}
// -----------------------------------------------------------------------------
// PDD_AudioPowerHandler
// -----------------------------------------------------------------------------
VOID
PDD_AudioPowerHandler(
BOOL power_down
)
{
//
// Handle any power up/down issues here.
//
}
MMRESULT private_WaveGetDevCaps (WAPI_INOUT apidir,
PVOID pCaps,
UINT wSize)
{
PWAVEINCAPS pwic = pCaps;
PWAVEOUTCAPS pwoc = pCaps;
MMRESULT mmRet = MMSYSERR_NOERROR;
FUNC_WPDD("+PDD_WaveGetDevCaps");
if (pCaps == NULL)
{
//
// If pCaps == NULL, we are requesting if the driver PDD is capable of
// this mode at all. In other words, if APIDIR == WAPI_IN, we return
// no error if input is supported, and MMSYSERR_NOTSUPPORTED otherwise.
// Since CP has both, we return MMSYSERR_NOERROR regardless.
//
mmRet = MMSYSERR_NOERROR;
}
else
{
//
// Fill in the DevCaps here.
//
pwoc->wMid = MM_MICROSOFT;
pwoc->wPid = (apidir == WAPI_OUT ? MM_MSFT_GENERIC_WAVEOUT :
MM_MSFT_GENERIC_WAVEIN);
pwoc->vDriverVersion = 0x0001;
wsprintf (pwoc->szPname, TEXT("AACI CODEC v%d.%d (%hs)"),
WAVEDEV_VERSION_MAJOR, WAVEDEV_VERSION_MINOR, __DATE__);
pwoc->dwFormats = WAVE_FORMAT_1M08 | WAVE_FORMAT_1M16 |
WAVE_FORMAT_1S08 | WAVE_FORMAT_1S16 |
WAVE_FORMAT_2M08 | WAVE_FORMAT_2M16 |
WAVE_FORMAT_2S08 | WAVE_FORMAT_2S16 |
WAVE_FORMAT_4M08 | WAVE_FORMAT_4M16 |
WAVE_FORMAT_4S08 | WAVE_FORMAT_4S16;
pwoc->wChannels = 2;
if (apidir == WAPI_OUT) {
pwoc->dwSupport = WAVECAPS_VOLUME | WAVECAPS_LRVOLUME;
}
}
FUNC_WPDD("-PDD_WaveGetDevCaps");
return(mmRet);
}
// -----------------------------------------------------------------------------
// PDD_WaveProc
// -----------------------------------------------------------------------------
MMRESULT PDD_WaveProc (WAPI_INOUT apidir,
DWORD dwCode,
DWORD dwParam1,
DWORD dwParam2)
{
MMRESULT mmRet = MMSYSERR_NOERROR;
switch (dwCode)
{
case WPDM_CLOSE:
AACI_WaveClose(apidir);
break;
case WPDM_CONTINUE:
AACI_WaveContinue(apidir, (PWAVEHDR) dwParam1);
break;
case WPDM_GETDEVCAPS:
mmRet = private_WaveGetDevCaps(apidir, (PVOID) dwParam1,
(UINT) dwParam2);
break;
case WPDM_OPEN:
mmRet = AACI_WaveOpen(apidir, (LPWAVEFORMATEX) dwParam1,
(BOOL) dwParam2);
break;
case WPDM_STANDBY:
IOCTLMSG1("PDD_WaveProc: WPDM_STANDBY %d",apidir);
AACI_Standby(apidir);
break;
case WPDM_START:
IOCTLMSG1("PDD_WaveProc: WPDM_START %d",apidir);
AACI_WaveStart(apidir, (PWAVEHDR) dwParam1);
break;
case WPDM_STOP:
IOCTLMSG1("PDD_WaveProc: WPDM_STOP %d",apidir);
AACI_WaveStop(apidir);
break;
case WPDM_PAUSE:
IOCTLMSG1("PDD_WaveProc: WPDM_PAUSE %d",apidir);
AACI_WaveStop(apidir);
break;
case WPDM_ENDOFDATA:
IOCTLMSG1("PDD_WaveProc: WPDM_ENDOFDATA %d",apidir);
AACI_WaveEndOfData(apidir);
break;
case WPDM_RESTART:
IOCTLMSG1("PDD_WaveProc: WPDM_RESTART %d",apidir);
AACI_WaveStart(apidir, (PWAVEHDR) dwParam1);
break;
case WPDM_GETVOLUME:
*((PULONG) dwParam1) = AACI_GetVolume();
break;
case WPDM_SETVOLUME:
AACI_SetVolume((ULONG) dwParam1);
break;
default :
WRNMSG1("PDD_WaveProc: Not supported message");
mmRet = MMSYSERR_NOTSUPPORTED;
break;
}
return(mmRet);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -