linux/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
<<
>>
Prefs
   1/*****************************************************************************
   2
   3            (c) Cambridge Silicon Radio Limited 2011
   4            All rights reserved and confidential information of CSR
   5
   6            Refer to LICENSE.txt included with this source for details
   7            on the license terms.
   8
   9*****************************************************************************/
  10
  11/*
  12 * ---------------------------------------------------------------------------
  13 *  FILE:     csr_wifi_hip_unifi_udi.h
  14 *
  15 *  PURPOSE:
  16 *      Declarations and definitions for the UniFi Debug Interface.
  17 *
  18 * ---------------------------------------------------------------------------
  19 */
  20#ifndef __CSR_WIFI_HIP_UNIFI_UDI_H__
  21#define __CSR_WIFI_HIP_UNIFI_UDI_H__
  22
  23#ifdef __cplusplus
  24extern "C" {
  25#endif
  26
  27#include "csr_wifi_hip_unifi.h"
  28#include "csr_wifi_hip_signals.h"
  29
  30
  31/*
  32 * Support for tracing the wire protocol.
  33 */
  34enum udi_log_direction
  35{
  36    UDI_LOG_FROM_HOST   = 0x0000,
  37    UDI_LOG_TO_HOST     = 0x0001
  38};
  39
  40typedef void (*udi_func_t)(void *ospriv, u8 *sigdata,
  41                           u32 signal_len,
  42                           const bulk_data_param_t *bulkdata,
  43                           enum udi_log_direction dir);
  44
  45CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn);
  46CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
  47
  48
  49/*
  50 * Function to print current status info to a string.
  51 * This is used in the linux /proc interface and might be useful
  52 * in other systems.
  53 */
  54s32 unifi_print_status(card_t *card, char *str, s32 *remain);
  55
  56#define UNIFI_SNPRINTF_RET(buf_p, remain, written)                  \
  57    do {                                                            \
  58        if (written >= remain) {                                    \
  59            if (remain >= 2) {                                      \
  60                buf_p[remain - 2] = '\n';                           \
  61                buf_p[remain - 1] = 0;                              \
  62            }                                                       \
  63            buf_p += remain;                                        \
  64            remain = 0;                                             \
  65        } else if (written > 0) {                                   \
  66            buf_p += written;                                       \
  67            remain -= written;                                      \
  68        }                                                           \
  69    } while (0)
  70
  71
  72#ifdef __cplusplus
  73}
  74#endif
  75
  76#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
  77