OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2004-2008 Atheros Communications Inc. |
| 3 * All rights reserved. |
| 4 * |
| 5 * This file is the include file for Atheros PS and patch parser. |
| 6 * It implements APIs to parse data buffer with patch and PS information and con
vert it to HCI commands. |
| 7 * |
| 8 * |
| 9 * |
| 10 * ar3kpsparser.h |
| 11 * |
| 12 * |
| 13 * |
| 14 * The software source and binaries included in this development package are |
| 15 * licensed, not sold. You, or your company, received the package under one |
| 16 * or more license agreements. The rights granted to you are specifically |
| 17 * listed in these license agreement(s). All other rights remain with Atheros |
| 18 * Communications, Inc., its subsidiaries, or the respective owner including |
| 19 * those listed on the included copyright notices.. Distribution of any |
| 20 * portion of this package must be in strict compliance with the license |
| 21 * agreement(s) terms. |
| 22 * |
| 23 * |
| 24 * |
| 25 */ |
| 26 |
| 27 /*------------------------------------------------------------------------------ |
| 28 * |
| 29 * <copyright file="File name" company="Atheros"> |
| 30 * Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. |
| 31 * |
| 32 // This program is free software; you can redistribute it and/or modify |
| 33 // it under the terms of the GNU General Public License version 2 as |
| 34 // published by the Free Software Foundation; |
| 35 // |
| 36 // Software distributed under the License is distributed on an "AS |
| 37 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 38 // implied. See the License for the specific language governing |
| 39 // rights and limitations under the License. |
| 40 // |
| 41 // |
| 42 *------------------------------------------------------------------------------ |
| 43 * |
| 44 * |
| 45 * |
| 46 * This file is the include file for Atheros PS and patch parser. |
| 47 * It implements APIs to parse data buffer with patch and PS information and con
vert it to HCI commands. |
| 48 * |
| 49 * |
| 50 * |
| 51 * |
| 52 * |
| 53 */ |
| 54 #ifndef __AR3KPSPARSER_H |
| 55 #define __AR3KPSPARSER_H |
| 56 |
| 57 |
| 58 |
| 59 |
| 60 #include <linux/fs.h> |
| 61 #include <linux/slab.h> |
| 62 #include "athdefs.h" |
| 63 #ifdef HCI_TRANSPORT_SDIO |
| 64 #include "a_config.h" |
| 65 #include "a_types.h" |
| 66 #include "a_osapi.h" |
| 67 #define ATH_MODULE_NAME misc |
| 68 #include "a_debug.h" |
| 69 #include "common_drv.h" |
| 70 #include "hci_transport_api.h" |
| 71 #include "ar3kconfig.h" |
| 72 #else |
| 73 #ifndef A_PRINTF |
| 74 #define A_PRINTF(args...) printk(KERN_ALERT args) |
| 75 #endif /* A_PRINTF */ |
| 76 #include "debug_linux.h" |
| 77 |
| 78 /* Helper data type declaration */ |
| 79 |
| 80 #ifndef A_UINT32 |
| 81 #define A_UCHAR unsigned char |
| 82 #define A_UINT32 unsigned long |
| 83 #define A_UINT16 unsigned short |
| 84 #define A_UINT8 unsigned char |
| 85 #define A_BOOL unsigned char |
| 86 #endif /* A_UINT32 */ |
| 87 |
| 88 #define ATH_DEBUG_ERR (1 << 0) |
| 89 #define ATH_DEBUG_WARN (1 << 1) |
| 90 #define ATH_DEBUG_INFO (1 << 2) |
| 91 |
| 92 |
| 93 |
| 94 #define FALSE 0 |
| 95 #define TRUE 1 |
| 96 |
| 97 #ifndef A_MALLOC |
| 98 #define A_MALLOC(size) kmalloc((size),GFP_KERNEL) |
| 99 #endif /* A_MALLOC */ |
| 100 |
| 101 |
| 102 #ifndef A_FREE |
| 103 #define A_FREE(addr) kfree((addr)) |
| 104 #endif /* A_MALLOC */ |
| 105 #endif /* HCI_TRANSPORT_UART */ |
| 106 |
| 107 /* String manipulation APIs */ |
| 108 #ifndef A_STRTOUL |
| 109 #define A_STRTOUL simple_strtoul |
| 110 #endif /* A_STRTOL */ |
| 111 |
| 112 #ifndef A_STRTOL |
| 113 #define A_STRTOL simple_strtol |
| 114 #endif /* A_STRTOL */ |
| 115 |
| 116 |
| 117 /* The maximum number of bytes possible in a patch entry */ |
| 118 #define MAX_PATCH_SIZE 20000 |
| 119 |
| 120 /* Maximum HCI packets that will be formed from the Patch file */ |
| 121 #define MAX_NUM_PATCH_ENTRY (MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1 |
| 122 |
| 123 |
| 124 |
| 125 |
| 126 |
| 127 |
| 128 |
| 129 typedef struct PSCmdPacket |
| 130 { |
| 131 A_UCHAR *Hcipacket; |
| 132 int packetLen; |
| 133 } PSCmdPacket; |
| 134 |
| 135 /* Parses a Patch information buffer and store it in global structure */ |
| 136 A_STATUS AthDoParsePatch(A_UCHAR *, A_UINT32); |
| 137 |
| 138 /* parses a PS information buffer and stores it in a global structure */ |
| 139 A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32); |
| 140 |
| 141 /* |
| 142 * Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI co
mmand array with |
| 143 * all the PS and patch commands. |
| 144 * The list will have the below mentioned commands in order. |
| 145 * CRC command packet |
| 146 * Download patch command(s) |
| 147 * Enable patch Command |
| 148 * PS Reset Command |
| 149 * PS Tag Command(s) |
| 150 * |
| 151 */ |
| 152 int AthCreateCommandList(PSCmdPacket **, A_UINT32 *); |
| 153 |
| 154 /* Cleanup the dynamically allicated HCI command list */ |
| 155 A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets); |
| 156 #endif /* __AR3KPSPARSER_H */ |
OLD | NEW |