nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 #ifndef HELPER_H
2 #define HELPER_H
3  
4 #include "types.h"
5  
6 extern struct hndrte_timer *
7 schedule_work(void *context, void *data, void *mainfn, int ms, int periodic);
8  
9 extern struct hndrte_timer *
10 schedule_delayed_work(void *context, void *data, void *mainfn, int ms, int periodic, int delay_ms);
11  
12 extern void *
13 skb_push(sk_buff *p, unsigned int len);
14  
15 extern void *
16 skb_pull(sk_buff *p, unsigned int len);
17  
18 extern void
19 hexdump(char *desc, void *addr, int len);
20  
21 extern unsigned short
22 bcm_qdbm_to_mw(unsigned char qdbm);
23  
24 extern unsigned char
25 bcm_mw_to_qdbm(unsigned short mw);
26  
27 extern void
28 set_chanspec(struct wlc_info *wlc, unsigned short chanspec);
29  
30 extern unsigned int
31 get_chanspec(struct wlc_info *wlc);
32  
33 extern void
34 set_mpc(struct wlc_info *wlc, uint32 mpc);
35  
36 extern uint32
37 get_mpc(struct wlc_info *wlc);
38  
39 extern void
40 set_monitormode(struct wlc_info *wlc, uint32 monitor);
41  
42 extern void
43 set_scansuppress(struct wlc_info *wlc, uint32 scansuppress);
44  
45 extern uint32
46 get_scansuppress(struct wlc_info *wlc);
47  
48 extern void
49 set_intioctl(struct wlc_info *wlc, uint32 cmd, uint32 arg);
50  
51 extern uint32
52 get_intioctl(struct wlc_info *wlc, uint32 cmd);
53  
54 #define HTONS(A) ((((uint16)(A) & 0xff00) >> 8) | (((uint16)(A) & 0x00ff) << 8))
55  
56 inline uint16
57 htons(uint16 a)
58 {
59 return (a & 0xff00) >> 8 | (a & 0xff) << 8;
60 }
61  
62 inline uint32
63 htonl(uint32 a)
64 {
65 return (a & 0xff000000) >> 24 | (a & 0xff0000) >> 8 | (a & 0xff00) << 8 | (a & 0xff) << 24;
66 }
67  
68 inline uint16
69 ntohs(uint16 a)
70 {
71 return htons(a);
72 }
73  
74 inline uint32
75 ntohl(uint32 a)
76 {
77 return htonl(a);
78 }
79  
80 inline void *
81 get_stack_ptr() {
82 void *stack = 0x0;
83 __asm("mov %0, sp" : "=r" (stack));
84 return stack;
85 }
86  
87 #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
88  
89 /*
90 inline int
91 get_register(int reg_nr) {
92 int reg_content = 0;
93 switch(reg_nr) {
94 case 0:
95 __asm("mov %0, r0" : "=r" (reg_content));
96 break;
97 case 1:
98 __asm("mov %0, r1" : "=r" (reg_content));
99 break;
100 case 2:
101 __asm("mov %0, r2" : "=r" (reg_content));
102 break;
103 case 3:
104 __asm("mov %0, r3" : "=r" (reg_content));
105 break;
106 case 10:
107 __asm("mov %0, r10" : "=r" (reg_content));
108 break;
109 default:
110 // not impl. do nothing
111 break;
112 }
113 return reg_content;
114 }
115  
116 inline void
117 copy_stack(void *dest, int copy_size) {
118 printf("copy_stack: %d\n", copy_size);
119 if(copy_size > 0) {
120 memcpy( (void *) (dest), get_stack_ptr(), copy_size);
121 }
122 return;
123 }
124 */
125  
126 #endif /* HELPER_H */