/* --------------------------------------------------------------------------- * remote_digital.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, Nov 11, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ #ifndef DIGITAL_TEST_H_ #define DIGITAL_TEST_H_ /* --------------------------------------------------------------------------- * System include files. * --------------------------------------------------------------------------- */ #include "LPC23xx.h" #include "types.h" /* --------------------------------------------------------------------------- * Application include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Constant and macro definitions. * --------------------------------------------------------------------------- */ #define NUMBER_OF_DI_MB 8 #define NUMBER_OF_DO_MB 8 #define NUMBER_OF_DI_EB 4 #define NUMBER_OF_DO_EB 4 #define NUMBER_OF_TOTAL_DI (NUMBER_OF_DI_MB + NUMBER_OF_DI_EB) #define NUMBER_OF_TOTAL_DO (NUMBER_OF_DO_MB + NUMBER_OF_DO_EB) /* --------------------------------------------------------------------------- * Type definitions. * --------------------------------------------------------------------------- */ typedef enum { digital_mb = 0, digital_eb = 1 } t_boardtype_digital; /* --------------------------------------------------------------------------- * Variable declarations. * --------------------------------------------------------------------------- */ BOOLEAN remoteDigitalInputs[(NUMBER_OF_TOTAL_DI)]; BOOLEAN remoteDigitalOutputs[(NUMBER_OF_TOTAL_DO)]; xSemaphoreHandle remoteDigitalSemaphore; /* Prototype of digital Semaphore*/ /* --------------------------------------------------------------------------- * Function declarations. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Function: remoteDioInit * * Initialisation of the digital remote driver, creates and takes digital * Semaphore. * * Parameters: void * * Return: void * --------------------------------------------------------------------------- */ void remoteDioInit (void); /* --------------------------------------------------------------------------- * Function: remoteDioWrite * * Sets or cleans a digital output on the remote device * * Parameters: UINT8 device - Number of the remote device * UINT8 channel - Number of the effected remote channel * BOOLEAN value - Value to be written * * Return: RESULT - Indicates the status of the write action * --------------------------------------------------------------------------- */ RESULT remoteDioWrite (UINT8 device, UINT8 channel, BOOLEAN value); /* --------------------------------------------------------------------------- * Function: remoteDioWriteAll * * Sets or cleans all digital outputs of a kind on the remote device * * Parameters: UINT8 device - Number of the remote device * t_boardtype_digital board - Type of board (MB or EB) * BOOLEAN value - Value to be written * * Return: RESULT - Indicates the status of the write action * --------------------------------------------------------------------------- */ RESULT remoteDioWriteAll (UINT8 device, t_boardtype_digital board, BOOLEAN value); /* --------------------------------------------------------------------------- * Function: remoteDioRead * * reads from one remote digital input. If the result fails, the previous * generated result will be returned. * * Parameters: UINT8 device - Number of the remote device * UINT8 channel - Number of the effected remote channel * * Return: BOOLEAN - The read result * --------------------------------------------------------------------------- */ BOOLEAN remoteDioRead (UINT8 device, INT32 channel); /* --------------------------------------------------------------------------- * Function: remoteDioReadAll * * reads from all remote digital inputs. If the result fails, nothing happens * * Parameters: UINT8 device - Number of the remote device * t_boardtype_digital board - Type of board (MB or EB) * * Return: void * --------------------------------------------------------------------------- */ void remoteDioReadAll (UINT8 device, t_boardtype_digital board); /* --------------------------------------------------------------------------- * Function: remoteDigitalSemaphoreRelease * * Is called as a result from the remote device to release the digital * Semaphore. This call is the last statement within the remote procedure. * It assures that the complete function is executed before the local * software resumes working. * * Parameters: UINT8 requestNr - Number of the momentary request * UINT8 nrOfResults - Indicates how many values are returned * UINT32 *results - Result-Array of "NrOfResults"-size * * Return: void * --------------------------------------------------------------------------- */ void remoteDigitalSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); /* --------------------------------------------------------------------------- * Function: digitalReadResult * * Is called as a result from the remote device to transfer the read value. * digitalReadResult stores the received value to a global variable. * * Parameters: UINT8 requestNr - Number of the momentary request * UINT8 nrOfResults - Indicates how many values are returned * UINT32 *results - Result-Array of "NrOfResults"-size * * Return: void * --------------------------------------------------------------------------- */ void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); /* --------------------------------------------------------------------------- * Function: digitalReadAllResult * * Is called as a result from the remote device to transfer the read value. * digitalReadResult stores the received value to a global array. * * Parameters: UINT8 requestNr - Number of the momentary request * UINT8 nrOfResults - Indicates how many values are returned * UINT32 *results - Result-Array of "NrOfResults"-size * * Return: void * --------------------------------------------------------------------------- */ void digitalReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); #endif /*DIGITAL_TEST_H_*/