dbc.c

来自「基于nucleus操作系统的GPRS无线数据传输终端全套源文件。包括支持ARM7」· C语言 代码 · 共 1,633 行 · 第 1/5 页

C
1,633
字号
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Reset_Queue is selected. Call the routine 
            responsible for the NU_Reset_Queue service.  */
            DBC_Reset_Queue();
            break;
            
        case    NU_SEND_TO_FRONT_OF_QUEUE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Send_To_Front_Of_Queue is selected. Call the routine 
            responsible for the NU_Send_To_Front_Of_Queue service.  */
            DBC_Send_To_Front_Of_Queue();
            break;
            
        case    NU_SEND_TO_QUEUE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Send_To_Queue is selected. Call the routine 
            responsible for the NU_Send_To_Queue service.  */
            DBC_Send_To_Queue();
            break;
            
        case    NU_BROADCAST_TO_PIPE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Broadcast_To_Pipe is selected. Call the routine
            responsible for the NU_Broadcast_To_Pipe service.  */
            DBC_Broadcast_To_Pipe();
            break;
            
        case    NU_RECEIVE_FROM_PIPE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Receive_From_Pipe is selected. Call the routine
            responsible for the NU_Receive_From_Pipe service.  */
            DBC_Receive_From_Pipe();
            break;
            
        case    NU_RESET_PIPE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Reset_Pipe is selected. Call the routine
            responsible for the NU_Reset_Pipe service.  */
            DBC_Reset_Pipe();
            break;
            
        case    NU_SEND_TO_FRONT_OF_PIPE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Send_To_Front_Of_Pipe is selected. Call the routine
            responsible for the NU_Send_To_Front_Of_Pipe service.  */
            DBC_Send_To_Front_Of_Pipe();
            break;
            
        case    NU_SEND_TO_PIPE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Send_To_Pipe is selected. Call the routine
            responsible for the NU_Send_To_Pipe service.  */
            DBC_Send_To_Pipe();
            break;
            
        case    NU_OBTAIN_SEMAPHORE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Obtain_Semaphore is selected. Call the routine
            responsible for the NU_Obtain_Semaphore service.  */
            DBC_Obtain_Semaphore();
            break;
            
        case    NU_RELEASE_SEMAPHORE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Release_Semaphore is selected. Call the routine
            responsible for the NU_Release_Semaphore service.  */
            DBC_Release_Semaphore();
            break;
            
        case    NU_RESET_SEMAPHORE:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Reset_Semaphore is selected. Call the routine
            responsible for the NU_Reset_Semaphore service.  */
            DBC_Reset_Semaphore();
            break;
            
        case    NU_RETRIEVE_EVENTS:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Retrieve_Events is selected. Call the routine
            responsible for the NU_Retrieve_Events service.  */
            DBC_Retrieve_Events();
            break;
            
        case    NU_SET_EVENTS:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Set_Events is selected. Call the routine
            responsible for the NU_Set_Events service.  */
            DBC_Set_Events();
            break;
            
        case    NU_SEND_SIGNALS:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Send_Signals is selected. Call the routine
            responsible for the NU_Send_Signals service.  */
            DBC_Send_Signals();
            break;
            
        case    NU_CONTROL_TIMER:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Control_Timer is selected. Call the routine
            responsible for the NU_Control_Timer service.  */
            DBC_Control_Timer();
            break;
            
            
        case    NU_RESET_TIMER:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Reset_Timer is selected. Call the routine
            responsible for the NU_Reset_Timer service.  */
            DBC_Reset_Timer();
            break;
            
        case    NU_RETRIEVE_CLOCK:
            
        /* NU_Retrieve_Clock is selected. Call the routine
            responsible for the NU_Retrieve_Clock service.  */
            DBC_Retrieve_Clock();
            break;
            
        case    NU_SET_CLOCK:
            
        /* NU_Set_Clock is selected. Call the routine
            responsible for the NU_Set_Clock service.  */
            DBC_Set_Clock();
            break;
            
            
        case    NU_ALLOCATE_MEMORY:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Allocate_Memory is selected. Call the routine
            responsible for the NU_Allocate_Memory service.  */
            DBC_Allocate_Memory();
            break;
            
        case    NU_DEALLOCATE_MEMORY:
            
        /* NU_Deallocate_Memory is selected. Call the routine
            responsible for the NU_Deallocate_Memory service.  */
            DBC_Deallocate_Memory();
            break;
            
        case    NU_ALLOCATE_PARTITION:
            
            /* Prompt user for name */
            DBC_Name_Prompt();
            /* NU_Allocate_Partition is selected. Call the routine
            responsible for the NU_Allocate_Partition service.  */
            DBC_Allocate_Partition();
            break;
            
        case    NU_DEALLOCATE_PARTITION:
            
        /* NU_Deallocate_Partition is selected. Call the routine
            responsible for the NU_Deallocate_Partition service.  */
            DBC_Deallocate_Partition();
            break;
#endif /* NO_SERVICES */  /* NO_SERVICES1 directive */
            
        default:
            if (Token[0] != NUL)
            {               
                /* Invalid command entered.  */
                DBC_Print_Line("\n\rDBUG+> Invalid Command: ");
                DBC_Print_Line(Token);
            }
        }
    }
}

#ifndef NO_STATUS      /* NO_STATUS2 directive */
/************************************************************************
*                                                                       
*   FUNCTION                                
*
*       DBC_Display_Status
*                                                                                                                                     
*   DESCRIPTION                                                           
*                                                                       
*       This routine prints out the item status.                         
*                                                                       
*   INPUTS                                                                
*       
*       string              Pointer to where the item name will be placed
*       total               Total number of items   
*       items_per_width     Number of items to be printed in a row
*       items_per_height    Number of items to be printed in a column
*       loop                Unused parameter
*       total_fields        Total fields for an item
*       type                Type of list
*                                                                       
*   OUTPUTS                                                               
*                                                                       
*       None                                                             
*                                                                       
************************************************************************/
VOID  DBC_Display_Status(CHAR *string, UNSIGNED total, INT items_per_width,
                         INT items_per_height, VOID (*DB_Item_Fields)(VOID),
                         VOID (*DB_Item_Information)(INT loop),
                         INT total_fields, INT type)
{
    INT             i,j;                              /* Working variables  */
    INT             counter;                        /* Index              */
    VOID            *temp_list[MAX_ITEMS];            /* Backup list        */
    
    total = DBC_Limit_Items(total);    
    
    /* Get item name */
    DBC_Get_Name(string, Token);
    
    /* Determine if there was another token.  */
    if (Token[0] != NUL)
    {
        for(i=0; (i<(INT)total && i<MAX_ITEMS); i++)
            temp_list[i] = DBC_List[i];
        
        DBC_Set_List(type);
        
        /* check for null value */
        if (total_items == NUL)
        {
            /* Print an error message.  */
            DBC_Print_Line(Invalid_Name);
            
            /* reset total_items to display all */
            total_items = total;
            
            for(i=0; (i<(INT)total && i<MAX_ITEMS); i++)
                DBC_List[i] = temp_list[i];
        }
    }
    
    else
        /* Set total_items to display all */
        total_items = total;
    
    /* Set counter */
    counter = 0;
    
    /* Print out the title.  */
    DBC_Print_Line(New_Line);
#ifdef NETWORK
    DBC_Print_Spaces(16);
#else
    for (i = 0; i < (COL/2 - 16); i++)
        DBT_Put_Char(' ');
#endif
    
    switch(type)
    {
    case TASK:
        
        DBC_Print_Line(" ***** Task Status Display *****\n\n\r");
        break;
        
    case MAILBOX:
        
        DBC_Print_Line(" ***** Mailbox Status Display *****\n\n\r");
        break;
        
    case QUEUE:
        
        DBC_Print_Line(" ***** Queue Status Display *****\n\n\r");
        break;
        
    case PIPE:
        
        DBC_Print_Line(" ***** Pipe Status Display *****\n\n\r");
        break;
        
    case SEMAPHORE:
        
        DBC_Print_Line(" ***** Semaphore Status Display *****\n\n\r");
        break;
        
    case EVENT:
        
        DBC_Print_Line(" ***** Event Status Display *****\n\n\r");
        break;
        
    case SIGNAL:
        
        DBC_Print_Line(" ***** Signal Status Display *****\n\n\r");
        break;
        
    case TIMER:
        
        DBC_Print_Line(" ***** Timer Status Display *****\n\n\r");
        break;
        
    case PARTITION:
        
        DBC_Print_Line(" ***** Partition Status Display *****\n\n\r");
        break;

⌨️ 快捷键说明

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