1 //------------------------------------------------------------------------------
3 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
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.
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
32 #include <linux/slab.h>
34 #ifdef HCI_TRANSPORT_SDIO
38 #define ATH_MODULE_NAME misc
40 #include "common_drv.h"
41 #include "hci_transport_api.h"
42 #include "ar3kconfig.h"
45 #define A_PRINTF(args...) printk(KERN_ALERT args)
47 #include "debug_linux.h"
49 /* Helper data type declaration */
52 #define A_UCHAR unsigned char
53 #define A_UINT32 unsigned long
54 #define A_UINT16 unsigned short
55 #define A_UINT8 unsigned char
56 #define A_BOOL unsigned char
59 #define ATH_DEBUG_ERR (1 << 0)
60 #define ATH_DEBUG_WARN (1 << 1)
61 #define ATH_DEBUG_INFO (1 << 2)
69 #define A_MALLOC(size) kmalloc((size),GFP_KERNEL)
74 #define A_FREE(addr) kfree((addr))
76 #endif /* HCI_TRANSPORT_UART */
78 /* String manipulation APIs */
80 #define A_STRTOUL simple_strtoul
84 #define A_STRTOL simple_strtol
88 /* The maximum number of bytes possible in a patch entry */
89 #define MAX_PATCH_SIZE 20000
91 /* Maximum HCI packets that will be formed from the Patch file */
92 #define MAX_NUM_PATCH_ENTRY (MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1
100 typedef struct PSCmdPacket
106 /* Parses a Patch information buffer and store it in global structure */
107 A_STATUS AthDoParsePatch(A_UCHAR *, A_UINT32);
109 /* parses a PS information buffer and stores it in a global structure */
110 A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32);
113 * Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI command array with
114 * all the PS and patch commands.
115 * The list will have the below mentioned commands in order.
117 * Download patch command(s)
118 * Enable patch Command
123 int AthCreateCommandList(PSCmdPacket **, A_UINT32 *);
125 /* Cleanup the dynamically allicated HCI command list */
126 A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets);
127 #endif /* __AR3KPSPARSER_H */