/* --------------------------------------------------------------------------- * remote_analogue.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 15, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ #ifndef REMOTE_ANALOGUE_H_ #define REMOTE_ANALOGUE_H_ /* --------------------------------------------------------------------------- * System include files. * --------------------------------------------------------------------------- */ #include "LPC23xx.h" #include "types.h" /* --------------------------------------------------------------------------- * Application include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Constant and macro definitions. * --------------------------------------------------------------------------- */ #define NUMBER_OF_AI_MB 8 #define NUMBER_OF_AO_MB 8 #define NUMBER_OF_AI_EB 4 #define NUMBER_OF_AO_EB 4 #define NUMBER_OF_TOTAL_AI (NUMBER_OF_AI_MB + NUMBER_OF_AI_EB) #define NUMBER_OF_TOTAL_AO (NUMBER_OF_AO_MB + NUMBER_OF_AO_EB) /* --------------------------------------------------------------------------- * Type definitions. * --------------------------------------------------------------------------- */ typedef enum { analogue_mb = 0, analogue_eb = 1 } t_boardtype_analogue; /* --------------------------------------------------------------------------- * Variable declarations. * --------------------------------------------------------------------------- */ INT32 remoteAnalogueInputs[(NUMBER_OF_TOTAL_AI)]; INT32 remoteAnalogueOutputs[(NUMBER_OF_TOTAL_AO)]; xSemaphoreHandle remoteAnalogueSemaphore; /* --------------------------------------------------------------------------- * Function declarations. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Function: remoteAioInit * * Initialisation of the remote analogue driver; takes the analogue semaphore * * Parameter: void * * Return: void * --------------------------------------------------------------------------- */ void remoteAioInit (void); /* --------------------------------------------------------------------------- * Function: remoteAioWrite * * Writes to one remote analogue output * * Parameter: UINT8 device - Number of the device to write one UINT8 channel - Channelnumber that should be affected INT32 value - Value that should be written * * Return: RESULT - Write result * --------------------------------------------------------------------------- */ RESULT remoteAioWrite (UINT8 device, UINT8 channel, INT32 value); /* --------------------------------------------------------------------------- * Function: remoteAioWriteAll * * Writes to all remote analogue outputs * * Parameter: UINT8 device - Number of the device to write on t_boardtype_analogue board - type of board (MB or EB) INT32 value - Value that should be written * * Return: RESULT - Write result * --------------------------------------------------------------------------- */ RESULT remoteAioWriteAll (UINT8 device, t_boardtype_analogue board, BOOLEAN value); /* --------------------------------------------------------------------------- * Function: remoteAioread * * Reads on one remote analogue outputs * * Parameter: UINT8 device - Number of the device to write on UINT8 channel - Number of affected channel * * Return: UINT32 - Read value * --------------------------------------------------------------------------- */ UINT32 remoteAioRead (UINT8 device, UINT8 channel); /* --------------------------------------------------------------------------- * Function: remoteAioread * * Reads on one remote analogue outputs * * Parameter: UINT8 device - Number of the device to write on t_boardtype_analogue board - type of board (MB or EB) * * Return: void * --------------------------------------------------------------------------- */ void remoteAioReadAll (UINT8 device, t_boardtype_analogue board); /* --------------------------------------------------------------------------- * Function: remoteAnalogueSemaphoreRelease * * Is called as a result from the remote device to release the analogue * 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 remoteAnalogueSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); /* --------------------------------------------------------------------------- * Function: analogueReadResult * * Is called as result function; receives the remotely read value * * 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 analogueReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); /* --------------------------------------------------------------------------- * Function: analogueReadAllResult * * Is called as result function; receives the remotely read values * * 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 analogueReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results); #endif /*REMOTE_ANALOGUE_H_*/