Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | /***************************************************************************** |
2 | ||
3 | (c) Cambridge Silicon Radio Limited 2011 | |
4 | All rights reserved and confidential information of CSR | |
5 | ||
6 | Refer to LICENSE.txt included with this source for details | |
7 | on the license terms. | |
8 | ||
9 | *****************************************************************************/ | |
10 | ||
11 | /* | |
12 | * --------------------------------------------------------------------------- | |
13 | * FILE: csr_wifi_hip_xbv.h | |
14 | * | |
15 | * PURPOSE: | |
16 | * Definitions and declarations for code to read XBV files - the UniFi | |
17 | * firmware download file format. | |
18 | * | |
19 | * --------------------------------------------------------------------------- | |
20 | */ | |
21 | #ifndef __XBV_H__ | |
22 | #define __XBV_H__ | |
23 | ||
635d2b00 GKH |
24 | #ifndef CSR_WIFI_XBV_TEST |
25 | /* Driver includes */ | |
26 | #include "csr_wifi_hip_unifi.h" | |
27 | #endif | |
28 | ||
29 | ||
30 | struct VMEQ | |
31 | { | |
26a6b2e1 | 32 | u32 addr; |
8c87f69a GKH |
33 | u16 mask; |
34 | u16 value; | |
635d2b00 GKH |
35 | }; |
36 | ||
37 | struct VAND | |
38 | { | |
26a6b2e1 GKH |
39 | u32 first; |
40 | u32 count; | |
635d2b00 GKH |
41 | }; |
42 | ||
43 | struct VERS | |
44 | { | |
26a6b2e1 | 45 | u32 num_vand; |
635d2b00 GKH |
46 | }; |
47 | ||
48 | struct FWDL | |
49 | { | |
26a6b2e1 GKH |
50 | u32 dl_addr; |
51 | u32 dl_size; | |
52 | u32 dl_offset; | |
635d2b00 GKH |
53 | }; |
54 | ||
55 | struct FWOV | |
56 | { | |
26a6b2e1 GKH |
57 | u32 dl_size; |
58 | u32 dl_offset; | |
635d2b00 GKH |
59 | }; |
60 | ||
61 | struct PTDL | |
62 | { | |
26a6b2e1 GKH |
63 | u32 dl_size; |
64 | u32 dl_offset; | |
635d2b00 GKH |
65 | }; |
66 | ||
67 | #define MAX_VMEQ 64 | |
68 | #define MAX_VAND 64 | |
69 | #define MAX_FWDL 256 | |
70 | #define MAX_PTDL 256 | |
71 | ||
72 | /* An XBV1 file can either contain firmware or patches (at the | |
73 | * moment). The 'mode' member of the xbv1_t structure tells us which | |
74 | * one is the case. */ | |
75 | typedef enum | |
76 | { | |
77 | xbv_unknown, | |
78 | xbv_firmware, | |
79 | xbv_patch | |
80 | } xbv_mode; | |
81 | ||
82 | typedef struct | |
83 | { | |
84 | xbv_mode mode; | |
85 | ||
86 | /* Parts of a Firmware XBV1 */ | |
87 | ||
88 | struct VMEQ vmeq[MAX_VMEQ]; | |
26a6b2e1 | 89 | u32 num_vmeq; |
635d2b00 GKH |
90 | struct VAND vand[MAX_VAND]; |
91 | struct VERS vers; | |
92 | ||
26a6b2e1 | 93 | u32 slut_addr; |
635d2b00 GKH |
94 | |
95 | /* F/W download image, possibly more than one part */ | |
96 | struct FWDL fwdl[MAX_FWDL]; | |
ab2b8c73 | 97 | s16 num_fwdl; |
635d2b00 GKH |
98 | |
99 | /* F/W overlay image, add r not used */ | |
100 | struct FWOV fwov; | |
101 | ||
102 | /* Parts of a Patch XBV1 */ | |
103 | ||
26a6b2e1 | 104 | u32 build_id; |
635d2b00 GKH |
105 | |
106 | struct PTDL ptdl[MAX_PTDL]; | |
ab2b8c73 | 107 | s16 num_ptdl; |
635d2b00 GKH |
108 | } xbv1_t; |
109 | ||
110 | ||
95e326c2 | 111 | typedef s32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len); |
635d2b00 GKH |
112 | |
113 | CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo); | |
95e326c2 | 114 | s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, |
26a6b2e1 | 115 | symbol_t *slut, u32 slut_len); |
635d2b00 | 116 | void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo, |
26a6b2e1 | 117 | u32 *size); |
635d2b00 | 118 | |
635d2b00 | 119 | #endif /* __XBV_H__ */ |