diff --git a/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c b/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c index 401f611..9377bb8 100644 --- a/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c +++ b/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c @@ -47,10 +47,13 @@ ElogErrCode elog_port_init(void) { /** * output log port interface + * + * @param log output of log + * @param size log size */ -void elog_port_output(const char *output, size_t size) { +void elog_port_output(const char *log, size_t size) { /* output to terminal */ - rt_kprintf("%.*s", size, output); + rt_kprintf("%.*s", size, log); //TODO output to flash } diff --git a/easylogger/inc/elog.h b/easylogger/inc/elog.h index 038e594..4e9a2a9 100644 --- a/easylogger/inc/elog.h +++ b/easylogger/inc/elog.h @@ -64,7 +64,7 @@ enum { /* output newline sign */ #define ELOG_NEWLINE_SIGN "\r\n" /* EasyLogger software version number */ -#define ELOG_SW_VERSION "0.07.25" +#define ELOG_SW_VERSION "0.07.28" /* EasyLogger assert for developer. */ #define ELOG_ASSERT(EXPR) \ @@ -195,7 +195,7 @@ size_t elog_strcpy(size_t cur_len, char *dst, const char *src); /* elog_port.c */ ElogErrCode elog_port_init(void); -void elog_port_output(const char *output, size_t size); +void elog_port_output(const char *log, size_t size); void elog_port_output_lock(void); void elog_port_output_unlock(void); const char *elog_port_get_time(void); diff --git a/easylogger/src/elog_flash.c b/easylogger/plugins/flash/elog_flash.c similarity index 99% rename from easylogger/src/elog_flash.c rename to easylogger/plugins/flash/elog_flash.c index 9495668..fe0ca30 100644 --- a/easylogger/src/elog_flash.c +++ b/easylogger/plugins/flash/elog_flash.c @@ -58,7 +58,7 @@ static void log_buf_lock(void); static void log_buf_unlock(void); /** - * EasyLogger flash save plugin initialize. + * EasyLogger flash log plugin initialize. * * @return result */ @@ -73,6 +73,8 @@ ElogErrCode elog_flash_init(void) { cur_buf_size = 0; #endif + /* port initialize */ + elog_flash_port_init(); /* initialize OK */ init_ok = true; diff --git a/easylogger/inc/elog_flash.h b/easylogger/plugins/flash/elog_flash.h similarity index 85% rename from easylogger/inc/elog_flash.h rename to easylogger/plugins/flash/elog_flash.h index c09af5f..1b27990 100644 --- a/easylogger/inc/elog_flash.h +++ b/easylogger/plugins/flash/elog_flash.h @@ -35,12 +35,12 @@ extern "C" { #endif -/* EasyLogger flash save plugin's using buffer mode */ +/* EasyLogger flash log plugin's using buffer mode */ #define ELOG_FLASH_USING_BUF_MODE -/* EasyLogger flash save plugin's RAM buffer size */ +/* EasyLogger flash log plugin's RAM buffer size */ #define ELOG_FLASH_BUF_SIZE 1024 -/* EasyLogger flash save plugin's software version number */ -#define ELOG_FLASH_SW_VERSION "0.07.04" +/* EasyLogger flash log plugin's software version number */ +#define ELOG_FLASH_SW_VERSION "0.07.28" /* elog_flash.c */ ElogErrCode elog_flash_init(void); @@ -56,8 +56,9 @@ void elog_flash_lock_enabled(bool enabled); void elog_flash_flush(void); #endif -/* elog_port.c */ -void elog_flash_port_output(const char *output, size_t size); +/* elog_flash_port.c */ +ElogErrCode elog_flash_port_init(void); +void elog_flash_port_output(const char *log, size_t size); void elog_flash_port_lock(void); void elog_flash_port_unlock(void); diff --git a/easylogger/plugins/flash/elog_flash_port.c b/easylogger/plugins/flash/elog_flash_port.c new file mode 100644 index 0000000..25d4f16 --- /dev/null +++ b/easylogger/plugins/flash/elog_flash_port.c @@ -0,0 +1,72 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015, Armink, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: Portable interface for EasyLogger's flash log pulgin. + * Created on: 2015-07-28 + */ + +#include "elog_flash.h" + +/** + * EasyLogger flash log pulgin port initialize + * + * @return result + */ +ElogErrCode elog_flash_port_init(void) { + ElogErrCode result = ELOG_NO_ERR; + + /* add your code here */ + + return result; +} + +/** + * output flash saved log port interface + * + * @param log flash saved log + * @param size log size + */ +void elog_flash_port_output(const char *log, size_t size) { + + /* add your code here */ + +} + +/** + * flash log lock + */ +void elog_flash_port_lock(void) { + + /* add your code here */ + +} + +/** + * flash log unlock + */ +void elog_flash_port_unlock(void) { + + /* add your code here */ + +} diff --git a/easylogger/port/elog_port.c b/easylogger/port/elog_port.c index b46fcac..b690218 100644 --- a/easylogger/port/elog_port.c +++ b/easylogger/port/elog_port.c @@ -45,22 +45,16 @@ ElogErrCode elog_port_init(void) { /** * output log port interface + * + * @param log output of log + * @param size log size */ -void elog_port_output(const char *output, size_t size) { +void elog_port_output(const char *log, size_t size) { /* add your code here */ } -/** - * output flash saved log port interface - */ -void elog_flash_port_output(const char *output, size_t size) { - - /* If used flash log plugin, then you must implement this function. */ - -} - /** * output lock */ @@ -79,25 +73,6 @@ void elog_port_output_unlock(void) { } -/** - * flash log lock - */ -void elog_flash_port_lock(void) { - - /* If used flash log plugin, then you must implement this function. */ - -} - -/** - * flash log unlock - */ -void elog_flash_port_unlock(void) { - - /* If used flash log plugin, then you must implement this function. */ - -} - - /** * get current time interface *