SAMP_API.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:25k
- #include "Config.h" // Global Configuration - do not remove!
- #if D_SUPPORT_SACD // ZKR GLSACD
- #if 1 ////////////////////////////////////////////////////////////////////////////////////////
- #include "IncludeSysDefs.h"
- #include "PlaycoreCoremaincoremain.h"
- #include "KerneluITRONrtos.h"
- #include "KernelKer_API.h"
- #include "KernelEventDef.h"
- #include "PlaycoreSAMPschedulerSAMPScheduler.h"
- #include "PlaycoreSAMPschedulerSAMP_API.h"
- #define SAMP_READY
- #ifdef SAMP_READY
- #include "playcoresampsamp_apm.h"
- #include "playcoresampsamp_nav.h"
- #include "playcoresampsamp_sdi.h"
- #include "playcoresampsamp_sdm.h"
- #endif
- #ifdef dbg_printf
- #undef dbg_printf
- #define dbg_printf(sMsg) printf ## sMsg
- #endif
- // *****************************************************************************
- // * External referencies
- // *****************************************************************************
- extern int SchedulerID;
- // *****************************************************************************
- // * Global variable
- // *****************************************************************************
- //keeps error code for API function calls
- SAMP(ErrCode) errorCode;
- static BOOL gbSAMP_APICallFinished = 0;
- // *****************************************************************************
- // * Function prototypes
- // *****************************************************************************
- SAMP(ErrCode) SAMP_API_Start (void);
- // *****************************************************************************
- // * Purpose : Send event to CORE dispatcher and wait for the answer
- // * Input Parameters : APIFunction - ID of called API function
- // * errPtr - error code return by called API function
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description : The APICallSend will send event to CORE handler
- // * dispatcher. The parameter is required ID of API function
- // * call. The functions wait for API execution finished
- // * Comments : Need to figur out correct parameter passing
- // *****************************************************************************
- BOOL SAMP_APICallRequest (UINT32 APIFunction, SAMP(ErrCode) *errPtr)
- {
- // ER SAMP(ErrCode) = E_OK;
- if (SchedulerID == -1)
- {
- tr_printf (("SAMP Scheduler is not installedn"));
- return FALSE;
- }
- gbSAMP_APICallFinished = 0;
-
- //send request to call API function
- if (!ie_send_ex(IE_CORE_SAMP_API, (void *)(APIFunction)))
- {
- tr_printf (("SAMP_APICall failure - sent eventn"));
- return FALSE;
- }
- //wait for the confirmation and error code
- // SAMP(ErrCode) = wai_sem(SEM_SAMP);
- while(gbSAMP_APICallFinished == 0) usleep(1000UL);
- #if 0
- if (SAMP(ErrCode) != E_OK)
- {
- tr_printf (("SAMP_APICall failure - wait for semaphoren"));
- return FALSE;
- }
- #endif
- *errPtr = errorCode;
- return TRUE;
- }
- // *****************************************************************************
- // * Purpose : Acknowledge the API function call is finished
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- BOOL SAMP_APICallAcknowledge (SAMP(ErrCode) err)
- {
- //confirm the comand is executed and return the ERROR code
- errorCode = err;
- gbSAMP_APICallFinished = 1;
- return 1;
- // return (sig_sem(SEM_SAMP) == E_OK);
- }
- #ifdef SAMP_READY
- #ifdef TEST_HARNASS
- // *****************************************************************************
- // * Purpose : handle the NAV API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_NAV_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case NAV_AREASWITCH:
- {
- SAMP(SACD_Area) Area = (SAMP(SACD_Area))SAMP_API_PARAM[0];
- err = SAMP(NAV_AreaSwitch)(Area);
- break;
- }
- case NAV_PLAYATTIMECODE:
- {
- SAMP(SACD_TimeCode) Timecode;
- Timecode.min = (BYTE)SAMP_API_PARAM[0];
- Timecode.sec = (BYTE)SAMP_API_PARAM[1];
- Timecode.fr = (BYTE)SAMP_API_PARAM[2];
- err = SAMP(NAV_PlayAtTimecode)(Timecode);
- break;
- }
- case NAV_PLAYTRACK:
- {
- SAMP(UInt16) track = (SAMP(UInt16))SAMP_API_PARAM[0];
- SAMP(UInt16) index = (SAMP(UInt16))SAMP_API_PARAM[1];
- err = SAMP(NAV_PlayTrack)(track, index);
- break;
- }
- case NAV_STOP:
- {
- err = SAMP(NAV_Stop)();
- break;
- }
- case NAV_PAUSE:
- err = SAMP(NAV_Pause)();
- break;
- case NAV_RESUMEPLAY:
- err = SAMP(NAV_ResumePlay)();
- break;
- case NAV_NEXTTRACK:
- err = SAMP(NAV_NextTrack)();
- break;
- case NAV_PREVIOUSTRACK:
- err = SAMP(NAV_PreviousTrack)();
- break;
- case NAV_FORWORDSCAN:
- {
- SAMP(UInt8) Speed = (SAMP(UInt8))SAMP_API_PARAM[0];
- err = SAMP(NAV_ForwardScan)(Speed);
- break;
- }
- case NAV_BACKWORDSCAN:
- {
- SAMP(UInt8) Speed = (SAMP(UInt8))SAMP_API_PARAM[0];
- err = SAMP(NAV_BackwardScan)(Speed);
- break;
- }
- case NAV_REPEAT:
- {
- SAMP(NAV_RepeatModeDef) RepeatMode = (SAMP(NAV_RepeatModeDef))SAMP_API_PARAM[0];
- err = SAMP(NAV_Repeat)(RepeatMode);
- break;
- }
- case NAV_REPEATAB:
- {
- SAMP(NAV_RepeatABModeDef) RepeatABMode = (SAMP(NAV_RepeatABModeDef))SAMP_API_PARAM[0];
- err = SAMP(NAV_RepeatAB)(RepeatABMode);
- break;
- }
- case NAV_SHUFFLE:
- {
- SAMP(Bool) ShuffleMode = (SAMP(Bool))SAMP_API_PARAM[0];
- err = SAMP(NAV_Shuffle)(ShuffleMode);
- break;
- }
- case NAV_INTROSCAN:
- {
- SAMP(Bool) IntroScanMode = (SAMP(Bool))SAMP_API_PARAM[0];
- SAMP(UInt8) Duration = SAMP_API_PARAM[1];
- err = SAMP(NAV_IntroScan)(IntroScanMode, Duration);
- break;
- }
- case NAV_SETPLAYSEQUENCE:
- {
- SAMP(NAV_PlaySequenceDef) PlaySequence = (SAMP(NAV_PlaySequenceDef))SAMP_API_PARAM[0];
- err = SAMP(NAV_SetPlaySequence)(PlaySequence);
- break;
- }
- case NAV_PLAYSEQUENCEDEF:
- {
- SAMP(NAV_ProgramListDef) *ProgramList = (SAMP(NAV_ProgramListDef) *)SAMP_API_PARAM[0];
- err = SAMP(NAV_SetProgramList)(ProgramList);
- break;
- }
- case NAV_SUBSCRIBE:
- {
- SAMP(NAV_CallbackDef) Callback = (SAMP(NAV_CallbackDef))SAMP_API_PARAM[0];
- SAMP(BitSet32) Events = SAMP_API_PARAM[1];
- err = SAMP(NAV_Subscribe)(Callback, Events);
- break;
- }
- case NAV_SUBSCRIBE_1394:
- {
- SAMP(NAV_CallbackDef) Callback = (SAMP(NAV_CallbackDef))SAMP_API_PARAM[0];
- SAMP(BitSet32) Events = SAMP_API_PARAM[1];
- err = SAMP(NAV_Subscribe_1394)(Callback, Events);
- break;
- }
- case NAV_GETSTATE:
- {
- SAMP(NAV_StateDef) *PState = (SAMP(NAV_StateDef) *)SAMP_API_PARAM[0];
- err = SAMP(NAV_GetState)(PState);
- break;
- }
- case NAV_GETPLAYLIST:
- {
- SAMP(NAV_ProgramListDef) *ProgramList = (SAMP(NAV_ProgramListDef) *)SAMP_API_PARAM[0];
- err = SAMP(NAV_GetPlayList)(ProgramList);
- break;
- }
- }
- return err;
- }
- // *****************************************************************************
- // * Purpose : handle the SDM API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_SDM_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case SDM_GETHANDLER:
- {
- SAMP(SDM_PVoidFuncDef) *ph = SAMP_API_PARAM[0];
- SAMP(SDM_GetHandler)(ph);
- break;
- }
- case SDM_SETENGINETYPE:
- {
- SAMP(SDM_EngineTypeDef) Engine = SAMP_API_PARAM[0];
- err = SAMP(SDM_SetEngineType)(Engine);
- break;
- }
- case SDM_SETDACPINNING:
- {
- SAMP(SDM_DataLineDef) PcmLine0 = SAMP_API_PARAM[0] & 0xf;
- SAMP(SDM_DataLineDef) PcmLine1 = (SAMP_API_PARAM[0]>>8) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine2 = (SAMP_API_PARAM[0]>>16) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine3 = (SAMP_API_PARAM[0]>>24) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine4 = SAMP_API_PARAM[1] & 0xf;
- SAMP(SDM_DataLineDef) PcmLine5 = (SAMP_API_PARAM[1]>>8) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine6 = (SAMP_API_PARAM[1]>>16) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine7 = (SAMP_API_PARAM[1]>>24) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine8 = (SAMP_API_PARAM[2]) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine9 = (SAMP_API_PARAM[2]>>8) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine10 = (SAMP_API_PARAM[2]>>16) & 0xf;
- SAMP(SDM_DataLineDef) PcmLine11 = (SAMP_API_PARAM[2]>>24) & 0xf;
- SAMP(SDM_DataLineDef) DsdLine6 = (SAMP_API_PARAM[3]) & 0xf;
- SAMP(SDM_DataLineDef) DsdLine7 = (SAMP_API_PARAM[3]>>8) & 0xf;
- SAMP(SDM_DataLineDef) DsdLine9 = (SAMP_API_PARAM[3]>>16) & 0xf;
- err = SAMP(SDM_SetDacPinning)
- ( PcmLine0
- , PcmLine1
- , PcmLine2
- , PcmLine3
- , PcmLine4
- , PcmLine5
- , PcmLine6
- , PcmLine7
- , PcmLine8
- , PcmLine9
- , PcmLine10
- , PcmLine11
- , DsdLine6
- , DsdLine7
- , DsdLine9);
- break;
- }
- case SDM_SETDSDCLKPOLARITY:
- {
- SAMP(Bool) Positive = SAMP_API_PARAM[0];
- err = SAMP(SDM_SetDsdClockPolarity)(Positive);
- break;
- }
- case SDM_SETAUDIOCLK:
- {
- SAMP(SACD_InputModeDef) InputMode = SAMP_API_PARAM[0];
- SAMP(SDM_AudioClockDef) AudioClock = SAMP_API_PARAM[1];
- err = SAMP(SDM_SetAudioClock)(InputMode,
- AudioClock);
- break;
- }
- case SDM_SETSYSCLK:
- {
- SAMP(UInt32) SystemClock = SAMP_API_PARAM[0];
- err = SAMP(SDM_SetSystemClock)(SystemClock);
- break;
- }
- case SDM_SETBURSTLEN:
- {
- SAMP(UInt16) BurstLength = SAMP_API_PARAM[0];
- err = SAMP(SDM_SetBurstLength)(BurstLength);
- break;
- }
- case SDM_ENA_DTCP:
- {
- SAMP(Bool) enableDTCP = (SAMP(Bool))SAMP_API_PARAM[0];
- err = SAMP(SDM_EnableDTCP)(enableDTCP);
- break;
- }
- }
- return err;
- }
- // *****************************************************************************
- // * Purpose : handle the APM API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_APM_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case APM_SET_INPUTMODE:
- {
- SAMP(SACD_InputModeDef) InputStream = SAMP_API_PARAM[0];
- err = SAMP(APM_SetInputMode)(InputStream);
- break;
- }
- case APM_SET_OUTPUTMODE:
- {
- SAMP(APM_OutputModeDef) out_mode_6ch = SAMP_API_PARAM[0];
- SAMP(APM_OutputModeDef) out_mode_2ch = SAMP_API_PARAM[1];
- err = SAMP(APM_SetOutputMode)(out_mode_6ch, out_mode_2ch);
- break;
- }
- case APM_SET_6CHDOWNMIX:
- {
- SAMP(APM_6ch_MixDef) Downmix = SAMP_API_PARAM[0];
- err = SAMP(APM_Set6chDownmix)(Downmix);
- break;
- }
- case APM_SET_2CHDOWNMIX:
- {
- SAMP(APM_2ch_MixDef) Downmix = SAMP_API_PARAM[0];
- err = SAMP(APM_Set2chDownmix)(Downmix);
- break;
- }
- case APM_SET_SPEAKERS:
- {
- SAMP(APM_SpeakerDef) Speakers = SAMP_API_PARAM[0];
- err = SAMP(APM_SetSpeakers)(Speakers);
- break;
- }
- case APM_SET_ATTENUATION:
- {
- SAMP(UInt16) Attenuation[8];
- Attenuation[0] = SAMP_API_PARAM[0];
- Attenuation[1] = SAMP_API_PARAM[1];
- Attenuation[2] = SAMP_API_PARAM[2];
- Attenuation[3] = SAMP_API_PARAM[3];
- Attenuation[4] = SAMP_API_PARAM[4];
- Attenuation[5] = SAMP_API_PARAM[5];
- Attenuation[6] = SAMP_API_PARAM[6];
- Attenuation[7] = SAMP_API_PARAM[7];
- err = SAMP(APM_SetAttenuation)(Attenuation);
- break;
- }
- case APM_SET_DELAY:
- {
- SAMP(UInt32) Delay[6];
- Delay[0] = SAMP_API_PARAM[0];
- Delay[1] = SAMP_API_PARAM[1];
- Delay[2] = SAMP_API_PARAM[2];
- Delay[3] = SAMP_API_PARAM[3];
- Delay[4] = SAMP_API_PARAM[4];
- Delay[5] = SAMP_API_PARAM[5];
- err = SAMP(APM_SetDelay)(Delay);
- break;
- }
- case APM_SET_FILTERMODE:
- {
- SAMP(APM_FilterModeDef) FilterMode = SAMP_API_PARAM[0];
- err = SAMP(APM_SetFilterMode)(FilterMode);
- break;
- }
- case APM_SET_PCMUPSAMPLING:
- {
- SAMP(UInt8) Upsampling = SAMP_API_PARAM[0];
- err = SAMP(APM_SetPcmUpsampling)(Upsampling);
- break;
- }
- case APM_SET_BASSFILTERS:
- {
- SAMP(APM_BassFrequencyDef) BassFrequency = SAMP_API_PARAM[0];
- SAMP(APM_BassSlopeDef) BassSlope = SAMP_API_PARAM[1];
- err = SAMP(APM_SetBassFilters)(BassFrequency, BassSlope);
- break;
- }
- case APM_SET_PIO:
- {
- SAMP(BitSet16) pio_bits = SAMP_API_PARAM[0];
- err = SAMP(APM_SetPIO)(pio_bits);
- break;
- }
- }
- return err;
- }
- // *****************************************************************************
- // * Purpose : handle the SAMP API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_SAMP_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case SAMP_INIT:
- {
- err = SAMP(SAMP_Init)();
- break;
- }
- case SAMP_TERM:
- {
- err = SAMP(SAMP_Term)();
- break;
- }
- case SAMP_SACDDISCREC:
- {
- SAMP(Bool) *pSACD = SAMP_API_PARAM[0];
- SAMP(Bool) *pHybrid = SAMP_API_PARAM[1];
- err = SAMP(SAMP_SACDDiscRec)(pSACD, pHybrid);
- break;
- }
- case SAMP_ACTIVATE:
- {
- SAMP(Bool) discRecognised = SAMP_API_PARAM[0];
- SAMP(SAMP_AreaInfoDef) *pST_Info = SAMP_API_PARAM[1];
- SAMP(SAMP_AreaInfoDef) *pMC_Info = SAMP_API_PARAM[2];
- SAMP(Bool) *pHybrid = SAMP_API_PARAM[3];
- err = SAMP(SAMP_Activate)(discRecognised, pST_Info, pMC_Info, pHybrid);
- break;
- }
- case SAMP_DEACTIVATE:
- {
- err = SAMP(SAMP_Deactivate)();
- break;
- }
- case SAMP_REACTIVATE:
- {
- err = SAMP(SAMP_Reactivate)();
- break;
- }
- case SAMP_SUBSCRIBE:
- {
- SAMP(SAMP_CallbackDef) Callback = SAMP_API_PARAM[0];
- SAMP(BitSet32) Events = SAMP_API_PARAM[1];
- err = SAMP(SAMP_Subscribe)(Callback, Events);
- break;
- }
- }
- return err;
- }
- // *****************************************************************************
- // * Purpose : handle the OSA API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_OSA_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case OSA_TASK_CREATE:
- {
- PRIORITY Priority = (PRIORITY)SAMP_API_PARAM[0];
- size_t Stacksize = (size_t)SAMP_API_PARAM[1];
- FP Entry = SAMP_API_PARAM[2];
- IDENT *Id = (IDENT *)SAMP_API_PARAM[3];
- err = SAMP(OS_TaskCreate) (Priority, Stacksize, Entry, Id);
- break;
- }
- case OSA_TASK_DELETE:
- {
- IDENT Id = (IDENT)SAMP_API_PARAM[0];
- err = SAMP(OS_TaskDelete) (Id);
- break;
- }
- case OSA_SEM_CREATE:
- {
- UNITS Units = (UNITS)SAMP_API_PARAM[0];
- IDENT *Id = (IDENT *)SAMP_API_PARAM[1];
- err = SAMP(OS_SemCreate) (Units, Id);
- break;
- }
- case OSA_SEM_DELETE:
- {
- IDENT Id = (IDENT)SAMP_API_PARAM[0];
- err = SAMP(OS_SemDelete) (Id);
- break;
- }
- case OSA_SEM_V:
- {
- IDENT Id = (IDENT)SAMP_API_PARAM[0];
- err = SAMP(OS_SemV) (Id);
- break;
- }
- }
- return err;
- }
- #endif
- #endif
- // *****************************************************************************
- // * Purpose : handle the SDI API function call event
- // * Input Parameters : err - error code return by API function call
- // * Return Value : TRUE - API function call executed succesfuly
- // * FALSE - API function call failed
- // * Description :
- // *****************************************************************************
- static SAMP(ErrCode) SAMP_SDI_API_Handler(UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- switch(param)
- {
- case SDI_SETAVAILABLECHARSETS:
- {
- SAMP(UInt8) nrOfCharSets = (SAMP(UInt8))SAMP_API_PARAM[0];
- SAMP(UInt8) *pCharSetList = (SAMP(UInt8)*)SAMP_API_PARAM[1];
- err = SAMP(SDI_SetAvailableCharSets)(nrOfCharSets, pCharSetList );
- break;
- }
- case SDI_SETLANGPREF:
- {
- SAMP(UInt8) nrOfLanguages = (SAMP(UInt8))SAMP_API_PARAM[0];
- SAMP(SDI_LanguageCodeDef) *pLanguageCodes = (SAMP(SDI_LanguageCodeDef) *)SAMP_API_PARAM[1];
- err = SAMP(SDI_SetLanguagePreference)(nrOfLanguages, pLanguageCodes );
- break;
- }
- case SDI_GETALBUMINFO:
- {
- SAMP(SDI_Album_Info) *pAlbumInfo = (SAMP(SDI_Album_Info) *)SAMP_API_PARAM[0];
- err = SAMP(SDI_GetAlbumInfo)(pAlbumInfo );
- break;
- }
- case SDI_GETALBUMTEXT:
- {
- SAMP(SDI_AlbumTextField) field = (SAMP(SDI_AlbumTextField))SAMP_API_PARAM[0];
- SAMP(SDI_TextChannelType) type = (SAMP(SDI_TextChannelType))SAMP_API_PARAM[1];
- SAMP(UInt32) bufferSize = (SAMP(UInt32))SAMP_API_PARAM[2];
- void *pAlbumText = (void *)SAMP_API_PARAM[3];
- SAMP(UInt8) *pCharSet = (SAMP(UInt8) *)SAMP_API_PARAM[4];
- SAMP(SDI_LanguageCodeDef) *pLanguage = (SAMP(SDI_LanguageCodeDef) *)SAMP_API_PARAM[5];
- err = SAMP(SDI_GetAlbumText)(field, type, bufferSize, pAlbumText, pCharSet, pLanguage );
- break;
- }
- case SDI_GETDISCINFO:
- {
- SAMP(SDI_Disc_Info) *pDiscInfo = (SAMP(SDI_Disc_Info) *)SAMP_API_PARAM[0];
- err = SAMP(SDI_GetDiscInfo)(pDiscInfo );
- break;
- }
- case SDI_GETDISCTEXT:
- {
- SAMP(SDI_DiscTextField) field = (SAMP(SDI_DiscTextField))SAMP_API_PARAM[0];
- SAMP(SDI_TextChannelType) type = SAMP_API_PARAM[1];
- SAMP(UInt32) bufferSize = SAMP_API_PARAM[2];
- void *pDiscText = (void *)SAMP_API_PARAM[3];
- SAMP(UInt8) *pCharSet = (SAMP(UInt8) *)SAMP_API_PARAM[4];
- SAMP(SDI_LanguageCodeDef) *pLanguage = (SAMP(SDI_LanguageCodeDef) *)SAMP_API_PARAM[5];
- err = SAMP(SDI_GetDiscText)( field, type, bufferSize, pDiscText, pCharSet, pLanguage );
- break;
- }
- case SDI_GETAREATEXT:
- {
- SAMP(SACD_Area) area = SAMP_API_PARAM[0];
- SAMP(SDI_AreaTextField) field = SAMP_API_PARAM[1];
- SAMP(SDI_TextChannelType) type = SAMP_API_PARAM[2];
- SAMP(UInt32) bufferSize = SAMP_API_PARAM[3];
- void *pAreaText = (void *)SAMP_API_PARAM[4];
- SAMP(UInt8) *pCharSet = (SAMP(UInt8) *)SAMP_API_PARAM[5];
- SAMP(SDI_LanguageCodeDef) *pLanguage = (SAMP(SDI_LanguageCodeDef) *)SAMP_API_PARAM[6];
- err = SAMP(SDI_GetAreaText)( area, field, type, bufferSize, pAreaText, pCharSet, pLanguage );
- break;
- }
- case SDI_GETTRACKINFO:
- {
- SAMP(SACD_Area) area = SAMP_API_PARAM[0];
- SAMP(UInt8) trackNr = SAMP_API_PARAM[1];
- SAMP(SDI_Track_Info) *pTrackInfo = (SAMP(SDI_Track_Info) *)SAMP_API_PARAM[2];
- err = SAMP(SDI_GetTrackInfo)(area, trackNr, pTrackInfo );
- break;
- }
- case SDI_GETTRACKTEXT:
- {
- SAMP(SACD_Area) area = SAMP_API_PARAM[0];
- SAMP(UInt8) trackNr = SAMP_API_PARAM[1];
- SAMP(SDI_TrackTextField) field = SAMP_API_PARAM[2];
- SAMP(SDI_TextChannelType) type = SAMP_API_PARAM[3];
- SAMP(UInt32) bufferSize = SAMP_API_PARAM[4];
- void *pTrackText = (void *)SAMP_API_PARAM[5];
- SAMP(UInt8) *pCharSet = (SAMP(UInt8) *)SAMP_API_PARAM[6];
- SAMP(SDI_LanguageCodeDef) *pLanguage = (SAMP(SDI_LanguageCodeDef) *)SAMP_API_PARAM[7];
- err = SAMP(SDI_GetTrackText)(area, trackNr, field, type, bufferSize, pTrackText, pCharSet, pLanguage );
- break;
- }
- case SDI_GETNUMOFINDEX:
- {
- SAMP(SACD_Area) area = SAMP_API_PARAM[0];
- SAMP(UInt8) track = SAMP_API_PARAM[1];
- SAMP(UInt8) *pNrOfIndices = (SAMP(UInt8) *)SAMP_API_PARAM[2];
- err = SAMP(SDI_GetNumberOfIndices)(area, track, pNrOfIndices );
- break;
- }
- case SDI_GETDTCPINFO:
- {
- SAMP(UInt32) offset = SAMP_API_PARAM[0];
- SAMP(UInt32) size = SAMP_API_PARAM[1];
- void *pBuffer = (void *)SAMP_API_PARAM[2];
- err = SAMP(SDI_GetDTCP_Info)(offset, size, pBuffer);
- break;
- }
- case SDI_GETSPECVERSION:
- {
- SAMP(SDI_Spec_Version) *pSpecVersion = (SAMP(SDI_Spec_Version) *)SAMP_API_PARAM[0];
- err = SAMP(SDI_GetSpecVersion)(pSpecVersion );
- break;
- }
- case SDI_GETAREADATA:
- {
- SAMP(SACD_Area) area = SAMP_API_PARAM[0];
- SAMP(SDI_Area_Data) *pAreaData = (SAMP(SDI_Area_Data) *)SAMP_API_PARAM[1];
- err = SAMP(SDI_GetAreaData)(area, pAreaData );
- break;
- }
- }
- return err;
- }
- // *****************************************************************************
- // * Purpose : API function call collector
- // * Input Parameters : param - IDE of the API function
- // * Return Value : NA
- // * Description : Call API function according requeste parameter, after the
- // * API function call set error code in global variable and
- // * confirm the execution is finished to caller
- // *****************************************************************************
- void SAMP_API_Handler (UINT32 param)
- {
- SAMP(ErrCode) err = SAMP(ERR_OK);
- char group = param >>8;
- #ifdef SAMP_READY
- if(SDI_GROUP == group)
- {
- err = SAMP_SDI_API_Handler(param);
- }
- #endif
- //for test only
- #ifdef TEST_HARNASS
- #ifdef SAMP_READY
- else
- if(NAV_GROUP == group)
- {
- err = SAMP_NAV_API_Handler(param);
- }
- else
- if(SDM_GROUP == group)
- {
- err = SAMP_SDM_API_Handler(param);
- }
- else
- if(APM_GROUP == group)
- {
- err = SAMP_APM_API_Handler(param);
- }
- else
- if(SAMP_GROUP == group)
- {
- err = SAMP_SAMP_API_Handler(param);
- }
- else
- if(OSA_GROUP == group)
- {
- err = SAMP_OSA_API_Handler(param);
- }
- #endif
- else
- {
- switch (param)
- {
- case SAMP_API_START:
- err = SAMP_API_Start ();
- break;
- default:
- dbg_printf (("The API command was not recognizedn"));
- break;;
- }
- }
- #endif
- SAMP_APICallAcknowledge (err);
- }
- #ifdef TEST_HARNASS
- // *****************************************************************************
- // * Purpose : Start SAMP code by creating first task
- // * Input Parameters : NA
- // * Return Value : error code of OS - schedular function
- // *****************************************************************************
- extern void task0 (void);
- extern IDENT tid0;
- SAMP(ErrCode) SAMP_API_Start (void)
- {
- return SAMP(OS_TaskCreate) (5,1500,task0,&tid0);
- }
- #endif
- #endif
- #endif // D_SUPPORT_SACD