⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hostif_high.c

📁 本程序为ST公司开发的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
t_ipod_buffer local_ipod_buffer[MAX_IPOD_PACKETS];  t_BinaryDownstreamParameters saved_BinaryDownstreamParameters;    //saved_BinaryDownstreamParameters#endif /* IPOD_PASSTHROUGH */                                             /* state variable used by 'scheduled tx' */t_textInfoParameters    saved_textInfoParameters;t_msgEntryParameters    saved_msgEntryParameters, saved_msgLongEntryParameters;t_discContentParameters saved_msgDiscContentParameters;t_dirContentParameters  saved_msgDirContentParameters;t_playlistAbsContentParameters saved_msgPlaylistAbsContentParameters;#if ((1 == HAVE_HOST_UPDATE) || (1 == HAVE_HOST_UPDATE_NEW))#if (0!=IPOD_PASSTHROUGH)t_BinaryUpstreamParameters  saved_BinaryUpstreamParameters = {0, 0, 0, 0};#endif /*IPOD_PASSTHROUGH*/#endifuint16 hostif_resume_data_count = 0;#define textInfoFlags_is_cdda        0x01#define textInfoFlags_have_cdda_info 0x02#define textInfoFlags_have_CA_info   0x04#define FIELD_COMPLETE  ((t_bool) 0)#define FIELD_MORE      ((t_bool) 1)#define NO_MESSAGE_SENT ((t_bool) 0)#define MESSAGE_SENT    ((t_bool) 1)int16 formatTextMsg(const uint8 *, char *, t_bool, uint8, uint8);uint8 *getID3TagFromSongInfos(t_SongInfos *, t_SongTagType, uint8 *);t_bool report_msg_text_info_field(t_textInfoBitmask fld);#if (0!=IPOD_PASSTHROUGH)t_bool hostif_process_binary_downstream(char *cmd, uint16 cmd_len, t_BinaryDownstreamParameters * DownstreamParams, t_usb_downstream_cmd_event * downstream_cmd_struct);void hostif_process_resume_data(t_BinaryDownstreamParameters * DownstreamParams, t_usb_downstream_cmd_event * downstream_cmd_struct);#endif /*IPOD_PASSTHROUGH*/void  hostif_process_preevents(void);extern t_SongInfos current_song_info;extern t_player_params player_params;extern t_player_seek player_seek;// OS20 stuffsemaphore_t sem_hostif_critical;uint8 hostif_servo_parameters_vector[MAX_SERVO_PARAMETER + 1];uint32 hostif_pvd_address;const char product_id_string[] = HOSTIF_PRODUCT_ID_ASCII;/* Events defined in hostif_low.h */t_hostif_inevent hostif_inevent;/* Global variable used for long message generation *//* This variable is shared among several functions, so it must be used only *//* trough the 'scheduled tx' framework */static char long_msg[HOSTIF_MAX_BLOCK_SIZE];/******************************************************************************//* Function:  InitHostIfTask                                                  *//*                                                                            *//*! \brief    HostInterface Task initialization  *  \param    void *  \return   void *  \remark   Initializes all static storage (i.e. block counters)  *            used by the Communication Protocol. *            Sets the defaults for the communication parameters. *//******************************************************************************/void InitHostIfTask(void){	hostifCommProtocolParam.maxI2CFrameSize = DEFAULT_MAX_I2C_FRAME_SIZE;  hostif_resume_data_count = 0;	semaphore_init_fifo(&sem_hostif_critical, 1);#if (0 != HAVE_POSITION)	memset(&hostifStoredData, 0, sizeof(hostifStoredDataType));	hostifLoadData = 0;#endif /* HAVE_POSITION */	hostif_reset();	hostif_ll_retry_count = 0;#if (0!=IPOD_PASSTHROUGH)  /* init of saved_BinaryDownstreamParameters */  saved_BinaryDownstreamParameters.ipod_buffer = local_ipod_buffer;#endif /* IPOD_PASSTHROUGH */}/******************************************************************************//* Function:  HostIfTask                                                      *//*                                                                            *//*! \brief    HostInterface Task   *  \param    void *  \return   void *  \remark *//******************************************************************************/void HostIfTask(void *unused){	while (1)	{		OSAL_wait_thread(OSAL_THREAD_HostIfTask);			#if (OS20_PROFILING == 1) && (0 != DEBUG_INCLUDE_MIPS_PROFILING)  		{    		extern uint8 print_profiling;    		extern void Print_profiling(void);    		if (print_profiling)    		{      			print_profiling = 0;      			Print_profiling();    		}  		}#endif    event_disable_scheduling();#if (0 != HAVE_USB)#if (0 != IPOD_PASSTHROUGH)#if (0 != IPOD_AP)    event_in_shedule(PLAYER_UPSTREAM_STATUS_EVENT);    event_in_shedule(PLAYER_DOWNSTREAM_STATUS_EVENT);#else /* !IPOD_AP */      event_in_shedule(USB_UPSTREAM_STATUS_EVENT);    event_in_shedule(USB_DOWNSTREAM_STATUS_EVENT);#endif /* IPOD_AP */    event_in_shedule(PLAYER_STATUS_EVENT);#endif /* IPOD_PASSTHROUGH  */#endif /* HAVE_USB */        event_enable_scheduling();#if (0 != HAVE_USB)#if (0 != IPOD_PASSTHROUGH)    hostif_process_preevents();#endif /* IPOD_PASSTHROUGH  */#endif /* HAVE_USB */    do    {            hostif_process_hostcmd();      hostif_process_scheduled_tx();      hostif_transition_handler();    } while (hostif_inevent != 0);      //JS changed - pass through funcs at least once                                         //(there can come event with hostif_inevent = 0)        event_disable_scheduling();			#if (0 != HAVE_HOST_UPDATE)		event_out_shedule(CONTROLLER_HOSTIF_STATUS_EVENT);#endif#if (0 != HAVE_USB)#if (0 != IPOD_PASSTHROUGH)#if (0 != IPOD_AP)    event_in_clear(PLAYER_UPSTREAM_STATUS_EVENT);    event_in_clear(PLAYER_DOWNSTREAM_STATUS_EVENT);#else /* !IPOD_AP */     event_in_clear(USB_UPSTREAM_STATUS_EVENT);    event_in_clear(USB_DOWNSTREAM_STATUS_EVENT);#endif  /* IPOD_AP */       event_in_clear(PLAYER_STATUS_EVENT);#endif /* IPOD_PASSTHROUGH  */#endif /* HAVE_USB */		event_cmd_shedule();      		event_enable_scheduling();				}}/************************************************** * * reset_hostif_servo_parameters() *  * Parameters: *  TBD *  * Description: *  * *************************************************/void reset_hostif_servo_parameters(t_hsp_reset_mode hsp_reset_mode){  uint8 i;  if (HSP_RESET_MODE_STARTUP == hsp_reset_mode)  {    hostif_servo_parameters_vector[STARTUP_STATUS_BYTE] = (uint8)HSP_STATUS_STARTUP_UPDATE_AWAITED;    for (i = MIN_STARTUP_PARAMETER; i <= MAX_SERVO_PARAMETER; i++)    {      hostif_servo_parameters_vector[i] = 0x00;    }  }#ifndef EXECUTE_AGC_ONLY_ONCE  else   /* (HSP_RESET_MODE_RESTART == hsp_reset_mode) */  {    hostif_servo_parameters_vector[STARTUP_STATUS_BYTE] = (uint8)HSP_STATUS_RESTART_UPDATE_AWAITED;    for (i = MIN_RESTART_PARAMETER; i <= MAX_SERVO_PARAMETER; i++)    {      hostif_servo_parameters_vector[i] = 0x00;    }  }#endif}/************************************************** * * store_hostif_servo_parameters() *  * Parameters: *  TBD *  * Description: *  * *************************************************/#if (HAVE_CD_MECHA == 1)void store_hostif_servo_parameters(t_hsp_storing_mode hsp_storing_mode){  t_hsp_status hsp_status;  if (HSP_STORING_MODE_STARTUP_OK == hsp_storing_mode)  {    hsp_status = HSP_STATUS_STARTUP_OK;  }#ifndef EXECUTE_AGC_ONLY_ONCE  else if (HSP_STORING_MODE_STARTUP_ERROR == hsp_storing_mode)#else  else   /* (HSP_STORING_MODE_STARTUP_ERROR == hsp_storing_mode) */#endif  {    if (!servo_startup_flags.field.fe_adjust_done)    {      if (SLEDGE_ERROR == servo_fsm_result)      {        hsp_status = HSP_STATUS_STARTUP_ERROR_SLEDGE_HOME_NOT_DONE;      }      else      {        hsp_status = HSP_STATUS_STARTUP_ERROR_FE_ADJUST_NOT_DONE;      }    }    else if (!servo_startup_flags.field.te_adjust_done)    {      hsp_status = HSP_STATUS_STARTUP_ERROR_TE_ADJUST_NOT_DONE;    }    else if (!servo_startup_flags.field.agc_focus_done)    {      hsp_status = HSP_STATUS_STARTUP_ERROR_AGC_FOCUS_NOT_DONE;    }    else   /* (!servo_startup_flags.field.agc_tracking_done) */    {      hsp_status = HSP_STATUS_STARTUP_ERROR_AGC_TRACKING_NOT_DONE;    }  }#ifndef EXECUTE_AGC_ONLY_ONCE  else if (HSP_STORING_MODE_RESTART_OK == hsp_storing_mode)  {    hsp_status = HSP_STATUS_RESTART_OK;  }  else   /* (HSP_STORING_MODE_RESTART_OK == hsp_storing_mode) */  {    if (!servo_startup_flags.field.agc_focus_done)    {      hsp_status = HSP_STATUS_RESTART_ERROR_AGC_FOCUS_NOT_DONE;    }    else   /* (!servo_startup_flags.field.agc_tracking_done) */    {      hsp_status = HSP_STATUS_RESTART_ERROR_AGC_TRACKING_NOT_DONE;    }  }#endif#ifndef EXECUTE_AGC_ONLY_ONCE  if ((HSP_STORING_MODE_RESTART_OK != hsp_storing_mode)   || (HSP_STORING_MODE_RESTART_ERROR != hsp_storing_mode))#endif  {    hostif_servo_parameters_vector[STARTUP_STATUS_BYTE] = (uint8)hsp_status;     hostif_servo_parameters_vector[1] = ANA_GAIN_AC;    hostif_servo_parameters_vector[2] = ANA_GAIN_BD;    hostif_servo_parameters_vector[3] = ANA_GAIN_E;    hostif_servo_parameters_vector[4] = ANA_GAIN_F;    hostif_servo_parameters_vector[5] = ANA_LS_AC;    hostif_servo_parameters_vector[6] = ANA_LS_BD;    hostif_servo_parameters_vector[7] = ANA_LS_E;    hostif_servo_parameters_vector[8] = ANA_LS_F;    hostif_servo_parameters_vector[9] = dsp_read_ymem(COEFF_ERROR_ADD + 0) >> 8;    hostif_servo_parameters_vector[10] = dsp_read_ymem(COEFF_ERROR_ADD + 0) & 0xFF;    hostif_servo_parameters_vector[11] = dsp_read_ymem(COEFF_ERROR_ADD + 3) >> 8;    hostif_servo_parameters_vector[12] = dsp_read_ymem(COEFF_ERROR_ADD + 3) & 0xFF;  }  hostif_servo_parameters_vector[13] = dsp_read_ymem(FOCUS_GAIN_ADD) >> 8;  hostif_servo_parameters_vector[14] = dsp_read_ymem(FOCUS_GAIN_ADD) & 0xFF;  hostif_servo_parameters_vector[15] = dsp_read_ymem(FOCUS_SHIFT_GAIN_ADD);  hostif_servo_parameters_vector[16] = dsp_read_ymem(TRACKING_GAIN_ADD) >> 8;  hostif_servo_parameters_vector[17] = dsp_read_ymem(TRACKING_GAIN_ADD) & 0xFF;  hostif_servo_parameters_vector[18] = dsp_read_ymem(TRACKING_SHIFT_GAIN_ADD);}#endif // HAVE_CD_MECHA/************************************************** * * hostifAppProcessPlayerInfoGroup() *  * Parameters: *  TBD *  * Description: * Application Layer Command Processing function. * Processes commands of the group 0x01 (Player Info) *  * *************************************************/void hostifAppProcessPlayerInfoGroup(char *cmd, uint16 cmd_len){  uint8 cmd_id = *(cmd + 1);  char response_msg[MAX_SERVO_PARAMETER + 3]; /* Max message length, for MECH_PARAM */  uint8 bitmask = 0;  /*uint8 par1;*/ // [RB] unused  t_player_cmd_event player_command;  switch (cmd_id) {		  case REQ_PRODUCT_VERSION:    {    char prod_id[10] = HOSTIF_PRODUCT_STRING;    /* Product Identification */    response_msg[0] = HOSTIF_GROUP_MSG_PLAYER_INFO;    response_msg[1] = MSG_PRODUCT_VERSION; /* ID */    memcpy(&response_msg[2], prod_id, 9);    hostifAppSendMsg(&response_msg[0], 2 + 9);    }    break;		#if (1 == HAVE_TEMP_SENSOR)		  case REQ_TEMPERATURE:	report_msg_temperature();    break;#endif  case REQ_STATE:    /* Request Status Information */    /* PAR1 is a bitmask specifying which info is required */    if (hostifAppHasParameter(cmd_len, PAR1))    bitmask = hostifAppGetParameter(cmd, PAR1);    /* use default value for bitmask if not provided in the command */    if ((bitmask & AVAILABLE_MODES) == 0)    {      hostifAppSendMsgCmdEval(CMDE_ILLEGAL_COMMAND, HOSTIF_GROUP_CMD_PLAYER_INFO, cmd_id);      break;    }    if (bitmask & POWER_MODE)    {      report_msg_power_mode(power_mode);    }    if (bitmask & PLAYER_MODE)    {      report_msg_player_mode(player_mode, player_transition_state, player_current_resume_info_available,player_seek.speed);    }    if (bitmask & LOADER_MODE)    {      report_msg_loader_mode(loader_mode, loader_mode_attribute);    }    if (bitmask & INSERT_MODE)    {#if (1 == HAVE_USB)      //USB device	    if (player_params.DevicesReady & DEV_USB_ID)	    {	    	report_msg_insert_mode(USB_READY, DUMMY_VALUE, DUMMY_VALUE);	    }	    else if (player_mount_params.DevicesWaitingForMount & DEV_USB_ID)	    {	    	report_msg_insert_mode(USB_MOUNT, player_mount_params.VID, player_mount_params.PID);	    }	    else	    {	    	report_msg_insert_mode(USB_DISCONNECT, DUMMY_VALUE, DUMMY_VALUE);	    }#endif#if (1 == HAVE_SDC)      //SDC	    if (player_params.DevicesReady & DEV_SDC_ID)	    {	    	report_msg_insert_mode(SDC_READY, DUMMY_VALUE, DUMMY_VALUE);	    }	    else if (player_mount_params.DevicesWaitingForMount & DEV_SDC_ID)	    {	    	report_msg_insert_mode(SDC_MOUNT, DUMMY_VALUE, DUMMY_VALUE);	    }	    else	    {	    	report_msg_insert_mode(SDC_DISCONNECT, DUMMY_VALUE, DUMMY_VALUE);	    }#endif	        }//JS disabled in CIS 0.09 not present#if 0    if (bitmask & ERROR_MODE)    {//    report_msg_error_mode(...);    }#endif      break;		  case REQ_MECH_PARAMETER:    if (PWM_POWER_ON != power_mode)    {      report_msg_error_mode(ERM_NA_STATE_ERROR);      report_msg_power_mode(power_mode);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -