Added Software projects

git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
Matthias
2008-12-23 10:34:08 +00:00
parent ee5a771818
commit 373a8c32b2
348 changed files with 86781 additions and 0 deletions
@@ -0,0 +1,274 @@
/* ---------------------------------------------------------------------------
* ledfunctions.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:
* Some handy Functions for the status and the Digital Output LEDs
* ---------------------------------------------------------------------------
* Version(s): 0.1, Mar 11, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include "lpc23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "Task.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "leds.h"
#include "dio.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
void LEDPauseFlash (t_led_ids LEDnum, UINT8 counts, INT16 delay_length)
{
/* Local Variable Declaration */
UINT16 loopcnt; /* loop index */
for ( loopcnt=0; loopcnt <= (counts*2); loopcnt++)
{
if (LEDnum == LED0) /* RED LED */
{
ledToggle (LED0); /* Toggle LED Status */
vTaskDelay (delay_length); /* Wait for defined time */
}
if (LEDnum == LED1) /* GREEN LED */
{
ledToggle (LED1);
vTaskDelay (delay_length);
}
}
if (ledGet (LED1) == FALSE) /* GREEN LED should be switched on */
{
ledToggle (LED1);
}
}
void LEDResult (BOOLEAN TestResult)
{
if (TestResult == TRUE) /* If Test was passed */
{
ledSet (LED0, 1); /* switch on RED LED */
}
if (TestResult == FALSE) /* If test failed */
{
ledSet (LED0, 0); /* Switch off RED LED */
}
}
void LEDResultDIO (BOOLEAN TestResult, UINT16 dioNo)
{
if (TestResult == TRUE) /* If Test was passed */
{
dioWrite (0, dioNo, TRUE); /* switch on DIO LED */
}
if (TestResult == FALSE) /* If test failed */
{
dioWrite (0, dioNo, FALSE); /* Switch off DIO LED */
}
}
void LEDToggleForever (void)
{
ledSet (LED0, FALSE); /* Set both LEDs to StartUp */
ledSet (LED1, TRUE);
vTaskDelay (500); /* Wait for 500 ms */
for (;;) /* endless loop */
{
ledToggle (LED0); /* Toggle RED LED */
ledToggle (LED1); /* Toggle GREEN LED */
vTaskDelay (500);
}
}
void LEDToggle (UINT16 cnts)
{
/* Local Variable Declaration */
UINT16 loopcnt; /* loop index */
ledSet (LED0, FALSE); /* Set both LEDs to StartUp */
ledSet (LED1, TRUE);
vTaskDelay (500); /* Wait for 500 ms */
for ( loopcnt = 0; loopcnt <= cnts; loopcnt++)
{
ledToggle(LED0); /* Toggle RED LED */
ledToggle(LED1); /* Toggle GREEN LED */
vTaskDelay (500);
}
}
void LEDShowStatus (UINT16 status)
{
/* Local Variable Declaration */
UINT16 loopcnt; /* loop index */
if (ledGet (LED0) == TRUE) /* If current LED Status is TRUE */
{
ledSet( LED0, FALSE); /* Switch of RED LED */
vTaskDelay (500); /* Wait for 500 ms */
}
for (loopcnt = 0; loopcnt <= (status*2); loopcnt++)
{
ledToggle (LED0); /* Toggle RED LED */
vTaskDelay (500);
}
vTaskDelay (1000);
}
void gLEDToggle (UINT16 time)
{
for (;;) /* Endless loop */
{
ledToggle (LED1); /* Toggle GREEN LED */
vTaskDelay (time); /* Wait for defined time */
}
}
void rLEDToggle (UINT16 time)
{
for (;;) /* Endless loop */
{
ledToggle (LED0); /* Toggle RED LED */
vTaskDelay (time); /* Wait for defined Time */
}
}
void dioToggle (UINT16 LEDnr)
{
UINT16 time = 100; /* LED Toggle-time definition */
for (;;) /* Endless loop */
{
dioWrite (0, LEDnr, TRUE); /* Write defined digitalOut to HIGH */
vTaskDelay (time); /* Wait for defined Toggle-time */
dioWrite (0, LEDnr, FALSE); /* Write defined digitalOut to LOW */
vTaskDelay (time);
}
}
void dioToggleNC (UINT16 LEDnr)
{
UINT16 time = 1000; /* LED Toggle-time definition */
for (;;) /* Endless loop */
{
dioWrite (0, LEDnr, TRUE); /* Write defined digitalOut to HIGH */
vTaskDelay (time); /* Wait for defined Toggle-time */
dioWrite (0, LEDnr, FALSE); /* Write defined digitalOut to LOW */
vTaskDelay (time);
}
}
void dio2x4 (UINT32 ToggleTime)
{
for (;;) /* endless loop */
{
dioWrite (0,0,TRUE); /* ON-OFF-ON-OFF-ON-OFF-ON-OFF */
dioWrite (0,1,FALSE);
dioWrite (0,2,TRUE);
dioWrite (0,3,FALSE);
dioWrite (0,4,TRUE);
dioWrite (0,5,FALSE);
dioWrite (0,6,TRUE);
dioWrite (0,7,FALSE);
vTaskDelay(ToggleTime); /* Wait Toggle Time */
dioWrite (0,0,FALSE); /* OFF-ON-OFF-ON-OFF-ON-OFF-ON */
dioWrite (0,1,TRUE);
dioWrite (0,2,FALSE);
dioWrite (0,3,TRUE);
dioWrite (0,4,FALSE);
dioWrite (0,5,TRUE);
dioWrite (0,6,FALSE);
dioWrite (0,7,TRUE);
vTaskDelay (ToggleTime);
}
}
void dioClean (void)
{
dioWrite (0,0,FALSE); /* Write digital Output to LOW */
dioWrite (0,1,FALSE);
dioWrite (0,2,FALSE);
dioWrite (0,3,FALSE);
dioWrite (0,4,FALSE);
dioWrite (0,5,FALSE);
dioWrite (0,6,FALSE);
dioWrite (0,7,FALSE);
}
UINT8 dioCapture (void)
{
/* Local Variable Declaration */
UINT8 dioCaptureResult = 0;
dioCaptureResult |= (dioReadBack (0,0) << 0); /*Save current DIO Status */
dioCaptureResult |= (dioReadBack (0,1) << 1);
dioCaptureResult |= (dioReadBack (0,2) << 2);
dioCaptureResult |= (dioReadBack (0,3) << 3);
dioCaptureResult |= (dioReadBack (0,4) << 4);
dioCaptureResult |= (dioReadBack (0,5) << 5);
dioCaptureResult |= (dioReadBack (0,6) << 6);
dioCaptureResult |= (dioReadBack (0,7) << 7);
return dioCaptureResult; /* Return saved DIO Status */
}
void dioResume (UINT8 dioResumeValue)
{
dioWrite (0,0,((dioResumeValue >> 0) & 1)); /* Set DIO to defined Value */
dioWrite (0,1,((dioResumeValue >> 1) & 1));
dioWrite (0,2,((dioResumeValue >> 2) & 1));
dioWrite (0,3,((dioResumeValue >> 3) & 1));
dioWrite (0,4,((dioResumeValue >> 4) & 1));
dioWrite (0,5,((dioResumeValue >> 5) & 1));
dioWrite (0,6,((dioResumeValue >> 6) & 1));
dioWrite (0,7,((dioResumeValue >> 7) & 1));
}
@@ -0,0 +1,220 @@
/* ---------------------------------------------------------------------------
* ledfunctions.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:
* Headerfile for ledfunctions.c
* ---------------------------------------------------------------------------
* Version(s): 0.1, Mar 11, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef LEDFUNCTIONS_H_
#define LEDFUNCTIONS_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "lpc23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "leds.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function: LEDPauseFlash
*
* Function that flashes either the RED or the GREEN LED in user defined
* length and number.
*
* Parameters: t_led_ids LEDnum - Defines the LED to flash
* UINT8 counts - Number of flash events
* INT16 delay_length - length of single flash event
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDPauseFlash(t_led_ids LEDnum, UINT8 counts, INT16 delay_length);
/* ---------------------------------------------------------------------------
* Function: LEDResult
*
* Function to display a BOOLEAN Variable either on RED or GREEN LED
*
* Parameters: BOOLEAN TestResult - Gives the BOOLEAN Variable to display
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDResult (BOOLEAN TestResult);
/* ---------------------------------------------------------------------------
* Function: LEDResultDIO
*
* Function to display a BOOLEAN Variable on a DIO LED
*
* Parameters: BOOLEAN TestResult - Gives the BOOLEAN Variable to display
* UINT 16 dioNo - Number of DIO channel
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDResultDIO (BOOLEAN TestResult, UINT16 dioNo);
/* ---------------------------------------------------------------------------
* Function: LEDToggleForever
*
* Function that simply toggles RED and GREEN LED in an endless loop
*
* Parameters: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDToggleForever( void);
/* ---------------------------------------------------------------------------
* Function: LEDToggle
*
* Function that simply toggles RED and GREEN LED for user defined number
*
* Parameters: UINT16 cnts - user defined toggle number
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDToggle( UINT16 cnts);
/* ---------------------------------------------------------------------------
* Function: LEDShowStatus
*
* Function to display a Variable value by flashing that amount of.
*
* Parameters: UINT16 status - Value of Variable to flash like
*
* Return: void
* ---------------------------------------------------------------------------
*/
void LEDShowStatus (UINT16 status);
/* ---------------------------------------------------------------------------
* Functions: gLEDToggle / rLEDToggle
*
* Functions to toggle either RED or GREEN LED forever with user defined
* flash time
*
* Parameters: UINT16 time
*
* Return: void
* ---------------------------------------------------------------------------
*/
void gLEDToggle (UINT16 time);
void rLEDToggle (UINT16 time);
/* ---------------------------------------------------------------------------
* Function: dioToggle
*
* Function to toggle LED Status of a user defined Digital Output with 100 ms
* flash time.
*
* Parameters: UINT16 LEDnr
*
* Return: void
* ---------------------------------------------------------------------------
*/
void dioToggle (UINT16 LEDnr);
/* ---------------------------------------------------------------------------
* Function: dioToggleNC
*
* Function to toggle LED Status of a user defined Digital Output with 1000 ms
* flash time.
*
* Parameters: UINT16 LEDnr
*
* Return: void
* ---------------------------------------------------------------------------
*/
void dioToggleNC (UINT16 LEDnr);
/* ---------------------------------------------------------------------------
* Function: dio2x4
*
* Function to constantly flash the DIO LEDs in ON-OFF-ON-OFF pattern with
* userdefined toggle Time.
* Normaly used to note the user for something
*
* Parameters: UINT32 ToggleTime
*
* Return: void
* ---------------------------------------------------------------------------
*/
void dio2x4 (UINT32 ToggleTime);
/* ---------------------------------------------------------------------------
* Function: dioClean
*
* Sets all Digital Outputs back to LOW
*
* Parameters: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void dioClean (void);
/* ---------------------------------------------------------------------------
* Function: dioCapture
*
* Function to capture and save up to all 8 Digital Output Levels
*
* Parameters: void
*
* Return: UINT8 - up to all 8 Digital Output Levels
* ---------------------------------------------------------------------------
*/
UINT8 dioCapture (void);
/* ---------------------------------------------------------------------------
* Function: dioResume
*
* Function to set or restore up to all 8 Digital Output Levels
*
* Parameters: UINT8 dioResumeValue - Value for setting Output Levels
*
* Return: void
* ---------------------------------------------------------------------------
*/
void dioResume (UINT8 dioResumeValue);
#endif /*LEDFUNCTIONS_H_*/
@@ -0,0 +1,176 @@
/* ---------------------------------------------------------------------------
* protocolfunctions.c - v0.1 (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: Initialisation and direct usage of the Bus Protocol
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jun 2, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "protocolfunctions.h"
#include "BusProtocol.h"
#include "adc.h"
#include "dac.h"
#include "bus.h"
#include "dio.h"
#include "serial.h"
#include "SerOut.h"
#include "topoftest.h"
#include "remote_digital.h"
#include "remote_analogue.h"
#include "remote_relay.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
extern BOOLEAN auto_testResult;
extern UINT32 UINT32result;
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
void protocolInit (t_bus_devices BUS_ID, UINT32 DEV_ID, UINT32 MAX_ID)
{
/* Create both needed Semaphores to be able to use them */
vSemaphoreCreateBinary (generalSemaphore);
vSemaphoreCreateBinary (slaveRestartSemaphore);
/* Init Device as Master of BUS1 System */
handleBus1 = bpInit (BUS2, BUS1, DEV_ID, MAX_ID, 16);
/* Attach basicly needed Handshake Functions */
bpAttachRpc (handleBus1, 1, "AvailableID", (t_rpc_remote_procedure_call) availableBusID, 0);
bpAttachRpcResult(handleBus1, 1, (t_bp_rpcresult_callback) generalResultFunction, 0);
/* Following Attachments depend on Device ID */
if (DEV_ID == 1)
{
/* If Device is Master, attach these functions */
/* Attach Slave Result Functions (called by Slave on the Master) */
bpAttachRpcResult(handleBus1, 2, (t_bp_rpcresult_callback) testResultFunction, 1);
bpAttachRpcResult(handleBus1, 3, (t_bp_rpcresult_callback) slaveRestartFunction, 0);
bpAttachRpcResult(handleBus1, 4, (t_bp_rpcresult_callback) UINT32ResultFunction, 1);
bpAttachRpcResult(handleBus1, 9, (t_bp_rpcresult_callback) receiveRemoteAttachedFunctions, 1);
/* Attach test result functions */
bpAttachRpcResult(handleBus1, 11, (t_bp_rpcresult_callback) digitalReadResult, 1);
bpAttachRpcResult(handleBus1, 12, (t_bp_rpcresult_callback) analogueReadResult, 1);
bpAttachRpcResult(handleBus1, 13, (t_bp_rpcresult_callback) digitalReadAllResult, maxDI_Channels);
bpAttachRpcResult(handleBus1, 14, (t_bp_rpcresult_callback) analogueReadAllResult, maxDAC_Channels);
/* Attach semaphore release functions */
bpAttachRpcResult(handleBus1, 20, (t_bp_rpcresult_callback) remoteDigitalSemaphoreRelease, 0);
bpAttachRpcResult(handleBus1, 21, (t_bp_rpcresult_callback) remoteAnalogueSemaphoreRelease, 0);
bpAttachRpcResult(handleBus1, 22, (t_bp_rpcresult_callback) remoteRelaySemaphoreRelease, 0);
}
if (DEV_ID > 1)
{
/* If Device is Slave, attach these functions */
}
}
void availableBusID (UINT8 senderId, UINT8 targetId, UINT8 requestNr,
UINT8 functionId, UINT8 nrOfParams, UINT32 *params)
{
/* Just call first Result Function on Slave */
bpSendRpcResult(handleBus1, 2, 1, 1, 0, NULL);
}
/* generalResultFunction is the easiest Way to realise a Handshake between
* Master and Slave. Master software takes a Semaphore and calls a function
* on Slave, that is only calling generalResultfunction() on Master. If this
* happens, the Semaphore will be released and Handshake is done
*/
void generalResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
/* If called, release the generalSemaphore */
if (xSemaphoreGive (generalSemaphore) == pdTRUE)
{
}
else
{
}
}
/* Test functions called on Slave will return their Test Results with a
* call on this function. Results on Slave are from type BOOLEAN
*/
void testResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
/* Set Slave Test result depending on what slave sends back as parameter*/
if (*results == 1)
{
/* Test was successfull */
auto_testResult = TRUE;
}
else
{
/* Test was a failure */
auto_testResult = FALSE;
}
}
void slaveRestartFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
/* Release slaveRestartSemaphore if Slave calls this Function on Reboot */
if (xSemaphoreGive (slaveRestartSemaphore) == pdTRUE)
{
}
else
{
}
}
void UINT32ResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
UINT32result = *results;
}
void receiveRemoteAttachedFunctions (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
sendString (SerOutPort, TRUE, importantMessage, (char *) results, Dummy, Dummy);
}
@@ -0,0 +1,162 @@
/* ---------------------------------------------------------------------------
* protocolfunctions.h - v0.1 (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, Jun 2, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __PROTOCOLTEST_H__
#define __PROTOCOLTEST_H__
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "Bus.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
int handleBus1;
UINT8 remoteDeviceNumber;
UINT8 thisDeviceNumber;
xSemaphoreHandle generalSemaphore;
xSemaphoreHandle slaveRestartSemaphore;
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function: protocolInit
*
* Function to calibrate slaves Voltage Output
*
* Parameters: t_bus_devices BUS_ID - ID of the BUS system
* UINT32 DEV_ID - ID of the local Device
* UINT32 MAX_ID - Max ID in System
*
* Return: void
* ---------------------------------------------------------------------------
*/
void protocolInit (t_bus_devices BUS_ID, UINT32 DEV_ID, UINT32 MAX_ID);
/* ---------------------------------------------------------------------------
* Function: availableBusID
*
* Function that just calls a Result on the Caller. It's just a Handshake
*
* Parameters: UINT8 senderId - ID of Caller
* UINT8 targetId - ID of Target
* UINT8 requestNr - Number of the request
* UINT8 functionId - Numer of function to call
* UINT8 nrOfParams - Number of attached Paramters
* UINT32 *params - Attached Paramters
*
* Return: void
* ---------------------------------------------------------------------------
*/
void availableBusID (UINT8 senderId, UINT8 targetId, UINT8 requestNr,
UINT8 functionId, UINT8 nrOfParams, UINT32 *params);
/* ---------------------------------------------------------------------------
* Function: generalResultfunction
*
* Function that is called be Slave on the Master to release a Semaphore
*
* Parameters: UINT8 requestNr - number of the request
* UINT8 nrOfResult - Number of Attached Results
* UIN32 *results - Attached Results
*
* Return: void
* ---------------------------------------------------------------------------
*/
void generalResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
/* ---------------------------------------------------------------------------
* Function: testResultfunction
*
* Function that is called be Slave for telling a Test Result
*
* Parameters: UINT8 requestNr - number of the request
* UINT8 nrOfResult - Number of Attached Results
* UIN32 *results - Attached Results
*
* Return: void
* ---------------------------------------------------------------------------
*/
void testResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
/* ---------------------------------------------------------------------------
* Function: slaveRestartfunction
*
* Function that is called be Slave on the Master to tell about a Restart
*
* Parameters: UINT8 requestNr - number of the request
* UINT8 nrOfResult - Number of Attached Results
* UIN32 *results - Attached Results
*
* Return: void
* ---------------------------------------------------------------------------
*/
void slaveRestartFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
/* ---------------------------------------------------------------------------
* Function: UINT32ResultFunction
*
* Function to receive a UINT32 Result from Slave. Result is stored then in
* the global variable UINT32 UINT32result
*
* Parameters: UINT8 requestNr - number of the request
* UINT8 nrOfResult - Number of Attached Results
* UIN32 *results - Attached Results
*
* Return: void
* ---------------------------------------------------------------------------
*/
void UINT32ResultFunction (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
void receiveRemoteAttachedFunctions (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results);
#endif /* __PROTOCOLTEST_H__ */
@@ -0,0 +1,284 @@
/* ---------------------------------------------------------------------------
* taskfunctions.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:
* Contains Functions to control the TestLED Tasks
* ---------------------------------------------------------------------------
* Version(s): 0.1, Apr 09, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include "lpc23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "taskfunctions.h"
#include "dio.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
void taskInit (void)
{
d_gLED = 0; /* Initialize TaskStatus with 0 */
d_ledtestled = 0;
d_dioled = 0;
d_aioled = 0;
d_busled = 0;
d_eepromled = 0;
d_flashled = 0;
d_mmcled = 0;
d_logled = 0;
d_comled = 0;
d_powerled = 0;
d_rtcled = 0;
}
void diotasksdelete(void)
{
if (d_dioled == pdPASS) /* If defined Task exists */
{
vTaskDelete (dioled); /* Delete Task */
dioWrite (0,DIOLED,FALSE); /* Switch off corresponding DIO-LED */
d_dioled = 0; /* Set TaskStatus to 0 */
}
if (d_ledtestled == pdPASS)
{
vTaskDelete (ledtestled);
dioWrite (0,LEDTESTLED,FALSE);
d_ledtestled = 0;
}
if (d_aioled == pdPASS)
{
vTaskDelete (aioled);
dioWrite (0,AIOLED,FALSE);
d_aioled = 0;
}
if (d_busled == pdPASS)
{
vTaskDelete (busled);
dioWrite (0,BUSLED,FALSE);
d_busled = 0;
}
#if (allMemoryUseSameLED == 0)
if (d_eepromled == pdPASS)
{
vTaskDelete (eepromled);
dioWrite (0,EEPROMLED,FALSE);
d_eepromled = 0;
}
if (d_flashled == pdPASS)
{
vTaskDelete (flashled);
dioWrite (0,FLASHLED,FALSE);
d_flashled = 0;
}
if (d_logled == pdPASS)
{
vTaskDelete (logled);
dioWrite (0,LOGLED,FALSE);
d_logled = 0;
}
#else
if (d_batteryled == pdPASS)
{
vTaskDelete (batteryled);
dioWrite (0,BATTERYLED,FALSE);
d_batteryled = 0;
}
if (d_memoryled == pdPASS)
{
vTaskDelete (memoryled);
dioWrite (0,MEMORYLED,FALSE);
d_memoryled = 0;
}
#endif
if (d_mmcled == pdPASS)
{
vTaskDelete (mmcled);
dioWrite (0,MMCLED,FALSE);
d_mmcled = 0;
}
if (d_comled == pdPASS)
{
vTaskDelete (comled);
dioWrite (0,COMLED,FALSE);
d_comled = 0;
}
if (d_powerled == pdPASS)
{
vTaskDelete (powerled);
dioWrite (0,POWERLED,FALSE);
d_powerled = 0;
}
if (d_rtcled == pdPASS)
{
vTaskDelete (rtcled);
dioWrite (0,RTCLED,FALSE);
d_rtcled = 0;
}
}
void diotaskssuspend(void)
{
if (d_dioled == pdPASS) /* If defined Task exists */
{
vTaskSuspend (dioled); /* Suspend Task */
dioWrite (0,DIOLED,FALSE); /* Switch off corresponding DIO-LED */
}
if (d_ledtestled == pdPASS)
{
vTaskSuspend (ledtestled);
dioWrite (0,LEDTESTLED,FALSE);
}
if (d_aioled == pdPASS)
{
vTaskSuspend (aioled);
dioWrite (0,AIOLED,FALSE);
}
if (d_busled == pdPASS)
{
vTaskSuspend (busled);
dioWrite (0,BUSLED,FALSE);
}
#if (allMemoryUseSameLED == 0)
if (d_eepromled == pdPASS)
{
vTaskSuspend (eepromled);
dioWrite (0,EEPROMLED,FALSE);
}
if (d_flashled == pdPASS)
{
vTaskSuspend (flashled);
dioWrite (0,FLASHLED,FALSE);
}
if (d_logled == pdPASS)
{
vTaskSuspend (logled);
dioWrite (0,LOGLED,FALSE);
}
#else
if (d_batteryled == pdPASS)
{
vTaskSuspend (batteryled);
dioWrite (0,BATTERYLED,FALSE);
}
if (d_memoryled == pdPASS)
{
vTaskSuspend (memoryled);
dioWrite (0,MEMORYLED,FALSE);
}
#endif
if (d_mmcled == pdPASS)
{
vTaskSuspend (mmcled);
dioWrite (0,MMCLED,FALSE);
}
if (d_comled == pdPASS)
{
vTaskSuspend (comled);
dioWrite (0,COMLED,FALSE);
}
if (d_powerled == pdPASS)
{
vTaskSuspend (powerled);
dioWrite (0,POWERLED,FALSE);
}
if (d_rtcled == pdPASS)
{
vTaskSuspend (rtcled);
dioWrite (0,RTCLED,FALSE);
}
}
void diotasksresume(void)
{
if (d_batteryled == pdPASS) /* If defined Task exists */
{
vTaskResume(batteryled); /* Resume Task */
}
if (d_dioled == pdPASS)
{
vTaskResume(dioled);
}
if (d_ledtestled == pdPASS)
{
vTaskResume(ledtestled);
}
if (d_aioled == pdPASS)
{
vTaskResume(aioled);
}
if (d_busled == pdPASS)
{
vTaskResume(busled);
}
if (d_eepromled == pdPASS)
{
vTaskResume(eepromled);
}
if (d_flashled == pdPASS)
{
vTaskResume(flashled);
}
if (d_logled == pdPASS)
{
vTaskResume(logled);
}
if (d_memoryled == pdPASS)
{
vTaskResume (memoryled);
}
if (d_mmcled == pdPASS)
{
vTaskResume(mmcled);
}
if (d_comled == pdPASS)
{
vTaskResume(comled);
}
if (d_powerled == pdPASS)
{
vTaskResume(powerled);
}
if (d_rtcled == pdPASS)
{
vTaskResume(rtcled);
}
}
@@ -0,0 +1,177 @@
/* ---------------------------------------------------------------------------
* taskfunctions.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:
* Headerfile for taskfunctions.c
* ---------------------------------------------------------------------------
* Version(s): 0.1, Apr 09, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef TASKFUNCTIONS_H_
#define TASKFUNCTIONS_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "lpc23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define allMemoryUseSameLED 1
/* Allocation of digital Output LEDs to a single Test */
/* LED Setting correspond to if all memory Test should share the same LED */
#if (allMemoryUseSameLED == 0)
#define LEDTESTLED 0
#define EEPROMLED 1
#define FLASHLED 2
#define LOGLED 3
#define DIOLED 4
#define MMCLED 5
#define POWERLED 6
#define RTCLED 7
#define AIOLED 8
#define BUSLED 8
#define COMLED 8
#else
#define BATTERYLED 0
#define LEDTESTLED 1
#define MEMORYLED 2
#define DIOLED 3
#define AIOLED 4
#define MMCLED 5
#define POWERLED 6
#define RTCLED 7
#define BUSLED 8
#define COMLED 8
#endif
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* Taskhandler
* Last Argument called in xTaskCreate
* Needed to identify a Task
*/
xTaskHandle batteryled;
xTaskHandle gLED;
xTaskHandle ledtestled;
xTaskHandle dioled;
xTaskHandle aioled;
xTaskHandle busled;
xTaskHandle eepromled;
xTaskHandle flashled;
xTaskHandle logled;
xTaskHandle memoryled;
xTaskHandle mmcled;
xTaskHandle comled;
xTaskHandle powerled;
xTaskHandle rtcled;
xTaskHandle spinWheel;
/* BaseType
* Return of xTaskCreate
* Indicates wether a Function was created (=pdPASS) oder not (= 0)
*/
portBASE_TYPE d_batteryled;
portBASE_TYPE d_gLED;
portBASE_TYPE d_ledtestled;
portBASE_TYPE d_dioled;
portBASE_TYPE d_aioled;
portBASE_TYPE d_busled;
portBASE_TYPE d_eepromled;
portBASE_TYPE d_flashled;
portBASE_TYPE d_logled;
portBASE_TYPE d_memoryled;
portBASE_TYPE d_mmcled;
portBASE_TYPE d_comled;
portBASE_TYPE d_powerled;
portBASE_TYPE d_rtcled;
portBASE_TYPE d_spinWheel;
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function: taskInit
*
* Function to initialize TaskStatus Variables
*
* Parameter: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void taskInit (void);
/* ---------------------------------------------------------------------------
* Function: diotasksdelete
*
* Function to delete ALL existing Tasks flashing a DIO-LED
*
* Parameter: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void diotasksdelete(void);
/* ---------------------------------------------------------------------------
* Function: diotaskssuspend
*
* Function to suspend ALL existing Tasks flashing a DIO-LED
*
* Parameter: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void diotaskssuspend (void);
/* ---------------------------------------------------------------------------
* Function: diotasksresume
*
* Function to resume ALL existing and suspended Tasks flashing a DIO-LED
*
* Parameter: void
*
* Return: void
* ---------------------------------------------------------------------------
*/
void diotasksresume (void);
#endif /*TASKFUNCTIONS_H_*/