X-Git-Url: https://jxself.org/git/?p=b43-tools.git;a=blobdiff_plain;f=fwcutter%2Ffwcutter.h;h=3b04c66789440eabed4bd6de2737098c2df6458b;hp=2f23d81d3f98c128fc54fdc728a554f4f7f6a961;hb=HEAD;hpb=b9e19faa25ad9e1b24f08dc77267760df1b98504 diff --git a/fwcutter/fwcutter.h b/fwcutter/fwcutter.h index 2f23d81..3b04c66 100644 --- a/fwcutter/fwcutter.h +++ b/fwcutter/fwcutter.h @@ -1,29 +1,46 @@ #ifndef _FWCUTTER_H_ #define _FWCUTTER_H_ -#define FW_FLAG_LE 0x01 /* little endian? convert */ -#define FW_FLAG_V4 0x02 /* b43 vs. b43legacy */ +#define FW_FLAG_LE 0x01 /* little endian? convert */ +#define FW_FLAG_V4 0x02 /* b43 vs. b43legacy */ +#define FW_FLAG_UNSUPPORTED 0x04 /* not supported/working */ #define fwcutter_stringify_1(x) #x #define fwcutter_stringify(x) fwcutter_stringify_1(x) #define FWCUTTER_VERSION fwcutter_stringify(FWCUTTER_VERSION_) +#undef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) + typedef uint16_t be16_t; /* Big-endian 16bit */ typedef uint32_t be32_t; /* Big-endian 32bit */ -#ifdef __DragonFly__ +typedef uint32_t le32_t; /* Little-endian 32bit */ + +#if defined(__DragonFly__) || defined(__FreeBSD__) #define bswap_16 bswap16 #define bswap_32 bswap32 +#elif defined(__APPLE__) +#define bswap_16 OSSwapInt16 +#define bswap_32 OSSwapInt32 #endif #define ARG_MATCH 0 #define ARG_NOMATCH 1 #define ARG_ERROR -1 +enum fwcutter_mode { + FWCM_EXTRACT_B43 = 0, /* default */ + FWCM_LIST, + FWCM_IDENTIFY, + FWCM_EXTRACT_BRCMSMAC, +}; + struct cmdline_args { const char *infile; const char *target_dir; - int identify_only; + enum fwcutter_mode mode; + int unsupported; }; struct insn { @@ -93,5 +110,31 @@ struct b43_iv { #define FW_IV_OFFSET_MASK 0x7FFF #define FW_IV_32BIT 0x8000 +/* header format for brcmsmac firmware */ +struct firmware_hdr { + le32_t offset; + le32_t len; + le32_t idx; +}; + +/* numbers of firmware types for brcmsmac firmware */ +enum firmware_brcmsmac { + D11UCODE_NAMETAG_START = 0, + D11LCN0BSINITVALS24, + D11LCN0INITVALS24, + D11LCN1BSINITVALS24, + D11LCN1INITVALS24, + D11LCN2BSINITVALS24, + D11LCN2INITVALS24, + D11N0ABSINITVALS16, + D11N0BSINITVALS16, + D11N0INITVALS16, + D11UCODE_OVERSIGHT16_MIMO, + D11UCODE_OVERSIGHT16_MIMOSZ, + D11UCODE_OVERSIGHT24_LCN, + D11UCODE_OVERSIGHT24_LCNSZ, + D11UCODE_OVERSIGHT_BOMMAJOR, + D11UCODE_OVERSIGHT_BOMMINOR +}; #endif /* _FWCUTTER_H_ */