diff options
| author | Yue Ma <yuem@qca.qualcomm.com> | 2014-06-17 15:20:09 -0700 |
|---|---|---|
| committer | Pitani Venkata Rajesh Kumar <c_vpitan@qti.qualcomm.com> | 2014-06-27 11:42:54 +0530 |
| commit | f33a5357dcf44efd60e92a6eb9f2132957bcecbe (patch) | |
| tree | 43aef209386cd68770b7cca64797e37eed23f351 | |
| parent | b7635a5e29bf06b0530a26fa580f9cffd1df8e57 (diff) | |
qca_cld: Add ADF API to get kernel boot time
Add ADF API to get kernel boot time for recording WMI command/event
timestamp.
Change-Id: I24b70cebd5c0d26e5674951a0ef77f21e3809073
CRs-fixed: 674966
| -rw-r--r-- | CORE/SERVICES/COMMON/adf/adf_os_time.h | 24 | ||||
| -rw-r--r-- | CORE/SERVICES/WMI/wmi_unified.c | 5 |
2 files changed, 26 insertions, 3 deletions
diff --git a/CORE/SERVICES/COMMON/adf/adf_os_time.h b/CORE/SERVICES/COMMON/adf/adf_os_time.h index 4cf7e8bab28f..aa81ab4e45ca 100644 --- a/CORE/SERVICES/COMMON/adf/adf_os_time.h +++ b/CORE/SERVICES/COMMON/adf/adf_os_time.h @@ -36,6 +36,9 @@ #define _ADF_OS_TIME_H #include <adf_os_time_pvt.h> +#ifdef CONFIG_CNSS +#include <net/cnss.h> +#endif typedef __adf_time_t adf_os_time_t; @@ -130,4 +133,25 @@ adf_os_mdelay(int msecs) */ #define adf_os_time_after_eq(_a, _b) __adf_os_time_after_eq(_a, _b) +/** + * @brief Get kernel boot time. + * + * @return Time in microseconds + */ +static inline a_uint64_t adf_get_boottime(void) +{ +#ifdef CONFIG_CNSS + struct timespec ts; + +#ifdef WLAN_OPEN_SOURCE + ktime_get_ts(&ts); +#else + cnss_get_monotonic_boottime(&ts); +#endif /* WLAN_OPEN_SOURCE */ + + return (((a_uint64_t)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000)); +#else + return adf_os_ticks_to_msecs(adf_os_ticks()) * 1000; +#endif /* CONFIG_CNSS */ +} #endif diff --git a/CORE/SERVICES/WMI/wmi_unified.c b/CORE/SERVICES/WMI/wmi_unified.c index 11dc1da8876d..d4b8ecd9a5d0 100644 --- a/CORE/SERVICES/WMI/wmi_unified.c +++ b/CORE/SERVICES/WMI/wmi_unified.c @@ -44,7 +44,6 @@ #include "wma_api.h" #include "wma.h" #include "macTrace.h" -#include "vos_api.h" #if defined(HIF_PCI) #include "if_pci.h" #elif defined(HIF_USB) @@ -67,7 +66,7 @@ struct wmi_event_debug wmi_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; wmi_command_log_buffer[g_wmi_command_buf_idx].command = a; \ adf_os_mem_copy(wmi_command_log_buffer[g_wmi_command_buf_idx].data, b , 16);\ wmi_command_log_buffer[g_wmi_command_buf_idx].time = \ - vos_get_monotonic_boottime(); \ + adf_get_boottime(); \ g_wmi_command_buf_idx++; \ } @@ -77,7 +76,7 @@ struct wmi_event_debug wmi_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; wmi_event_log_buffer[g_wmi_event_buf_idx].event = a; \ adf_os_mem_copy(wmi_event_log_buffer[g_wmi_event_buf_idx].data, b , 16);\ wmi_event_log_buffer[g_wmi_event_buf_idx].time = \ - vos_get_monotonic_boottime(); \ + adf_get_boottime(); \ g_wmi_event_buf_idx++; \ } |
