Commit 8fe2d919 authored by Peter Zumbruch's avatar Peter Zumbruch
Browse files

- added if statement around CAN switch structure

- added canState_UNKNOWN case
- added ATOMIC_BLOCK(ATOMIC_RESTORESTATE) into timer0AScheduler to learn about ATOMIC_BLOCK
- cleaned up some obsolete commented commands
- removed/changed Debug statements


git-svn-id: https://subversion.gsi.de/epics/trunk/hadcon/API-Slave@386 50339f28-a4cd-11e1-ab1f-8360dde1fe65
parent c182bad2
......@@ -269,8 +269,10 @@ int main( void )
}
// CANbus interface has received a message
printDebug_p(debugLevelPeriodicDebug, debugSystemCAN, __LINE__, PSTR(__FILE__), PSTR("CAN %s"), ( 1 == canReady ) ? "--yes" : "");
printDebug_p(debugLevelPeriodicDebug, debugSystemCAN, __LINE__, PSTR(__FILE__), PSTR("CAN %s"), ( canState_IDLE != canReady ) ? "--yes" : "");
if ( canState_IDLE != canReady)
{
switch (canReady)
{
case canState_IDLE:
......@@ -284,29 +286,30 @@ int main( void )
PSTR("interrupts disabled (cli)"));
canConvertCanFrameToUartFormat(ptr_canStruct);
canReady = canState_IDLE; /* restore flag */
printDebug_p(debugLevelEventDebug, debugSystemCAN, __LINE__, PSTR(__FILE__),
PSTR("CAN canReady %i received"), canReady);
// (re)enable interrupts
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("enabling interrupts (sei)"));
sei();
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("interrupts enabled (sei)"));
break;
case canState_MOB_ERROR:
case canState_GENERAL_ERROR:
case canState_UNKNOWN:
default:
/* can error detected */
// disable interrupts
cli();
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("interrupts disabled (cli)"));
printDebug_p(debugLevelEventDebug, debugSystemCAN, __LINE__, PSTR(__FILE__),
PSTR("CAN canReady %i received -> ErrorHandling"), canReady);
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("interrupts disabled (cli)"));
canErrorHandling(canReady);
......@@ -319,21 +322,18 @@ int main( void )
PSTR("CAN canReady %i reset to %i"), canReady, canState_IDLE);
// (re)enable interrupts
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("enabling interrupts (sei)"));
sei();
printDebug_p(debugLevelEventDebugVerbose, debugSystemMain, __LINE__, PSTR(__FILE__),
PSTR("interrupts enabled (sei)"));
break;
}
}
// timer 0 set by ISR
printDebug_p(debugLevelPeriodicDebug, debugSystemTIMER0, __LINE__, PSTR(__FILE__), PSTR("timer 0%s"), ( 1 == timer0Ready ) ? "--yes" : "");
if ( 1 == timer0Ready )
{
cli();
/* canGetGeneralStatusError(); */
timer0Ready = 0;
sei();
}
......@@ -361,7 +361,6 @@ int main( void )
if ( 1 == timer0AReady )
{
cli();
/* canGetMObError(); */
timer0AReady = 0; /* restore flag */
sei();
}
......@@ -371,14 +370,14 @@ int main( void )
if(1 == timer0ASchedulerReady )
{
// ATOMIC_BLOCK()
cli();
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
if (0 != owiTemperatureConversionGoingOnCountDown)
{
owiTemperatureConversionGoingOnCountDown--;
}
timer0ASchedulerReady = 0; /* restore flag */
sei();
}
}
/*relay block*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment