Commit 78202939 authored by Peter Zumbruch's avatar Peter Zumbruch
Browse files

- removed obsolete error code arrays

	- replaced by rule errorType * 100 + errorIndex

- refactored xxx_errorCode to xxxErrorCode

- xxx_init flags:
	- moved from main.c to api.c
	- changed to uint16_t
	

- cosmetics	

git-svn-id: https://subversion.gsi.de/epics/trunk/hadcon/API-Slave@402 50339f28-a4cd-11e1-ab1f-8360dde1fe65
parent d1d99f29
......@@ -61,7 +61,7 @@ void disableJTAG(uint8_t disable)
*the upper four ADC channels (used for JTAG, too)
*/
#ifndef ALLOW_DISABLE_JTAG
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("disabling JTAG not ALLOWED"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("disabling JTAG not ALLOWED"));
#else
disableJTAG_flag = (FALSE != disable);
......@@ -179,7 +179,7 @@ void modifyJTAG(struct uartStruct *ptr_uartStruct)
}
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
return;
......
......@@ -140,21 +140,14 @@ char message[BUFFER_SIZE];
char resultString[BUFFER_SIZE];
unsigned char nextCharPos; /*pointer of the variable uartString */
uint8_t canErrorCode = 0; /* error code for CAN-communication */
uint8_t twi_errorCode = 0; /* error code for I2C/TWI-communication */
uint8_t uart_errorCode = 0; /* error code for UART-communication */
uint8_t mailbox_errorCode = 0; /* error code for Message Object Block */
uint8_t general_errorCode = 0; /* general error code */
uint16_t canErrorCode = 0; /* error code for CAN-communication */
uint16_t twiErrorCode = 0; /* error code for I2C/TWI-communication */
uint16_t uartErrorCode = 0; /* error code for UART-communication */
uint16_t mobErrorCode = 0; /* error code for Message Object Block */
uint16_t generalErrorCode = 0; /* general error code */
uint8_t ptr_subscribe = 0;/* pointer of variable subscribe_ID and subscribe_mask */
uint8_t canMob; /*variable for Message Object Block in the interrupt routine*/
int8_t uart0_init = 0; /* return variable of UART0_Init function*/
int8_t can_init = 0; /* return variable of canInit function*/
int8_t twim_init = 0; /* return variable of TWIM_Init function*/
int8_t owi_init = 0; /* return variable of OWI_Init function*/
int8_t timer0_init = 0; /* return variable of Timer0_Init function*/
int8_t timer0A_init = 0;/* return variable of Timer0A_Init function*/
uint8_t *ptr_buffer_in = NULL; /*pointer to write CAN data in buffer_ring*/
uint8_t *ptr_buffer_out = NULL; /*pointer to read CAN data in buffer_ring*/
uint8_t flag_pingActive = 0; /*automatic ping action disabled*/
......
......@@ -185,7 +185,7 @@ int8_t owiReadDevicesID( uint8_t *pins )
if ( 0 == countDEV )
{
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, TRUE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, TRUE, NULL);
}
......@@ -286,7 +286,7 @@ int8_t owiShowDevicesID( struct uartStruct* ptr_myuartStruct)
// found any matching device??
if ( 0 == countFoundFamilyCode && 0 != familyCode )
{
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_family_code_not_found, TRUE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_family_code_not_found, TRUE, NULL);
}//end of if ( 0 == countFoundFamilyCode && 0 != familyCode )
return countFoundFamilyCode;
......@@ -358,7 +358,7 @@ int8_t owiFindFamilyDevicesAndAccessValues( uint8_t *pins, uint8_t countDev, uin
if ( 0 == countDev )
{
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, FALSE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, FALSE, NULL);
return 0;
}
......@@ -486,7 +486,7 @@ int8_t owiFindFamilyDevicesAndAccessValues( uint8_t *pins, uint8_t countDev, uin
snprintf(message, BUFFER_SIZE - 1, "%s %.2X", owi_id_string, readValueSS);
break;
default:
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_undefined_family_code, FALSE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_undefined_family_code, FALSE, NULL);
continue;
break;
}
......@@ -536,7 +536,7 @@ int8_t owiFindFamilyDevicesAndAccessValues( uint8_t *pins, uint8_t countDev, uin
// snprintf(message, BUFFER_SIZE - 1, "%s %.2X", owi_id_string, readValueSS);
break;
default:
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_undefined_family_code, FALSE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_undefined_family_code, FALSE, NULL);
continue;
break;
}
......
......@@ -173,12 +173,12 @@ void owiTemperatureReadSensors( struct uartStruct *ptr_uartStruct, uint8_t conve
if ( TRUE == ptr_owiStruct->idSelect_flag && 0 == foundDevices)
{
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no matching ID was found"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no matching ID was found"));
}
}
else
{
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
}
}
......@@ -234,7 +234,7 @@ uint16_t owiTemperatureGetNumberOfDevicesAndSetTemperatureMask(struct uartStruct
NumDevicesFound = owiReadDevicesID(BUSES);
if ( 0 == NumDevicesFound )
{
general_errorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, FALSE, NULL);
generalErrorCode = CommunicationError_p(ERRG, GENERAL_ERROR_no_device_is_connected_to_the_bus, FALSE, NULL);
tempDevices = 0;
}
else
......@@ -301,7 +301,7 @@ void owiTemperatureMiscSubCommandGetSetFlag(struct uartStruct *ptr_uartStruct, u
ptr_uartStruct->number_of_arguments=2;
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
}
......@@ -341,7 +341,7 @@ void owiTemperatureMiscSubCommandGetSetStepByStepParasiticConversion(struct uart
ptr_uartStruct->number_of_arguments=2;
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
}
......@@ -382,7 +382,7 @@ void owiTemperatureMiscSubCommandGetSetForceParasiticMode(struct uartStruct *ptr
ptr_uartStruct->number_of_arguments=2;
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
}
......@@ -412,7 +412,7 @@ void owiTemperatureMiscSubCommandGetSetMaxConversionTime(struct uartStruct *ptr_
ptr_uartStruct->number_of_arguments=2;
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
}
......@@ -446,7 +446,7 @@ void owiTemperatureMiscSubCommandGetSetResolution_DS18B20(struct uartStruct *ptr
owiTemperatureResolution_DS18B20 = value;
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("%s value '%i' out of range [9,..,12]"), value);
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("%s value '%i' out of range [9,..,12]"), value);
return;
break;
}
......@@ -458,7 +458,7 @@ void owiTemperatureMiscSubCommandGetSetResolution_DS18B20(struct uartStruct *ptr
}
break;
default:
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("invalid number of arguments"));
break;
}
}
......@@ -483,7 +483,7 @@ void owiTemperatureMiscSubCommandConvertOnly(struct uartStruct *ptr_uartStruct)
}
else
{
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
}
break;
case 1:
......@@ -505,7 +505,7 @@ void owiTemperatureMiscSubCommandConvertOnly(struct uartStruct *ptr_uartStruct)
}
else
{
general_errorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
generalErrorCode = CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("no supported 1-wire temperature device present"));
}
break;
default:
......
Markdown is supported
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