void StoredFilter_Start(void) { Leds_SetLeds(0x4); CMU_ClockEnable(cmuClock_USART2, true); CMU_ClockEnable(cmuClock_GPIO, true); SPI_setup(2, 0, true); setupMEM(); setupFPGA(); setupSD(); done = false; setupTimer(); FPGA_Enable(); while(1) { if (done) break; } FPGA_Disable(); TIMER_Enable( TIMER0, false ); TIMER_Reset( TIMER0 ); FPGADriver_Destroy(); SDDriver_Finalize(); MEM_Destroy(); }
int main(int argc, char** argv) { struct file_ops_t *fo1; struct file_ops_t *fo2; struct memory_t *mem1; struct memory_t *mem2; uint16_t chunk = 128; char *filename; uint32_t max; if (argc < 2) { printf("too few arguments\n"); printf("%s [type:]filename [[type:]filename]\n", argv[0]); printf(" type is either HEX or BIN, case insensitive\n\n"); printf(" If second file is present both files are printed and compared\n"); printf(" else only first file is printed\n"); exit(-1); } if (argc > 1) { if (argv[1][0] == 'C') { chunk = atoi(&argv[1][1]); /* hack */ argc--; argv++; } } if (argc > 1) { mem1 = MEM_Init(chunk, 1); parse_file(argv[1], &fo1, &filename); max = fo1->ReadFile(filename, mem1); printf("Filename: %s\n", filename); MEM_Print(mem1); } if (argc > 2) { mem2 = MEM_Init(chunk, 1); parse_file(argv[2], &fo2, &filename); max = fo2->ReadFile(filename, mem2); printf("\n\nFilename: %s\n", filename); MEM_Print(mem2); printf("\nComparing files...\n"); if (MEM_Compare(mem1, mem2)) { // mem_compare is verbose enough ;) //printf("Differ\n"); } else { printf("Same\n"); } MEM_Destroy(mem2); } MEM_Destroy(mem1); }