summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Nelson2016-09-14 21:50:34 -0500
committerSam Nelson2016-09-14 21:50:34 -0500
commit696a9ec37559b671860ef393194c6032b7b6d9ef (patch)
treebf5955bf0999af0fe3b9ea90cb5d0baaa049541d
parent3de2f7d6fb455f504b5958bdb39a8f15584cf441 (diff)
downloadmpm-transport-696a9ec37559b671860ef393194c6032b7b6d9ef.tar.gz
mpm-transport-696a9ec37559b671860ef393194c6032b7b6d9ef.tar.xz
mpm-transport-696a9ec37559b671860ef393194c6032b7b6d9ef.zip
mpm_transport: Add options to debug using log fileDEV.MPM-TRANSPORT-02.00.02.00
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rwxr-xr-xsrc/transport/mpm_transport.c44
-rw-r--r--src/transport/mpm_transport_cfg.h5
2 files changed, 34 insertions, 15 deletions
diff --git a/src/transport/mpm_transport.c b/src/transport/mpm_transport.c
index 64053bd..6f69092 100755
--- a/src/transport/mpm_transport.c
+++ b/src/transport/mpm_transport.c
@@ -53,6 +53,31 @@
53#include "mpm_transport_srio.h" 53#include "mpm_transport_srio.h"
54#endif 54#endif
55 55
56#ifdef LOGFILE_DEBUG
57FILE * debug_fp;
58#endif
59
60void mpm_printf(int val, const char* str, ...) {
61 if (VERBOSITY_LEVEL == 0) return;
62 if (val <= VERBOSITY_LEVEL) {
63 va_list args;
64 va_start(args, str);
65#ifdef SYSLOG_DEBUG
66 vsyslog(LOG_INFO, str, args);
67#endif
68#ifdef LOGFILE_DEBUG
69 vfprintf(debug_fp, str, args);
70#endif
71#ifdef DEBUG
72 vprintf(str, args);
73#endif
74 va_end(args);
75#ifdef LOGFILE_DEBUG
76 fflush(debug_fp);
77#endif
78 }
79}
80
56#define DEFAULT_CONFIG_FILE_NAME "/etc/mpm/mpm_config.json" 81#define DEFAULT_CONFIG_FILE_NAME "/etc/mpm/mpm_config.json"
57 82
58#define json_obj_getnum(obj, item, iteme) \ 83#define json_obj_getnum(obj, item, iteme) \
@@ -1072,6 +1097,10 @@ mpm_transport_h mpm_transport_open(char *slave_name, mpm_transport_open_t *cfg)
1072 int res; 1097 int res;
1073 int ret; 1098 int ret;
1074 1099
1100#ifdef LOGFILE_DEBUG
1101 debug_fp = fopen ("/var/log/mpmfilelog", "w+");
1102 mpm_printf(1,"Log file opened ..\n");fflush(debug_fp);
1103#endif
1075 if (!slave_name || !cfg) { 1104 if (!slave_name || !cfg) {
1076 mpm_printf(1, "Null parameter\n"); 1105 mpm_printf(1, "Null parameter\n");
1077 goto close_n_exit; 1106 goto close_n_exit;
@@ -1775,21 +1804,6 @@ mpm_transport_trans_h mpm_transport_put_initiate64(mpm_transport_h h, uint64_t t
1775 return tp; 1804 return tp;
1776} 1805}
1777 1806
1778void mpm_printf(int val, const char* str, ...) {
1779 if (VERBOSITY_LEVEL == 0) return;
1780 if (val <= VERBOSITY_LEVEL) {
1781 va_list args;
1782 va_start(args, str);
1783#ifdef SYSLOG_DEBUG
1784 vsyslog(LOG_INFO, str, args);
1785#endif
1786#ifdef DEBUG
1787 vprintf(str, args);
1788#endif
1789 va_end(args);
1790 }
1791}
1792
1793int mpm_transport_peripheral_enable(char *slave_name, mpm_transport_open_t *cfg) 1807int mpm_transport_peripheral_enable(char *slave_name, mpm_transport_open_t *cfg)
1794{ 1808{
1795 mpm_transport_cfg_t *sp = NULL; 1809 mpm_transport_cfg_t *sp = NULL;
diff --git a/src/transport/mpm_transport_cfg.h b/src/transport/mpm_transport_cfg.h
index a08c0bd..aa5f1b9 100644
--- a/src/transport/mpm_transport_cfg.h
+++ b/src/transport/mpm_transport_cfg.h
@@ -47,11 +47,16 @@
47 47
48//#define DEBUG 48//#define DEBUG
49//#define SYSLOG_DEBUG 49//#define SYSLOG_DEBUG
50//#define LOGFILE_DEBUG
50 51
51#ifdef SYSLOG_DEBUG 52#ifdef SYSLOG_DEBUG
52#include "syslog.h" 53#include "syslog.h"
53#endif 54#endif
54 55
56#ifdef LOGFILE_DEBUG
57extern FILE * debug_fp;
58#endif
59
55#define JSON_PARSER_VERSION "1.0.0.0" 60#define JSON_PARSER_VERSION "1.0.0.0"
56 61
57#define MAX_FILE_NAME_LEN 128 62#define MAX_FILE_NAME_LEN 128