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

📄 rvt_env.c

📁 是一个手机功能的模拟程序
💻 C
字号:
/*******************************************************************************
 *
 * rvt_env.c
 *
 * This module interfaces the environment and contains all start/init/stop...
 * functions of the trace module.
 *
 * (C) Texas Instruments, all rights reserved
 *
 * Version number	: 0.1
 *
 * History			: 0.1 (7/4/2000) - Created
 *
 * Date             : 7/4/2000
 *
 * Author           : Cristian Livadiotti, c-livadiotti@ti.com
 *
 ******************************************************************************/

#include "nucleus.h"

#include <string.h>

#include "rvf_api.h"
#include "rv_general.h"
#include "rvm_gen.h"
#include "rvm_priorities.h"

#include "rvt_gen.h"
#include "rvt_def_i.h"
#include "rvt_env.h"
#include "rvt_env_i.h"

#include "rvm_use_id_list.h"

#include "serialswitch.h"

#ifndef _WINDOWS
	#include "debug.cfg"
#endif


T_RVF_ADDR_ID	rvt_addr_id			= 0;
T_RVF_MB_ID		rvt_mb_id			= 0;

T_RVT_STATE		rvt_module_state = RVT_NOT_STARTED;

#define TI_RX_HISR_STACK_SIZE    (1024)
NU_HISR TI_rcv_HISR;
static UINT8 TI_RX_HISR_stack[TI_RX_HISR_STACK_SIZE];


/********************************************************************************/
/*                                                                              */
/*    Function Name:   rvt_get_info												*/
/*                                                                              */
/*    Purpose:         This function is used to notify the RVM					*/
/*                     of the Trace's Memory Banks requirements.				*/
/*                                                                              */
/*    Input Parameters:                                                         */
/*        &p_info_swe (refer to rvm_gen.h).                                     */
/*                                                                              */
/*    Output Parameters:                                                        */
/*        p_info_swe (refer to rvm_gen.h).                                      */
/*                                                                              */
/*    Global Parameters:                                                        */
/*        None.                                                                 */
/*                                                                              */
/*    Note:                                                                     */
/*        None.                                                                 */
/*                                                                              */
/********************************************************************************/

T_RVM_RETURN
rvt_get_info (T_RVM_INFO_SWE *p_info_swe)
{
	if (!p_info_swe)
		return RVM_INVALID_PARAMETER;

	p_info_swe->swe_type						= RVM_SWE_TYPE_4;
	
	p_info_swe->type_info.type4.swe_use_id		= RVT_USE_ID;
	p_info_swe->type_info.type4.version			= 1;
	memcpy( p_info_swe->type_info.type4.swe_name, "TRACE", sizeof("TRACE") );

	p_info_swe->type_info.type4.stack_size		= TRACE_TASK_STACK_SIZE;
	p_info_swe->type_info.type4.priority		= RVM_TRACE_TASK_PRIORITY;

	p_info_swe->type_info.type4.return_path.addr_id			= 0;
	p_info_swe->type_info.type4.return_path.callback_func	= NULL;



	/* Memory banks definitions
	   For now, one memory bank is needed */
	p_info_swe->type_info.type4.nb_mem_bank		= 1;
	/* TRACE MB */
	memcpy (p_info_swe->type_info.type4.mem_bank[0].bank_name, "RV_TRACE", RVM_NAME_MAX_LEN);
	p_info_swe->type_info.type4.mem_bank[0].initial_params.size          = TRACE_MB_SIZE;
	p_info_swe->type_info.type4.mem_bank[0].initial_params.watermark     = TRACE_MB_WATERMARK;
	
	/*RVT generic functions	*/
	p_info_swe->type_info.type4.init			= rvt_init;
	p_info_swe->type_info.type4.core			= (T_RVM_SWE_CORE_FUNC)rvt_task_core;
	p_info_swe->type_info.type4.stop			= rvt_stop;
	p_info_swe->type_info.type4.kill			= rvt_kill;
	p_info_swe->type_info.type4.set_info		= rvt_set_info;

	/* Linked SW entities : none, except if Profiler or Nucleus Monitor are defined*/
	#if (TI_PROFILER == 1)  || (TI_NUC_MONITOR == 1)
	p_info_swe->type_info.type4.nb_linked_swe	= 1;
	p_info_swe->type_info.type4.linked_swe_id[0]= TI_PRF_USE_ID;
	#else
	p_info_swe->type_info.type4.nb_linked_swe	= 0;
	#endif

	return RVM_OK;
}



/********************************************************************************/
/*                                                                              */
/*    Function Name:   rvt_set_info												*/
/*                                                                              */
/*    Purpose:         This function is used to notify the Trace module         */
/*                     about mb ids and task id	.								*/
/*                                                                              */
/*    Input Parameters:                                                         */
/*        task_id[]: array of task ids.											*/
/*        mb_id[]: array of memory bank ids.									*/
/*                                                                              */
/*    Output Parameters:                                                        */
/*        None.																	*/
/*                                                                              */
/*    Global Parameters:                                                        */
/*        None.                                                                 */
/*                                                                              */
/*    Note:                                                                     */
/*        None.                                                                 */
/*                                                                              */
/********************************************************************************/

T_RVM_RETURN
rvt_set_info (T_RVF_ADDR_ID		addr_id,
			  T_RV_RETURN_PATH	return_path[],
			  T_RVF_MB_ID		bk_id[],
			  T_RVM_CB_FUNC		rvm_error_ft)
{
	/* Save the parameters given by environment	*/

	/* addr Id */
	rvt_addr_id = addr_id;

	/* Bank Id */
	rvt_mb_id = bk_id [0];

	return RVM_OK;
}




/********************************************************************************/
/*                                                                              */
/*    Function Name:   rvt_init													*/
/*                                                                              */
/*    Purpose:         This is the initialization function.						*/
/*					   It is called by the RVM									*/
/*                                                                              */
/*    Input Parameters:                                                         */
/*        None.																	*/
/*                                                                              */
/*    Output Parameters:                                                        */
/*        None.																	*/
/*                                                                              */
/*    Global Parameters:                                                        */
/*        None.                                                                 */
/*                                                                              */
/*    Note:                                                                     */
/*        None.                                                                 */
/*                                                                              */
/********************************************************************************/

T_RVM_RETURN
rvt_init (void)
{
  STATUS  status_ret;                                            

  if (rvt_module_state != RVT_NOT_STARTED)
	return RVM_NOT_READY;

  /*
  ** The stack is entirely filled with the pattern 0xFE.
  */
  memset (TI_RX_HISR_stack, 0xFE, TI_RX_HISR_STACK_SIZE);

  status_ret = NU_Create_HISR (&TI_rcv_HISR,                        
                        "TI_RCV_HISR",                       
                        rvt_RX_process,                    
                        2,                                
                        TI_RX_HISR_stack,                    
                        TI_RX_HISR_STACK_SIZE);              
                                                          
  if (status_ret != NU_SUCCESS)
	return RVM_INTERNAL_ERR;

  // initialize the baud rate and the callback function for the RX HISR
  SER_tr_Init (SER_LAYER_1, TR_BAUD_115200, rvt_activate_RX_HISR); 

  /* set the RVT state to "STARTED" */
  rvt_module_state = RVT_STARTED;

  return RVM_OK;
}



/*
** Functions stop and kill are defined for compilation only
*/
T_RVM_RETURN
rvt_stop (void)
{
	return RVM_OK;
}


T_RVM_RETURN
rvt_kill (void)
{
	return RVM_OK;
}


⌨️ 快捷键说明

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