test_osapi_main.c

来自「这是DVD中伺服部分的核心代码」· C语言 代码 · 共 127 行

C
127
字号
/*****************************************************************************
******************************************************************************
**                                                                          **
**  Copyright (c) 2006 Videon Central, Inc.                                 **
**  All rights reserved.                                                    **
**                                                                          **
**  The computer program contained herein contains proprietary information  **
**  which is the property of Videon Central, Inc.  The program may be used  **
**  and/or copied only with the written permission of Videon Central, Inc.  **
**  or in accordance with the terms and conditions stipulated in the        **
**  agreement/contract under which the programs have been supplied.         **
**                                                                          **
******************************************************************************
*****************************************************************************/
/**
 * @file test_osapi_main.c
 *
 * $Revision: 1.3 $ 
 *
 * Operating System API (OSAPI) test file. 
 *
 */

#include <stdio.h>
#include <stdlib.h>

#include "vdvd_types.h"
#include "osapi.h"
#include "dbgprint.h"
#include "test_osapi.h"


void PassFail( int passed )
{
    if ( passed ) 
    {
        DbgPrint(("\r[passed] \n"));
    }
    else
    {
        DbgPrint(("\r[FAILED] \n"));
//        DbgPrint(("Press <ENTER> to continue...\n"));
//        getchar();
    }
}








int main ( int argc, char* argv[] )
{
    int choice;

    (void)argc;
    (void)argv;

    do 
        {

        DbgPrint(("\n"));
        DbgPrint((" OSAPI TEST MAIN MENU \n"));
        DbgPrint(("----------------------\n"));
        DbgPrint(("                      \n"));
        DbgPrint(("1) Memory Tests       \n"));
        DbgPrint(("2) Memory Pool Tests  \n"));
        DbgPrint(("3) Task Tests         \n"));
        DbgPrint(("4) Semaphore Tests    \n"));
        DbgPrint(("5) Message Queue Tests\n"));
        DbgPrint(("6) Timer Tests        \n"));
        DbgPrint(("                      \n"));
        DbgPrint(("0) Run all tests      \n"));
        DbgPrint(("Q) Quit               \n"));
        DbgPrint(("                      \n"));
        DbgPrint(("choice: "));

        choice = getchar();

        while ( getchar() != '\n' );
            ;
        
        switch ( choice ) 
        {
            case '1': OSAPIMemoryTests();  
                      break;

            case '2': OSAPIMemoryPoolTests();  
                      break;

            case '3': OSAPITaskTests();   
                      break;

            case '4': OSAPISemaphoreTests();   
                      break;

            case '5': OSAPIMessageQueueTests(); 
                      break;

            case '6': OSAPITimerTests(); 
                      break;

            case '0':
                      OSAPIMemoryTests();
                      OSAPIMemoryPoolTests();
                      OSAPITaskTests();
                      OSAPISemaphoreTests();
                      OSAPIMessageQueueTests();
                      break;  

            case 10:
            case 13:
                      break;
        }

    } while ( (choice != 'Q') && (choice != 'q') );
    
    
    DbgPrint(("OSAPI TEST FINISHED\n"));

    return ( 0 );
}


⌨️ 快捷键说明

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