int main () { unsigned long sp; __asm__ volatile ( "mov %%esp,%0\n" :"=m"(sp) : ); //printf ("%x\n",sp); printf ("\n############################\n"); printf ("####### Hello World! #######\n"); printf ("############################\n\n"); while (1) { printf ("$ "); char buffer[80]; read (buffer); if (buffer[0] == 't') sleep_test (); else if (buffer[0] == 'm') mem_test(); else if (buffer[0] == 'r'){ int ret = read(buffer); printf ("\n%i\n", ret); } else printf ("\n%s\n", buffer); } for (;;) ; return 0; }
int main(void) { qm_rtc_config_t rtc_cfg; unsigned int count = 0; /* Maximum number of 3-second iterations. */ const unsigned int loop_max = 5; gpio_init(); gpio_set_out(BOARD_LED_PIN, 0); /* Configure the onboard LED pin. */ /* Clear Screen. */ QM_PUTS("Starting: Power Profiler"); QM_PUTS("Low power mode example."); QM_PRINTF("Increment = %d\n", QM_RTC_ALARM_SECOND(CLK_RTC_DIV_1)); clk_periph_enable(CLK_PERIPH_RTC_REGISTER | CLK_PERIPH_CLK); /* Initialise RTC configuration: Run, but don't interrupt. */ rtc_cfg.init_val = 0; rtc_cfg.alarm_en = 0; rtc_cfg.alarm_val = QM_RTC_ALARM_SECOND(CLK_RTC_DIV_1); rtc_cfg.callback = rtc_example_callback; rtc_cfg.prescaler = CLK_RTC_DIV_1; qm_rtc_set_config(QM_RTC_0, &rtc_cfg); qm_irq_request(QM_IRQ_RTC_0_INT, qm_rtc_0_isr); test_clock_rates(); /* Enable the RTC Interrupt. */ rtc_cfg.alarm_en = 1; qm_rtc_set_config(QM_RTC_0, &rtc_cfg); count = 0; while (++count < loop_max) { QM_PRINTF("\nC:%d R:%d => ", count, rtc_tick); slow_mode_test(); halt_test(); sleep_test(); #if DEEP_SLEEP deep_sleep_test(); #endif } QM_PUTS("Finished: Power Profiler"); return 0; }
void kernel_main(uint32_t arg) { volatile int gdb = 1; serial_init(); printf(" | ___| \n"); printf(" __| _ \\ | _ \\ __ \\ \n"); printf("\\__ \\ ( | | ( | ) | \n"); printf("____/\\___/ _|\\___/____/ \n"); if (!gdb) printk("looping for gdb\n"); while ( gdb == 0 ); /* needs to be very early as it clears the bss */ mem_init((struct multiboot_info *)((uint64_t)arg)); interrupts_init(); /* ocaml needs floating point */ sse_enable(); time_init(); pci_enumerate(); interrupts_enable(); #if 0 gdb = 0; gdb = 10/gdb; #endif blk_test(); sleep_test(); for(;;) ping_serve(); /* does things if network packet comes in */ printf("Kernel done. \nGoodbye!\n"); kernel_hang(); }
void machdep_init (void) { static int done = 0; if (!done) { rpt_available = 1; write_log ("Calibrating timebase: "); flush_log (); loops_to_go = 5; sync (); last_time = read_processor_time (); uae_msleep (loops_to_go * 1000); best_time = read_processor_time () - last_time; syncbase = best_time / loops_to_go; write_log ("%.6f MHz\n", (double) syncbase / 1000000); sleep_test(); done = 1; } }
static void real_main2 (int argc, char **argv) { #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) extern int EvalException ( LPEXCEPTION_POINTERS blah, int n_except ); __try #endif { if (! graphics_setup ()) { exit (1); } if (restart_config[0]) { #ifdef FILESYS free_mountinfo (currprefs.mountinfo); currprefs.mountinfo = alloc_mountinfo (); #endif default_prefs (&currprefs, 0); fix_options (); } #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef FILESYS rtarea_init (); hardfile_install (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; uae_inithrtimer (); sleep_test (); machdep_init (); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; if (! no_gui) { int err = gui_init (); struct uaedev_mount_info *mi = currprefs.mountinfo; currprefs = changed_prefs; currprefs.mountinfo = mi; if (err == -1) { write_log ("Failed to initialize the GUI\n"); if (restart_program == 3) { restart_program = 0; return; } } else if (err == -2) { restart_program = 0; return; } } restart_program = 0; #ifdef JIT if (!(( currprefs.cpu_level >= 2 ) && ( currprefs.address_space_24 == 0 ) && ( currprefs.cachesize ))) canbang = 0; #endif #ifdef _WIN32 logging_init(); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #endif fix_options (); changed_prefs = currprefs; #ifdef SAVESTATE savestate_init (); #endif #ifdef SCSIEMU scsidev_install (); #endif #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif memory_init (); memory_reset (); #ifdef FILESYS filesys_install (); #endif #ifdef AUTOCONFIG bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); #endif if (custom_init ()) { /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif #ifdef WIN32 #ifdef FILESYS filesys_init (); /* New function, to do 'add_filesys_unit()' calls at start-up */ #endif #endif if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } start_program (); } } } #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) __except( EvalException( GetExceptionInformation(), GetExceptionCode() ) ) { // EvalException does the good stuff... } #endif }
int test_inner(void) { pj_caching_pool caching_pool; const char *filename; int line; int rc = 0; mem = &caching_pool.factory; pj_log_set_level(3); pj_log_set_decor(param_log_decor); rc = pj_init(); if (rc != 0) { app_perror("pj_init() error!!", rc); return rc; } //pj_dump_config(); pj_caching_pool_init( &caching_pool, NULL, 0 ); #if INCLUDE_ERRNO_TEST DO_TEST( errno_test() ); #endif #if INCLUDE_EXCEPTION_TEST DO_TEST( exception_test() ); #endif #if INCLUDE_OS_TEST DO_TEST( os_test() ); #endif #if INCLUDE_RAND_TEST DO_TEST( rand_test() ); #endif #if INCLUDE_LIST_TEST DO_TEST( list_test() ); #endif #if INCLUDE_POOL_TEST DO_TEST( pool_test() ); #endif #if INCLUDE_POOL_PERF_TEST DO_TEST( pool_perf_test() ); #endif #if INCLUDE_STRING_TEST DO_TEST( string_test() ); #endif #if INCLUDE_FIFOBUF_TEST DO_TEST( fifobuf_test() ); #endif #if INCLUDE_RBTREE_TEST DO_TEST( rbtree_test() ); #endif #if INCLUDE_HASH_TEST DO_TEST( hash_test() ); #endif #if INCLUDE_TIMESTAMP_TEST DO_TEST( timestamp_test() ); #endif #if INCLUDE_ATOMIC_TEST DO_TEST( atomic_test() ); #endif #if INCLUDE_MUTEX_TEST DO_TEST( mutex_test() ); #endif #if INCLUDE_TIMER_TEST DO_TEST( timer_test() ); #endif #if INCLUDE_SLEEP_TEST DO_TEST( sleep_test() ); #endif #if INCLUDE_THREAD_TEST DO_TEST( thread_test() ); #endif #if INCLUDE_SOCK_TEST DO_TEST( sock_test() ); #endif #if INCLUDE_SOCK_PERF_TEST DO_TEST( sock_perf_test() ); #endif #if INCLUDE_SELECT_TEST DO_TEST( select_test() ); #endif #if INCLUDE_UDP_IOQUEUE_TEST DO_TEST( udp_ioqueue_test() ); #endif #if PJ_HAS_TCP && INCLUDE_TCP_IOQUEUE_TEST DO_TEST( tcp_ioqueue_test() ); #endif #if INCLUDE_IOQUEUE_PERF_TEST DO_TEST( ioqueue_perf_test() ); #endif #if INCLUDE_IOQUEUE_UNREG_TEST DO_TEST( udp_ioqueue_unreg_test() ); #endif #if INCLUDE_ACTIVESOCK_TEST DO_TEST( activesock_test() ); #endif #if INCLUDE_FILE_TEST DO_TEST( file_test() ); #endif #if INCLUDE_SSLSOCK_TEST DO_TEST( ssl_sock_test() ); #endif #if INCLUDE_ECHO_SERVER //echo_server(); //echo_srv_sync(); udp_echo_srv_ioqueue(); #elif INCLUDE_ECHO_CLIENT if (param_echo_sock_type == 0) param_echo_sock_type = pj_SOCK_DGRAM(); echo_client( param_echo_sock_type, param_echo_server, param_echo_port); #endif goto on_return; on_return: pj_caching_pool_destroy( &caching_pool ); PJ_LOG(3,("test", "")); pj_thread_get_stack_info(pj_thread_this(), &filename, &line); PJ_LOG(3,("test", "Stack max usage: %u, deepest: %s:%u", pj_thread_get_stack_max_usage(pj_thread_this()), filename, line)); if (rc == 0) PJ_LOG(3,("test", "Looks like everything is okay!..")); else PJ_LOG(3,("test", "Test completed with error(s)")); pj_shutdown(); return 0; }