summaryrefslogtreecommitdiff
path: root/util/getpir/code_gen.c
diff options
context:
space:
mode:
authorLi-Ta Lo <ollie@lanl.gov>2004-09-07 21:31:06 +0000
committerLi-Ta Lo <ollie@lanl.gov>2004-09-07 21:31:06 +0000
commit39fdcbf9f0e117629cea42ce335529a7061fada6 (patch)
tree94d4e7903e2bd70bda95b55985545613abb93729 /util/getpir/code_gen.c
parent7b08c116b9bb3aaf2059935e46f51446a27f93ee (diff)
downloadcoreboot-39fdcbf9f0e117629cea42ce335529a7061fada6.tar.xz
seperate code generation
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1646 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/getpir/code_gen.c')
-rw-r--r--util/getpir/code_gen.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/getpir/code_gen.c b/util/getpir/code_gen.c
index 32528633a0..150d083d86 100644
--- a/util/getpir/code_gen.c
+++ b/util/getpir/code_gen.c
@@ -13,16 +13,21 @@ static char *preamble[] = {
0
};
-void code_gen(FILE * fpir, struct irq_routing_table *rt)
+void code_gen(char *filename, struct irq_routing_table *rt)
{
char **code = preamble;
struct irq_info *se_arr = (struct irq_info *) ((char *) rt + 32);
int i, ts = (rt->size - 32) / 16;
+ FILE *fpir;
+
+ if ((fpir = fopen(filename, "w")) == NULL) {
+ printf("Failed creating file!\n");
+ exit(2);
+ }
while (*code)
fprintf(fpir, "%s", *code++);
-
fprintf(fpir, "\t32+16*%d, /* there can be total %d devices on the bus */\n",
ts, ts);
fprintf(fpir, "\t0x%02x, /* Where the interrupt router lies (bus) */\n",
@@ -52,4 +57,6 @@ void code_gen(FILE * fpir, struct irq_routing_table *rt)
}
fprintf(fpir, "\t}\n");
fprintf(fpir, "};\n");
+
+ fclose(fpir);
}