⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tstcfg.c

📁 美国GE公司MIL-1553B测试程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*===========================================================================*
 * FILE:                        T S T C F G . C
 *===========================================================================*
 *
 * COPYRIGHT (C) 1995 - 2004 BY
 *          CONDOR ENGINEERING, INC., SANTA BARBARA, CALIFORNIA
 *          ALL RIGHTS RESERVED.
 *
 *          THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND
 *          COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
 *          THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY
 *          OTHER COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
 *          AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE
 *          SOFTWARE IS HEREBY TRANSFERRED.
 *
 *          THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
 *          NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY CONDOR
 *          ENGINEERING.
 *
 *===========================================================================*
 *
 * FUNCTION:    Demonstration of PC-1553 and IP-1553 API routines under
 *              DOS, Windows 3.x, and NT 3.51/4.00/2000 (BusTools board).
 *
 *              To see the interrupt thread function demos, search in this file
 *              for the string "_thread".
 *
 * Notes:       This program can be compiled for either MS-DOS, 16-bit Windows
 *              or Win32.  When compiling for Win32, use the Borland C/C++
 *              compiler which supports the gotoxy() and clrscn() functions.
 *              The Microsoft Visual C/C++ compilers do not support this
 *              functionality, which will cause the screens to look funny.
 *===========================================================================*/

/* $Revision:  5.00 Release $
   Date        Revision
  ----------   ---------------------------------------------------------------
  10/01/1997   Changed slightly to support IP-1553 on the PCI carrier.ajh.
  06/14/1998   Changed BC bus list to demonstrate various messages.ajh.
  07/22/1998   Added many features including aperiodic messages, interrupt
               threads and memory write capability.V2.60.ajh
  04/26/1999   Changed BC, BM and RT monitoring displays to display invalid
               bus data as "xxxx" rather than blanks.V3.05.ajh
  05/20/1999   Changed demo_bc_download() to properly describe the setup needed
               to create a BC_CONTROL_CONDITION2-type conditional message in a
               bus list.V3.06.ajh
  01/18/2000   Added support for the ISA-1553, PMC-1553, and IP PROM V5.V4.00.ajh
  06/20/2000   Modified setup code to ask for board parameters if they are not
               defined on the command line.V4.05.ajh
  08/01/2000   Simplified the interrupt queue processing.V4.09.ajh
  08/29/2000   Changed name from DEMO.C to avoid confusion with the demo version
               of the BusTools/1553 GUI program.V4.12.ajh
  01/05/2001   Added support for the PCC-1553.V4.30.ajh
  03/13/2001   Added menus and support for the new BIT functions.V4.31.ajh
  04/30/2001   Added support for Microsoft compiler under Win32.V4.39.rc/ajh
  03/07/2003   Add support for QPCI-1553.
*/

/*---------------------------------------------------------------------------*
 *                     INCLUDES, DEFINES and GLOBALS
 *---------------------------------------------------------------------------*/

#define VERSION "Version 5.00"

#if !defined(_CVI_)
#include <conio.h>      // for _getch() declaration
#endif

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

#include "busapi.h"

#if defined(_CVI_)
#include <utility.h>
#endif

#define MAX_BOARDS 2    /* TESTCFG.C Menus only support two boards */

/****************************************************************************
*  Board definitions.  These default values indicate to the program that
*  the associated board has not been defined. V4.05
****************************************************************************/

static BT_UINT dwMemAddr[MAX_BOARDS]   = { 0xff, 0xff };
static BT_UINT   wIoAddr[MAX_BOARDS]   = { 0xff, 0xff };
static BT_UINT cardID[MAX_BOARDS] = {0xff,0xff};

/****************************************************************************
*  Model setup definitions
****************************************************************************/
#define FRAME_RATE   1000000L    /* BC minor frame period in micro seconds */
BT_U16BIT  RT_ADDR = 2;          /* This is the RT we will simulate        */
#define RT_MBUF_COUNT       2    /* Number of data buffers per RT          */
#define MAX_SA             11    /* Number of msgs in one-shot demo        */

#define FRAME_COUNT         2   /* Number of BC minor frames              */
#define MSG_COUNT_PER_FRAME 4    /* Number of messages per minor frame     */
#define MSG_WORD_COUNT      16  /*  Number of words per BC message         */

#define APERIODIC_MSG_NUM  (FRAME_COUNT*MSG_COUNT_PER_FRAME+3)  /* Aperiodic msgs */
#define NUM_APERIODIC      5
#define BC_MSGS_TO_ALLOC   (APERIODIC_MSG_NUM+NUM_APERIODIC+2)  /* Total msgs */

#ifdef __WIN32__
#define APERIODIC_WAIT_TIME   2000          /* Aperiodic execution time, ms  */
#else
#define APERIODIC_WAIT_TIME   2             /* Aperiodic execution time, sec */
#endif

/****************************************************************************
*  Local routine declarations
****************************************************************************/

static int  avio                 (int cardnum);
static void demo_banner          (BT_UINT flag);
static void demo_menu            (int flag);
static int  demo_bc_download     (int cardnum);
static int  demo_rt_download_abuf(int cardnum);
static int  demo_rt_download_cbuf(int cardnum, BT_U32BIT wcMask, int TRFlag);
static int  demo_rt_download_mbuf(int cardnum);
static int  demo_bc_watch        (int *flags);
static int  demo_bc_watch_thread (int *flags);
static int  demo_bm_watch        (int *flags);
static int  demo_bm_watch_thread (int cardnum);
static int  demo_rt_watch        (int *flags);
static int  demo_bc_update       (int cardnum);
static int  demo_memory_display  (int cardnum);
static int  demo_memory_write    (int cardnum);
static int  demo_memory_test     (int cardnum);
static int  demo_memory_exercise (int cardnum);
static int  demo_setcondition    (int cardnum,int value);
static int  demo_displayIDprom   (int cardnum);
static int  demo_bit_internal    (int cardnum);
static int  demo_bit_twoboardwrap(int cardnum1,int cardnum2);
static int  demo_bit_cablewrap   (int cardnum);
static int   List_Devices        ();

/****************************************************************************
*  Special return values to jump between watching displays
****************************************************************************/

#define REQUEST_START      1000
#define REQUEST_BCWATCH    1001
#define REQUEST_BMWATCH    1002
#define REQUEST_RTWATCH    1003
#define REQUEST_DEVLIST    1004
#define REQUEST_BMALL      1005
#define REQUEST_BCALL      1006
#define REQUEST_RTALL      1007
#define REQUEST_BCUPDATE   1008
#define REQUEST_MEMEXER    1009
#define REQUEST_TEST0      1010
#define REQUEST_TEST1      1011
#define REQUEST_TEST2      1012
#define REQUEST_BCWATCHT   1013

#define BC_CHAR   59    // "F1" code
#define BM_CHAR   60    // "F2" code
#define RT_CHAR   61    // "F3" code
#define DEV_CHART 62    // "F4" code
#define BM_ALL    63    // "F5" code
#define BC_ALL    64    // "F6" code
#define RT_ALL    65    // "F7" code
#define BC_UPDATE 66    // "F8" code
#define MEMEXER   67    // "F9" code
#define TEST0     68    // "F10" code    MS gives 0 followed by 68
#define TEST1     133   // "F11" code    MS gives E0 followed by 133
#define TEST2     134   // "F12" code    MS gives E0 followed by 134
#define BC_CHART  '-'   // "minus" code

/****************************************************************************
*  OS- amd compiler-specific declarations
****************************************************************************/

#ifdef __TURBOC__
#define _getch    getch
#define _kbhit    kbhit
#endif

#ifdef _CVI_
#define _getch   GetKey
#define _kbhit   KeyHit
#define stricmp  strcmp
#endif

#define OS "32  "

/****************************************************************************
*  Local data definitions for switching output coupling and voltage levels.
****************************************************************************/

BT_UINT coupling_type[2] = {1,1};   // Default to transformer coupling
char   *coupling_name[2] = {"Direct Coupling Selected",
                            "Transformer Coupling",};
int     output_level[2] = {0,0};    // Selected output level (0-high, 1-low)
//      access by [coupling][level]
BT_UINT output_voltage[2][3] = {{650, 450, 320}, {1980, 1490, 990}};
char   *output_names  [2][3] = {{ "6.5 volts",  "4.5 volts", "3.2 volts"},
                                {"19.8 volts", "14.9 volts", "9.9 volts"}};

/****************************************************************************
*  Globals
****************************************************************************/

BT_U32BIT   dwTestAddr;         // BC Condition test address setup in bc_download
BT_U16BIT   buffer1[1024];      // Memory test buffer.
BT_U16BIT   buffer2[1024];      // Memory test buffer.
int         flag_board_inited[MAX_BOARDS];
char        routine[100];       // Current function name for error status display
API_BC_MBUF message[MAX_SA];    // Array of messages for one-shot demo.
BT_U16BIT   nLastMessageNum;    // This is the message F8 updates.
static int  old_menu_flag = -999;
DeviceList dlist;
char board1[16];
char board2[16];

⌨️ 快捷键说明

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