📄 appmain.c
字号:
// AppMain.c
//////////////////////////////////////////////////////////////////////////////
////
//// Copyright (c) 2003, Valley Technologies, Inc.
//// All rights reserved.
////
//////////////////////////////////////////////////////////////////////////////
////
//// $Header $
////
//// $ReleaseClass: src $
////
//// Original Author : ebersole
//// Most Recent Contributing $Author: ebersole $
////
//////////////////////////////////////////////////////////////////////////////
////
//// This file contains the main() routine for the Exhibit #2 Host
//// Application.
////
//////////////////////////////////////////////////////////////////////////////
//############################################################################
// Include Files
//############################################################################
#include <stdio.h>
#include "dm642_lib.h"
#include "Dm642App.h"
//############################################################################
// Function Prototypes
//############################################################################
int RunApp(DM642_HANDLE hDM642);
//############################################################################
//////////////////////////////////////////////////////////////////////////////
////
//// Name: main
////
//// Purpose: The entry point into the Exhibit #2 Application.
//// main() performs basic initialization, including connecting
//// to an EVM-DM642. main() then passes control to RunApp(),
//// which actually executes the application.
////
//// Input Parameters:
//// argc - number of inputs to the program, plus 1.
//// <= 2
//// argv - the inputs to the program, in "string" form.
////
//// Output Parameters: none
////
//// Return Value(s) :
//// 0 - in ALL cases.
////
//////////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
DM642_HANDLE hDM642 = NULL;
DWORD dwAction = 0;
BOOL fRegisteredEvent = FALSE;
printf ("DM642 diagnostic utility.\n");
//---------------------------
// Setup the debug values
//---------------------------
if ((2 == argc) && (0 == strcmp (argv [1], "off")))
{
DM642SetDebug (FALSE);
}
else
{
DM642SetDebug (TRUE);
}
//------------------------------------------------
// Check if the DM642 device driver is present.
// If not, don't go any further.
//------------------------------------------------
if(FALSE == DM642IsDeviceDriverPresent())
{
return 0;
}
//------------------------------
// Initialize all of the boards
//------------------------------
DM642Init();
//---------------------------------------------------------------
// Open one of the boards, defaulting to board #0 in the case
// of an error
//---------------------------------------------------------------
ChangeBoard(&hDM642, DM642_DEFAULT_VENDOR_ID, DM642_DEFAULT_DEVICE_ID);
//-------------------------------------------------------------
// Run the main body of the Application. It is possible that
// this routine will not return!
//-------------------------------------------------------------
RunApp(hDM642);
//---------------------------
// Clean up resources ....
//---------------------------
if (hDM642)
{
DM642Close(hDM642);
}
//------------------------------------------------------------------------
// Pause and wait for the user to strike a key.
// This allows the user to see any output before the program terminates.
//------------------------------------------------------------------------
printf("Press any key to continue ...\n");
getchar();
return 0;
} // END main()
//############################################################################
// End of Functions
//############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -