int main(int argc, char **argv) { // Initialize TIC isr_init(); tic_init(); irq_set_mask(0x000FFFFF); //irq_enable(); // Initialize I2C Core i2c_core_init(0x00, 0xC7); //MPU6050_Initialize(); for(;;) { i2c_write_register(MPU6050_DEFAULT_ADDRESS, MPU6050_RA_WHO_AM_I, 0x00); } //i2c_test(); //spi_test(); //gpio_test(); //uart_test(); //timer_test(); }
int main() { char test2[] = "Lokalerstr"; char *str = test2; uint32_t i; // for (i = 0; i < 4; i++) // test2[i] = 'l'; // glob[0] = 'g'; // Initialize stuff uart_init(); // Say Hello! uart_putstr( "** Spike Test Firmware **\n" ); // Initialize TIC isr_init(); tic_init(); irq_set_mask( 0x00000002 ); irq_enable(); // Say Hello! uart_putstr( "Timer Interrupt instelled.\n" ); // Do some trivial tests uart_putstr( "Subroutine-Return Test: " ); test(); uart_putchar('\n'); uart_putstr( "Local-Pointer Test:" ); for (;*str; str++) { uart_putchar(*str); } uart_putchar('\n'); uart_putstr( "Global-Pointer Test:" ); str = glob; for (;*str; str++) { uart_putchar(*str); } uart_putchar('\n'); uart_putstr( "Stack Pointer : " ); writeint(get_sp()); uart_putchar('\n'); uart_putstr( "Global Pointer: " ); writeint(get_gp()); uart_putchar('\n'); uart_putstr( "Timer Test (1s): " ); for(i=0; i<4; i++) { uart_putstr("tic..."); msleep(1000); } uart_putchar('\n'); uart_putstr( "Timer Interrupt counter: " ); writeint( tic_msec ); uart_putchar('\n'); int val = tic_msec; uart_putstr( "Shift: " ); writeint( val ); uart_putstr(" <-> "); for(i=0; i<32; i++) { if (val & 0x80000000) uart_putchar( '1' ); else uart_putchar( '0' ); val <<= 1; } uart_putstr("\r\n"); uart_putstr( "GPIO Test..." ); gpio0->oe = 0x000000ff; for(;;) { for(i=0; i<8; i++) { uint32_t out1, out2; out1 = 0x01 << i; out2 = 0x80 >> i; gpio0->out = out1 | out2; msleep(100); } } /* uart_putstr( "Memory Dump: " ); uint32_t *start = (uint32_t *)0x40000000; uint32_t *end = (uint32_t *)0x40000100; uint32_t *p; for (p=start; p<end; p++) { if (((uint32_t)p & 12) == 0) { uart_putstr("\r\n["); writeint((uint32_t) p); uart_putchar(']'); } uart_putchar(' '); writeint(*p); } */ uart_putstr("Entering Echo Test...\n"); while (1) { uart_putchar(uart_getchar()); } }