Files
Matthias b32b2bd87b updates
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@138 9fe90eed-be63-e94b-8204-d34ff4c2ff93
2009-03-17 12:45:50 +00:00

206 lines
8.7 KiB
C#

/* ---------------------------------------------------------------------------
* Initialisation.cs (c) 2009 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: This file handles all Inits, variable definitions and start
* Values of arrays.
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 08, 2009, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System use files
* ---------------------------------------------------------------------------
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.IO.Ports;
using System.Threading;
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
namespace QUA_2475_designtest
{
public partial class mainWindow
{
/* PORT DEFINITION */
private SerialPort com1 = new SerialPort(); /* Define type COM1 */
/* THREAD DEFINITION */
Thread com1GetMessage; /* COM1 Read Thread */
//Thread com6GetMessage; /* COM2 Read Thread */
Thread TestTimeoutThread; /* Test Timeout Thread */
/* INTEGER DEFINITION */
const int NrOfTests = 23; /* Indicates number of single Test */
uint actualTest = 0; /* Indicates number of actual Test */
uint TotalTestNumber = 1; /* Number of total Tests */
uint TotalPassedNumber = 1; /* Number of passed Tests */
uint TotalFailedNumber = 1; /* Number of failed Tests */
uint testcnt = 0;
/* BOOLEAN DEFINITION */
private bool Master_receiveMessages = true; /* Allow COM2 to read */
private bool activeTest = false; /* Indicates an active Test */
private bool activeAutomatictest = false; /* autoTest is active */
private bool AllTestResult; /* Shows the autoTest Result */
private bool setRTC = false;
/* ARRAY DEFINITION */
/* Array of all available Textboxes for Tests */
public TextBox[] TestTextBoxes = new TextBox[NrOfTests];
/* Array for all single Test call commands */
public string[] TestCallCommands = new string[NrOfTests];
/* Array for absolut path and file names of Tests */
public string[] Testfiles = new string[NrOfTests];
/* Array to contain each Test Result */
public bool[] TestResult = new bool[NrOfTests];
/* Array to enable individual tests */
public bool[] ActivateTest = new bool[NrOfTests];
/* Array for all test messages of single Test */
public string[] TestMessage = new String[NrOfTests];
private string MasterInputString; /* bound to T_MasterInput */
/* ENUM TYPE DEFINITION */
/* Enumeration for single Tests. With these numbers, all information
* for each test is callable. Usable e.g. as ArrayIndex for Arrays
* listed above.
*/
public enum TestType
{
VCC = 0,
VDDAT = 1,
VBAT = 2,
VCORE = 3,
TEMP = 4,
REVNUM = 5,
LED_MB = 6,
EEPROM_MB = 7,
ETH0 = 8,
ETH1 = 9,
USB = 10,
DIO_MB = 11,
AIO_MB = 12,
RLY_MB = 13,
LED_EB = 14,
EEPROM_EB = 15,
DIO_EB = 16,
AIO_EB = 17,
RLY_EB = 18,
CAL_AOMB = 19,
CAL_AIMB = 20,
CAL_AOEB = 21,
CAL_AIEB = 22
};
public void initialise()
{
com1.PortName = "COM9"; /* Bind com1 to COM1 */
com1.Open(); /* Open com1 */
com1.BaudRate = 115200; /* Set com1 Baudrate */
/* Capture corresponding Textboxes to TextBox Array */
TestTextBoxes[(int)TestType.VCC] = T_test_VCC;
TestTextBoxes[(int)TestType.VDDAT] = T_test_VDDAT;
TestTextBoxes[(int)TestType.VBAT] = T_test_VBAT;
TestTextBoxes[(int)TestType.VCORE] = T_test_VCORE;
TestTextBoxes[(int)TestType.TEMP] = T_test_TEMP;
TestTextBoxes[(int)TestType.REVNUM] = T_test_REVNUM;
TestTextBoxes[(int)TestType.LED_MB] = T_test_MB_LED;
TestTextBoxes[(int)TestType.EEPROM_MB] = T_test_MB_EEPROM;
TestTextBoxes[(int)TestType.ETH0] = T_test_eth0;
TestTextBoxes[(int)TestType.ETH1] = T_test_eth1;
TestTextBoxes[(int)TestType.USB] = T_test_USB;
TestTextBoxes[(int)TestType.DIO_MB] = T_test_MB_DIO;
TestTextBoxes[(int)TestType.AIO_MB] = T_test_MB_AIO;
TestTextBoxes[(int)TestType.RLY_MB] = T_test_MB_RLY;
TestTextBoxes[(int)TestType.LED_EB] = T_test_EB_LED;
TestTextBoxes[(int)TestType.EEPROM_EB] = T_test_EB_EEPROM;
TestTextBoxes[(int)TestType.DIO_EB] = T_test_EB_DIO;
TestTextBoxes[(int)TestType.AIO_EB] = T_test_EB_AIO;
TestTextBoxes[(int)TestType.RLY_EB] = T_test_EB_RLY;
/* Reset all Test Results */
TestResult[0] = false;
TestResult[1] = false;
TestResult[2] = false;
TestResult[3] = false;
TestResult[4] = false;
TestResult[5] = false;
TestResult[6] = false;
TestResult[7] = false;
TestResult[8] = false;
TestResult[9] = false;
TestResult[10] = false;
TestResult[11] = false;
TestResult[12] = false;
TestResult[13] = false;
TestResult[14] = false;
TestResult[15] = false;
TestResult[16] = false;
TestResult[17] = false;
TestResult[18] = false;
TestResult[19] = false;
TestResult[20] = false;
TestResult[21] = false;
TestResult[22] = false;
/* Define Commands (path and filename) for test-script calls */
TestCallCommands[0] = "test_vcc 2\r";
TestCallCommands[1] = "test_vddat 2\r";
TestCallCommands[2] = "test_vbat 2\r";
TestCallCommands[3] = "test_vcore 2\r";
TestCallCommands[4] = "test_temp 2\r";
TestCallCommands[5] = "test_revnum 2\r";
TestCallCommands[6] = "test_led 2 0\r";
TestCallCommands[7] = "test_eeprom 2 0\r";
TestCallCommands[8] = "test_eth 2 0\r";
TestCallCommands[9] = "test_eth 2 1\r";
TestCallCommands[10] = "test_usb 2\r";
TestCallCommands[11] = "test_dio 2 0\r";
TestCallCommands[12] = "test_aio 2 0\r";
TestCallCommands[13] = "test_rly 2 0\r";
TestCallCommands[14] = "test_led 2 1\r";
TestCallCommands[15] = "test_eeprom 2 1\r";
TestCallCommands[16] = "test_dio 2 1\r";
TestCallCommands[17] = "test_aio 2 1\r";
TestCallCommands[18] = "test_rly 2 1\r";
TestCallCommands[19] = "cslave 0\r";
TestCallCommands[20] = "cslave 1\r";
TestCallCommands[21] = "cslave 2\r";
TestCallCommands[22] = "cslave 3\r";
/* Define and start com1 reading Thread */
com1GetMessage = new Thread(new ThreadStart(com1_DataReceived));
com1GetMessage.Start();
}
}
}