From f3c5d9a59c842df6cd9546ff922c5591e593fcb6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 12 Jan 2009 08:27:33 +0000 Subject: [PATCH] folder modifications git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@108 9fe90eed-be63-e94b-8204-d34ff4c2ff93 --- Test_Item/SW/script/bus1_test | 130 +++++++++++ Test_Item/SW/script/bus2_test | 130 +++++++++++ Test_Item/SW/script/eeprom_test | 214 +++++++++++++++++++ Test_Item/SW/script/eth0_test | 49 +++++ Test_Item/SW/script/eth1_test | 49 +++++ Test_Item/SW/script/testfile | 4 + Test_Item/SW/script/usb1_test | 75 +++++++ Test_Item/SW/testapplication/digital_test.c | 2 +- Test_Item/SW/testapplication/ethernet_test.c | 2 +- Test_Item/SW/testapplication/ethernet_test.h | 2 +- 10 files changed, 654 insertions(+), 3 deletions(-) create mode 100644 Test_Item/SW/script/bus1_test create mode 100644 Test_Item/SW/script/bus2_test create mode 100644 Test_Item/SW/script/eeprom_test create mode 100644 Test_Item/SW/script/eth0_test create mode 100644 Test_Item/SW/script/eth1_test create mode 100644 Test_Item/SW/script/testfile create mode 100644 Test_Item/SW/script/usb1_test diff --git a/Test_Item/SW/script/bus1_test b/Test_Item/SW/script/bus1_test new file mode 100644 index 0000000..5b6248f --- /dev/null +++ b/Test_Item/SW/script/bus1_test @@ -0,0 +1,130 @@ +#!/bin/sh + +# Functionality: +# Slaves COM is sending a defined String to the same COM on Master. +# Master is running a background process that +# only returns what comes in. + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + +#----------------------------------------------------------------------------- +# PREPERATIONS +#----------------------------------------------------------------------------- + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/bus1.res ] +then + rm /test/result/bus1.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/bus1.err ] +then + rm /test/result/bus1.err +fi + +# Make shure that Original file of Test does NOT exists +if [ -s /test/result/bus1.ori ] +then + rm /test/result/bus1.ori +fi + +# Make shure that readback file of Test does NOT exists +if [ -s /test/result/bus1.rb ] +then + rm /test/result/bus1.rb +fi + +# Set up COM3 +stty -F /dev/ttyS4 -echo -echoe -echok -echonl -echoprt -echoctl -echoke -ocrnl -icrnl -onlcr -opost crtscts clocal cread cs8 ignpar +stty -F /dev/ttyS5 -echo -echoe -echok -echonl -echoprt -echoctl -echoke -ocrnl -icrnl -onlcr -opost crtscts clocal cread cs8 ignpar + +#----------------------------------------------------------------------------- +# TEST WITH 19200 BAUD +#----------------------------------------------------------------------------- + +# Message Baudrate to Log +echo -e "Test bus1 with Baudrate: 19200\n\r" +# Set Baudrate +stty -F /dev/ttyS4 19200 +stty -F /dev/ttyS5 19200 + +# Start a Backgroundprocess to receive something +cat /dev/ttyS5 1>> /test/result/bus1.rb & + +sleep 1 + +# Send the defined String +echo "This is BUS1 Test with 19200 Baud" > /dev/ttyS4 +echo "This is BUS1 Test with 19200 Baud" 1>> /test/result/bus1.ori + + +# Set Script-Process to Sleep to have time to receive something +sleep 1 +# After Receiving (Or Timeout), kill all Processes on CAT +killall cat + +# Compare the read String with the original one +diff /test/result/bus1.ori /test/result/bus1.rb 1>> /test/result/bus1.res + 2>> /test/result/bus1.err + +#----------------------------------------------------------------------------- +# TEST WITH 115200 BAUD +#----------------------------------------------------------------------------- + +# Message Baudrate to Log +echo -e "Test bus1 with Baudrate: 115200\n\r" +# Set Baudrate +stty -F /dev/ttyS4 115200 +stty -F /dev/ttyS5 115200 + +# Start a Backgroundprocess to receive something +cat /dev/ttyS5 1>> /test/result/bus1.rb & + +sleep 1 + +# Send the defined String +echo "This is BUS1 Test with 115200 Baud" > /dev/ttyS4 +echo "This is BUS1 Test with 115200 Baud" 1>> /test/result/bus1.ori + + +# Set Script-Process to Sleep to have time to receive something +sleep 1 +# After Receiving (Or Timeout), kill all Processes on CAT +killall cat + +# Compare the read String with the original one +diff /test/result/bus1.ori /test/result/bus1.rb 1>> /test/result/bus1.res + 2>> /test/result/bus1.err + + +#----------------------------------------------------------------------------- +# OUTPUT AND RESULT CALCULATION +#----------------------------------------------------------------------------- + +# Display content of /test/result/bus1.res +echo -e "\n\rContent of bus1.res" +cat /test/result/bus1.res + +# Display content of /test/result/bus1.err +echo -e "\n\rContent of bus1.err" +cat /test/result/bus1.err + +# If comparison returned neither results nor errors, the copying and comparision was successful +if [ ! -s /test/result/bus1.res -a ! -s /test/result/bus1.err ] + +then + # Test was successful + echo -e "\n\rBUS1 TEST-PASSED" + echo "BUS1 TEST-PASSED" >> /test/result/bus1.res +else + # Test failed + echo -e "\n\rBUS1 TEST-FAIL" + echo "BUS1 TEST-FAILED" >> /test/result/bus1.res +fi diff --git a/Test_Item/SW/script/bus2_test b/Test_Item/SW/script/bus2_test new file mode 100644 index 0000000..e432aad --- /dev/null +++ b/Test_Item/SW/script/bus2_test @@ -0,0 +1,130 @@ +#!/bin/sh + +# Functionality: +# Slaves COM is sending a defined String to the same COM on Master. +# Master is running a background process that +# only returns what comes in. + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + +#----------------------------------------------------------------------------- +# PREPERATIONS +#----------------------------------------------------------------------------- + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/bus2.res ] +then + rm /test/result/bus2.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/bus2.err ] +then + rm /test/result/bus2.err +fi + +# Make shure that Original file of Test does NOT exists +if [ -s /test/result/bus2.ori ] +then + rm /test/result/bus2.ori +fi + +# Make shure that readback file of Test does NOT exists +if [ -s /test/result/bus2.rb ] +then + rm /test/result/bus2.rb +fi + +# Set up COM3 +stty -F /dev/ttyS4 -echo -echoe -echok -echonl -echoprt -echoctl -echoke -ocrnl -icrnl -onlcr -opost crtscts clocal cread cs8 ignpar +stty -F /dev/ttyS5 -echo -echoe -echok -echonl -echoprt -echoctl -echoke -ocrnl -icrnl -onlcr -opost crtscts clocal cread cs8 ignpar + +#----------------------------------------------------------------------------- +# TEST WITH 19200 BAUD +#----------------------------------------------------------------------------- + +# Message Baudrate to Log +echo -e "Test bus2 with Baudrate: 19200\n\r" +# Set Baudrate +stty -F /dev/ttyS4 19200 +stty -F /dev/ttyS5 19200 + +# Start a Backgroundprocess to receive something +cat /dev/ttyS4 1>> /test/result/bus2.rb & + +sleep 1 + +# Send the defined String +echo "This is BUS2 Test with 19200 Baud" > /dev/ttyS5 +echo "This is BUS2 Test with 19200 Baud" 1>> /test/result/bus2.ori + + +# Set Script-Process to Sleep to have time to receive something +sleep 1 +# After Receiving (Or Timeout), kill all Processes on CAT +killall cat + +# Compare the read String with the original one +diff /test/result/bus2.ori /test/result/bus2.rb 1>> /test/result/bus2.res + 2>> /test/result/bus2.err + +#----------------------------------------------------------------------------- +# TEST WITH 115200 BAUD +#----------------------------------------------------------------------------- + +# Message Baudrate to Log +echo -e "Test bus2 with Baudrate: 115200\n\r" +# Set Baudrate +stty -F /dev/ttyS4 115200 +stty -F /dev/ttyS5 115200 + +# Start a Backgroundprocess to receive something +cat /dev/ttyS4 1>> /test/result/bus2.rb & + +sleep 1 + +# Send the defined String +echo "This is BUS2 Test with 115200 Baud" > /dev/ttyS5 +echo "This is BUS2 Test with 115200 Baud" 1>> /test/result/bus2.ori + + +# Set Script-Process to Sleep to have time to receive something +sleep 1 +# After Receiving (Or Timeout), kill all Processes on CAT +killall cat + +# Compare the read String with the original one +diff /test/result/bus2.ori /test/result/bus2.rb 1>> /test/result/bus2.res + 2>> /test/result/bus2.err + + +#----------------------------------------------------------------------------- +# OUTPUT AND RESULT CALCULATION +#----------------------------------------------------------------------------- + +# Display content of /test/result/bus2.res +echo -e "\n\rContent of bus2.res" +cat /test/result/bus2.res + +# Display content of /test/result/bus2.err +echo -e "\n\rContent of bus2.err" +cat /test/result/bus2.err + +# If comparison returned neither results nor errors, the copying and comparision was successful +if [ ! -s /test/result/bus2.res -a ! -s /test/result/bus2.err ] + +then + # Test was successful + echo -e "\n\rBUS2 TEST-PASSED" + echo "BUS2 TEST-PASSED" >> /test/result/bus2.res +else + # Test failed + echo -e "\n\rBUS2 TEST-FAIL" + echo "BUS2 TEST-FAILED" >> /test/result/bus2.res +fi diff --git a/Test_Item/SW/script/eeprom_test b/Test_Item/SW/script/eeprom_test new file mode 100644 index 0000000..b6ba1df --- /dev/null +++ b/Test_Item/SW/script/eeprom_test @@ -0,0 +1,214 @@ +#!/bin/sh + +# Functionality: +# The EEPROM is write protected. The actual used i2c driver in the kernel +# only supports reading on the EEPROM. +# The test reads all EEPROM block contents. Each block should not be +# empty. This will be checked. If all eight blocks are read as not-empty, +# test passes. + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + +#----------------------------------------------------------------------------- +# PREPERATIONS +#----------------------------------------------------------------------------- + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/eeprom.res ] +then + rm /test/result/eeprom.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/eeprom.err ] +then + rm /test/result/eeprom.err +fi + +# Make shure that Original file of Test does NOT exists +if [ -s /test/result/eeprom.ori ] +then + rm /test/result/eeprom.ori +fi + +# Make shure that readback file of Test does NOT exists +if [ -s /test/result/eeprom.rb ] +then + rm /test/result/eeprom.rb +fi + +#----------------------------------------------------------------------------- +# TEST +#----------------------------------------------------------------------------- + +if [ ! -d /sys/bus/i2c/devices/0-0050 ] +then + # First Block in EEPROM not available - Write Message to result file + echo "FIRST Block unavailable" >> /test/result/eeprom.res +else + # First Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0050/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "First Block OK" + else + # File is not available or its size is zero - Test failed + echo "First Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0051 ] +then + # Second Block in EEPROM not available - Write Message to result file + echo "Second Block unavailable" >> /test/result/eeprom.res +else + # Second Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0051/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Second Block OK" + else + # File is not available or its size is zero - Test failed + echo "Second Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0052 ] +then + # Third Block in EEPROM not available - Write Message to result file + echo "Third Block unavailable" >> /test/result/eeprom.res +else + # Third Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0052/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Third Block OK" + else + # File is not available or its size is zero - Test failed + echo "Third Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0053 ] +then + # Fourth Block in EEPROM not available - Write Message to result file + echo "Fourth Block unavailable" >> /test/result/eeprom.res +else + # Fourth Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0053/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Fourth Block OK" + else + # File is not available or its size is zero - Test failed + echo "Fourth Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0054 ] +then + # Fifth Block in EEPROM not available - Write Message to result file + echo "Fifth Block unavailable" >> /test/result/eeprom.res +else + # Fifth Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0054/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Fifth Block OK" + else + # File is not available or its size is zero - Test failed + echo "Fifth Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0055 ] +then + # Sixth Block in EEPROM not available - Write Message to result file + echo "Sixth Block unavailable" >> /test/result/eeprom.res +else + # Sixth Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0055/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Sixth Block OK" + else + # File is not available or its size is zero - Test failed + echo "Sixth Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0056 ] +then + # Seventh Block in EEPROM not available - Write Message to result file + echo "Seventh Block unavailable" >> /test/result/eeprom.res +else + # Seventh Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0056/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Seventh Block OK" + else + # File is not available or its size is zero - Test failed + echo "Seventh Block File error" >> /test/result/eeprom.res + fi +fi + +if [ ! -d /sys/bus/i2c/devices/0-0057 ] +then + # Eigth Block in EEPROM not available - Write Message to result file + echo "Eigth Block unavailable" >> /test/result/eeprom.res +else + # Eigth Block in EEPROM available - Check Size + if [ -s /sys/bus/i2c/devices/0-0057/eeprom ] + then + # File is available and its size greater zero - Test passed + echo -e "Eigth Block OK" + else + # File is not available or its size is zero - Test failed + echo "Eigth Block File error" >> /test/result/eeprom.res + fi +fi + +#----------------------------------------------------------------------------- +# OUTPUT AND RESULT CALCULATION +#----------------------------------------------------------------------------- + +# Display content of /test/result/eeprom.res +if [ -s /test/result/eeprom.res ] +then + echo -e "\n\rContent of eeprom.res" + cat /test/result/eeprom.res +fi + +# Display content of /test/result/eeprom.err +if [ -s /test/result/eeprom.err ] +then + echo -e "\n\rContent of eeprom.err" + cat /test/result/eeprom.err +fi + +# If comparison returned neither results nor errors, the copying and +# comparision was successful +if [ ! -s /test/result/eeprom.res -a ! -s /test/result/eeprom.err ] + +then + # Test was successful + echo -e "\n\rEEPROM TEST-PASSED" + echo "EEPROM TEST-PASSED" >> /test/result/eeprom.res +else + # Test failed + echo -e "\n\rEEPROM TEST-FAIL" + echo "EEPROM TEST-FAILED" >> /test/result/eeprom.res +fi + + + + + + diff --git a/Test_Item/SW/script/eth0_test b/Test_Item/SW/script/eth0_test new file mode 100644 index 0000000..856cad0 --- /dev/null +++ b/Test_Item/SW/script/eth0_test @@ -0,0 +1,49 @@ +#!/bin/sh + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/eth0.res ] +then + rm /test/result/eth0.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/eth0.err ] +then + rm /test/result/eth0.err +fi + +# Ping Server in local network to make shure Ethernet Device works +# "-c 4": Send only 4 packages +# "-I eth0": Use Ethernet 0 as device +ping -c 4 -I eth0 192.168.1.2 1>> /test/result/eth0.res 2>> /test/result/eth0.err + + +# Display content of /test/result/usb2.res +echo -e "\n\rContent of eth0res" +cat /test/result/eth0.res + +# Display content of /test/result/usb2.err +echo -e "\n\rContent of eth0.err" +cat /test/result/eth0.err + +# Variable "$?" contains the ping result. 0 represents a successful ping. If ethernet device not available, error file will +# not be empty +if [ $? -eq 0 -a ! -s /test/result/eth0.err ] +then + # Test was successful + echo -e "\n\rETHERNET 0 TEST-PASSED" + echo "ETHERNET 0 TEST-PASSED" >> /test/result/eth0.res +else + # Test failed + echo -e "\n\rETHERNET 0 TEST-FAIL" + echo "\n\rETHERNET 0 TEST-FAILED" >> /test/result/eth0.res +fi diff --git a/Test_Item/SW/script/eth1_test b/Test_Item/SW/script/eth1_test new file mode 100644 index 0000000..4e945af --- /dev/null +++ b/Test_Item/SW/script/eth1_test @@ -0,0 +1,49 @@ +#!/bin/sh + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/eth1.res ] +then + rm /test/result/eth1.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/eth1.err ] +then + rm /test/result/eth1.err +fi + +# Ping Server in local network to make shure Ethernet Device works +# "-c 4": Send only 4 packages +# "-I eth1": Use Ethernet 1 as device +ping -c 4 -I eth1 192.168.1.2 1> /test/result/eth1.res 2> /test/result/eth1.err + + +# Display content of /test/result/eth2.res +echo -e "\n\rContent of eth1.res" +cat /test/result/eth1.res + +# Display content of /test/result/eth2.err +echo -e "\n\rContent of eth1.err" +cat /test/result/eth1.err + +# Variable "$?" contains the ping result. 0 represents a successful ping. If ethernet device not available, error file will +# not be empty +if [ $? -eq 0 -a ! -s /test/result/eth1.err ] +then + # Test was successful + echo -e "\n\rETHERNET 1 TEST-PASSED" + echo "ETHERNET 1 TEST-PASSED" >> /test/result/eth1.res +else + # Test failed + echo -e "\n\rETHERNET 1 TEST-FAIL" + echo "\n\rETHERNET 1 TEST-FAILED" >> /test/result/eth1.res +fi diff --git a/Test_Item/SW/script/testfile b/Test_Item/SW/script/testfile new file mode 100644 index 0000000..08b7a5b --- /dev/null +++ b/Test_Item/SW/script/testfile @@ -0,0 +1,4 @@ +0123456789 +9876543210 +abcdefghijklmnopqrstuvwxyz +zyxwvutsrqponmlkjihgfedcba diff --git a/Test_Item/SW/script/usb1_test b/Test_Item/SW/script/usb1_test new file mode 100644 index 0000000..5233659 --- /dev/null +++ b/Test_Item/SW/script/usb1_test @@ -0,0 +1,75 @@ +#!/bin/sh + + +# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor + + + +# Make shure that mounting Directory exists +if [ ! -d /mnt/usb1 ] +then + mkdir /mnt/usb1 +fi + +# Make shure that result Directory exists +if [ ! -d /test/result ] +then + mkdir /test/result +fi + +# Make shure that result file of Test does NOT exists +if [ -s /test/result/usb1.res ] +then + rm /test/result/usb1.res +fi + +# Make shure that error file of Test does NOT exists +if [ -s /test/result/usb1.err ] +then + rm /test/result/usb1.err +fi + +# Mount USB-Stick to /mnt/usb1 +mount /dev/sda1 /mnt/usb1 2>> /test/result/usb1.err + +# Copy Testfile from Test Directory to USB-Stick +cp /test/testfile /mnt/usb1 2>> /test/result/usb1.err + +# Compare original Testfile and copied Testfile on USB-Stick +# Print compare results to /test/result/usb1.res +# Print compare errors to /test/result/usb1.err +if [ ! -e /mnt/usb1/testfile ] +then + echo "TESTFILE DOES NOT EXIST" >> /test/result/usb1.err +fi +diff /test/testfile /mnt/usb1/testfile 1>> /test/result/usb1.res + 2>> /test/result/usb1.err + +# Delete Testfile on USB-Stick +rm /mnt/usb1/testfile 2>> /test/result/usb1.err + +# Unmount USB-Stick +umount /mnt/usb1 2>> /test/result/usb1.err + +# Delete Folder usb1 in /mnt +rmdir /mnt/usb1 2>> /test/result/usb1.err + +# Display content of /test/result/usb1.res +echo -e "\n\rContent of usb1.res" +cat /test/result/usb1.res + +# Display content of /test/result/usb1.err +echo -e "\n\rContent of usb1.err" +cat /test/result/usb1.err + +# If comparison returned neither results nor errors, the copying and comparision was successful +if [ ! -s /test/result/usb1.res -a ! -s /test/result/usb1.err ] +then + # Test was successful + echo -e "\n\rUSB1 TEST-PASSED" + echo "USB1 TEST-PASSED" >> /test/result/usb1.res +else + # Test failed + echo -e "\n\rUSB1 TEST-FAIL" + echo "USB1 TEST-FAILED" >> /test/result/usb1.res +fi \ No newline at end of file diff --git a/Test_Item/SW/testapplication/digital_test.c b/Test_Item/SW/testapplication/digital_test.c index 040ebc7..fbe331a 100644 --- a/Test_Item/SW/testapplication/digital_test.c +++ b/Test_Item/SW/testapplication/digital_test.c @@ -1 +1 @@ -/* --------------------------------------------------------------------------- * digital_test.c (c) 2008 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: Test file for the digital connections * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files * --------------------------------------------------------------------------- */ #include #include #include #include /* --------------------------------------------------------------------------- * Application include files * --------------------------------------------------------------------------- */ #include "digital_test.h" #include "smc4000io.h" #include "BusProtocol.h" #include "protocolfunctions.h" /* --------------------------------------------------------------------------- * Local constant and macro definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Global variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local function definitions * --------------------------------------------------------------------------- */ void digitalWrite (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 2 * params[0]: digital output channel number * params[1]: digital output value (0: LOW, !0: HIGH) */ int result; UINT32 channel; UINT16 doutValue; printf ("\nCalled function: digitalWrite\n"); printf ("params[0]: %i\n", params[0]); printf ("params[1]: %i\n", params[1]); channel = params[0]; if (params[1] != 0) { params[1] = 1; } if (channel < NUMBEROFDO_MB) { /* Channel is located in mainboard */ din0_7Read (IOCTL_interface, & doutValue); /* Get actual DoutValue */ doutValue &=~(1 << channel); /* Reset channel bit to Zero */ doutValue |= (params[1] << channel);/* Set channel bit */ /* Write built Bitmask to IO-Control Processor */ result = dout0_15Write (IOCTL_interface, & doutValue); } else if ((channel >= NUMBEROFDO_MB) && (channel < NUMBEROFTOTALDO)) { /* Channel is located in extensionboard */ dinext0_3Read (IOCTL_interface, &doutValue); doutValue &=~(1 << channel); /* Reset channel bit to Zero */ doutValue |= (params[1] << channel);/* Set channel bit */ /* Write built Bitmask to IO-Control Processor */ result = doutext0_3Write (IOCTL_interface, & doutValue); } /* Release digital semaphore on calling device with result function */ bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 20, 1, 0, NULL); printf ("dout_Write returned: %d\n", result); } void digitalWriteAll (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 2 * params[0]: board type (0: MB, 1: EB) * params[1]: digital output value (0: LOW, !0: HIGH) */ int result; UINT16 doutValue = 9; if (params[1] == 0) { /* All effected Outputs should be written to LOW */ doutValue = 0x0000; } else if (params[1] == 1) { /* All effected Outputs should be written to HIGH */ doutValue = 0x00FF; printf ("params[1] recognised as 1"); } if (params[0] == 0) { /* Maindboard Outputs should be effected */ result = dout0_15Write (IOCTL_interface, & doutValue); } else if (params[0] == 1) { /* Extensionboard Outputs should be effected */ result = doutext0_3Write (IOCTL_interface, & doutValue); } /* Release digital semaphore on calling device with result function */ bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 20, 1, 0, NULL); printf ("dout_Write returned: %d\n", result); } void digitalRead (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { int result; INT32 dioReadResult; UINT32 channel; UINT16 doutValue; /* nrOfParams = 1 * params[0]: digital input channel number */ channel = params[0]; printf ("\nCalled function: digitalRead\n"); if (channel < NUMBEROFDI_MB) { /* work on digital input of Mainboard */ result = din0_7Read (IOCTL_interface, & doutValue); printf ("digital read: %h\n", doutValue); dioReadResult = (doutValue & (0x0000 | (1 << channel))); } else if ((channel >= NUMBEROFDI_MB) && (channel < NUMBEROFTOTALDI)) { /* Work on digital input of Extensionboard */ result = doutext0_3Write (IOCTL_interface, & doutValue); printf ("digital read: %h\n", doutValue); } printf ("dout_Write returned: %d\n", result); bpSendRpcResult(bushandler, MASTERDEVICENUMBER, 11, 1, 1, &dioReadResult); } void digitalReadAll (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 1 * params[0]: board type (0: MB, 1: EB) */ int result; UINT32 doutValue[2]; UINT8 channelcnt; printf ("Called function: digitalReadAll\n"); printf ("params[0]: %i\n", params[0]); fflush( stdout ); if (params[0] == 0) { doutValue[0] = params[0]; result = din0_7Read (IOCTL_interface, & doutValue[1]); printf ("digital read: %x\n", doutValue[1]); } else if (params[0] == 1) { doutValue[0] = params[0]; result = doutext0_3Write (IOCTL_interface, & doutValue[1]); printf ("digital read: %x\n", doutValue[1]); } printf ("digitalReadAll returned: %d\n", result); bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 13, 1, 2, &doutValue); } void digitalMB_test_execute (void) { printf ("THIS IS THE DIGITAL TEST SEQUENCE"); } void digitalEB_test_execute (void) { printf ("THIS IS THE DIGITAL TEST SEQUENCE"); } \ No newline at end of file +/* --------------------------------------------------------------------------- * digital_test.c (c) 2008 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: Test file for the digital connections * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files * --------------------------------------------------------------------------- */ #include #include #include #include /* --------------------------------------------------------------------------- * Application include files * --------------------------------------------------------------------------- */ #include "digital_test.h" #include "smc4000io.h" #include "BusProtocol.h" #include "protocolfunctions.h" /* --------------------------------------------------------------------------- * Local constant and macro definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Global variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local function definitions * --------------------------------------------------------------------------- */ void digitalWrite (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 2 * params[0]: digital output channel number * params[1]: digital output value (0: LOW, !0: HIGH) */ int result; UINT32 channel; UINT16 doutValue; printf ("\nCalled function: digitalWrite\n"); printf ("params[0]: %i\n", params[0]); printf ("params[1]: %i\n", params[1]); channel = params[0]; if (params[1] != 0) { params[1] = 1; } if (channel < NUMBEROFDO_MB) { /* Channel is located in mainboard */ din0_7Read (IOCTL_interface, & doutValue); /* Get actual DoutValue */ doutValue &=~(1 << channel); /* Reset channel bit to Zero */ doutValue |= (params[1] << channel);/* Set channel bit */ /* Write built Bitmask to IO-Control Processor */ result = dout0_15Write (IOCTL_interface, & doutValue); } else if ((channel >= NUMBEROFDO_MB) && (channel < NUMBEROFTOTALDO)) { /* Channel is located in extensionboard */ dinext0_3Read (IOCTL_interface, &doutValue); doutValue &=~(1 << channel); /* Reset channel bit to Zero */ doutValue |= (params[1] << channel);/* Set channel bit */ /* Write built Bitmask to IO-Control Processor */ result = doutext0_3Write (IOCTL_interface, & doutValue); } /* Release digital semaphore on calling device with result function */ bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 20, 1, 0, NULL); printf ("dout_Write returned: %d\n", result); } void digitalWriteAll (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 2 * params[0]: board type (0: MB, 1: EB) * params[1]: digital output value (0: LOW, !0: HIGH) */ int result; UINT16 doutValue; if (params[1] == 0) { /* All effected Outputs should be written to LOW */ doutValue = 0x0000; } else if (params[1] == 1) { /* All effected Outputs should be written to HIGH */ doutValue = 0x00FF; printf ("params[1] recognised as 1"); } if (params[0] == 0) { /* Maindboard Outputs should be effected */ result = dout0_15Write (IOCTL_interface, & doutValue); } else if (params[0] == 1) { /* Extensionboard Outputs should be effected */ result = doutext0_3Write (IOCTL_interface, & doutValue); } /* Release digital semaphore on calling device with result function */ bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 20, 1, 0, NULL); printf ("dout_Write returned: %d\n", result); } void digitalRead (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { int result; INT32 dioReadResult; UINT32 channel; UINT16 doutValue; /* nrOfParams = 1 * params[0]: digital input channel number */ channel = params[0]; printf ("\nCalled function: digitalRead\n"); if (channel < NUMBEROFDI_MB) { /* work on digital input of Mainboard */ result = din0_7Read (IOCTL_interface, & doutValue); printf ("digital read: %h\n", doutValue); dioReadResult = (doutValue & (0x0000 | (1 << channel))); } else if ((channel >= NUMBEROFDI_MB) && (channel < NUMBEROFTOTALDI)) { /* Work on digital input of Extensionboard */ result = doutext0_3Write (IOCTL_interface, & doutValue); printf ("digital read: %h\n", doutValue); } printf ("dout_Write returned: %d\n", result); bpSendRpcResult(bushandler, MASTERDEVICENUMBER, 11, 1, 1, &dioReadResult); } void digitalReadAll (UINT8 senderId, UINT8 targetId, UINT8 requestNr, UINT8 functionId, UINT8 nrOfParams, UINT32 *params) { /* nrOfParams = 1 * params[0]: board type (0: MB, 1: EB) */ int result; UINT32 doutValue[2]; UINT8 channelcnt; printf ("Called function: digitalReadAll\n"); printf ("params[0]: %i\n", params[0]); fflush( stdout ); if (params[0] == 0) { doutValue[0] = params[0]; result = din0_7Read (IOCTL_interface, & doutValue[1]); printf ("digital read: %x\n", doutValue[1]); } else if (params[0] == 1) { doutValue[0] = params[0]; result = doutext0_3Write (IOCTL_interface, & doutValue[1]); printf ("digital read: %x\n", doutValue[1]); } printf ("digitalReadAll returned: %d\n", result); bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 13, 1, 2, &doutValue); } void digitalMB_test_execute (void) { printf ("THIS IS THE DIGITAL TEST SEQUENCE"); } void digitalEB_test_execute (void) { printf ("THIS IS THE DIGITAL TEST SEQUENCE"); } \ No newline at end of file diff --git a/Test_Item/SW/testapplication/ethernet_test.c b/Test_Item/SW/testapplication/ethernet_test.c index ec978e8..aceba84 100644 --- a/Test_Item/SW/testapplication/ethernet_test.c +++ b/Test_Item/SW/testapplication/ethernet_test.c @@ -1 +1 @@ -/* --------------------------------------------------------------------------- * ethernet_test.c (c) 2008 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: * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files * --------------------------------------------------------------------------- */ #include /* --------------------------------------------------------------------------- * Application include files * --------------------------------------------------------------------------- */ #include "ethernet_test.h" /* --------------------------------------------------------------------------- * Local constant and macro definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Global variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local function definitions * --------------------------------------------------------------------------- */ void ethernet_test_execute (void) { printf ("THIS IS THE ETHERNET TEST SEQUENCE"); } \ No newline at end of file +/* --------------------------------------------------------------------------- * ethernet_test.c (c) 2008 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: * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files * --------------------------------------------------------------------------- */ #include #include #include /* --------------------------------------------------------------------------- * Application include files * --------------------------------------------------------------------------- */ #include "ethernet_test.h" /* --------------------------------------------------------------------------- * Local constant and macro definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Global variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local function definitions * --------------------------------------------------------------------------- */ void ethernet_test_execute (void) { BOOLEAN test_result; test_result = eth0_test(); /* Transfer test result to master */ bpSendRpcResult(bushandler, REMOTEDEVICENUMBER, 2, 1, 1, &test_result); /* Release test Semaphore on Master by calling general release function */ bpSendRpcResult(handleBus1, 1, 1, 1, 0, NULL); } BOOLEAN eth0_test (void) { int fd; int rd; char readback[512]; BOOLEAN test_result; printf ("THIS IS THE ETHERNET TEST SEQUENCE"); /* Call local test script */ system ("/./test/eth0_test"); /* Software continues here after script is ended * Try to open test result file */ if ((fd = open ("result/eth0.res", O_RDONLY, 0)) == -1) { /* Opening was not successful - Set test result to false */ printf ("Cannot open File"); test_result = FALSE; } else { /* Opening was sucessful - Try to read content of result file */ if ((rd = read (fd, readback, 512)) == -1) { /* Reading was not sucessful - Set test result to false */ printf ("Cannot read from file"); test_result = FALSE; } else { /* Reading was sucessful - Try to find the result keyword */ if ((strstr (readback, "PASSED")) != NULL) { /* Keyword "PASSED" found - Set test resulr to true */ printf ("\n\rTest is PASSED\n\r"); test_result = TRUE; } else if ((strstr (readback, "FAILED")) != NULL) { /* Keyword "FAILED" found - Set test result to false */ printf ("\n\rTest is FAILED\n\r"); test_result = FALSE; } else { /* No Keyword found - Set test result to false */ printf ("No result found in file"); test_result = FALSE; } } } } return (test_result); /* Transmit test result */ } \ No newline at end of file diff --git a/Test_Item/SW/testapplication/ethernet_test.h b/Test_Item/SW/testapplication/ethernet_test.h index 4a40404..d8fdfa3 100644 --- a/Test_Item/SW/testapplication/ethernet_test.h +++ b/Test_Item/SW/testapplication/ethernet_test.h @@ -1 +1 @@ -/* --------------------------------------------------------------------------- * ethernet_test.h (c) 2008 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: * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Application include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Constant and macro definitions. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Type definitions. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Variable declarations. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Function declarations. * --------------------------------------------------------------------------- */ void ethernet_test_execute (void); \ No newline at end of file +/* --------------------------------------------------------------------------- * ethernet_test.h (c) 2008 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: * --------------------------------------------------------------------------- * Version(s): 0.1, Dez 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Application include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Constant and macro definitions. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Type definitions. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Variable declarations. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Function declarations. * --------------------------------------------------------------------------- */ void ethernet_test_execute (void); BOOLEAN eth0_test (void); \ No newline at end of file