error.h

00001 /*
00002   @file error.h 
00003   Header file for the error handling module
00004   
00005   Nicolas Williamson - Summer 2009
00006   
00007 */
00008 
00009 #ifndef __ROBOT_ERROR_H__
00010 #define __ROBOT_ERROR_H__
00011 
00013 #define ERR_BUF_SIZE 32
00014 
00019 typedef enum error_priorities {
00020   PRIORITY_LOW = 0, 
00021   PRIORITY_MED = 1, 
00022   PRIORITY_HIGH = 2, 
00023   PRIORITY_DEBUG = 3,
00024   PRIORITY_MAX
00025 //  PRIORITY_FATAL = 3 //Ranger poses immediate danger to surrounding humans
00026 } ERROR_PRIORITY;
00027 
00032 typedef struct error_info {
00033   ERROR_ID error_id; 
00034   unsigned short frequency; 
00035   unsigned long long int time_occurred; 
00036 } ERROR_INFO;
00037 
00045 typedef struct error_buffer{
00046   ERROR_INFO errors[ERR_BUF_SIZE]; 
00047   unsigned char first; 
00048   unsigned char next; 
00049   unsigned char overflows; 
00050   unsigned char empty; 
00051 } ERROR_BUFFER; 
00052 
00053 
00054 //Initialization
00055 void error_init(VOID_VOID_F f_transmit, INT_VOID_F f_time, BOARD_ID board_id);
00056 //Errors
00057 void error_occurred(ERROR_ID error_code);
00058 void error_occurred_irq(ERROR_ID error_code);
00059 void error_occurred_fiq(ERROR_ID error_code);
00060 void error_update(void);
00061 //Transmit
00062 void error_send_next(void);
00063 int error_get_time(void);
00064 int error_get_info(void);
00065 int error_get_frequency(void);
00066 ERROR_ID error_get_id(void);
00067 BOARD_ID error_get_board(void);
00068 //Ring Buffers - Private
00069 static void error_push(volatile ERROR_BUFFER* buffer, volatile ERROR_INFO new_error);
00070 static volatile ERROR_INFO* error_pop(volatile ERROR_BUFFER* buffer);
00071 
00072 
00073 #endif //__ROBOT_ERROR_H__
00074 
Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3