default: rlink_speed_table.c clean
-%_init.fsm: init.m4
+%_init.fsm: rlink_init.m4
${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
-%_call.fsm: call.m4
+%_call.fsm: rlink_call.m4
${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
%.dtc: %.fsm
#endif
#include "rlink.h"
-#include "st7.h"
+#include "rlink_st7.h"
HEADER
$bytes =~ s/(^|\s)(.{70}?\S*)/\2\n/go; # break up long lines
$bytes =~ s/\n +/\n/go;
$bytes =~ s/(^|\n)/\1\t/go; # format nicely
- printf("static const u8 dtc_%d[] = {\n%s\n};\n\n", $prescaler, $bytes);
+ printf("static const uint8_t dtc_%d[] = {\n%s\n};\n\n", $prescaler, $bytes);
push(@speed_table, sprintf("\tdtc_%d, sizeof(dtc_%d), (ST7_FOSC * 2) / (1000 * %d), %d\n", $prescaler, $prescaler, $prescaler, $prescaler));
}
-printf("const rlink_speed_table_t rlink_speed_table[] = {{\n%s}};\n\n", join("}, {\n", @speed_table));
-printf("const size_t rlink_speed_table_size = sizeof(rlink_speed_table) / sizeof(*rlink_speed_table);\n\n");
+printf("const struct rlink_speed_table rlink_speed_table[] = { {\n%s} };\n\n", join("}, {\n", @speed_table));
+printf("const size_t rlink_speed_table_size = ARRAY_SIZE(rlink_speed_table);\n\n");
sub byte_array_from_file {