thg_sdm.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:9k
- /*******************************************************************************
- * Copyright(c) Philips Consumer Electronics B.V. 2001
- * The attached material and the information contained therein is proprietary
- * to Philips and is issued only under strict confidentiality arrangements.
- * It shall not be used, reproduced, copied in whole or in part, adapted,
- * modified, or disseminated without a written license of Philips.
- * It must be returned to Philips upon its first request.
- *
- * Project: SA-MP ( Super Audio Media Player )
- * File %name: thg_sdm.c %
- * %version: 21 %
- * %date_modified: Mon Oct 14 16:50:21 2002 %
- * %derived_by: potm %
- * Creation date: Thu Jun 14 16:22:36 2001
- * First author: klerxm
- *
- * Advanced Systems and Applications Lab - Eindhoven
- *
- * Continuus %full_filespec: thg_sdm.c~21:csrc:1 %
- *
- * Description: Test harness of the System Diversity Manager
- *
- * Change history:
- *
- * Rev Date Who Comments
- * ---- ---------- -------- -----------------------------------------------------
- * 1 2001-06-06 klerxm Dummy version
- * 2 2001-06-14 klerxm Template update
- * 3 2001-09-04 klerxm Changes required for new global header files
- * 4 2001-10-08 kokh Adapted to changed definition of ErrCode
- * 5 2001-11-01 potm Implemented SDM test harness functions
- * 6 2001-11-07 kasterej Fix in SDM_SetMemoryConfig()
- * 7 2001-11-15 kokh Added SDM_SetSystemClock
- * 8 2001-11-21 potm Fixed use of UInt16's with TH_GetParam
- * 9 2001-11-28 potm Adapted to new SDM_Get/SetDacPinning
- * 10 2001-12-03 coenen Adapted to new SDM_Get/SetBurstLength
- * 11 2002-02-04 sribnyid Added SDM_GetEngineType, SDM_GetTaskPriorities, SDM_GetSystemClock
- * 12
- * 13 2002-02-22 potm Removed SDM_GetTaskPriorities
- * 14 2002-02-25 coenen Added SDM_GetHostType/SetHostType <-- yeah, right! NOT!
- * 15 2002-02-27 kokh TH_Send -> SAMP(TH_Send) + added impl for Set/GetHostType
- * 16 2002-03-18 kokh Removed Set/GetHostType again
- * 17 2002-03-25 novosadt SDM_SetMemoryConfig takes only one argument, interface for
- * tests still uses two parameters (CR390)
- * 18 2002-06-20 klerxm Completely removed SDM_SetMemoryConfig and SDM_GetMemoryConfig (CR390)
- * 19 2002-09-23 klerxm Use only UInt32 type parameters with TH_GetParam
- * 20 2002-10-14 potm Fixed a warning
- * 21 2003-02-13 potm Added SDM_EnableDTCP and SDM_GetDTCPStatus (CR405)
- *
- *******************************************************************************/
- #define COMP_PREFIX "SDM"
- /*******************************************************************************
- * Include Files
- *******************************************************************************/
- #include "config.h"
- #ifdef TEST_HARNASS
- #include "Playcoresampsamp_gen.h"
- #include <samp_sdm.h>
- #include <samp_sdm_exp.h>
- #if 0 //jerry cai
- #include <sdm.h>
- #endif
- #include <testharn.h>
- /*******************************************************************************
- * Macro Definitions
- *******************************************************************************/
- /*******************************************************************************
- * Data Definitions
- *******************************************************************************/
- /*******************************************************************************
- * Function prototype
- *******************************************************************************/
- DECLARE_GROUPFUNC(THG_SDM)
- /*******************************************************************************
- * Global test-harness function
- *******************************************************************************/
- DEFINE_GROUPFUNC(THG_SDM)
- #ifdef THGSDM
- SAMP(ErrCode) lErr;
- SAMP(UInt32) param[15];
- SAMP(UInt16) sdmBurstLength;
- SAMP(UInt32) systemClock;
- SAMP(SDM_DataLineDef) sdmDataLine[15];
- SAMP(SDM_EngineTypeDef) sdmEngine;
- SAMP(SDM_AudioClockDef) sdmAudioClock;
- SAMP(Bool) boolean;
- GROUP_SWITCH
- /*
- * Functions exported from SA-MP
- */
- CASE_CMD( "Init" )
- SAMP(SDM_Init)();
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", SAMP(ERR_OK));
- END_CASE
- CASE_CMD( "Term" )
- SAMP(SDM_Term)();
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", SAMP(ERR_OK));
- END_CASE
- CASE_CMD( "SetEngineType" )
- SAMP(ErrCode) lErr = SAMP(ERR_OK);
- TH_GetParam(OPTIONS, "%u", ¶m[0]);
- lErr = SAMP_EXP(SDM_SetEngineType)(param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", (SAMP(UInt32))lErr);
- END_CASE
- CASE_CMD( "SetDacPinning" )
- TH_GetParam(OPTIONS, "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u", ¶m[0], ¶m[1],
- ¶m[2], ¶m[3],
- ¶m[4], ¶m[5],
- ¶m[6], ¶m[7],
- ¶m[8], ¶m[9],
- ¶m[10], ¶m[11],
- ¶m[12], ¶m[13],
- ¶m[14]);
- lErr = SAMP_EXP(SDM_SetDacPinning)(param[0], param[1], param[2], param[3],
- param[4], param[5], param[6], param[7],
- param[8], param[9], param[10], param[11],
- param[12], param[13], param[14]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- CASE_CMD( "SetDsdClockPolarity" )
- TH_GetParam(OPTIONS, "%u", ¶m[0]);
- lErr = SAMP_EXP(SDM_SetDsdClockPolarity)((SAMP(Bool))param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- CASE_CMD( "SetSystemClock" )
- TH_GetParam(OPTIONS, "%u", ¶m[0]);
- lErr = SAMP_EXP(SDM_SetSystemClock)(param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- CASE_CMD( "SetAudioClock" )
- TH_GetParam(OPTIONS, "%u%u", ¶m[0], ¶m[1]);
- lErr = SAMP_EXP(SDM_SetAudioClock)(param[0], param[1]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", (SAMP(UInt32))lErr);
- END_CASE
- CASE_CMD( "SetSystemClock" )
- TH_GetParam(OPTIONS, "%u", ¶m[0]);
- lErr = SAMP_EXP(SDM_SetSystemClock)(param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- CASE_CMD( "SetBurstLength" )
- TH_GetParam(OPTIONS, "%u", &(param[0]));
- lErr = SAMP_EXP(SDM_SetBurstLength)((SAMP(UInt16))param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- CASE_CMD( "EnableDTCP" )
- TH_GetParam(OPTIONS, "%u", &(param[0]));
- lErr = SAMP_EXP(SDM_EnableDTCP)((SAMP(Bool))param[0]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
- END_CASE
- #if 0 //ARNO, PERHAPS REMOVE lATER
- /*
- * Functions internal to SA-MP
- */
- CASE_CMD( "GetEngineType" )
- lErr = SAMP_EXP(SDM_GetEngineType)(&sdmEngine);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmEngine);
- END_CASE
- CASE_CMD( "GetDacPinning" )
- lErr = SAMP_EXP(SDM_GetDacPinning)(&sdmDataLine[0], &sdmDataLine[1], &sdmDataLine[2], &sdmDataLine[3],
- &sdmDataLine[4], &sdmDataLine[5], &sdmDataLine[6], &sdmDataLine[7],
- &sdmDataLine[8], &sdmDataLine[9], &sdmDataLine[10], &sdmDataLine[11],
- &sdmDataLine[12], &sdmDataLine[13], &sdmDataLine[14]);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u", lErr,
- sdmDataLine[0], sdmDataLine[1], sdmDataLine[2], sdmDataLine[3],
- sdmDataLine[4], sdmDataLine[5], sdmDataLine[6], sdmDataLine[7],
- sdmDataLine[8], sdmDataLine[9], sdmDataLine[10], sdmDataLine[11],
- sdmDataLine[12], sdmDataLine[13], sdmDataLine[14]);
- END_CASE
- CASE_CMD( "GetDsdClockPolarity" )
- lErr = SAMP_EXP(SDM_GetDsdClockPolarity)(&boolean);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%s", lErr, boolean ? "TRUE" : "FALSE");
- END_CASE
- CASE_CMD( "GetAudioClock" )
- TH_GetParam(OPTIONS, "%u", ¶m[0]);
- lErr = SAMP_EXP(SDM_GetAudioClock)(param[0], &sdmAudioClock);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmAudioClock);
- END_CASE
- CASE_CMD( "GetSystemClock" )
- lErr = SAMP_EXP(SDM_GetSystemClock)(&systemClock);
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, systemClock);
- END_CASE
- CASE_CMD( "GetBurstLength" )
- lErr = SAMP_EXP(SDM_GetBurstLength)( &sdmBurstLength );
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmBurstLength);
- END_CASE
- CASE_CMD( "GetDTCPStatus" )
- lErr = SAMP_EXP(SDM_GetDTCPStatus)( &boolean );
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, boolean);
- END_CASE
- #endif
- #endif
-
- DEFAULT
- SAMP(TH_Send)(COMP_PREFIX, cmd, "%s", "Unknown command");
- END_CASE
- END_GROUPFUNC
- /*******************************************************************************
- * End of File
- *******************************************************************************/
- #endif