Fixed issues with the logger and brought logger to same structure as the rest - now the logger is a independent object
Added testItems to HwValidationMenu for SWo git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@235 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -1,125 +0,0 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file Logger.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file Logger.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef _LOGGER_H_
|
||||
#define _LOGGER_H_
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "IODevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Logs an error
|
||||
* \memberof Logger
|
||||
*/
|
||||
#define LOGGER_ERROR(...) \
|
||||
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_WARNING(...) \
|
||||
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_INFO(...) \
|
||||
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_DEBUG(...) \
|
||||
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_PRINT(...) \
|
||||
Logger_log("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_ERROR_ISR(...) \
|
||||
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_WARNING_ISR(...) \
|
||||
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_INFO_ISR(...) \
|
||||
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_DEBUG_ISR(...) \
|
||||
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
|
||||
|
||||
#define LOGGER_PRINT_ISR(...) \
|
||||
Logger_logISR("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOGTYPE_PRINT, /**< Raw print */
|
||||
LOGTYPE_DEBUG, /**< Debug information only; will not be stored on SD-card */
|
||||
LOGTYPE_INFO, /**< Informational messages of important events */
|
||||
LOGTYPE_WARNING, /**< Recoverable fault */
|
||||
LOGTYPE_ERROR /**< Unrecoverable fault */
|
||||
} LogType;
|
||||
|
||||
|
||||
struct LogQueueItem
|
||||
{
|
||||
char fileName[32];
|
||||
char functionName[32];
|
||||
char context[128];
|
||||
int lineNumber;
|
||||
LogType logType;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus Logger_construct(struct IODevice* const device);
|
||||
void Logger_terminate(void);
|
||||
|
||||
void Logger_logISR(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* context);
|
||||
ErrorStatus Logger_addCommandHandlers(void);
|
||||
extern ErrorStatus Logger_logModuleInfo(void);
|
||||
|
||||
/**
|
||||
* Logs a string.
|
||||
* Use the Logging macros instead
|
||||
* \memberof Logger
|
||||
* \private
|
||||
* \param fileName File name to be logged
|
||||
* \param functionName Function name to be logged
|
||||
* \param lineNumber Line number to be logged
|
||||
* \param logType Type of logging
|
||||
* \param format printf-type formatting string
|
||||
* \param ... Variable arguments according to the formatting string
|
||||
*/
|
||||
void Logger_log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...) __attribute__((format(printf, 5, 6)));
|
||||
|
||||
#endif
|
||||
@@ -59,6 +59,25 @@ struct HwValidationMenu
|
||||
bool runTask;
|
||||
};
|
||||
|
||||
|
||||
struct HwValidationMenuItems
|
||||
{
|
||||
struct DisplayDevice* display; // DisplayDevice to talk to
|
||||
struct Adc* internalADC; // Internal ADC with channel array
|
||||
struct MAX5715* externalDAC; // External DAC with channel array
|
||||
struct Gpio* interlock1;
|
||||
struct Gpio* interlock2;
|
||||
struct Gpio* solenoid;
|
||||
struct Gpio* mcp0Relay;
|
||||
struct Gpio* mcp1Relay;
|
||||
struct Gpio* mcp2Relay;
|
||||
struct Gpio* cat0Relay;
|
||||
struct Gpio* cat0Relay;
|
||||
struct Gpio* cat0Relay;
|
||||
struct Pcba* pcba;
|
||||
// struct Eeprom* eeprom; // Not implemented yet
|
||||
|
||||
};
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -66,16 +85,19 @@ struct HwValidationMenu
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* HwValidationMenu_construct
|
||||
* Description of function
|
||||
* Constructor for HW validation menu (usually used on a terminal)
|
||||
*
|
||||
* @param self
|
||||
* @param ioDevice
|
||||
* @return ErrorStatus
|
||||
* @param self The validation menu object
|
||||
* @param ioDevice IODevice to communicate with
|
||||
* @param testItems list of items to test
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus HwValidationMenu_construct(struct HwValidationMenu* self, struct IODevice* ioDevice);
|
||||
extern ErrorStatus HwValidationMenu_construct(struct HwValidationMenu* self, struct IODevice* ioDevice, struct HwValidationMenuItems testItems);
|
||||
|
||||
|
||||
#endif /* INC_HWVALIDATIONMENU_H_ */
|
||||
|
||||
Reference in New Issue
Block a user