1 /* Copyright (c) 2015, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __RB_WRAPPER_H
30 #define __RB_WRAPPER_H
31 
32 #define MAX_RB_NAME_SIZE 32
33 
34 struct rb_info {
35     void *rb_ctx;
36     char name[MAX_RB_NAME_SIZE];
37     u32 flags;
38     u32 verbose_level;
39     u32 written_records;
40     u32 max_interval_sec;
41     int id;
42     void *ctx;
43     struct timeval last_push_time;
44 };
45 struct hal_info_s;
46 wifi_error rb_init(struct hal_info_s *info, struct rb_info *rb_info, int id,
47                    size_t size_of_buf, int num_bufs, char *name);
48 void rb_deinit(struct rb_info *rb_info);
49 void get_rb_status(struct rb_info *rb_info, wifi_ring_buffer_status *rbs);
50 void rb_check_for_timeout(struct rb_info *rb_info, struct timeval *now);
51 wifi_error rb_start_logging(struct rb_info *rb_info, u32 verbose_level,
52                             u32 flags, u32 max_interval_sec, u32 min_data_size);
53 int is_rb_name_match(struct rb_info *rb_info, char *name);
54 wifi_error ring_buffer_write(struct rb_info *rb_info, u8 *buf, size_t length,
55                              int no_of_records, size_t record_length);
56 void push_out_rb_data(void *cb_ctx);
57 #endif /* __RB_WRAPPER_H */
58