fix wep encryption setting for madwifi
[openwrt.git] / target / linux / ixp4xx-2.6 / image / npe-ucode / src / IxNpeMicrocode.h
1 /*
2 * IxNpeMicrocode.h - Headerfile for compiling the Intel microcode C file
3 *
4 * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com>
5 *
6 * This file is released under the GPLv2
7 *
8 *
9 * compile with
10 *
11 * gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode
12 *
13 * Executing the resulting binary on your build-host creates the
14 * "NPE-[ABC].xxxxxxxx" files containing the selected microcode
15 *
16 * fetch the IxNpeMicrocode.c from the Intel Access Library.
17 * It will include this header.
18 *
19 * select Images for every NPE from the following
20 * (used C++ comments for easy uncommenting ....)
21 */
22
23 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
24 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
25 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
26 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS_TSLOT_SWITCH
27 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
28 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
29 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL
30 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT
31 // #define IX_NPEDL_NPEIMAGE_NPEA_DMA
32 // #define IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT
33 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT
34 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT
35 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0
36 // #define IX_NPEDL_NPEIMAGE_NPEA_WEP
37
38
39 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
40 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
41 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
42 // #define IX_NPEDL_NPEIMAGE_NPEB_DMA
43 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
44 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
45 #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL
46
47
48 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
49 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
50 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
51 // #define IX_NPEDL_NPEIMAGE_NPEC_DMA
52 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_SPAN
53 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_FIREWALL
54 #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_CCM_ETH
55 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_ETH_LEARN_FILTER_SPAN_FIREWALL
56 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
57 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
58 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL
59
60
61 #include <stdio.h>
62 #include <unistd.h>
63 #include <stdlib.h>
64 #include <netinet/in.h>
65 #include <sys/types.h>
66 #include <sys/stat.h>
67 #include <fcntl.h>
68 #include <errno.h>
69 #include <endian.h>
70 #include <byteswap.h>
71 #include <string.h>
72
73 #if __BYTE_ORDER == __LITTLE_ENDIAN
74 #define to_le32(x) (x)
75 #define to_be32(x) bswap_32(x)
76 #else
77 #define to_be32(x) (x)
78 #define to_le32(x) bswap_32(x)
79 #endif
80
81 struct dl_image {
82 unsigned magic;
83 unsigned id;
84 unsigned size;
85 unsigned data[0];
86 };
87
88 const unsigned IxNpeMicrocode_array[];
89
90 int main(int argc, char *argv[])
91 {
92 struct dl_image *image = (struct dl_image *)IxNpeMicrocode_array;
93 int imgsiz, i, fd, cnt;
94 const unsigned *arrayptr = IxNpeMicrocode_array;
95 const char *names[] = { "IXP425", "IXP465", "unknown" };
96 int bigendian = 1;
97
98 if (argc > 1) {
99 if (!strcmp(argv[1], "-le"))
100 bigendian = 0;
101 else if (!strcmp(argv[1], "-be"))
102 bigendian = 1;
103 else {
104 printf("Usage: %s <-le|-be>\n", argv[0]);
105 return EXIT_FAILURE;
106 }
107 }
108
109 for (image = (struct dl_image *)arrayptr, cnt=0;
110 (image->id != 0xfeedf00d) && (image->magic == 0xfeedf00d);
111 image = (struct dl_image *)(arrayptr), cnt++)
112 {
113 unsigned char field[4];
114 imgsiz = image->size + 3;
115 *(unsigned*)field = to_be32(image->id);
116 char filename[40], slnk[10];
117
118 sprintf(filename, "NPE-%c.%08x", (field[0] & 0xf) + 'A',
119 image->id);
120 sprintf(slnk, "NPE-%c", (field[0] & 0xf) + 'A');
121 printf("Writing image: %s.NPE_%c Func: %2x Rev: %02x.%02x "
122 "Size: %5d to: '%s'\n",
123 names[field[0] >> 4], (field[0] & 0xf) + 'A',
124 field[1], field[2], field[3], imgsiz*4, filename);
125 fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
126 if (fd >= 0) {
127 for (i=0; i<imgsiz; i++) {
128 *(unsigned*)field = bigendian ?
129 to_be32(arrayptr[i]) :
130 to_le32(arrayptr[i]);
131 write(fd, field, sizeof(field));
132 }
133 close(fd);
134 unlink(slnk);
135 symlink(filename, slnk);
136 } else {
137 perror(filename);
138 }
139 arrayptr += imgsiz;
140 }
141 close(fd);
142 return 0;
143 }
This page took 0.052213 seconds and 5 git commands to generate.