staging: ath6kl: Convert A_UINT32 to u32
[linux-2.6/libata-dev.git] / drivers / staging / ath6kl / miscdrv / ar3kps / ar3kpsparser.h
blobfdc1c949ab80ec6560b8f21ac853c31b7d77b0a9
1 //------------------------------------------------------------------------------
2 //
3 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
4 //
5 //
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
9 //
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //------------------------------------------------------------------------------
21 // This file is the include file for Atheros PS and patch parser.
22 // It implements APIs to parse data buffer with patch and PS information and convert it to HCI commands.
25 #ifndef __AR3KPSPARSER_H
26 #define __AR3KPSPARSER_H
31 #include <linux/fs.h>
32 #include <linux/slab.h>
33 #include "athdefs.h"
34 #ifdef HCI_TRANSPORT_SDIO
35 #include "a_config.h"
36 #include "a_types.h"
37 #include "a_osapi.h"
38 #define ATH_MODULE_NAME misc
39 #include "a_debug.h"
40 #include "common_drv.h"
41 #include "hci_transport_api.h"
42 #include "ar3kconfig.h"
43 #else
44 #ifndef A_PRINTF
45 #define A_PRINTF(args...) printk(KERN_ALERT args)
46 #endif /* A_PRINTF */
47 #include "debug_linux.h"
49 /* Helper data type declaration */
51 #ifndef u32 #define A_UCHAR unsigned char
52 #define u32 unsigned long
53 #define u16 unsigned short
54 #define u8 unsigned char
55 #define bool unsigned char
56 #endif /* u32 */
58 #define ATH_DEBUG_ERR (1 << 0)
59 #define ATH_DEBUG_WARN (1 << 1)
60 #define ATH_DEBUG_INFO (1 << 2)
64 #define false 0
65 #define true 1
67 #ifndef A_MALLOC
68 #define A_MALLOC(size) kmalloc((size),GFP_KERNEL)
69 #endif /* A_MALLOC */
72 #ifndef A_FREE
73 #define A_FREE(addr) kfree((addr))
74 #endif /* A_MALLOC */
75 #endif /* HCI_TRANSPORT_UART */
77 /* String manipulation APIs */
78 #ifndef A_STRTOUL
79 #define A_STRTOUL simple_strtoul
80 #endif /* A_STRTOL */
82 #ifndef A_STRTOL
83 #define A_STRTOL simple_strtol
84 #endif /* A_STRTOL */
87 /* The maximum number of bytes possible in a patch entry */
88 #define MAX_PATCH_SIZE 20000
90 /* Maximum HCI packets that will be formed from the Patch file */
91 #define MAX_NUM_PATCH_ENTRY (MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1
99 typedef struct PSCmdPacket
101 A_UCHAR *Hcipacket;
102 int packetLen;
103 } PSCmdPacket;
105 /* Parses a Patch information buffer and store it in global structure */
106 int AthDoParsePatch(A_UCHAR *, u32 );
108 /* parses a PS information buffer and stores it in a global structure */
109 int AthDoParsePS(A_UCHAR *, u32 );
112 * Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI command array with
113 * all the PS and patch commands.
114 * The list will have the below mentioned commands in order.
115 * CRC command packet
116 * Download patch command(s)
117 * Enable patch Command
118 * PS Reset Command
119 * PS Tag Command(s)
122 int AthCreateCommandList(PSCmdPacket **, u32 *);
124 /* Cleanup the dynamically allicated HCI command list */
125 int AthFreeCommandList(PSCmdPacket **HciPacketList, u32 numPackets);
126 #endif /* __AR3KPSPARSER_H */