Example #1
0
static void init(void)
{
    /* Enable all the interrupts */
    IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize LED driver */
	LED_INIT();
	/* Initialize system timer */
	timer_init();

	/*
	 * Kernel initialization: processes (allow to create and dispatch
	 * processes using proc_new()).
	 */
	proc_init();

	/* Init spi on dma to drive lcd */
	spi_dma_init(&spi);
	spi_dma_setclock(LCD_SPICLOCK);
	/* Initialize the dispaly */
	lcd_ili9225_init(&spi.fd);
	/* Init the backligth display leds */
	LCD_BACKLIGHT_INIT();
	lcd_setBacklight(LCD_BACKLIGHT_MAX);
	/* Draw an empty Bitmap on the screen */
	gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
	/* Refresh the display */
	lcd_ili9225_blitBitmap(&lcd_bitmap);
	/* Initialize the keypad driver */
	kbd_init();

}
Example #2
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();

	/*
	 * XXX: Arduino has a single UART port that was previously
	 * initialized for debugging purpose.
	 * In order to activate the serial driver you should disable 
	 * the debugging module.
	 */
#if 0
	/* Initialize UART0 */
	ser_init(&out, SER_UART0);
	/* Configure UART0 to work at 115.200 bps */
	ser_setbaudrate(&out, 115200);
#else
	(void)out;
#endif
	/* Initialize LED driver */
	LED_INIT();
}
Example #3
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize LED driver */
	LED_INIT();
	LED_OFF();

	/* Kernel initialization */
	proc_init();

	/* Initialize the serial driver */
	ser_init(&ser_port, SER_UART2);
	/*
	 * Hard-code the baud rate to 115.200 bps.
	 *
	 * TODO: implement the baud rate settings as well as other UART
	 * settings over the USB connection.
	 */
	ser_setbaudrate(&ser_port, 115200);

	/* Initialize usb-serial driver */
	usbser_init(&usb_port, 0);
}
Example #4
0
int afsk_testSetup(void)
{
	kdbg_init();
	kfiledebug_init(&dbg);
	fp_adc = afsk_fileOpen("test/afsk_test.au");
	#if CPU_AVR
		#warning TODO: open the file?
	#else
		fp_dac = fopen("test/afsk_test_out.au", "w+b");
	#endif
	ASSERT(fp_dac);
	#define FS_HH (((uint32_t)CONFIG_AFSK_DAC_SAMPLERATE) >> 24)
	#define FS_HL ((((uint32_t)CONFIG_AFSK_DAC_SAMPLERATE) >> 16) & 0xff)
	#define FS_LH ((((uint32_t)CONFIG_AFSK_DAC_SAMPLERATE) >> 8) & 0xff)
	#define FS_LL (((uint32_t)CONFIG_AFSK_DAC_SAMPLERATE) & 0xff)

	uint8_t snd_header[] = { '.','s','n','d', 0,0,0,24, 0,0,0,0, 0,0,0,2, FS_HH,FS_HL,FS_LH,FS_LL, 0,0,0,1};

	ASSERT(fwrite(snd_header, 1, sizeof(snd_header), fp_dac) == sizeof(snd_header));

	timer_init();
	afsk_init(&afsk_fd, 0 ,0);
	ax25_init(&ax25, &afsk_fd.fd, message_hook);
	return 0;
}
Example #5
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize UART0 */
	ser_init(&out, SER_UART0);
	/* Configure UART0 to work at 115.200 bps */
	ser_setbaudrate(&out, 115200);
	/* Initialize LED driver */
	LED_INIT();

	/*
	 * Kernel initialization: processes (allow to create and dispatch
	 * processes using proc_new()).
	 */
	proc_init();

	/* Initialize TCP/IP stack */
	tcpip_init(NULL, NULL);

	/* Bring up the network interface */
	netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input);
	netif_set_default(&netif);
	netif_set_up(&netif);
}
int main(void)
{
	IRQ_ENABLE;
	kdbg_init();

	#if CONFIG_KERN
	proc_init();
    #endif

	if (!dataflash_testSetup())
	{
			LOG_INFO("DATAFLASH setup..ok\n");
	}
	else
	{
			LOG_ERR("DATAFLASH setup..fail!\n");
			return EOF;
	}

	dataflash_testRun();

	for(;;)
	{
	}
}
Example #7
0
File: main.c Project: mtarek/BeRTOS
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize UART1 */
	ser_init(&out, SER_UART1);
	/* Configure UART1 to work at 115.200 bps */
	ser_setbaudrate(&out, 115200);
	/* Initialize LED driver */
	LED_INIT();
	/* Initialize the OLED display (RIT128x96) */
	rit128x96_init();
	/* Draw an empty Bitmap on the screen */
	gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
	/* Refresh the display */
	rit128x96_blitBitmap(&lcd_bitmap);
	/* Initialize the keypad driver */
	kbd_init();
	/* Initialize the internal flash memory */
	flash_init(&flash, 0);

	/*
	 * Kernel initialization: processes (allow to create and dispatch
	 * processes using proc_new()).
	 */
	proc_init();
}
Example #8
0
File: main.c Project: fantasea/APRS
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize LED driver */
	LED_INIT();

	ser_init(&ser_port, SER_UART2);
	ser_setbaudrate(&ser_port, 115200L);

	afsk_init(&afsk, 0, 0);

	// timer period = 24000000 hz /100/25 = 9600hz
	AD_Init(&afsk);
	AD_SetTimer(100, 25);
	AD_Start();

	DA_Init(&afsk);
	DA_SetTimer(100, 25);

	kiss_init(&ser_port, &ax25, &afsk);

	ax25_init(&ax25, &afsk.fd, 1, ax25_message_callback);
}
Example #9
0
File: main.c Project: mtarek/BeRTOS
static void init(void)
{
	IRQ_ENABLE;
	kdbg_init();

	timer_init();
	LOG_INFO("TIMER init..ok\n");

	/*
	 * Init temperature sensor device.
	 * - init the temperature driver
	 * - init the spi communication channel
	 */
	tmp123_init();
	// Init SPI connected to sensor temperature
	spimaster_init(&temp_sensor_bus, SER_SPI1);
	ser_setbaudrate(&temp_sensor_bus, 1000000L);
	LOG_INFO("TMP123 sensor init..ok\n");

	// Init SPI bus to communicate to SD card
	spi_dma_init(&spi_dma);
	spi_dma_setclock(20000000L);
	LOG_INFO("SD SPI init..ok\n");

	adc_init();
	LOG_INFO("ADC init..ok\n");

}
Example #10
0
int timer_testSetup(void)
{
	IRQ_ENABLE;
	wdt_start(7);
	timer_init();
	kdbg_init();
	return 0;
}
Example #11
0
/**
 * every mod register the window (with type), ui mod provider the frame
 */
int main(int argc, char *argv[])
{
	int retval;

	kdbg_init(DBG_LOG | DBG_ERR | DBG_FAT | DBG_TIME);

	/* Initialize GThread before calling any Glib or GTK+ functions. */
	g_thread_init(NULL);

#ifdef ENABLE_NLS
	bindtextdomain(PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE, "UTF-8");
	textdomain(PACKAGE);
#endif

#ifdef HAVE_SETLOCALE
	/* Locale initialization is not complete here.  See gtk_init_check() */
	setlocale(LC_ALL, "");
#endif

	/* Initialize GThread before calling any Glib or GTK+ functions. */
	// g_thread_init(NULL);

#ifdef ENABLE_NLS
	bindtextdomain(PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE, "UTF-8");
	textdomain(PACKAGE);
#endif

#ifdef HAVE_SETLOCALE
	/* Locale initialization is not complete here.  See gtk_init_check() */
	setlocale(LC_ALL, "");
#endif

	printf("gtk_init(&argc, &argv);\n");
	gtk_init(&argc, &argv);

	printf("KIM *im = kim_new(knil);\n");
	KIM *im = kim_new(knil);
	kim_start(im);

	printf("zuk_init(im, argc, argv);\n");
	zuk_init(im, argc, argv);

	printf("zuk_show(im, argc, argv);\n");
	zuk_show(im, argc, argv);

	printf("gtk_main();\n");
	gtk_main();

	printf("zuk_final(argc, argv);\n");
	zuk_final(im, argc, argv);

	kim_del(im);

	printf("main:: return:%d\n", retval);
	return retval;
}
Example #12
0
static void init(void)
{
	kdbg_init();

	IRQ_ENABLE;

	timer_init();
	LED_INIT();
	lcd_hx8347_init();
}
Example #13
0
int dc_motor_testSetUp(void)
{
	IRQ_ENABLE;
	kdbg_init();
	timer_init();
	proc_init();
	pwm_init();
	adc_init();

	return 0;
}
Example #14
0
static void init(void)
{
	IRQ_ENABLE;
	kdbg_init();
	timer_init();
	kbd_init();
	proc_init();

	PIOA_CODR = LEDR | LEDG | BUZZER_BIT | CUTOFF_PIN | LAND_PIN;
	PIOA_OER = LEDR | LEDG | BUZZER_BIT | CUTOFF_PIN | LAND_PIN;
}
Example #15
0
int msg_testSetup(void)
{
	kdbg_init();

	kprintf("Init Timer..");
	timer_init();
	kprintf("Done.\n");

	kprintf("Init Process..");
	proc_init();
	kprintf("Done.\n");
	return 0;
}
Example #16
0
int dc_motor_testSetUp(void)
{
	IRQ_ENABLE;
	kdbg_init();
	timer_init();
	proc_init();
#if !CFG_PWM_ENABLE_OLD_API
	pwm_init();
#endif
	adc_init();

	return 0;
}
Example #17
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize LED driver */
	LED_INIT();
	/* Enable the WAKE_UP button */
	kbd_init();
	/* Initialize the USB mouse device */
	usbmouse_init(0);
}
Example #18
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize UART0 */
	ser_init(&out, SER_UART0);
	/* Configure UART0 to work at 115.200 bps */
	ser_setbaudrate(&out, 115200);
	/* Initialize LED driver */
	LED_INIT();
}
Example #19
0
/**
 * Initialize the module.  Initialize the following subsystems:
 *
 * - kernel debugging
 * - timer
 * - serial UART0
 * - Bluetooth module
 * - AFSK driver
 * - KISS driver
 *
 * The AFSK module should be initialized after the startup banner is
 * printed to reduce the chance of a buffer overrun.
 */
static void init(void)
{
    IRQ_ENABLE;
    kdbg_init();
    timer_init();

    power_on();

    int hc_status = init_hc05(&ser.fd);

    wdt_location = 0;

    mobilinkd_set_error(MOBILINKD_ERROR_WATCHDOG_TIMEOUT);

    afsk_init(&afsk, ADC_CH, 0);

    wdt_location = 1;

    kiss_init(&kiss, &afsk.fd, &ser.fd);
    wdt_location = 2;

    if (kiss.params.options & KISS_OPTION_VIN_POWER_ON)
    {
        set_power_config(get_power_config() | POWER_ON_VIN_ON);
    }
    if (kiss.params.options & KISS_OPTION_VIN_POWER_OFF)
    {
        set_power_config(get_power_config() | POWER_OFF_VIN_OFF);
    }

    if (kiss.params.options & KISS_OPTION_PTT_SIMPLEX)
    {
        afsk_ptt_set(&afsk, AFSK_PTT_MODE_SIMPLEX);
    }
    else
    {
        afsk_ptt_set(&afsk, AFSK_PTT_MODE_MULTIPLEX);
    }

    power_on_message(hc_status);
    enable_power_off();

    wdt_enable(WDTO_4S);
}
Example #20
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize UART1 */
	ser_init(&out, SER_UART1);
	/* Configure UART1 to work at 115.200 bps */
	ser_setbaudrate(&out, 115200);
	/* Initialize LED driver */
	LED_INIT();

	/*
	 * Kernel initialization: processes (allow to create and dispatch
	 * processes using proc_new()).
	 */
	proc_init();
}
Example #21
0
File: main.c Project: DINKIN/bertos
static void init(void)
{
	IRQ_ENABLE;
	kdbg_init();
	timer_init();

	/*
	 * Init afsk demodulator. We need to implement the macros defined in hw_afsk.h, which
	 * is the hardware abstraction layer.
	 * We do not need transmission for now, so we set transmission DAC channel to 0.
	 */
	afsk_init(&afsk, ADC_CH, 0);
	/*
	 * Here we initialize AX25 context, the channel (KFile) we are going to read messages
	 * from and the callback that will be called on incoming messages.
	 */
	ax25_init(&ax25, &afsk.fd, message_callback);

	/* Initialize serial port, we are going to use it to show APRS messages*/
	ser_init(&ser, SER_UART0);
	ser_setbaudrate(&ser, 115200L);
}
Example #22
0
int main(void)
{
	IRQ_ENABLE;

	kdbg_init();
	LED_INIT();
	timer_init();
	proc_init();

	spi_dma_init(&spi);
	spi_dma_setclock(LCD_SPICLOCK);
	lcd_ili9225_init(&spi.fd);
	LCD_BACKLIGHT_INIT();
	lcd_setBacklight(lcd_brightness);

	gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
	gfx_setFont(&lcd_bitmap, &font_luBS14);
	lcd_ili9225_blitBitmap(&lcd_bitmap);

	kbd_init();

	hp_proc = proc_new(hp_process, NULL, PROC_STACK_SIZE, hp_stack);
	lp_proc = proc_new(lp_process, NULL, PROC_STACK_SIZE, lp_stack);
	led_proc = proc_new(led_process, NULL, PROC_STACK_SIZE, led_stack);

	proc_setPri(hp_proc, 2);
	proc_setPri(lp_proc, 1);

	lcd_ili9225_blitBitmap24(0, 50, BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, bmp_logo);
	timer_delay(3000);

	while (1)
	{
		menu_handle(&main_menu);
		cpu_relax();
	}
}
Example #23
0
registers_t *kinit(mboot_info_t *mboot, uint32_t mboot_magic)
{

  kdbg_init();
  assert(mboot_magic == MBOOT_MAGIC2);

  mboot_mod_t *mods = (mboot_mod_t *)(assert_higher(mboot->mods_addr));

  kernel_elf_init(mboot);
  pmm_init(mboot);
  vmm_init(mods[0].mod_end);
  idt_init();
  tss_init();

  register_int_handler(INT_PF, page_fault_handler);
  register_int_handler(INT_SCHEDULE, switch_kernel_thread);

  scheduler_init();
  timer_init(500);
  /* vfs_init(); */
  syscall_init();
  process_init((void(*)(void))&_idle);

  tar_header_t *tarfs_location = assert_higher((tar_header_t *)mods[0].mod_start);
  debug_enabled = 1;

  debug("[info] Mboot flags %x\n", mboot->mods_addr);
  debug("[info] Mounting tarfs as root\n");
  vfs_init();
  vfs_mount("/", tarfs_init(tarfs_location));
  vfs_mount("/mnt/tarfs", tarfs_init(tarfs_location));
  vfs_mount("/dev/debug", debug_dev_init());
  keyboard_init();

  fopen("/dev/debug", "w");
  fopen("/dev/debug", "w");
  /* for(;;); */

  /* vfs_mount("/", tarfs_init(tarfs_location)); */
  /* keyboard_init(); */
  /* vfs_mount("/dev/debug", debug_dev_init()); */

  /* fopen("/dev/kbd", "r"); */
  /* fopen("/dev/debug", "w"); */
  /* fopen("/dev/debug", "w"); */

  execve("/bin/init",0,0);

  debug("[status]========================\n");
  debug("[status] Os5 by Thomas Lovén\n");
  debug("[status] Kernel git data: [%s (%s)] %s\n", __kernel_git_hash, (__kernel_git_dirty)?"dirty":"clean", __kernel_git_date);
  debug("[status] %s: %s\n", __kernel_git_branch, __kernel_git_message);
  debug("[status] Kernel compilation: %s %s\n", __kernel_build_date, __kernel_build_time);
  debug("[status]========================\n");

  thread_t *init = new_thread((void(*)(void))current->proc->mm.code_entry,1);
  init->proc = current->proc;

  debug("[status] Kernel booted\n");
  return switch_kernel_thread(0);
}
Example #24
0
int blowfish_testSetup(void)
{
	kdbg_init();
	return 0;
}
Example #25
0
static void init(void)
{

    IRQ_ENABLE;

	kdbg_init();
	timer_init();

	/* Initialize serial port, we are going to use it to show APRS messages*/
	ser_init(&g_serial, SER_UART0);
	ser_setbaudrate(&g_serial, SER_DEFAULT_BAUD_RATE);
    // For some reason BertOS sets the serial
    // to 7 bit characters by default. We set
    // it to 8 instead.
    UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); // see ATMEGA328P datasheet P197, Table 20-11. UCSZn Bits Settings

    // initialize the reader that wraps the serial
    serialreader_init(&g_serialreader, &g_serial);

    // Load settings first
    settings_load();

	/*
	 * Init afsk demodulator. We need to implement the macros defined in hw_afsk.h, which
	 * is the hardware abstraction layer.
	 * We do not need transmission for now, so we set transmission DAC channel to 0.
	 */
	afsk_init(&g_afsk, ADC_CH, DAC_CH);

	/*
	 * Here we initialize AX25 context, the channel (KFile) we are going to read messages
	 * from and the callback that will be called on incoming messages.
	 */
	ax25_init(&g_ax25, &g_afsk.fd, ax25_msg_callback);
	g_ax25.pass_through = false;

	// Initialize the kiss module
	// NOTE - use shared memory buffer
#if MOD_KISS
	kiss_init(&g_serialreader,&g_ax25);
#endif

#if MOD_BEACON
	// Initialize the beacon module
    beacon_init(beacon_mode_exit_callback);
#endif

    // Initialize the digi module
#if MOD_DIGI
    digi_init();
#endif

#if MOD_RADIO
    // Initialize the soft serial and radio
    radio_init(4310400); //TODO read from settings
#endif

    // Initialize GPS NMEA/GPRMC parser
#if MOD_TRACKER
    tracker_init();
#endif

#if MOD_CONSOLE
    //////////////////////////////////////////////////////////////
    // Initialize the console & commands
    console_init();
    console_add_command(PSTR("MODE"),cmd_switch_mode);			// setup tnc run mode
#if MOD_KISS
    console_add_command(PSTR("KISS"),cmd_enter_kiss_mode);		// enable KISS mode
#endif
#endif
}
Example #26
0
int omac_testSetup(void)
{
	kdbg_init();
	return 0;
}
Example #27
0
int byteorder_testSetup(void)
{
	kdbg_init();
	return 0;
}
Example #28
0
int MD5_testSetup(void)
{
	kdbg_init();
	return 0;
}
Example #29
0
int sprintf_testSetup(void)
{
	kdbg_init();
	return 0;
}
int hashtable_testSetup(void)
{
    kdbg_init();
    return 0;
}