summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h
blob: 007b0eb950d2f3f82b90e5b548c70a1bd2862e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//------------------------------------------------------------------------------
//
// Copyright (c) 2004-2010 Atheros Corporation.  All rights reserved.
// 
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
//
//------------------------------------------------------------------------------
//
// This file is the include file for Atheros PS and patch parser.
// It implements APIs to parse data buffer with patch and PS information and convert it to HCI commands.
//

#ifndef __AR3KPSPARSER_H
#define __AR3KPSPARSER_H




#include <linux/fs.h>
#include <linux/slab.h>
#include "athdefs.h"
#ifdef HCI_TRANSPORT_SDIO
#include "a_config.h"
#include "a_types.h"
#include "a_osapi.h"
#define ATH_MODULE_NAME misc
#include "a_debug.h"
#include "common_drv.h"
#include "hci_transport_api.h"
#include "ar3kconfig.h"
#else
#ifndef A_PRINTF
#define A_PRINTF(args...)     printk(KERN_ALERT args)
#endif /* A_PRINTF */
#include "debug_linux.h"

/* Helper data type declaration */

#ifndef A_UINT32
#define A_UCHAR                 unsigned char
#define A_UINT32                unsigned long
#define A_UINT16                unsigned short
#define A_UINT8                 unsigned char
#define A_BOOL                  unsigned char
#endif /* A_UINT32 */

#define ATH_DEBUG_ERR          (1 << 0)
#define ATH_DEBUG_WARN         (1 << 1)
#define ATH_DEBUG_INFO         (1 << 2)



#define FALSE   0
#define TRUE    1

#ifndef A_MALLOC
#define A_MALLOC(size)  kmalloc((size),GFP_KERNEL)
#endif /* A_MALLOC */


#ifndef A_FREE
#define A_FREE(addr)  kfree((addr))
#endif /* A_MALLOC */
#endif /* HCI_TRANSPORT_UART */

/* String manipulation APIs */
#ifndef A_STRTOUL
#define A_STRTOUL               simple_strtoul
#endif  /* A_STRTOL */

#ifndef A_STRTOL 
#define A_STRTOL                simple_strtol
#endif /* A_STRTOL */


/* The maximum number of bytes possible in a patch entry */
#define MAX_PATCH_SIZE                    20000

/* Maximum HCI packets that will be formed from the Patch file */
#define MAX_NUM_PATCH_ENTRY               (MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1







typedef struct PSCmdPacket
{
    A_UCHAR *Hcipacket;
    int packetLen;
} PSCmdPacket;

/* Parses a Patch information buffer and store it in global structure */
A_STATUS AthDoParsePatch(A_UCHAR *, A_UINT32);

/* parses a PS information buffer and stores it in a global structure */
A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32);

/* 
 *  Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI command array with
 *  all the PS and patch commands.
 *  The list will have the below mentioned commands in order.
 *  CRC command packet
 *  Download patch command(s)
 *  Enable patch Command
 *  PS Reset Command
 *  PS Tag Command(s)
 *
 */  
int AthCreateCommandList(PSCmdPacket **, A_UINT32 *);

/* Cleanup the dynamically allicated HCI command list */
A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets);
#endif /* __AR3KPSPARSER_H */
OpenPOWER on IntegriCloud