util.o: util.h
+args.o: args.h main.h util.h
+
$(BIN): $(OBJECTS)
$(CC) $(CFLAGS) -o $(BIN) $(OBJECTS) $(LDFLAGS)
* GNU General Public License for more details.
*/
+#include "main.h"
#include "list.h"
#include "util.h"
#include "args.h"
#include <stdlib.h>
#include <string.h>
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
-/* The header that fwcutter puts in to every .fw file */
-struct fw_header {
- /* Type of the firmware data */
- uint8_t type;
- /* Version number of the firmware data format */
- uint8_t ver;
- uint8_t __padding[2];
- /* Size of the data. For ucode and PCM this is in bytes.
- * For IV this is in number-of-ivs. */
- uint32_t size;
-} __attribute__ ((__packed__));
-
struct bin_instruction {
unsigned int opcode;
fprintf(stderr, "Corrupt input file (not fwcutter output)\n");
goto err_close;
}
- if (hdr.type != 'u') {
+ if (hdr.type != FW_TYPE_UCODE) {
fprintf(stderr, "Corrupt input file. Not a microcode image.\n");
goto err_close;
}
- if (hdr.ver != 1) {
+ if (hdr.ver != FW_HDR_VER) {
fprintf(stderr, "Invalid input file header version.\n");
goto err_close;
}
#include <stdio.h>
+#include "util.h"
+
+
+/* The header that fwcutter also puts in to every .fw file */
+struct fw_header {
+ /* Type of the firmware data */
+ uint8_t type;
+ /* Version number of the firmware data format */
+ uint8_t ver;
+ uint8_t __padding[2];
+ /* Size of the data. For ucode and PCM this is in bytes.
+ * For IV this is in number-of-ivs. (big-endian!) */
+ be32_t size;
+} __attribute__ ((__packed__));
+
+/* struct fw_header -> type */
+#define FW_TYPE_UCODE 'u'
+#define FW_TYPE_PCM 'p'
+#define FW_TYPE_IV 'i'
+/* struct fw_header -> ver */
+#define FW_HDR_VER 0x01
+
FILE *infile;
FILE *outfile;
#define BCM43xx_DASM_UTIL_H_
#include <stdlib.h>
+#include <stdint.h>
+
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
void dump(const char *data,
char * xstrdup(const char *str);
void * xrealloc(void *in, size_t size);
+typedef _Bool bool;
+
+typedef uint32_t be32_t;
+
#endif /* BCM43xx_DASM_UTIL_H_ */