📄 info.c
字号:
/****************************************************************************/
/* TEXAS INSTRUMENTS PROPRIETARY INFORMATION */
/* */
/* (c) Copyright, Texas Instruments Incorporated, 2006. */
/* All Rights Reserved. */
/* */
/* Property of Texas Instruments Incorporated. Restricted Rights - */
/* Use, duplication, or disclosure is subject to restrictions set */
/* forth in TI's program license agreement and associated documentation. */
/****************************************************************************/
/****************************************************************************/
/* info.c */
/* */
/* System information functions. */
/* */
/* Re-ordering or adding to aunction arrays requires changes/additions to */
/* the .projector file: It uses array indexes to identify tasks. */
/****************************************************************************/
#include <stddef.h>
#include "common.h"
#include "ddp2230_rtos_include.h"
#include "ddp.h"
#include "anr.h"
#include "osd.h"
#include "frame.h"
#include "cw.h"
#include "seq.h"
#include "taskparm.h"
#include "info.h"
#include "dbmessage.h"
#include "sysmon.h"
#include "pollTask.h"
#include "usbIO.h"
#include "projectorCtl.h"
#include "rfcControl.h"
#include "irRemote.h"
#include "datapath.h"
#include "guiApp.h"
#include "refDdcProc.h"
/****************************************************/
/* External functions. */
/****************************************************/
extern int08 ALC_GetAutoLockTaskID(uint32 *al_task_id);
/****************************************************/
/* Task type identifiers indicating what kind of */
/* task is being queried. This is needed because */
/* the API uses two different methods of providing */
/* task information. */
/****************************************************/
#define TASKTYPE_APP 0x00 /* application task */
#define TASKTYPE_API1 0x10 /* API task, regular form */
#define TASKTYPE_API2 0x20 /* API task, irregular form */
#define TASKTYPE_TMASK 0xf0 /* mask the task type */
#define TASKTYPE_IMASK 0x0f /* mask the task index */
/****************************************************/
/* Application task array. */
/* */
/* Re-ordering or adding to infoFunc[] requires */
/* changes/additions to the .projector file: It */
/* uses array indexes to identify tasks. */
/****************************************************/
static void (*const infoFunc[])( TASKINFO_STRUCT *info ) =
{
sysmon_info,
pollTask_info,
usbIO_info,
pctl_info,
irRemote_info,
guiTask_info,
datapath_info,
rfc_info,
ddc_info
};
static const nInfoFunc = sizeof( infoFunc ) / 4;
/****************************************************/
/* API task array. */
/* */
/* Re-ordering or adding to infoAPIFunc[] requires */
/* changes/additions to the .projector file: It */
/* uses array indexes to identify tasks. */
/****************************************************/
static const struct _apiInfoStruct
{
char * const taskName;
int32 stackSize;
int08 (*taskIDFunc)( uint32 *taskID );
}
infoAPIFunc[] =
{
{ "OSD Manager" , OSD_TASK_STACK_SIZE, OSD_GetTaskID },
{ "frameTask" , FRAME_TASK_STACK_SIZE, FRAME_GetVSyncTaskID },
{ "autolockTask" , ALC_TASK_STACK_SIZE, ALC_GetAutoLockTaskID },
{ "sequenceTask" , SEQ_STACK_SIZE, SEQ_GetTaskID }
};
static const nInfoAPIFunc = sizeof( infoAPIFunc ) / sizeof( struct _apiInfoStruct );
/****************************************************/
/* API irregular task array. */
/* */
/* Re-ordering or adding to infoIrregFunc[] */
/* required changes/additions to the .projector */
/* file: It uses array indexes to identify tasks. */
/****************************************************/
static const struct _apiIrregInfoStruct
{
char * const taskName;
int32 stackSize;
}
infoIrregFunc[] =
{
{ "cwIndexTask", CW_INDEX_STACK_SIZE },
{ "i2cSlave[1]", I2CSLAVE_TASK_STACK_SIZE }
};
static const nInfoIrregFunc = sizeof( infoIrregFunc ) / sizeof( struct _apiIrregInfoStruct );
/****************************************************/
/* Local functions. */
/****************************************************/
static BOOL _getAPITaskInfo( uint08 index, TASKINFO_STRUCT *pInfo );
static BOOL _getAppTaskInfo( uint08 index, TASKINFO_STRUCT *pInfo );
static BOOL _getIrregTaskInfo ( uint08 index, TASKINFO_STRUCT *pInfo );
/****************************************************************************/
/* Get task information for one app or API task. 'index' identifies the */
/* type of task and array offset within a task: */
/* index = ( TASKTYPE_??? | offset ) */
/****************************************************************************/
BOOL info_getTaskInfo( uint08 index, TASKINFO_STRUCT *pInfo )
{
switch( index & TASKTYPE_TMASK )
{
case TASKTYPE_APP: return _getAppTaskInfo ( index & TASKTYPE_IMASK, pInfo );
case TASKTYPE_API1: return _getAPITaskInfo ( index & TASKTYPE_IMASK, pInfo );
case TASKTYPE_API2: return _getIrregTaskInfo( index & TASKTYPE_IMASK, pInfo );
default: return FALSE;
}
}
/****************************************************************************/
/* Dump all task information to the debug port. */
/****************************************************************************/
static const char h1[] = "Task name TID Pri Stack SFree SUsed\r\n";
static const char h2[] = "---------------- -------- --- ----- ----- -----\r\n";
/****************************************************************************/
void info_showAllTaskInfo( void )
{
TASKINFO_STRUCT info;
uint08 fx;
dbmsg_trace( DBM_ALWAYS, "\r\n" );
dbmsg_trace( DBM_ALWAYS, (char*)h1 );
dbmsg_trace( DBM_ALWAYS, (char*)h2 );
/****************************************************/
/* Iterate the range of possible tasks. */
/****************************************************/
for( fx = TASKTYPE_APP; fx < TASKTYPE_API2 +0x10; fx++ )
{
if( info_getTaskInfo( fx, &info ) && info.taskID )
{
dbmsg_ftrace( DBM_ALWAYS, "%-16s %8x %3d %5d %5d %5d\r\n",
info.taskName, info.taskID, info.priority, info.stackSize,
info.stackUnused, info.stackUsed );
}
}
dbmsg_trace( DBM_ALWAYS, "\r\n" );
}
/****************************************************************************/
/* Get task information for the one app task at infoFunc[index]. */
/****************************************************************************/
static BOOL _getAppTaskInfo( uint08 index, TASKINFO_STRUCT *pInfo )
{
if( index >= nInfoFunc ) /* if invalid index */
return FALSE;
(*infoFunc[index])( pInfo );
if( ID_INVALID == pInfo -> taskID ) /* if task not running */
{
pInfo -> taskID = 0;
pInfo -> stackSize = 0;
pInfo -> stackUnused = 0;
pInfo -> priority = 0;
pInfo -> stackUsed = 0;
}
else /* task is running */
{
RTA_TaskGetUnusedStack( pInfo -> taskID, &pInfo -> stackUnused );
RTA_TaskGetPriority ( pInfo -> taskID, &pInfo -> priority );
pInfo -> stackUsed = pInfo -> stackSize - pInfo -> stackUnused;
}
return TRUE;
}
/****************************************************************************/
/* Get task information for the one API task at infoFunc[index]. */
/****************************************************************************/
static BOOL _getAPITaskInfo( uint08 index, TASKINFO_STRUCT *pInfo )
{
uint32 taskID;
if( index >= nInfoAPIFunc ) /* if invalid index */
return FALSE;
pInfo -> taskName = infoAPIFunc[index].taskName;
if( PASS == (*infoAPIFunc[index].taskIDFunc)( &taskID ))
{
pInfo -> taskID = taskID;
RTA_TaskGetUnusedStack( taskID, &pInfo -> stackUnused );
RTA_TaskGetPriority ( taskID, &pInfo -> priority );
pInfo -> stackSize = infoAPIFunc[index].stackSize;
pInfo -> stackUsed = pInfo -> stackSize - pInfo -> stackUnused;
}
else
{
pInfo -> taskID = 0;
pInfo -> stackUnused = 0;
pInfo -> priority = 0;
pInfo -> stackSize = 0;
pInfo -> stackUsed = 0;
}
return TRUE;
}
/****************************************************************************/
/* Get task information for the one API color wheel task at [index]. */
/****************************************************************************/
static BOOL _getIrregTaskInfo( uint08 index, TASKINFO_STRUCT *pInfo )
{
uint32 taskID;
int08 cc; /* completion code */
if( index >= nInfoIrregFunc ) /* if invalid index */
return FALSE;
pInfo -> taskName = infoIrregFunc[index].taskName;
/****************************************************/
/* Exec indexed function. */
/****************************************************/
switch( index )
{
case 0:
cc = CW_GetTaskID( CW_INDEX_TASK, &taskID );
break;
case 1:
cc = I2C_GetSlaveTaskID( I2C_PORT1, &taskID );
break;
}
if( PASS == cc )
{
pInfo -> taskID = taskID;
RTA_TaskGetUnusedStack( taskID, &pInfo -> stackUnused );
RTA_TaskGetPriority ( taskID, &pInfo -> priority );
pInfo -> stackSize = infoIrregFunc[index].stackSize;
pInfo -> stackUsed = pInfo -> stackSize - pInfo -> stackUnused;
}
else
{
pInfo -> taskID = 0;
pInfo -> stackUnused = 0;
pInfo -> priority = 0;
pInfo -> stackSize = 0;
pInfo -> stackUsed = 0;
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -