File dump_fw.c changed (mode: 100644) (index 65c74a4..561dd2a) |
54 |
54 |
*/ |
*/ |
55 |
55 |
|
|
56 |
56 |
#include <stdio.h> |
#include <stdio.h> |
|
57 |
|
#include <stdint.h> |
57 |
58 |
#include <stdlib.h> |
#include <stdlib.h> |
58 |
59 |
#include <string.h> |
#include <string.h> |
59 |
60 |
#include "dhf.h" |
#include "dhf.h" |
60 |
61 |
|
|
61 |
|
#define AP_SUFFIX "_ap.fw" |
|
62 |
|
#define STA_SUFFIX "_sta.fw" |
|
|
62 |
|
#define AP_SUFFIX "_ap_fw.bin" |
|
63 |
|
#define STA_SUFFIX "_sta_fw.bin" |
63 |
64 |
#define VERSION "HFW000" |
#define VERSION "HFW000" |
64 |
65 |
|
|
65 |
66 |
/* 0xAABB to 0xBBAA */ |
/* 0xAABB to 0xBBAA */ |
|
89 |
90 |
int host_bytes_in_word_be = 0; |
int host_bytes_in_word_be = 0; |
90 |
91 |
int host_words_in_dword_be = 0; |
int host_words_in_dword_be = 0; |
91 |
92 |
|
|
92 |
|
#define host_to_le16(value) \ |
|
93 |
|
host_bytes_in_word_be ? swap_bytes_16(value) : (value); |
|
94 |
|
#define host_to_le32(value) \ |
|
95 |
|
host_words_in_dword_be ? \ |
|
96 |
|
(host_bytes_in_word_be ? reverse_bytes_32(value) \ |
|
97 |
|
: swap_bytes_32(value)) : \ |
|
98 |
|
(host_bytes_in_word_be ? swap_words_32(value) : (value)); |
|
99 |
|
|
|
100 |
|
#define le16_to_host(value) \ |
|
101 |
|
host_bytes_in_word_be ? swap_bytes_16(value) : (value); |
|
102 |
|
#define le32_to_host(value) \ |
|
103 |
|
host_words_in_dword_be ? \ |
|
104 |
|
(host_bytes_in_word_be ? reverse_bytes_32(value) \ |
|
105 |
|
: swap_bytes_32(value)) : \ |
|
106 |
|
(host_bytes_in_word_be ? swap_words_32(value) : (value)); |
|
107 |
|
|
|
108 |
|
typedef unsigned int u32; |
|
109 |
|
typedef unsigned short u16; |
|
110 |
|
typedef unsigned char u8; |
|
|
93 |
|
#define host_to_le16(value) \ |
|
94 |
|
(host_bytes_in_word_be ? swap_bytes_16(value) : (value)) |
|
95 |
|
#define host_to_le32(value) \ |
|
96 |
|
(host_words_in_dword_be ? \ |
|
97 |
|
(host_bytes_in_word_be ? reverse_bytes_32(value) \ |
|
98 |
|
: swap_bytes_32(value)) : \ |
|
99 |
|
(host_bytes_in_word_be ? swap_words_32(value) : (value))) |
|
100 |
|
|
|
101 |
|
#define le16_to_host(value) \ |
|
102 |
|
(host_bytes_in_word_be ? swap_bytes_16(value) : (value)) |
|
103 |
|
#define le32_to_host(value) \ |
|
104 |
|
(host_words_in_dword_be ? \ |
|
105 |
|
(host_bytes_in_word_be ? reverse_bytes_32(value) \ |
|
106 |
|
: swap_bytes_32(value)) : \ |
|
107 |
|
(host_bytes_in_word_be ? swap_words_32(value) : (value))) |
|
108 |
|
|
|
109 |
|
/* Use C99 exact width types */ |
|
110 |
|
typedef uint32_t u32; |
|
111 |
|
typedef uint16_t u16; |
|
112 |
|
typedef uint8_t u8; |
111 |
113 |
|
|
112 |
114 |
/* Checking endianess at runtime because performance isn't an issue, |
/* Checking endianess at runtime because performance isn't an issue, |
113 |
115 |
* and I'd rather not add a configure step since this is slotting into the |
* and I'd rather not add a configure step since this is slotting into the |