Added Altium Project files

git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@131 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
Matthias
2009-01-15 10:28:29 +00:00
parent e92b94654b
commit f468e09499
66 changed files with 3619 additions and 60 deletions
@@ -49,6 +49,7 @@
* ---------------------------------------------------------------------------
*/
BOOLEAN remoteDigitalInitialised = FALSE;
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
@@ -72,6 +73,8 @@ void remoteDioInit (void)
NewLine, "Initialise digital remote buffers", Dummy);
sendString (SerOutPort, FALSE, importantMessage,
"\tInputs...", Dummy, Dummy);
/* reset stat array of remote digital inputs */
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_DI; loopcnt++)
{
remoteDigitalInputs[loopcnt] = FALSE;
@@ -81,6 +84,8 @@ void remoteDioInit (void)
sendString (SerOutPort, FALSE, importantMessage,
"\tOutputs...", Dummy, Dummy);
/* Reset stat array of remote digital outputs */
for (loopcnt = 0; loopcnt < NUMBER_OF_TOTAL_DO; loopcnt++)
{
remoteDigitalOutputs[loopcnt] = FALSE;
@@ -88,10 +93,11 @@ void remoteDioInit (void)
sendString (SerOutPort, FALSE, importantMessage,
"Done", Dummy, Dummy);
/* Create and afterwards take the remote_digital semaphore */
vSemaphoreCreateBinary (remoteDigitalSemaphore);
sendString (SerOutPort, TRUE, importantMessage,
"Take digital semaphore... ", Dummy, Dummy);
/* Print out if semaphore-taking was successful */
if (xSemaphoreTake(remoteDigitalSemaphore, 0) == pdTRUE)
{
sendString (SerOutPort, FALSE, importantMessage,
@@ -103,12 +109,13 @@ void remoteDioInit (void)
"Failed", Dummy, Dummy);
}
/* Set all mainboard and extensionboard outputs to LOW */
sendString(SerOutPort, TRUE, importantMessage,
"reset remote digital outputs...", Dummy, Dummy);
set_mb = remoteDioWriteAll (remoteDeviceNumber, digital_mb, FALSE);
set_eb = remoteDioWriteAll (remoteDeviceNumber, digital_eb, FALSE);
/* Print out if setting of remote outputs was successful */
if ((set_mb == OK) && (set_eb == OK))
{
sendString(SerOutPort, FALSE, importantMessage, "Done", Dummy, Dummy);
@@ -131,27 +138,32 @@ RESULT remoteDioWrite (UINT8 device, UINT8 channel, BOOLEAN value)
/* Remote digital driver is not initialised */
sendString (SerOutPort, TRUE, importantMessage,
"\t\tdigital not intialised", Dummy, Dummy);
return (ERROR);
return (ERROR); /* Return error result */
}
/* Copy channelnumber and value to array that will be sent */
sendArray[0] = (INT32) channel;
sendArray[1] = (INT32) value;
/* Call DigitalWrite on remote device */
bpSendCallRpc(handleBus1, device, 20, 2, sendArray);
/* Take digital Semaphore with predefined timeout */
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
{
sendString (SerOutPort, TRUE, importantMessage,
s_tab, "digital write was not successful", Dummy);
returnValue = ERROR;
}
else
{
remoteDigitalOutputs[channel] = value;
returnValue = OK;
}
{
/* Semaphore was able to be taken, return error result */
sendString (SerOutPort, TRUE, importantMessage,
s_tab, "digital write was not successful", Dummy);
returnValue = ERROR;
}
else
{
/* Semaphore was taken successfully, return OK result */
remoteDigitalOutputs[channel] = value;
returnValue = OK;
}
return (returnValue);
}
@@ -165,6 +177,7 @@ RESULT remoteDioWriteAll(UINT8 device, t_boardtype_digital board, BOOLEAN value)
RESULT returnValue;
if (remoteDigitalInitialised == FALSE)
{
/* Remote digital driver is not initialised */
@@ -173,13 +186,17 @@ RESULT remoteDioWriteAll(UINT8 device, t_boardtype_digital board, BOOLEAN value)
return (ERROR);
}
/* Copy boardtype and value to array that will be sent */
sendArray[0] = (INT32)board;
sendArray[1] = (INT32)value;
/* Call DigitalWriteAll on remote device */
bpSendCallRpc(handleBus1, device, 21, 2, sendArray);
/* Take digital Semaphore with predefined timeout */
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
{
/* Semaphore was able to be taken, return error result */
sendString(SerOutPort, TRUE, importantMessage, s_tab,
"digital write was not successful", Dummy);
@@ -187,30 +204,34 @@ RESULT remoteDioWriteAll(UINT8 device, t_boardtype_digital board, BOOLEAN value)
}
else
{
/* Semaphore was taken successfully */
/* Switch depending on the board type */
switch (board)
{
case digital_mb:
/* Set loop values for mainboard */
loopcnt = 0;
loopend = NUMBER_OF_DO_MB;
break;
case digital_eb:
/* Set loop values for extensionboard */
loopcnt = NUMBER_OF_DO_MB;
loopend = NUMBER_OF_TOTAL_DO;
break;
}
/* Write all values in local stat array to given value in a loop */
for (loopcnt; loopcnt < loopend; loopcnt++)
{
remoteDigitalOutputs[loopcnt] = value;
// \TODO IS THIS LOOP WORKING??
}
returnValue = OK;
returnValue = OK; /* Set result to OK */
}
return (returnValue);
return (returnValue); /* Return result */
}
@@ -229,19 +250,27 @@ BOOLEAN remoteDioRead (UINT8 device, INT32 channel)
return (ERROR);
}
/* Call DigitalRead on remote device */
bpSendCallRpc(handleBus1, device, 22, 1, channelArray);
/* Take digital Semaphore with predefined timeout */
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
{
/* Semaphore was able to be takenprint out error message */
sendString (SerOutPort, TRUE, importantMessage,
s_tab, "digital read did not receive a readback", Dummy);
}
else
{
/* The actual value is received in the resultfunction
* "digitalReadResult" (see below in this file). This function
* handles the received value to the global variable
* "remoteDioReadresult", which is read below
*/
remoteDigitalInputs[channel] = remoteDioReadResult;
}
return (remoteDioReadResult);
return (remoteDioReadResult); /* Return result */
}
@@ -259,9 +288,13 @@ void remoteDioReadAll (UINT8 device, t_boardtype_digital board)
return;
}
/* Call DigitalReadAll on remote device */
bpSendCallRpc(handleBus1, device, 23, 1, boardArray);
/* Take digital Semaphore with predefined timeout */
if (xSemaphoreTake(remoteDigitalSemaphore, 3000) != pdTRUE)
{
/* Semaphore was able to be takenprint out error message */
sendString (SerOutPort, TRUE, importantMessage,
s_tab, "digital read all did not receive a readback", Dummy);
}
@@ -276,18 +309,18 @@ void remoteDioReadAll (UINT8 device, t_boardtype_digital board)
void remoteDigitalSemaphoreRelease (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
if (remoteDigitalInitialised == FALSE)
{
/* Remote digital driver is not initialised */
/* Remote digital driver is not initialised, semaphore unaccessible */
sendString (SerOutPort, TRUE, importantMessage,
"\t\tdigital not intialised", Dummy, Dummy);
return;
return; /* Return without action */
}
xSemaphoreGive (remoteDigitalSemaphore);
xSemaphoreGive (remoteDigitalSemaphore); /* Release digital Semaphore */
}
void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
{
@@ -296,7 +329,7 @@ void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
/* Remote digital driver is not initialised */
sendString (SerOutPort, TRUE, importantMessage,
"\t\tdigital not intialised", Dummy, Dummy);
return;
return; /* Return without action */
}
/* nrOfResults = 2
@@ -312,7 +345,7 @@ void digitalReadResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
/* Remote digital input is HIGH */
remoteDioReadResult = TRUE;
}
xSemaphoreGive (remoteDigitalSemaphore);
xSemaphoreGive (remoteDigitalSemaphore); /* Release digital Semaphore */
}
@@ -342,13 +375,16 @@ void digitalReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
/* Incoming Results are from Mainboard */
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_MB; loopcnt++)
{
/* Write incoming result to channel bit */
tempValue = (results[1] & (0x0000 | (1 << loopcnt)));
if (tempValue == 0)
{
/* Received result is a LOW value - write to stat array */
remoteDigitalInputs[loopcnt] = FALSE;
}
else
{
/* Received result is a HIGH value - write to stat array */
remoteDigitalInputs[loopcnt] = TRUE;
}
}
@@ -359,18 +395,21 @@ void digitalReadAllResult (UINT8 requestNr, UINT8 nrOfResults, UINT32 *results)
/* Incoming Results are from Extensionboard */
for (loopcnt = 0; loopcnt < NUMBER_OF_DI_EB; loopcnt++)
{
/* Write incoming result to channel bit */
tempValue = (results[1] & (0x0000 | (1 << loopcnt)));
if (tempValue == 0)
{
/* Received result is a LOW value - write to stat array */
remoteDigitalInputs[(loopcnt + NUMBER_OF_DI_MB)] = FALSE;
}
else
{
/* Received result is a HIGH value - write to stat array */
remoteDigitalInputs[(loopcnt + NUMBER_OF_DI_MB)] = TRUE;
}
}
}
xSemaphoreGive (remoteDigitalSemaphore);
xSemaphoreGive (remoteDigitalSemaphore); /* Release digital Semaphore */
}