dbc.c
来自「基于nucleus操作系统的GPRS无线数据传输终端全套源文件。包括支持ARM7」· C语言 代码 · 共 1,633 行 · 第 1/5 页
C
1,633 行
* DESCRIPTION
*
* This is the main function of the Nucleus debug task. It is
* mainly responsible for dispatching commands to the various
* responsible functions.
*
* INPUTS
*
* argc Unused parameter
* argv Unused parameter
*
* OUTPUTS
*
* None
*
************************************************************************/
VOID DBC_Debug(UNSIGNED argc, VOID *argv)
{
CHAR *string_ptr; /* Working string pointer */
INT i; /* Working variable */
CHAR close=0, put_prompt=1;
/* Access argc and argv to avoid compilation warnings */
DBC_Status = (STATUS) argc + (STATUS) argv;
DBC_Status++;
/* since we have negotiated the size of output, it is necessary to check them */
if (his_side.width>MAXCOL || his_side.rows>MAXROW)
{
NERRS_Log_Error (NERR_RECOVERABLE, __FILE__, __LINE__);
return;
}
/* Initialize the print buffer. */
DBC_Init_Buffer();
/* Print the menu once for the user to see. */
DBC_Print_Menu();
/* Loop forever, processing commands when entered. */
for (;;)
{
/* Prompt the user for a selection. */
if (put_prompt)
DBC_Print_Line(Prompt);
put_prompt = 1;
/* Obtain an input line from the user. */
DBC_Input_Line(Input_Line);
/* Break out the first token to see if a valid command has been
entered. */
string_ptr = DBC_Get_Token(Input_Line, Token);
#ifdef NETWORK
/* check if client wants to close the connection */
if (NU_Received_Exit(Token, (INT)(strlen(Token))))
{
NU_Sleep(10);
NU_Close_And_Check_Retval(telnet_socket);
break;
}
/* check the connection, if it closed, suspend DBC_Debug() */
if (NU_Telnet_Check_Connection((INT)telnet_socket, close)==SCLOSED)
break;
#endif /* NETWORK */
if (Token[0]==0)
{
/* eliminate the extra prompt */
put_prompt = 0;
continue;
}
i = 0;
/* Determine if the token matches any of the commands. */
while ((DB_Commands[i].string) &&
(DBT_String_Compare(Token,DB_Commands[i].string) == DB_FALSE))
i++; /* Look at next command. */
/* Process according the the command's ID. */
switch(DB_Commands[i].id)
{
#ifndef NO_STATUS /* NO_STATUS1 directive */
case TS:
/* Task status is selected. Call the routine responsible for
the task status command. */
DBC_Display_Status(string_ptr, NU_Task_Pointers((NU_TASK **) DBC_List,
DBC_Limit_Items(NU_Established_Tasks())),
DBC_Items_Per_Width(20, 10),
DBC_Items_Per_Height(10), DBC_Task_Fields,
DBC_Task_Information, 9, TASK);
break;
case MS:
/* Mailbox status is selected. Call the routine responsible
for the mailbox status command. */
DBC_Display_Status(string_ptr,
NU_Mailbox_Pointers((NU_MAILBOX **) DBC_List,
DBC_Limit_Items(NU_Established_Mailboxes())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(5), DBC_Mailbox_Fields,
DBC_Mailbox_Information, 5, MAILBOX);
break;
case QS:
/* Queue status is selected. Call the routine responsible for
the queue status command. */
DBC_Display_Status(string_ptr,
NU_Queue_Pointers((NU_QUEUE **) DBC_List,
DBC_Limit_Items(NU_Established_Queues())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(11), DBC_Queue_Fields,
DBC_Queue_Information, 11, QUEUE);
break;
case PS:
/* Pipe status is selected. Call the routine responsible for
the pipe status command. */
DBC_Display_Status(string_ptr,
NU_Pipe_Pointers((NU_PIPE **) DBC_List,
DBC_Limit_Items(NU_Established_Pipes())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(11), DBC_Pipe_Fields,
DBC_Pipe_Information, 11, PIPE);
break;
case SS:
/* Semaphore status is selected. Call the routine responsible
for the semaphore status command. */
DBC_Display_Status(string_ptr,
NU_Semaphore_Pointers((NU_SEMAPHORE **) DBC_List,
DBC_Limit_Items(NU_Established_Semaphores())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(5), DBC_Semaphore_Fields,
DBC_Semaphore_Information, 5, SEMAPHORE);
break;
case ES:
/* Event status is selected. Call the routine responsible for
the event status command. */
DBC_Display_Status(string_ptr,
NU_Event_Group_Pointers((NU_EVENT_GROUP **) DBC_List,
DBC_Limit_Items(NU_Established_Event_Groups())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(4), DBC_Event_Fields,
DBC_Event_Information, 4, EVENT);
break;
case SI:
/* Signal status is selected. Call the routine responsible for
the signal status command. */
DBC_Display_Status(string_ptr, NU_Task_Pointers((NU_TASK **) DBC_List,
DBC_Limit_Items(NU_Established_Tasks())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(4), DBC_Signal_Fields,
DBC_Signal_Information, 4, SIGNAL);
break;
case TI:
/* Timer status is selected. Call the routine responsible for
the timer status command. */
DBC_Display_Status(string_ptr, NU_Timer_Pointers((NU_TIMER **) DBC_List,
DBC_Limit_Items(NU_Established_Timers())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(4), DBC_Timer_Fields,
DBC_Timer_Information, 4, TIMER);
break;
case PM:
/* Partition status is selected. Call the routine responsible
for the partition status command. */
DBC_Display_Status(string_ptr,
NU_Partition_Pool_Pointers((NU_PARTITION_POOL **) DBC_List,
DBC_Limit_Items(NU_Established_Partition_Pools())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(9), DBC_Partition_Fields,
DBC_Partition_Information, 9, PARTITION);
break;
case DM:
/* Memory status is selected. Call the routine responsible for
the memory status command. */
DBC_Display_Status(string_ptr,
NU_Memory_Pool_Pointers((NU_MEMORY_POOL **) DBC_List,
DBC_Limit_Items(NU_Established_Memory_Pools())),
DBC_Items_Per_Width(20, 9),
DBC_Items_Per_Height(8), DBC_Dynamic_Memory_Fields,
DBC_Dynamic_Memory_Information, 8, MEMORY);
break;
case M:
/* Memory status is selected. Call the routine responsible for
the memory status command. */
DBC_Display_Memory(string_ptr);
break;
case SM:
/* Set memory status is selected. Call the routine responsible
for the set memory status command. */
DBC_Set_Memory(string_ptr);
break;
#endif /* NO_STATUS1 directive */
case HELP:
/* Help menu is selected. Call the routine responsible for
the help menu command. */
DBC_Print_Menu();
break;
#ifndef NO_SERVICES /* NO_SERVICES1 directive */
case NU_RESUME_TASK:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Resume_Task is selected. Call the routine responsible for
the NU_Resume_Task service. */
DBC_Resume_Task();
break;
case NU_SUSPEND_TASK:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Suspend_Task is selected. Call the routine responsible for
the NU_Suspend_Task service. */
DBC_Suspend_Task();
break;
case NU_TERMINATE_TASK:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Terminate_Task is selected. Call the routine responsible
for the NU_Terminate_Task service. */
DBC_Terminate_Task();
break;
case NU_RESET_TASK:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Reset_Task is selected. Call the routine responsible for
the NU_Reset_Task service. */
DBC_Reset_Task();
break;
case NU_CHANGE_PRIORITY:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Change_Priority is selected. Call the routine responsible
for the NU_Change_Priority service. */
DBC_Change_Priority();
break;
case NU_BROADCAST_TO_MAILBOX:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Broadcast_To_Mailbox is selected. Call the routine
responsible for the NU_Broadcast_To_Mailbox service. */
DBC_Broadcast_To_Mailbox();
break;
case NU_RECEIVE_FROM_MAILBOX:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Receive_From_Mailbox is selected. Call the routine
responsible for the NU_Receive_From_Mailbox service. */
DBC_Receive_From_Mailbox();
break;
case NU_RESET_MAILBOX:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Reset_Mailbox is selected. Call the routine
responsible for the NU_Reset_Mailbox service. */
DBC_Reset_Mailbox();
break;
case NU_SEND_TO_MAILBOX:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Send_To_Mailbox is selected. Call the routine
responsible for the NU_Send_To_Mailbox service. */
DBC_Send_To_Mailbox();
break;
case NU_BROADCAST_TO_QUEUE:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Broadcast_To_Queue is selected. Call the routine
responsible for the NU_Broadcast_To_Queue service. */
DBC_Broadcast_To_Queue();
break;
case NU_RECEIVE_FROM_QUEUE:
/* Prompt user for name */
DBC_Name_Prompt();
/* NU_Receive_From_Queue is selected. Call the routine
responsible for the NU_Receive_From_Queue service. */
DBC_Receive_From_Queue();
break;
case NU_RESET_QUEUE:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?