thg_sdm.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:9k
源码类别:

DVD

开发平台:

Others

  1. /*******************************************************************************
  2. * Copyright(c) Philips Consumer Electronics B.V. 2001
  3. * The attached material and the information contained therein is proprietary
  4. * to Philips and is issued only under strict confidentiality arrangements.
  5. * It shall not be used, reproduced, copied in whole or in part, adapted,
  6. * modified, or disseminated without a written license of Philips.           
  7. * It must be returned to Philips upon its first request.
  8. *
  9. *  Project:        SA-MP ( Super Audio Media Player )
  10. *  File %name:     thg_sdm.c %
  11. *  %version:       21 %
  12. *  %date_modified: Mon Oct 14 16:50:21 2002 %
  13. *  %derived_by:    potm %
  14. *  Creation date:  Thu Jun 14 16:22:36 2001
  15. *  First author:   klerxm
  16. *
  17. *  Advanced Systems and Applications Lab - Eindhoven
  18. *
  19. *  Continuus %full_filespec: thg_sdm.c~21:csrc:1 %
  20. *
  21. *  Description:    Test harness of the System Diversity Manager
  22. *
  23. * Change history:
  24. *
  25. * Rev  Date       Who      Comments
  26. * ---- ---------- -------- -----------------------------------------------------
  27. *   1  2001-06-06 klerxm   Dummy version
  28. *   2  2001-06-14 klerxm   Template update
  29. *   3  2001-09-04 klerxm   Changes required for new global header files
  30. *   4  2001-10-08 kokh     Adapted to changed definition of ErrCode
  31. *   5  2001-11-01 potm     Implemented SDM test harness functions
  32. *   6  2001-11-07 kasterej Fix in SDM_SetMemoryConfig()
  33. *   7  2001-11-15 kokh     Added SDM_SetSystemClock
  34. *   8  2001-11-21 potm     Fixed use of UInt16's with TH_GetParam
  35. *   9  2001-11-28 potm     Adapted to new SDM_Get/SetDacPinning
  36. *  10  2001-12-03 coenen   Adapted to new SDM_Get/SetBurstLength
  37. *  11  2002-02-04 sribnyid Added SDM_GetEngineType, SDM_GetTaskPriorities, SDM_GetSystemClock
  38. *  12
  39. *  13  2002-02-22 potm     Removed SDM_GetTaskPriorities
  40. *  14  2002-02-25 coenen   Added SDM_GetHostType/SetHostType <-- yeah, right! NOT!
  41. *  15  2002-02-27 kokh     TH_Send -> SAMP(TH_Send) + added impl for Set/GetHostType
  42. *  16  2002-03-18 kokh     Removed Set/GetHostType again
  43. *  17  2002-03-25 novosadt SDM_SetMemoryConfig takes only one argument, interface for
  44. *                          tests still uses two parameters (CR390)
  45. *  18  2002-06-20 klerxm   Completely removed SDM_SetMemoryConfig and SDM_GetMemoryConfig (CR390)
  46. *  19  2002-09-23 klerxm   Use only UInt32 type parameters with TH_GetParam
  47. *  20  2002-10-14 potm     Fixed a warning
  48. *  21  2003-02-13 potm     Added SDM_EnableDTCP and SDM_GetDTCPStatus (CR405)
  49. *
  50. *******************************************************************************/
  51. #define COMP_PREFIX "SDM"
  52. /*******************************************************************************
  53. *                                Include Files
  54. *******************************************************************************/
  55. #include "config.h"
  56. #ifdef TEST_HARNASS
  57. #include "Playcoresampsamp_gen.h"
  58. #include <samp_sdm.h>
  59. #include <samp_sdm_exp.h>
  60. #if 0 //jerry cai
  61. #include <sdm.h>
  62. #endif
  63. #include <testharn.h>
  64. /*******************************************************************************
  65. *                               Macro Definitions
  66. *******************************************************************************/
  67. /*******************************************************************************
  68. *                               Data Definitions
  69. *******************************************************************************/
  70. /*******************************************************************************
  71. *                              Function prototype
  72. *******************************************************************************/
  73. DECLARE_GROUPFUNC(THG_SDM)
  74. /*******************************************************************************
  75. *                          Global test-harness function
  76. *******************************************************************************/
  77. DEFINE_GROUPFUNC(THG_SDM)
  78. #ifdef THGSDM
  79.   SAMP(ErrCode) lErr;
  80.   SAMP(UInt32) param[15];
  81.   SAMP(UInt16) sdmBurstLength;
  82.   SAMP(UInt32) systemClock;
  83.   SAMP(SDM_DataLineDef) sdmDataLine[15];
  84.   SAMP(SDM_EngineTypeDef) sdmEngine;
  85.   SAMP(SDM_AudioClockDef) sdmAudioClock;
  86.   SAMP(Bool) boolean;
  87.   GROUP_SWITCH
  88.   /* 
  89.    * Functions exported from SA-MP 
  90.    */
  91.   CASE_CMD( "Init" )
  92.     SAMP(SDM_Init)();
  93.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", SAMP(ERR_OK));
  94.   END_CASE
  95.   CASE_CMD( "Term" )
  96.     SAMP(SDM_Term)();
  97.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", SAMP(ERR_OK));
  98.   END_CASE
  99.   CASE_CMD( "SetEngineType" )
  100.     SAMP(ErrCode) lErr = SAMP(ERR_OK);
  101.     TH_GetParam(OPTIONS, "%u", &param[0]);
  102.     lErr = SAMP_EXP(SDM_SetEngineType)(param[0]);
  103.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", (SAMP(UInt32))lErr);
  104.   END_CASE
  105.   CASE_CMD( "SetDacPinning" )
  106.     TH_GetParam(OPTIONS, "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u", &param[0], &param[1], 
  107.                                                            &param[2], &param[3],
  108.                                                            &param[4], &param[5],
  109.                                                            &param[6], &param[7],
  110.                                                            &param[8], &param[9],
  111.                                                            &param[10], &param[11],
  112.                                                            &param[12], &param[13],
  113.                                                            &param[14]);
  114.     lErr = SAMP_EXP(SDM_SetDacPinning)(param[0],  param[1],  param[2],  param[3], 
  115.                                    param[4],  param[5],  param[6],  param[7], 
  116.                                    param[8],  param[9],  param[10], param[11], 
  117.                                    param[12], param[13], param[14]);
  118.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  119.   END_CASE
  120.   CASE_CMD( "SetDsdClockPolarity" )
  121.     TH_GetParam(OPTIONS, "%u", &param[0]);
  122.     lErr = SAMP_EXP(SDM_SetDsdClockPolarity)((SAMP(Bool))param[0]);
  123.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  124.   END_CASE
  125.   CASE_CMD( "SetSystemClock" )
  126.     TH_GetParam(OPTIONS, "%u", &param[0]);
  127.     lErr = SAMP_EXP(SDM_SetSystemClock)(param[0]);
  128.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  129.   END_CASE
  130.   CASE_CMD( "SetAudioClock" )
  131.     TH_GetParam(OPTIONS, "%u%u", &param[0], &param[1]);
  132.     lErr = SAMP_EXP(SDM_SetAudioClock)(param[0], param[1]);
  133.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", (SAMP(UInt32))lErr);
  134.   END_CASE
  135.   CASE_CMD( "SetSystemClock" )
  136.     TH_GetParam(OPTIONS, "%u", &param[0]);
  137.     lErr = SAMP_EXP(SDM_SetSystemClock)(param[0]);
  138.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  139.   END_CASE
  140.   CASE_CMD( "SetBurstLength" )
  141.     TH_GetParam(OPTIONS, "%u", &(param[0]));
  142.     lErr = SAMP_EXP(SDM_SetBurstLength)((SAMP(UInt16))param[0]);
  143.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  144.   END_CASE
  145.   CASE_CMD( "EnableDTCP" )
  146.     TH_GetParam(OPTIONS, "%u", &(param[0]));
  147.     lErr = SAMP_EXP(SDM_EnableDTCP)((SAMP(Bool))param[0]);
  148.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u", lErr);
  149.   END_CASE
  150. #if 0 //ARNO, PERHAPS REMOVE lATER
  151.   /*
  152.    * Functions internal to SA-MP
  153.    */
  154.   CASE_CMD( "GetEngineType" )
  155.     lErr = SAMP_EXP(SDM_GetEngineType)(&sdmEngine);
  156.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmEngine);
  157.   END_CASE
  158.   CASE_CMD( "GetDacPinning" )
  159.     lErr = SAMP_EXP(SDM_GetDacPinning)(&sdmDataLine[0],  &sdmDataLine[1],  &sdmDataLine[2],  &sdmDataLine[3],
  160.                                    &sdmDataLine[4],  &sdmDataLine[5],  &sdmDataLine[6],  &sdmDataLine[7],
  161.                                    &sdmDataLine[8],  &sdmDataLine[9],  &sdmDataLine[10], &sdmDataLine[11],
  162.                                    &sdmDataLine[12], &sdmDataLine[13], &sdmDataLine[14]);
  163.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u", lErr,
  164.                                    sdmDataLine[0],  sdmDataLine[1],  sdmDataLine[2],  sdmDataLine[3],
  165.                                    sdmDataLine[4],  sdmDataLine[5],  sdmDataLine[6],  sdmDataLine[7],
  166.                                    sdmDataLine[8],  sdmDataLine[9],  sdmDataLine[10], sdmDataLine[11],
  167.                                    sdmDataLine[12], sdmDataLine[13], sdmDataLine[14]);
  168.   END_CASE
  169.   CASE_CMD( "GetDsdClockPolarity" )
  170.     lErr = SAMP_EXP(SDM_GetDsdClockPolarity)(&boolean);
  171.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%s", lErr, boolean ? "TRUE" : "FALSE");
  172.   END_CASE
  173.   CASE_CMD( "GetAudioClock" )
  174.     TH_GetParam(OPTIONS, "%u", &param[0]);
  175.     lErr = SAMP_EXP(SDM_GetAudioClock)(param[0], &sdmAudioClock);
  176.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmAudioClock);
  177.   END_CASE
  178.   CASE_CMD( "GetSystemClock" )
  179.     lErr = SAMP_EXP(SDM_GetSystemClock)(&systemClock);
  180.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, systemClock);
  181.   END_CASE
  182.   CASE_CMD( "GetBurstLength" )
  183.     lErr = SAMP_EXP(SDM_GetBurstLength)( &sdmBurstLength );
  184.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, sdmBurstLength);
  185.   END_CASE
  186.   CASE_CMD( "GetDTCPStatus" )
  187.     lErr = SAMP_EXP(SDM_GetDTCPStatus)( &boolean );
  188.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%u%u", lErr, boolean);
  189.   END_CASE
  190. #endif
  191. #endif
  192.   
  193.   DEFAULT
  194.     SAMP(TH_Send)(COMP_PREFIX, cmd, "%s", "Unknown command");
  195.   END_CASE
  196. END_GROUPFUNC
  197. /*******************************************************************************
  198. *                                 End of File
  199. *******************************************************************************/
  200. #endif