elog_flash.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * This file is part of the EasyLogger Library.
  3. *
  4. * Copyright (c) 2015-2017, Armink, <armink.ztl@gmail.com>
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * 'Software'), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be
  15. * included in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. * Function: It is an head file for flash log plugin. You can see all be called functions.
  26. * Created on: 2015-06-05
  27. */
  28. #ifndef __ELOG_FLASH_H__
  29. #define __ELOG_FLASH_H__
  30. #include <elog.h>
  31. #include <elog_flash_cfg.h>
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #if !defined(ELOG_FLASH_BUF_SIZE)
  36. #error "Please configure RAM buffer size (in elog_flash_cfg.h)"
  37. #endif
  38. /* EasyLogger flash log plugin's software version number */
  39. #define ELOG_FLASH_SW_VERSION "V2.0.1"
  40. /* elog_flash.c */
  41. ElogErrCode elog_flash_init(void);
  42. void elog_flash_output(size_t pos, size_t size);
  43. void elog_flash_output_all(void);
  44. void elog_flash_output_recent(size_t size);
  45. void elog_flash_set_filter(uint8_t level,const char *tag,const char *keyword);
  46. void elog_flash_write(const char *log, size_t size);
  47. void elog_flash_clean(void);
  48. void elog_flash_lock_enabled(bool enabled);
  49. #ifdef ELOG_FLASH_USING_BUF_MODE
  50. void elog_flash_flush(void);
  51. #endif
  52. /* elog_flash_port.c */
  53. ElogErrCode elog_flash_port_init(void);
  54. void elog_flash_port_output(const char *log, size_t size);
  55. void elog_flash_port_lock(void);
  56. void elog_flash_port_unlock(void);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif /* __ELOG_FLASH_H__ */