b43-dasm: Add a space char after comma to improve asm code readability.
[b43-tools.git] / disassembler / main.c
index 8ae804077b7055552788cac7fffd80a346a0b958..8e6415ed875ee8ca98b9068f9786bf5aff772f14 100644 (file)
@@ -11,6 +11,7 @@
  *   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;
@@ -656,7 +643,7 @@ static void emit_asm(struct disassembler_context *ctx)
                        first = 1;
                        for (i = 0; i < ARRAY_SIZE(stmt->u.insn.operands); i++) {
                                if (stmt->u.insn.is_labelref == i) {
-                                       fprintf(outfile, ",%s",
+                                       fprintf(outfile, ", %s",
                                                stmt->u.insn.labelref->u.label.name);
                                }
                                if (!stmt->u.insn.operands[i])
@@ -664,7 +651,7 @@ static void emit_asm(struct disassembler_context *ctx)
                                if (first)
                                        fprintf(outfile, "\t");
                                if (!first)
-                                       fprintf(outfile, ",");
+                                       fprintf(outfile, ", ");
                                first = 0;
                                fprintf(outfile, "%s",
                                        stmt->u.insn.operands[i]);
@@ -699,11 +686,11 @@ static int read_input(struct disassembler_context *ctx)
                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;
        }