xref: /openbsd/sys/dev/microcode/atmel/build.c (revision 0f5793a2)
1 /*
2  * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 #include <sys/types.h>
17 #include <fcntl.h>
18 
19 #include "atmel_intersil_fw.h"
20 #include "atmel_rfmd2958-smc_fw.h"
21 #include "atmel_rfmd2958_fw.h"
22 #include "atmel_rfmd_fw.h"
23 
24 void
25 output(const char *name, char *buf, int buflen)
26 {
27 	int i;
28 	int fd;
29 
30 	printf("creating %s length %d\n", name, buflen);
31 	fd = open(name, O_WRONLY|O_CREAT|O_TRUNC, 0644);
32 	if (fd == -1)
33 		err(1, "%s", name);
34 
35 	write(fd, buf, buflen);
36 	close(fd);
37 }
38 
39 
40 int
41 main(int argc, char *argv[])
42 {
43 	output("atu-intersil-int", atmel_fw_intersil_int,
44 	    sizeof atmel_fw_intersil_int);
45 	output("atu-intersil-ext", atmel_fw_intersil_ext,
46 	    sizeof atmel_fw_intersil_ext);
47 
48 	output("atu-rfmd2958smc-int", atmel_fw_rfmd2958_smc_int,
49 	    sizeof atmel_fw_rfmd2958_smc_int);
50 	output("atu-rfmd2958smc-ext", atmel_fw_rfmd2958_smc_ext,
51 	    sizeof atmel_fw_rfmd2958_smc_ext);
52 
53 	output("atu-rfmd2958-int", atmel_fw_rfmd2958_int,
54 	    sizeof atmel_fw_rfmd2958_int);
55 	output("atu-rfmd2958-ext", atmel_fw_rfmd2958_ext,
56 	    sizeof atmel_fw_rfmd2958_ext);
57 
58 	output("atu-rfmd-int", atmel_fw_rfmd_int,
59 	    sizeof atmel_fw_rfmd_int);
60 	output("atu-rfmd-ext", atmel_fw_rfmd_ext,
61 	    sizeof atmel_fw_rfmd_ext);
62 
63 	return 0;
64 }
65