00001 /*This file has been prepared for Doxygen automatic documentation generation.*/ 00019 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00020 * 00021 * Redistribution and use in source and binary forms, with or without 00022 * modification, are permitted provided that the following conditions are met: 00023 * 00024 * 1. Redistributions of source code must retain the above copyright notice, this 00025 * list of conditions and the following disclaimer. 00026 * 00027 * 2. Redistributions in binary form must reproduce the above copyright notice, 00028 * this list of conditions and the following disclaimer in the documentation 00029 * and/or other materials provided with the distribution. 00030 * 00031 * 3. The name of Atmel may not be used to endorse or promote products derived 00032 * from this software without specific prior written permission. 00033 * 00034 * 4. This software may only be redistributed and used in connection with an Atmel 00035 * AVR product. 00036 * 00037 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00038 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00039 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00040 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00041 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00042 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00043 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00045 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00046 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00047 * 00048 */ 00049 00050 #ifndef __DATALOG_H__ 00051 #define __DATALOG_H__ 00052 00053 #include <time.h> 00054 00055 #include "FreeRTOS.h" 00056 00057 #include "supervisor.h" 00058 00059 00060 //_____ M A C R O S ________________________________________________________ 00061 00063 #define DATALOG_LOG_MAXSIZE 64 00064 00066 #define DATALOG_ALLOC_DYNAMIC TRUE 00067 #define DATALOG_ALLOC_STATIC FALSE 00068 00072 typedef enum 00073 { 00074 DATALOG_ID_TEMP, // The temperature sensor. 00075 DATALOG_ID_POT, // The potentiometer sensor. 00076 DATALOG_ID_LIGHT, // The light sensor. 00077 DATALOG_ID_PB1, // The pushbutton1 sensor. 00078 DATALOG_ID_PB2, // The pushbutton2 sensor. 00079 DATALOG_ID_PB3, // The pushbutton3 sensor. 00080 DATALOG_ID_JS, // The joystick sensor. 00081 DATALOG_ID_LEDB1, // The bicolor led 1 actuator. 00082 DATALOG_ID_LEDB2, // The bicolor led 2 actuator. 00083 DATALOG_ID_LEDM1, // The monocolor led 1 actuator. 00084 DATALOG_ID_LEDM2, // The monocolor led 2 actuator. 00085 DATALOG_ID_LCD, // The LCD actuator. 00086 } eLogSourceId; 00087 00088 //_____ D E F I N I T I O N S ______________________________________________ 00089 00091 typedef struct LogDef { 00092 int id; // Id of the sensor or actuator that produced the log. 00093 time_t rawdate; // Raw date value the log was produced. 00094 char *pcStringLog; // Const or allocated. Content is "{value,event}[|alarm]\r\n" 00095 void (*pfFreeStringLog)( void *pcStr ); // Fct ptr to call to free the memory 00096 // used by the pcStringLog field. 00097 void (*pfFreeLogStruct)( void *pxLog ); // Fct ptr to call to free the memory 00098 // used by the current LogDef structure. 00099 }xLogDef; 00100 00102 extern char *acLogSourceName[]; 00103 00104 00105 //_____ D E C L A R A T I O N S ____________________________________________ 00106 00107 #if configCTRLPANEL_TRACE == 1 00108 00111 void v_datalog_trace( void ); 00112 #endif 00113 00121 Bool bdatalog_start( unsigned portBASE_TYPE uxPriority ); 00122 00123 00131 xLogDef *pxdatalog_log_alloc_init( Bool bAllocType ); 00132 00138 #define pxdatalog_log_alloc_init_FromISR() pxdatalog_log_alloc_init( DATALOG_ALLOC_STATIC ) 00139 00140 00147 void vdatalog_log_free( xLogDef *pxLog ); 00148 00149 00157 void vdatalog_make_logstring( xLogDef *pxLog, signed portCHAR *pcLogString ); 00158 00167 portBASE_TYPE x_datalog_AddLogFromISR( xLogDef *pxLog ); 00168 00169 00175 Bool b_datalog_set_current_log_drive_toDF( void ); 00176 00177 00183 Bool b_datalog_set_current_log_drive_toSDMMC( void ); 00184 00185 #endif