~ubuntu-branches/ubuntu/natty/bcmwl/natty

« back to all changes in this revision

Viewing changes to src/src/include/bcmutils.h

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Milone
  • Date: 2010-02-14 19:58:58 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100214195858-76xedzc2a1gz1ujz
Tags: upstream-5.60.48.36+bdcom
ImportĀ upstreamĀ versionĀ 5.60.48.36+bdcom

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Misc useful os-independent macros and functions.
3
3
 *
4
 
 * Copyright 2008, Broadcom Corporation
 
4
 * Copyright (C) 2010, Broadcom Corporation
5
5
 * All Rights Reserved.
6
6
 * 
7
 
 *      Unless you and Broadcom execute a separate written software license
8
 
 * agreement governing use of this software, this software is licensed to you
9
 
 * under the terms of the GNU General Public License version 2, available at
10
 
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL"), with the
11
 
 * following added to such license:
12
 
 *      As a special exception, the copyright holders of this software give you
13
 
 * permission to link this software with independent modules, regardless of the
14
 
 * license terms of these independent modules, and to copy and distribute the
15
 
 * resulting executable under terms of your choice, provided that you also meet,
16
 
 * for each linked independent module, the terms and conditions of the license
17
 
 * of that module. An independent module is a module which is not derived from
18
 
 * this software.
19
 
 *
20
7
 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
21
8
 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
22
9
 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
23
10
 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
24
11
 *
25
 
 * $Id: bcmutils.h,v 13.199.2.5 2008/11/25 12:13:46 Exp $
 
12
 * $Id: bcmutils.h,v 13.217 2009/05/14 22:33:52 Exp $
26
13
 */
27
14
 
28
15
#ifndef _bcmutils_h_
29
16
#define _bcmutils_h_
30
17
 
 
18
#ifdef __cplusplus
 
19
extern "C" {
 
20
#endif
 
21
 
31
22
#define _BCM_U  0x01    
32
23
#define _BCM_L  0x02    
33
24
#define _BCM_D  0x04    
107
98
 
108
99
#define PKTQ_PREC_ITER(pq, prec)        for (prec = (pq)->num_prec - 1; prec >= 0; prec--)
109
100
 
 
101
typedef bool (*ifpkt_cb_t)(void*, int);
 
102
 
110
103
struct ether_addr;
111
104
 
112
105
#define pktq_psetmax(pq, prec, _max)    ((pq)->q[prec].max = (_max))
123
116
extern void *pktq_pdeq(struct pktq *pq, int prec);
124
117
extern void *pktq_pdeq_tail(struct pktq *pq, int prec);
125
118
 
126
 
extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir);
 
119
extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir,
 
120
        ifpkt_cb_t fn, int arg);
127
121
 
128
122
extern bool pktq_pdel(struct pktq *pq, void *p, int prec);
129
123
 
148
142
extern void *pktq_deq_tail(struct pktq *pq, int *prec_out);
149
143
extern void *pktq_peek(struct pktq *pq, int *prec_out);
150
144
extern void *pktq_peek_tail(struct pktq *pq, int *prec_out);
151
 
extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir); 
 
145
extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir, ifpkt_cb_t fn, int arg);
152
146
 
153
147
extern uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf);
154
148
extern uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf);
168
162
extern char *BCMROMFN(bcmstrcat)(char *dest, const char *src);
169
163
extern char *BCMROMFN(bcmstrncat)(char *dest, const char *src, uint size);
170
164
extern ulong wchar2ascii(char *abuf, ushort *wbuf, ushort wbuflen, ulong abuflen);
 
165
char* bcmstrtok(char **string, const char *delimiters, char *tokdelim);
 
166
int bcmstricmp(const char *s1, const char *s2);
 
167
int bcmstrnicmp(const char* s1, const char* s2, int cnt);
171
168
 
172
169
extern char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf);
173
170
extern int BCMROMFN(bcm_ether_atoe)(char *p, struct ether_addr *ea);
287
284
#define BCME_NOT_WME_ASSOCIATION        -34     
288
285
#define BCME_SDIO_ERROR                 -35     
289
286
#define BCME_DONGLE_DOWN                -36     
290
 
#define BCME_VERSION                    -37     
 
287
#define BCME_VERSION                    -37 
291
288
#define BCME_TXFAIL                     -38     
292
289
#define BCME_RXFAIL                     -39     
293
290
#define BCME_NODEVICE                   -40     
445
442
        a[0] = v & 0xff;
446
443
}
447
444
 
 
445
static INLINE void
 
446
xor_128bit_block(const uint8 *src1, const uint8 *src2, uint8 *dst)
 
447
{
 
448
        if (
 
449
#ifdef __i386__
 
450
            1 ||
 
451
#endif
 
452
            (((uintptr)src1 | (uintptr)src2 | (uintptr)dst) & 3) == 0) {
 
453
 
 
454
                ((uint32 *)dst)[0] = ((const uint32 *)src1)[0] ^ ((const uint32 *)src2)[0];
 
455
                ((uint32 *)dst)[1] = ((const uint32 *)src1)[1] ^ ((const uint32 *)src2)[1];
 
456
                ((uint32 *)dst)[2] = ((const uint32 *)src1)[2] ^ ((const uint32 *)src2)[2];
 
457
                ((uint32 *)dst)[3] = ((const uint32 *)src1)[3] ^ ((const uint32 *)src2)[3];
 
458
        } else {
 
459
 
 
460
                int k;
 
461
                for (k = 0; k < 16; k++)
 
462
                        dst[k] = src1[k] ^ src2[k];
 
463
        }
 
464
}
 
465
 
448
466
extern uint8 BCMROMFN(hndcrc8)(uint8 *p, uint nbytes, uint8 crc);
449
467
extern uint16 BCMROMFN(hndcrc16)(uint8 *p, uint nbytes, uint16 crc);
450
468
extern uint32 BCMROMFN(hndcrc32)(uint8 *p, uint nbytes, uint32 crc);
451
469
 
452
 
#if defined(BCMDBG) || defined(BCMDBG_ERR) || defined(BCMDBG_DUMP)
 
470
#if defined(BCMDBG) || defined(DHD_DEBUG) || defined(BCMDBG_ERR) || \
 
471
        defined(BCMDBG_DUMP)
453
472
extern int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len);
454
473
extern int bcm_format_hex(char *str, const void *bytes, int len);
455
474
extern void prhex(const char *msg, uchar *buf, uint len);
484
503
 
485
504
extern void bcm_binit(struct bcmstrbuf *b, char *buf, uint size);
486
505
extern int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...);
 
506
extern void bcm_inc_bytes(uchar *num, int num_bytes, uint8 amount);
 
507
extern int bcm_cmp_bytes(uchar *arg1, uchar *arg2, uint8 nbytes);
 
508
extern void bcm_print_bytes(char *name, const uchar *cdata, int len);
487
509
 
488
510
typedef  uint32 (*bcmutl_rdreg_rtn)(void *arg0, uint arg1, uint32 offset);
489
511
extern uint bcmdumpfields(bcmutl_rdreg_rtn func_ptr, void *arg0, uint arg1, struct fielddesc *str,
492
514
extern uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint len);
493
515
extern uint BCMROMFN(bcm_bitcount)(uint8 *bitmap, uint bytelength);
494
516
 
 
517
#ifdef __cplusplus
 
518
        }
 
519
#endif
 
520
 
495
521
#endif