📄 fbm_api.c
字号:
default:
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
IPVD_QUEUE_SEND, returnVal, lv_msg[0], 0); // Log the error
break;
} /* End switch */
}
# else
MV_FBM_task_release_resources();
# endif /* FBM_IN_ISR_ONLY */
return(MV_FBM_OK);
} /* End MV_FBM_release_resources() */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_FBM_task_release_resources
DESCRIPTION:
FBM task deletes its message queues then commit suicide
RETURNS:
MV_FBM_OK
MV_FBM_NOT_OK
CALLING SEQUENCE:
*/
extern int
MV_FBM_task_release_resources(
void
)
/*EMP=======================================================================*/
{
tmErrorCode_t lv_return_value;
/****************-----------------------------------------------!*********
****************! Variable declarations !*********
****************!-----------------------------------------------*********/
/****************-----------------------------------------------!*********
****************! Execution !*********
****************!------------------------------------------------********/
/* Delete FBM message queue */
lv_return_value = tmosalQueueDestroy(GV_fbm_qid);
if (lv_return_value != TM_OK)
{
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
IPVD_QUEUE_DESTROY, lv_return_value, 0, 0); // Log the error
}
/* If FBM uses task, commit suicide */
# ifndef FBM_IN_ISR_ONLY
/* Return pREPC resources */
fclose(0);
/* Commit suicide */
tmosalTaskExit();
# endif
return(MV_FBM_OK);
} /* End MV_FBM_task_release_resources() */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_FBM_set_defaults
PACKAGE: MV_FBM
SCOPE: PLATFORM
DESCRIPTION:
Sets the video decoder package to default settings.
The status variable as reset to init value.
CALLING SEQUENCE:
*/
extern void
MV_FBM_set_defaults(
void
)
/*EMP=======================================================================*/
{
/* Enable fbm_event interrupts */
/*----------------------------------*/
/* Abort decoding related events */
/*----------------------------------*/
/* Enable 'Branch' event to create an interrupt */
/* Enable 'Abort_decoding_failed' event to create an interrupt */
/* Enable 'Abort_decoding_coef' event to create an interrupt */
/* Enable 'Abort_decoding_slice' event to create an interrupt */
/* Enable 'Buffer full' event to create an interrupt */
MV_drv_set_fbm_event_enable(MV_FBM_EVENT_ALL_EVENTS);
/* Enable fbm_error interrupts */
MV_drv_set_error_event_enable(MV_ERROR_EVENT_ALL_EVENTS);
LV_fbm_status_ptr->waiting_for_sync = FALSE;
LV_fbm_status_ptr->video_in_sync = FALSE;
LV_fbm_status_ptr->waiting_for_eopd = FALSE;
LV_fbm_status_ptr->picture_under_decoding = FALSE;
LV_fbm_status_ptr->picture_under_display = FALSE;
LV_fbm_status_ptr->display_started = FALSE;
LV_fbm_status_ptr->last_tab_label_used = MV_TAB_LABEL_ONE;
LV_fbm_status_ptr->next_picture.info_valid = FALSE;
LV_fbm_status_ptr->cur_picture.info_valid = FALSE;
LV_fbm_status_ptr->next_future_picture.info_valid = FALSE;
LV_fbm_status_ptr->cur_future_picture.info_valid = FALSE;
LV_fbm_status_ptr->next_past_picture.info_valid = FALSE;
LV_fbm_status_ptr->cur_past_picture.info_valid = FALSE;
LV_fbm_status_ptr->next_displayed_picture.info_valid = FALSE;
LV_fbm_status_ptr->cur_displayed_picture.info_valid = FALSE;
LV_fbm_status_ptr->previous_displayed_picture.info_valid = FALSE;
LV_fbm_status_ptr->next_recov_picture.info_valid = FALSE;
LV_fbm_status_ptr->cur_recov_picture.info_valid = FALSE;
LV_fbm_status_ptr->next_picture.new_frame = FALSE;
LV_fbm_status_ptr->cur_past_picture.frame_store = FS1;
LV_fbm_status_ptr->cur_future_picture.frame_store = FS1;
LV_fbm_status_ptr->decode_P_possible = FALSE;
LV_fbm_status_ptr->decode_B_possible = FALSE;
LV_fbm_status_ptr->Vs = VS_DECODE;
LV_fbm_status_ptr->next_Vs = VS_DECODE;
LV_fbm_status_ptr->picture_number = 1;
LV_fbm_status_ptr->change_channel_requested = FALSE;
LV_fbm_status_ptr->soft_reset_requested = FALSE;
LV_fbm_status_ptr->trick_mode_broken_link = TRUE;
LV_fbm_status_ptr->I_or_GI_P_found_after_trick_mode_broken_link = FALSE;
LV_fbm_status_ptr->decode_as_soon_as_in_sync = FALSE;
LV_fbm_status_ptr->toggle_24hz = 0;
LV_fbm_status_ptr->top_field_first_24hz = 0;
LV_fbm_status_ptr->low_delay_display_programmed = FALSE;
/* PR903 : 50 -> 60Hz conversion */
LV_fbm_status_ptr->prepare_2vs_frozen = FALSE;
LV_fbm_status_ptr->next_B_picture_frozen_2vs = FALSE;
LV_fbm_status_ptr->run_normal_vs_algoritm = TRUE;
LV_fbm_status_ptr->vs_counter = 0;
LV_fbm_status_ptr->step_status = MV_DEC_STEP_MODE_NONE;
LV_fbm_status_ptr->step_picture_structure_mode = MV_PICTURE_STRUCTURE_FRAME_PICTURE;
LV_fbm_status_ptr->step_required = FALSE;
LV_fbm_status_ptr->scan_status = MV_DEC_SCAN_MODE_NONE;
LV_fbm_status_ptr->freeze_mode_requested = MV_DEC_FREEZE_MODE_NONE;
LV_fbm_status_ptr->freeze_status = MV_DEC_FREEZE_MODE_NONE;
LV_fbm_status_ptr->picture_found_for_freeze_flag = FALSE;
LV_fbm_status_ptr->pip_decoding_requested = FALSE;
LV_fbm_status_ptr->pip_decoding_launched = FALSE;
LV_fbm_status_ptr->pip_decoding_programmed = FALSE;
LV_fbm_status_ptr->pip_waiting_for_eopd = FALSE;
LV_fbm_status_ptr->pip_waiting_for_in_sync = FALSE;
LV_fbm_status_ptr->pip_eoph_for_video_fifo_switch_back_occured = FALSE;
LV_fbm_status_ptr->pip_decoding_terminated = FALSE;
LV_fbm_status_ptr->pip_ready_to_be_displayed = FALSE;
LV_fbm_status_ptr->pip_discard_B_main_fifo = FALSE;
LV_fbm_status_ptr->dec_picture_controlled = FALSE;
LV_fbm_status_ptr->start_decoding_before_in_sync_processed = FALSE;
LV_fbm_status_ptr->fbm_state = FBM_STATE_DEC_STOPPED;
} /* End of MV_FBM_set_defaults */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_FBM_decode_pip
PACKAGE: MV_FBM
SCOPE: PLATFORM
DESCRIPTION:
Program decode PIP to FBM
CALLING SEQUENCE:
*/
extern int /* Returns: <description> */
MV_FBM_decode_pip(
unsigned long in_still_pict_y_odd_addr,
unsigned long in_still_pict_y_even_addr,
unsigned long in_still_pict_c_odd_addr,
unsigned long in_still_pict_c_even_addr
)
/*EMP=======================================================================*/
{
Int32 lv_timeout = MV_CFG_QUEUE_TIMEOUT;
tmErrorCode_t returnVal;
/****************-----------------------------------------------!*********
****************! Variable declarations !*********
****************!-----------------------------------------------*********/
/* Declaration for sending messages */
FBM_QUEUE_MSG msg;
/****************-----------------------------------------------!*********
****************! Execution !*********
****************!------------------------------------------------********/
LV_fbm_status_ptr->frame_store_y_odd_add[FRAME_STORE_FOR_DECODE_PICTURE_IN_PICTURE_FCT] =
(unsigned long)(in_still_pict_y_odd_addr - GV_MV_INP_status.SDRAM_base_addr);
LV_fbm_status_ptr->frame_store_y_even_add[FRAME_STORE_FOR_DECODE_PICTURE_IN_PICTURE_FCT] =
(unsigned long)(in_still_pict_y_even_addr - GV_MV_INP_status.SDRAM_base_addr);
LV_fbm_status_ptr->frame_store_c_odd_add[FRAME_STORE_FOR_DECODE_PICTURE_IN_PICTURE_FCT] =
(unsigned long)(in_still_pict_c_odd_addr - GV_MV_INP_status.SDRAM_base_addr);
LV_fbm_status_ptr->frame_store_c_even_add[FRAME_STORE_FOR_DECODE_PICTURE_IN_PICTURE_FCT] =
(unsigned long)(in_still_pict_c_even_addr - GV_MV_INP_status.SDRAM_base_addr);
msg[0] = FBM_MSG_DECODE_PIP;
returnVal = tmosalQueueSend(GV_fbm_qid, msg, sizeof(FBM_QUEUE_MSG), &lv_timeout, tmosalQueueSendFlagNone);
if (returnVal != TM_OK)
{
switch (returnVal)
{
case TMOSAL_ERR_QUE_TIMEOUT:
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TIMEOUT, IPVD_DBG_QUEUE_TIMEOUT_LEVEL,1, 0,0,0);
break;
default:
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
IPVD_QUEUE_SEND, returnVal, msg[0], 0); // Log the error
break;
} /* End switch */
}
return(MV_FBM_OK);
} /* End of MV_FBM_decode_pip */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_FBM_step
PACKAGE: MV_FBM
SCOPE:
DESCRIPTION:
Program step command to FBM
CALLING SEQUENCE:
*/
int /* Returns: <description> */
MV_FBM_step(
MV_DEC_STEP_MODE in_step_mode
)
/*EMP=======================================================================*/
{
Int32 lv_timeout = MV_CFG_QUEUE_TIMEOUT;
tmErrorCode_t returnVal;
/****************-----------------------------------------------!*********
****************! Variable declarations !*********
****************!-----------------------------------------------*********/
/* Declaration for sending messages */
FBM_QUEUE_MSG msg;
/****************-----------------------------------------------!*********
****************! Execution !*********
****************!------------------------------------------------********/
msg[0] = FBM_MSG_STEP;
switch(in_step_mode)
{
case MV_DEC_STEP_MODE_I:
msg[1] = MV_DEC_STEP_MODE_I;
break;
case MV_DEC_STEP_MODE_IP:
msg[1] = MV_DEC_STEP_MODE_IP;
break;
case MV_DEC_STEP_MODE_NONE:
msg[1] = MV_DEC_STEP_MODE_NONE;
break;
default:
msg[1] = MV_DEC_STEP_MODE_NONE;
break;
}
returnVal = tmosalQueueSend(GV_fbm_qid, msg, sizeof(FBM_QUEUE_MSG), &lv_timeout, tmosalQueueSendFlagNone);
if (returnVal != TM_OK)
{
switch (returnVal)
{
case TMOSAL_ERR_QUE_TIMEOUT:
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TIMEOUT, IPVD_DBG_QUEUE_TIMEOUT_LEVEL,1, 0,0,0);
break;
default:
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
IPVD_QUEUE_SEND, returnVal, msg[0], 0); // Log the error
break;
} /* End switch */
}
return(MV_FBM_OK);
} /* End of MV_FBM_step */
/*==========================================================================*/
/* L O C A L F U N C T I O N S */
/*==========================================================================*/
#ifndef FBM_IN_ISR_ONLY
/*LPF=======================================================================*/
/*
FUNCTION NAME: LF_FBM_task
DESCRIPTION: FBM task
RETURNS:
MV_FBM_OK
MV_FBM_NOT_OK
CALLING SEQUENCE:
*/
static void
LF_FBM_task(void)
/*EMP=======================================================================*/
{
/****************-----------------------------------------------!*********
****************! Variable declarations !*********
****************!-----------------------------------------------*********/
FBM_QUEUE_MSG msg;
UInt32 size;
Int32 timeout = 0;
while(1)
{
tmErrorCode_t lv_return_value;
lv_return_value = tmosalQueueReceive(GV_fbm_qid, msg, &size, &timeout, tmosalQueueReceiveFlagNone);
if(lv_return_value == TM_OK )
/* there is a message in the queue */
{
MV_FBM_supervisor(msg,LV_fbm_status_ptr);
}
else
{
DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
IPVD_QUEUE_RECEIVE, lv_return_value, msg, 0); // Log the error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -