static int __init CONSOLE_setup(char *str) { /* * 2.4 does not want the /dev/ options on the front */ if (strncmp(str, "/dev/", 5) == 0) return(console_setup(str + 5)); return(console_setup(str)); }
static int __init early_printk_setup(char* arg) { /* early printk only works for serial ports now */ console_setup(arg); serial_console_init(); printk( "early printk enabled \n" ); return 1; }
static int general_setup(void) { int i; maths_setup(); config_setup(); screen_w = cfgnum("screen.width", 800); screen_h = cfgnum("screen.height", 600); if (cfgnum("fullscreen", 0) == 1) displayflags |= SDL_FULLSCREEN; sprite_global.opt_alpha = cfgnum("alpha", 0); i = SDL_Init(SDL_INITFLAGS); assert(i == 0); atexit(atexit_cleanup); SDL_WM_SetCaption(VERSIONSTRING, 0); sprite_global.display = SDL_SetVideoMode(screen_w, screen_h, 0, displayflags); assert(sprite_global.display); SDL_ShowCursor(SDL_DISABLE); if (cfgnum("sound", 0) == 1) { sound_setup(); /* place the ear on the ground, in the center */ sound_move_ear(screen_w / 2, screen_h); } sprite_setup(); text_setup(); console_setup(); console_set_pos(9, 254); console_load_bg(path_to_data("console-bg.png")); sprite_types_setup(); char bg1[255]; char bg2[255]; sprintf(bg1,"data/bg%d.png",screen_w); sprintf(bg2,"data/bgmask%d.png",screen_w); sprite_background_load(bg1, bg2); level_setup(); winds_setup(); return 0; }
void ardutouch_setup( Synth *x ) { synth = x; // set global ptr to runtime synth console_setup( (Mode *) x ); // initialize console module audio_setup(); // initialize audio module bufsPerScan = audioRate / (scanRate * audioBufSz); scanDC = bufsPerScan; /* initialize buttons */ for ( byte i = 0; i < NumButs; i++ ) pinMode( butPin[i], INPUT ); // set corresponding digital pin as input /* get initial positions of pots */ for ( byte i = 0; i < NumPots; i++ ) #ifdef CLOCKWISE_POTS potVal[i] = analogRead( potPin[i] ); #else potVal[i] = 1023 - analogRead( potPin[i] ); #endif #ifndef USE_SERIAL_PORT /* initialize LEDs */ for ( byte i = 0; i < NumLEDs; i++ ) { pinMode( LEDPin[i], OUTPUT ); digitalWrite( LEDPin[i], LED_OFF ); } #endif x->config(); // configure the synth x->reset(); // reset the synth audio::enable(); // enable audio output x->welcome(); // execute any post-reset code #ifdef AUTO_METRICS // for developers only! audio::wait(100); // run the synth for a bit writeMetrics(); // write processor metrics to NVS #endif }
void __init ti_avalanche_setup(void) { #ifdef CONFIG_REMOTE_DEBUG int rs_putDebugChar(char); char rs_getDebugChar(void); // int saa9730_putDebugChar(char); // char saa9730_getDebugChar(void); int evm3_putDebugChar(char); int evm3_getDebugChar(void); extern int (*putDebugChar)(char); extern char (*getDebugChar)(void); #endif char *argptr; static char *nfs_ptr; static char *ip_ptr; // JAH_TBD // ioport_resource.end = 0x7fffffff; #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { int i = 0; char *s = prom_getenv("modetty0"); while(s[i] >= '0' && s[i] <= '9') i++; strcpy(serial_console, "ttyS0,"); strncpy(serial_console + 6, s, i); prom_printf("Config serial console: %s\n", serial_console); console_setup(serial_console); } #endif /* CONFIG_SERIAL_CONSOLE */ #ifdef CONFIG_REMOTE_DEBUG argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); rs_kgdb_hook(line); putDebugChar = rs_putDebugChar; getDebugChar = rs_getDebugChar; prom_printf("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints and stuff are in atlas_irq_setup() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) mips_cpu.options &= ~MIPS_CPU_FPU; /* * Add nfsroot and IP enviroment variables to the cmdline. * these are stored in the ADAM2 enviroment space in the * following manner: * * for nfsroot: * nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] * * * for ipaddress * ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> * * Note that if the Adam2 enviroment contains nfs set to "yes" the * following code will also add the root=/dev/nfs automatically. * * (see Documentation/nfsroot.txt for more information) */ argptr = prom_getcmdline(); nfs_ptr = prom_getenv("nfs"); if(nfs_ptr) { if(!strncmp(nfs_ptr,"yes",3)) { strcat(argptr,"root=/dev/nfs "); argptr = prom_getcmdline(); nfs_ptr = prom_getenv("nfsroot"); strcat(argptr,nfs_ptr); strcat(argptr," "); } } ip_ptr = prom_getenv("linuxip"); argptr = prom_getcmdline(); if(ip_ptr) { strcat(argptr,ip_ptr); } avalanche_soc_platform_init(); #if defined(CONFIG_MIPS_EVM3) rtc_ops = &evm3_rtc_ops; #else rtc_ops = &no_rtc_ops; #endif /* CONFIG_MIPS_EVM3 */ mips_reboot_setup(); }
void __init rt2880_setup(void) { #ifdef CONFIG_KGDB int rs_putDebugChar(char); char rs_getDebugChar(void); int saa9730_putDebugChar(char); char saa9730_getDebugChar(void); extern int (*generic_putDebugChar)(char); extern char (*generic_getDebugChar)(void); #endif char *argptr; iomem_resource.start = 0; iomem_resource.end= ~0; ioport_resource.start= 0; ioport_resource.end = ~0; #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS")) == NULL) { int i = 0; char *s =(char *) prom_getenv("modetty0"); while(s[i] >= '0' && s[i] <= '9') i++; #ifdef CONFIG_RALINK_MT7620 strcpy(serial_console, "ttyS0,"); #else strcpy(serial_console, "ttyS1,"); #endif strncpy(serial_console + 6, s, i); printk("Config serial console: %s\n", serial_console); console_setup(serial_console, NULL); } #endif #ifdef CONFIG_KGDB argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); if(line == 0) { rs_kgdb_hook(line); generic_putDebugChar = rs_putDebugChar; generic_getDebugChar = rs_getDebugChar; } else { saa9730_kgdb_hook(); generic_putDebugChar = saa9730_putDebugChar; generic_getDebugChar = saa9730_getDebugChar; } printk("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints and stuff are in surfboard_irq_setup() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) cpu_data[0].options &= ~MIPS_CPU_FPU; board_time_init = mips_time_init; mips_reboot_setup(); }
__initfunc(void sgi_setup(void)) { #ifdef CONFIG_SERIAL_CONSOLE char *ctype; #endif #ifdef CONFIG_REMOTE_DEBUG char *kgdb_ttyd; #endif irq_setup = sgi_irq_setup; /* Init the INDY HPC I/O controller. Need to call this before * f*****g with the memory controller because it needs to know the * boardID and whether this is a Guiness or a FullHouse machine. */ sgihpc_init(); /* Init INDY memory controller. */ sgimc_init(); /* Now enable boardcaches, if any. */ indy_sc_init(); #ifdef CONFIG_SERIAL_CONSOLE /* ARCS console environment variable is set to "g?" for * graphics console, it is set to "d" for the first serial * line and "d2" for the second serial line. */ ctype = prom_getenv("console"); if(*ctype == 'd') { if(*(ctype+1)=='2') console_setup ("ttyS1", NULL); else console_setup ("ttyS0", NULL); } #endif #ifdef CONFIG_REMOTE_DEBUG kgdb_ttyd = prom_getcmdline(); if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) { int line; kgdb_ttyd += strlen("kgdb=ttyd"); if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2') printk("KGDB: Uknown serial line /dev/ttyd%c, " "falling back to /dev/ttyd1\n", *kgdb_ttyd); line = *kgdb_ttyd == '2' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyd%d for session\n", line ? 1 : 2); rs_kgdb_hook(line); prom_printf("KGDB: Using serial line /dev/ttyd%d for session, " "please connect your debugger\n", line ? 1 : 2); remote_debug = 1; /* Breakpoints and stuff are in sgi_irq_setup() */ } #endif #ifdef CONFIG_SGI_PROM_CONSOLE console_setup("ttyS0", NULL); #endif sgi_volume_set(simple_strtoul(prom_getenv("volume"), NULL, 10)); #ifdef CONFIG_VT #ifdef CONFIG_SGI_NEWPORT_CONSOLE conswitchp = &newport_con; #else conswitchp = &dummy_con; #endif #endif rtc_ops = &indy_rtc_ops; kbd_ops = &sgi_kbd_ops; #ifdef CONFIG_PSMOUSE aux_device_present = 0xaa; #endif #ifdef CONFIG_VIDEO_VINO init_vino(); #endif }
void __init atlas_setup(void) { #ifdef CONFIG_REMOTE_DEBUG int rs_putDebugChar(char); char rs_getDebugChar(void); int saa9730_putDebugChar(char); char saa9730_getDebugChar(void); extern int (*generic_putDebugChar)(char); extern char (*generic_getDebugChar)(void); #endif char *argptr; ioport_resource.end = 0x7fffffff; #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { int i = 0; char *s = prom_getenv("modetty0"); while(s[i] >= '0' && s[i] <= '9') i++; strcpy(serial_console, "ttyS0,"); strncpy(serial_console + 6, s, i); prom_printf("Config serial console: %s\n", serial_console); console_setup(serial_console, NULL); } #endif #ifdef CONFIG_REMOTE_DEBUG argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); if(line == 0) { rs_kgdb_hook(line); generic_putDebugChar = rs_putDebugChar; generic_getDebugChar = rs_getDebugChar; } else { saa9730_kgdb_hook(); generic_putDebugChar = saa9730_putDebugChar; generic_getDebugChar = saa9730_getDebugChar; } prom_printf("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints and stuff are in atlas_irq_setup() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) mips_cpu.options &= ~MIPS_CPU_FPU; rtc_ops = &atlas_rtc_ops; board_time_init = mips_time_init; board_timer_setup = mips_timer_setup; rtc_get_time = mips_rtc_get_time; mips_reboot_setup(); }
int main(void) { if (DFU_AVAILABLE) { DFU_maybe_jump_to_bootloader(); } clock_setup(); tick_setup(1000); gpio_setup(); led_num(0); if (CDC_AVAILABLE) { console_setup(DEFAULT_BAUDRATE); } if (SEMIHOSTING) { initialise_monitor_handles(); } else if (VCDC_AVAILABLE) { retarget(STDOUT_FILENO, VIRTUAL_USART); retarget(STDERR_FILENO, VIRTUAL_USART); } else if (CDC_AVAILABLE) { retarget(STDOUT_FILENO, CONSOLE_USART); retarget(STDERR_FILENO, CONSOLE_USART); } led_num(1); { char serial[USB_SERIAL_NUM_LENGTH+1]; desig_get_unique_id_as_string(serial, USB_SERIAL_NUM_LENGTH+1); cmp_set_usb_serial_number(serial); } usbd_device* usbd_dev = cmp_usb_setup(); DAP_app_setup(usbd_dev, &on_dfu_request); if (CDC_AVAILABLE) { cdc_uart_app_setup(usbd_dev, &on_usb_activity, &on_usb_activity); } if (VCDC_AVAILABLE) { vcdc_app_setup(usbd_dev, &on_usb_activity, &on_usb_activity); } if (DFU_AVAILABLE) { dfu_setup(usbd_dev, &on_dfu_request); } tick_start(); /* Enable the watchdog to enable DFU recovery from bad firmware images */ iwdg_set_period_ms(1000); iwdg_start(); while (1) { iwdg_reset(); usbd_poll(usbd_dev); if (CDC_AVAILABLE) { cdc_uart_app_update(); } if (VCDC_AVAILABLE) { vcdc_app_update(); } // Handle DAP bool dap_active = DAP_app_update(); if (dap_active) { usb_timer = 1000; } else if (do_reset_to_dfu && DFU_AVAILABLE) { /* Blink 3 times to indicate reset */ int x; for (x=0; x < 3; x++) { iwdg_reset(); led_num(7); wait_ms(150); led_num(0); wait_ms(150); iwdg_reset(); } DFU_reset_and_jump_to_bootloader(); } if (usb_timer > 0) { usb_timer--; LED_ACTIVITY_OUT(1); } else { LED_ACTIVITY_OUT(0); } } return 0; }
void __init malta_setup(void) { #ifdef CONFIG_REMOTE_DEBUG int rs_putDebugChar(char); char rs_getDebugChar(void); extern int (*putDebugChar)(char); extern char (*getDebugChar)(void); #endif char *argptr; int i; current_cpu_data.asid_cache = ASID_FIRST_VERSION; TLBMISS_HANDLER_SETUP(); irq_setup = malta_irq_setup; /* Request I/O space for devices used on the Malta board. */ for (i = 0; i < STANDARD_IO_RESOURCES; i++) request_resource(&ioport_resource, standard_io_resources+i); /* * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge. */ enable_dma(4); #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { int i=0; char *s = prom_getenv("modetty0"); while(s[i] >= '0' && s[i] <= '9') i++; strcpy(serial_console, "ttyS0,"); strncpy(serial_console + 6, s, i); prom_printf("Config serial console: %s\n", serial_console); console_setup(serial_console, NULL); } #endif #ifdef CONFIG_REMOTE_DEBUG argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); rs_kgdb_hook(line); putDebugChar = rs_putDebugChar; getDebugChar = rs_getDebugChar; prom_printf("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints and stuff are in malta_irq_setup() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) mips_cpu.options &= ~MIPS_CPU_FPU; rtc_ops = &malta_rtc_ops; #ifdef CONFIG_BLK_DEV_IDE ide_ops = &std_ide_ops; #endif #ifdef CONFIG_BLK_DEV_FD fd_ops = &std_fd_ops; #endif }