📄 create_rvtasks.c
字号:
/*************************************************************************************
* *
* Name create_RVtasks.c *
* *
* Function this file contains functions allowing tasks creation in *
* the Riviera environment *
* *
* Version 0.1 *
* *
* Date Modification *
* ------------------------------------ *
* 03 August 2000 Create *
* *
* Author Pascal Puel *
* *
* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved *
* *
* --------------------------------------------------------------------------------- *
* *
* History: *
* *
* 10/18/2001 - Updated for R2D by Christophe Favergeon *
* 08/28/2002 - Clean-Up by Gerard Cauvy *
* *
************************************************************************************/
#ifndef _WINDOWS
#include "rv.cfg"
#endif
#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_api.h"
#include "rvm/rvm_use_id_list.h"
#include "rvt/rvt_gen.h"
//sys_types.h is necessary for function prototypes in buzzer.h
#include "sys_types.h"
#include "buzzer/buzzer.h"
#include "rv/rv_defined_swe.h"
#include "chipset.cfg"
#ifndef _WINDOWS
# include "power/power.h"
#endif
#include <stdio.h>
#include <string.h>
#define START_TASK_ID (MAX_RVF_TASKS-1)
#define RV_START_TASK_PRIO (249)
T_RVT_USER_ID rv_trace_user_id = 0xff;
T_RVT_USER_ID etm_trace_user_id;
extern void etm_receive(unsigned char *inbuf, unsigned short size);
#ifdef MIXED_TRACE
T_RVT_USER_ID l23_trace_user_id;
extern void ext_processExtInput (T_RVT_BUFFER, UINT16);
#endif
#ifdef RVM_RNET_BR_SWE
T_RVT_USER_ID rnet_trace_user_id;
extern void rnet_receive (UINT8 *inbuf, UINT16 size);
#endif
#if (TEST==1)
// The name that uniquely identifies the Memory Bank MUST be
// 'TEST1', whereas it might be used by some other software
// entity for testing purpose.
#define RVTEST_MENU_MB_NAME ("TEST1")
// Memory requirements.
#define RVTEST_MENU_MB_SIZE (5000)
#define RVTEST_MENU_MB_WATERMARK (4000)
extern void rv_test (UINT32 p);
#endif
/*******************************************************************************
**
** Function rvt_init_trace
**
** Description This function is called by the RV_START task to register
** the Riviera Frame in the trace module
**
** Returns void
**
*******************************************************************************/
void rvt_init_trace (void)
{
rvt_register_id ("RV", &rv_trace_user_id, rvt_set_trace_level);
}
#ifdef RVM_ETM_SWE
/*******************************************************************************
**
** Function etm_init_trace
**
** Description This function is called by the RV_START task to register
** the ETM in the trace module
**
** Returns void
**
*******************************************************************************/
void etm_init_trace (void)
{
extern T_RVT_USER_ID tm_trace_user_id;
rvt_register_id("TM", &etm_trace_user_id, etm_receive);
#if (PSP_STANDALONE != 1)
tm_trace_user_id = etm_trace_user_id; // TML1 use the tm_trace_user_id
#endif
}
#endif
#ifdef MIXED_TRACE
/*******************************************************************************
**
** Function l23_init_trace
**
** Description This function is called by the RV_START task to register
** the Protocol Stack (Layers 2 & 3) in the trace module
**
** Returns void
**
*******************************************************************************/
void l23_init_trace (void)
{
rvt_register_id ("L23", &l23_trace_user_id, ext_processExtInput);
}
#endif
#ifdef RVM_RNET_BR_SWE
/*******************************************************************************
**
** Function rnet_init_trace
**
** Description This function is called by the RV_START task to register
** RNET in the trace module
**
** Returns void
**
*******************************************************************************/
void rnet_init_trace (void)
{
rvt_register_id ("RNET", &rnet_trace_user_id, rnet_receive);
}
#endif
/*******************************************************************************
**
** Function rv_start_swe_and_check
**
** Description This internal function is called by the stater task to
** start the basic SWEs in the system and to check if
** they started successfully or not.
**
** Returns void
**
*******************************************************************************/
#if (CHIPSET!=15) || (REMU==0)
BOOLEAN rv_start_swe_and_check (T_RVM_USE_ID swe_use_id, T_RVM_NAME swe_name)
{
T_RV_RETURN return_path = {0};
T_RV_HDR *msg_ptr = NULL;
UINT16 rec_evt = 0;
char error_msg[150] = "";
/* temporary initialization of addr_id */
return_path.addr_id = START_TASK_ID;
return_path.callback_func = NULL;
/* attempt to initialize the required SWE */
if (rvm_start_swe (swe_use_id, return_path) != RVM_OK)
{
sprintf (error_msg,
"create_RVtasks: Unable to start %s (0x%.8x). Error in rvm_start_swe",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen((char *)error_msg),
NULL_PARAM,
RV_TRACE_LEVEL_WARNING, RVM_USE_ID);
return FALSE;
}
/*
* wait for the SWE to be actually started.
* note that the 'RVM_EVT_TO_APPLI' notification is sent back
* once xxx_start () is invoked.
*/
while (rec_evt = rvf_evt_wait (START_TASK_ID, \
0xFFFF, \
0xFFFFFFFFL))
{
if (rec_evt & ~RVF_TASK_MBOX_0_EVT_MASK)
{
sprintf (error_msg,
"create_RVtasks: Starting %s (0x%.8x). Event ",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen((char *)error_msg),
(UINT32)rec_evt,
RV_TRACE_LEVEL_WARNING,
RVM_USE_ID);
}
if (rec_evt & RVF_TASK_MBOX_0_EVT_MASK)
{
if ((msg_ptr = (T_RV_HDR *) rvf_read_addr_mbox (START_TASK_ID, \
RVF_TASK_MBOX_0)) == NULL)
{
sprintf (error_msg,
"create_RVtasks: Starting %s (0x%.8x). Message NULL",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen((char *)error_msg),
NULL_PARAM,
RV_TRACE_LEVEL_WARNING,
RVM_USE_ID);
continue;
}
if (msg_ptr->msg_id != RVM_EVT_TO_APPLI)
{
sprintf (error_msg,
"create_RVtasks: Starting %s (0x%.8x). Message ID ",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen((char *)error_msg),
msg_ptr->msg_id,
RV_TRACE_LEVEL_WARNING,
RVM_USE_ID);
rvf_free_buf (msg_ptr);
continue;
}
break;
}
}
switch (((T_RVM_APPLI_RESULT *)msg_ptr)->result)
{
case RVM_OK:
{
sprintf (error_msg,
"create_RVtasks: %s (0x%.8x) started",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen ((char *)error_msg),
NULL_PARAM,
RV_TRACE_LEVEL_DEBUG_HIGH,
RVM_USE_ID);
rvf_free_buf (msg_ptr);
return TRUE;
}
case RVM_NOT_READY:
{
sprintf (error_msg,
"create_RVtasks: %s (0x%.8x) already started",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen ((char *)error_msg),
NULL_PARAM,
RV_TRACE_LEVEL_DEBUG_MEDIUM,
RVM_USE_ID);
rvf_free_buf (msg_ptr);
return TRUE;
}
default:
{
break;
}
}
sprintf (error_msg,
"create_RVtasks: Unable to start %s (0x%.8x). Error ",
(char *)swe_name,
swe_use_id);
rvf_send_trace ((char *)error_msg,
strlen ((char *)error_msg),
((T_RVM_APPLI_RESULT *)msg_ptr)->result,
RV_TRACE_LEVEL_WARNING,
RVM_USE_ID);
rvf_free_buf (msg_ptr);
return FALSE;
}
#endif
/*******************************************************************************
**
** Function rv_start
**
** Description This function is called by the RV_START task. It starts the
** Riviera environment and the TRACE task. This start must be
** done after Application_initialize().
**
** Returns void
**
*******************************************************************************/
void rv_start (void)
{
#if (TEST==1)
T_RVF_MB_ID mb_id = RVF_INVALID_MB_ID;
T_RVF_MB_PARAM mb_requirements = {0};
volatile UINT16 result = 0;
#endif
/* initialize the RVM and the RVF at the same time */
#if (CHIPSET!=15) || (REMU==0)
rvm_start_environment ();
#endif
/*
** Init trace module
*/
rvt_init_trace ();
#ifdef RVM_ETM_SWE
etm_init_trace ();
#endif
#if (_GSM==1)
#ifdef MIXED_TRACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -