]> Pileus Git - ~andy/linux/blob - drivers/staging/csr/csr_wifi_hip_unifi_udi.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[~andy/linux] / drivers / staging / csr / csr_wifi_hip_unifi_udi.h
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 #include "csr_wifi_hip_unifi.h"
24 #include "csr_wifi_hip_signals.h"
25
26
27 /*
28  * Support for tracing the wire protocol.
29  */
30 enum udi_log_direction
31 {
32     UDI_LOG_FROM_HOST   = 0x0000,
33     UDI_LOG_TO_HOST     = 0x0001
34 };
35
36 typedef void (*udi_func_t)(void *ospriv, u8 *sigdata,
37                            u32 signal_len,
38                            const bulk_data_param_t *bulkdata,
39                            enum udi_log_direction dir);
40
41 CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn);
42 CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
43
44
45 /*
46  * Function to print current status info to a string.
47  * This is used in the linux /proc interface and might be useful
48  * in other systems.
49  */
50 s32 unifi_print_status(card_t *card, char *str, s32 *remain);
51
52 #define UNIFI_SNPRINTF_RET(buf_p, remain, written)                  \
53     do {                                                            \
54         if (written >= remain) {                                    \
55             if (remain >= 2) {                                      \
56                 buf_p[remain - 2] = '\n';                           \
57                 buf_p[remain - 1] = 0;                              \
58             }                                                       \
59             buf_p += remain;                                        \
60             remain = 0;                                             \
61         } else if (written > 0) {                                   \
62             buf_p += written;                                       \
63             remain -= written;                                      \
64         }                                                           \
65     } while (0)
66
67 #endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */