Ejemplo n.º 1
0
/**
 * @brief This function is the entry point after a system reset
 *
 * After a system reset, the following steps are necessary and carried out:
 * 1. load data section from flash to ram
 * 2. overwrite uninitialized data section (BSS) with zeros
 * 3. initialize the newlib
 * 4. initialize the board (sync clock, setup std-IO)
 * 5. initialize and start RIOTs kernel
 */
void reset_handler(void)
{
    uint32_t *dst;
    uint32_t *src = &_etext;

    /* make sure all RAM blocks are turned on
     * -> see NRF51822 Product Anomaly Notice (PAN) #16 for more details
     */
    NRF_POWER->RAMON = 0xf;

    /* load data section from flash to ram */
    for (dst = &_srelocate; dst < &_erelocate; ) {
        *(dst++) = *(src++);
    }

    /* default bss section to zero */
    for (dst = &_szero; dst < &_ezero; ) {
        *(dst++) = 0;
    }

    /* initialize the board and startup the kernel */
    board_init();
    /* initialize std-c library (this should be done after board_init) */
    __libc_init_array();
    /* startup the kernel */
    kernel_init();
}
Ejemplo n.º 2
0
Archivo: cpu.c Proyecto: jthacker/RIOT
void mips_start(void)
{
    board_init();

    /* kernel_init */
    kernel_init();
}
Ejemplo n.º 3
0
int main(void)
{
	//使用CCM内存
	kernel_init(0x10000000,0x10000);
	kthread_create(init,0,0);
	kernel_start();
}
Ejemplo n.º 4
0
void game_init(void)
{
    kernel_init();
    register_triggers();
    register_xmas();

    register_nr();
    register_cr();
    register_jsreport();

    register_races();
    register_spells();
    register_names();
    register_resources();
    register_buildings();
    register_itemfunctions();
#if MUSEUM_MODULE
    register_museum();
#endif
#if ARENA_MODULE
    register_arena();
#endif
    wormholes_register();

    register_itemtypes();
#ifdef USE_LIBXML2
    register_xmlreader();
#endif
    register_attributes();
    register_gmcmd();

    chaos_register();
}
Ejemplo n.º 5
0
int kernel_start()
{
	int i;

	// point to low address (0GB ~ ...)
	pgd_tmp[PGD_INDEX(0)] =
		(uint32_t)pte_low | PAGE_PRESENT | PAGE_WRITE;

	// point to high address (3GB ~ 4GB)
	pgd_tmp[PGD_INDEX(PAGE_OFFSET)] =
		(uint32_t)pte_hig | PAGE_PRESENT | PAGE_WRITE;

	for (i = 0; i < 1024; i++) {
		pte_low[i] = (i << 12) | PAGE_PRESENT | PAGE_WRITE;
	}

	for (i = 0; i < 1024; i++) {
		pte_hig[i] = (i << 12) | PAGE_PRESENT | PAGE_WRITE;
	}

	// set page directory
	set_cr3(pgd_tmp);
	page_on();

	kernel_stack_top = ((uint32_t)kernel_stack + STACK_SIZE) & 0xFFFFFFF0;

	set_esp(kernel_stack_top);

	global_mboot_ptr = 
		(multiboot_t *)((uint32_t)global_mboot_tmp + PAGE_OFFSET);

	kernel_init();

	return 0;
}
Ejemplo n.º 6
0
void system_init(void *mbp)
{
  /* The interrupt handlers are in the drivers, now!!! */
  /* (and exception handlers are set by kernel_init() */
  mem_init(mbp);
  kernel_init();
}
Ejemplo n.º 7
0
/*******************************************************************************
* Function Name  : Reset_Handler
* Description    : This is the code that gets called when the processor first starts execution
*              following a reset event.  Only the absolutely necessary set is performed,
*              after which the application supplied main() routine is called.
* Input          :
* Output         :
* Return         :
*******************************************************************************/
void Reset_Handler(void)
{
    unsigned long *pulDest;

    /*
     * This used for cleaning AHBRAM0 section
     */
#if 0
    for (pulDest = ((unsigned long *)AHBRAM0_BASE); \
                    pulDest < ((unsigned long *)(AHBRAM0_BASE + AHBRAM0_SIZE)); \
                    pulDest++){
        *(pulDest++) = 0;
    }
#endif

    /*
     * This used for cleaning AHBRAM1 section
     */
#if 0
    for (pulDest = ((unsigned long *)AHBRAM1_BASE); \
                    pulDest < ((unsigned long *)(AHBRAM1_BASE + AHBRAM1_SIZE)); \
                    pulDest++){
        *(pulDest++) = 0;
    }
#endif

    /*
     * Copy the data segment initializers from flash to SRAM in ROM mode
     */
#if (__RAM_MODE__==0)
    unsigned long *pulSrc = &__sidata;
    for(pulDest = &__data_start__; pulDest < &__data_end__; )
    {
        *(pulDest++) = *(pulSrc++);
    }
#endif


    /*
     * Zero fill the bss segment.
     */
    for(pulDest = &__bss_start__; pulDest < &__bss_end__; )
    {
        *(pulDest++) = 0;
    }

    /*
     *  Call IEC60335 CPU register tests POST
     */
    //    __ASM volatile ("bl _CPUregTestPOST \t\n");

    /*
     * Call the application's entry point.
     */
    board_init();
    kernel_init();
}
Ejemplo n.º 8
0
/* called from arch code */
void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3)
{
	// save the boot args
	lk_boot_args[0] = arg0;
	lk_boot_args[1] = arg1;
	lk_boot_args[2] = arg2;
	lk_boot_args[3] = arg3;

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_primary_cpu_init_level(LK_INIT_LEVEL_EARLIEST, LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_ARCH_EARLY, LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_PLATFORM_EARLY, LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

#if WITH_SMP
	dprintf(INFO, "\nwelcome to lk/MP\n\n");
#else
	dprintf(INFO, "\nwelcome to lk\n\n");
#endif
	dprintf(INFO, "boot args 0x%lx 0x%lx 0x%lx 0x%lx\n",
		lk_boot_args[0], lk_boot_args[1], lk_boot_args[2], lk_boot_args[3]);

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_primary_cpu_init_level(LK_INIT_LEVEL_TARGET_EARLY, LK_INIT_LEVEL_HEAP - 1);
	heap_init();

	// initialize the kernel
	lk_primary_cpu_init_level(LK_INIT_LEVEL_HEAP, LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_primary_cpu_init_level(LK_INIT_LEVEL_KERNEL, LK_INIT_LEVEL_THREADING - 1);

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	t->pinned_cpu = 0;
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
Ejemplo n.º 9
0
Archivo: main.c Proyecto: sndnvaps/lk-1
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_init_level(LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_init_level(LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_init_level(LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");
#if WITH_PLATFORM_MSM_SHARED
	bs_set_timestamp(BS_BL_START);
#endif

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_init_level(LK_INIT_LEVEL_HEAP - 1);
	heap_init();

#if WITH_PLATFORM_MSM_SHARED
	__stack_chk_guard_setup();
#endif

	// initialize the kernel
	lk_init_level(LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_init_level(LK_INIT_LEVEL_THREADING - 1);

#if (!ENABLE_NANDWRITE)
	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
#else
	bootstrap_nandwrite();
#endif
}
Ejemplo n.º 10
0
/**
 * @brief System main loop called by the ETS
 *
 * This function is called by ETS after all initializations has been
 * finished to start periodic processing of defined ETS tasks. We
 * overwrite this ETS function to take over the control and to start RIOT.
 */
void ets_run(void)
{
    #if ENABLE_DEBUG
    register uint32_t *sp __asm__ ("a1");
    ets_uart_printf("_stack      %p\n", sp);
    ets_uart_printf("_bss_start  %p\n", &_bss_start);
    ets_uart_printf("_bss_end    %p\n", &_bss_end);
    ets_uart_printf("_heap_start %p\n", &_sheap);
    ets_uart_printf("_heap_end   %p\n", &_eheap);
    ets_uart_printf("_heap_free  %lu\n", get_free_heap_size());
    #endif

    /* init min task priority */
    ets_task_min_prio = 0;

    #ifdef MODULE_NEWLIB_SYSCALLS_DEFAULT
    _init();
    #endif

    ets_tasks_init();

    /* enable interrupts used by ETS/SDK */
    #ifndef MODULE_ESP_SDK_INT_HANDLING
    ets_isr_unmask(BIT(ETS_FRC2_INUM));
    ets_isr_unmask(BIT(ETS_WDEV_INUM));
    ets_isr_unmask(BIT(ETS_WDT_INUM));
    #endif

    #ifdef MODULE_ESP_GDBSTUB
    gdbstub_init();
    #endif

    #if ENABLE_DEBUG==0
    /* disable SDK messages */
    system_set_os_print(0);
    #endif

    #ifdef CONTEXT_SWITCH_BY_INT
    extern void IRAM thread_yield_isr(void* arg);
    ets_isr_attach(ETS_SOFT_INUM, thread_yield_isr, NULL);
    ets_isr_unmask(BIT(ETS_SOFT_INUM));
    #endif

    /* initialize dummy lwIP library to link it even if esp_wifi is not used */
    extern void esp_lwip_init(void);
    esp_lwip_init();

    thread_create(ets_task_stack, sizeof(ets_task_stack),
            ETS_TASK_PRIORITY,
            THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
            ets_task_func, NULL, "ets");


    /* does not return */
    kernel_init();
}
Ejemplo n.º 11
0
__attribute__ ((constructor)) static void startup(void) {
    /* use putchar so the linker links it in: */
    putchar('\n');

    board_init();

    puts("RIOT MSP430 hardware initialization complete.\n");

    kernel_init();
}
Ejemplo n.º 12
0
Archivo: main.c Proyecto: chywoo/vos
void main(void)
{
	kernel_init();

	create_process(ex_ps1);
	create_process(ex_ps2);
	create_process(ex_ps3);

	scheduler();
}
Ejemplo n.º 13
0
Archivo: init.c Proyecto: aunali1/exopc
void init(void) {
        kernel_init();
        xn_init();
        tmplt_init();
	sec_init();
        xr_reset();
#ifndef EXOPC
	disk_init();
#endif
}
Ejemplo n.º 14
0
int main(int argc, char* argv[]) {
  kernel_init();

  int returnVal;

  // Create task with low priority to ensure other initialized tasks are blocked.
  kernel_createtask((int*)&returnVal, 28, (int)task1, 0);

  kernel_runloop();
  return 0;
}
Ejemplo n.º 15
0
/// Called from our bootstub
/// \param mbd Virtual address of Grub multiboot info structure (*? bytes)
/// \param magic Grub boot signature (0x1BADB002) (4 bytes)
void arch_init(multiboot_info_t* mbd, unsigned int magic)
{
	// Create the kernel info build string
	sprintf(kinfo.buildstring, "EOS (Built %s %s using GNU C version %s)", __DATE__, __TIME__, __VERSION__);

	// Low level hardware setup of the interrupt controller and system timer
	pic_init();
	pit_init(100);
	asm ("sti");

	// Clear screen
	tty_clear();
	
	// Parse the command line
	kernel_parse_cmdline((char *)PHYS_VIRT(mbd->cmdline));

	// Now safe to print to the kernel log
	printf("%s\n", kinfo.buildstring);
	kprintf(1, "arch_init(mbd: %08X, magic: %08X)\n", mbd, magic);

	// Read CPU information
	cpu_init();
	
	// Read placement information
	kinfo.start = &_ld_kernel_start;
	kinfo.end = &_ld_kernel_end;
	kinfo.memory = mbd->mem_upper;

	// Read kernel elf headers
	elf_init_kernel(&mbd->u.elf_sec);

	// Read module information
	if (mbd->mods_count > 0)
	{
		kprintf(2, "found %d modules\n", mbd->mods_count);

		// Read multiboot module information
		multiboot_module_t *mod;
		mod = (void *)PHYS_VIRT(mbd->mods_addr);
		
		// Expand kernel end to include the loaded modules
		kinfo.end = (void *)PHYS_VIRT(mod[mbd->mods_count - 1].mod_end);
		
		// The first module is the initfs the rest are drivers
		if (mbd->mods_count > 1)
			arch_init_drivers(&mod[1], mbd->mods_count - 1);
	}
	
	// Start the memory manager
	mm_init(128 * 1024);
	
	dev_init();
	kernel_init();
}
Ejemplo n.º 16
0
void lib_os_init()
{
	kernel_init();

	#ifdef _MESSAGES_F_H
	messages_init();
	#endif

	#ifdef _STDIO_H_
	stdio_init();
	#endif
}
Ejemplo n.º 17
0
void cmain()
{
	bool risu;
	int proc;	
	
	kernel_init();
	video_clear();
	log_message("Welcome into KVM on PitOS Release");
	log_show();
	
	ki_activate_p(umain,100,0,proc, risu);
	if(risu == false) 
		log_message("Non posso Allocare un Processo");
	kernel_go();		
}
Ejemplo n.º 18
0
void main(void)
{
    system_init();
    kernel_init();
    disable_irq();

    while(1)
    {
       backlight_hw_on();
       buttonlight_hw_off();
       sleep(HZ/4);
       backlight_hw_off();
       buttonlight_hw_on();
       sleep(HZ/4);
    }
}
Ejemplo n.º 19
0
//! Kernel entry point.
// --------------------------------
void kernel_main(void* info, void* page_dir)
{
	if(arch_init() != 0)
	{
		return;
	}
	if(kernel_init() != 0)
	{
		return;
	}
	if(kernel_run() != 0)
	{
		kernel_done();
		arch_done();
	}
}
Ejemplo n.º 20
0
void cmain()
{
	bool risu;
	int proc,procHi;

	kernel_init();
	log_message("Welcome into Message Logging for OSSYS");

	ki_activate_p(umain,100,0,proc, risu);
	
	if(risu == false) 
		log_message("Non posso Allocare un Processo");

	kernel_go();
	
}
Ejemplo n.º 21
0
void cop_main(void)
{
/* This is the entry point for the coprocessor
   Anyone not running an upgraded bootloader will never reach this point,
   so it should not be assumed that the coprocessor be usable even on
   platforms which support it.

   A kernel thread is initially setup on the coprocessor and immediately
   destroyed for purposes of continuity. The cop sits idle until at least
   one thread exists on it. */

#if NUM_CORES > 1
    system_init();
    kernel_init();
    /* This should never be reached */
#endif
    while(1) {
        sleep_core(COP);
    }
}
Ejemplo n.º 22
0
/*
 * Target is the dataset whose pool we want to open.
 */
static void
zhack_import(char *target, boolean_t readonly)
{
	nvlist_t *config;
	nvlist_t *props;
	int error;

	kernel_init(readonly ? FREAD : (FREAD | FWRITE));
	g_zfs = libzfs_init();
	ASSERT(g_zfs != NULL);

	dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb);

	g_readonly = readonly;
	g_importargs.unique = B_TRUE;
	g_importargs.can_be_active = readonly;
	g_pool = strdup(target);

	error = zpool_tryimport(g_zfs, target, &config, &g_importargs);
	if (error)
		fatal(NULL, FTAG, "cannot import '%s': %s", target,
		    libzfs_error_description(g_zfs));

	props = NULL;
	if (readonly) {
		VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0);
		VERIFY(nvlist_add_uint64(props,
		    zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0);
	}

	zfeature_checks_disable = B_TRUE;
	error = spa_import(target, config, props,
	    (readonly ?  ZFS_IMPORT_SKIP_MMP : ZFS_IMPORT_NORMAL));
	zfeature_checks_disable = B_FALSE;
	if (error == EEXIST)
		error = 0;

	if (error)
		fatal(NULL, FTAG, "can't import '%s': %s", target,
		    strerror(error));
}
Ejemplo n.º 23
0
int main(void)
{
    SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ
                   | SYSCTL_OSC_MAIN);

    Serial_init(Serial_module_debug, 115200);

    Serial_puts(Serial_module_debug, "Hello, world!\r\n");

    kernel_init(kernel_stack + sizeof(kernel_stack));

    sys_spawn(worker1_main, NULL);
    sys_spawn(worker2_main, NULL);

    while(1)
    {
        sys_yield();
    }

    return 0;
}
Ejemplo n.º 24
0
Archivo: main.c Proyecto: issey1022/os
/*!
 * @brief OSメイン関数
 * @attention CPSRの外部割込み無効モードとして起動
 * @param[in] なし
 * @param[out] なし
 * @return 終了値
 * 	@retval 0:OS実効終了
 * @note 正常retvalは返却されない
 */
int main(void)
{
  
  unsigned long *p;

  /* BSSセクションの初期化(BSSセクションの初期化はここでOK) */
  for (p = &_bss_start; p < &_end; p++) {
    *p = 0;
  }

  uart3_init(); /* シリアルの初期化 */

  KERNEL_OUTMSG("kernel boot OK!\n");

  /* OSの動作開始 */
  kernel_init(start_threads, "init tsk", 0, 0x100, 0, NULL); /* initタスク起動 */
  
  /* 正常ならばここには戻ってこない */

  return 0;
}
Ejemplo n.º 25
0
void energy::Fitting::init(Worker *worker)
{
    this->camera = worker->camera;
    this->offscreenrend = &(worker->offscreenrend);
    this->sensor_depth_texture = worker->sensor_depth_texture;
    this->skeleton = worker->skeleton;
    this->cylinders = worker->cylinders;
    this->handfinder = worker->handfinder;

    ///--- 3D fitting
    tw_settings->tw_add(settings->fit3D_enable,"E_3D (enable)","group=Fitting");
    tw_settings->tw_add(settings->fit3D_weight,"E_3D (weight)","group=Fitting");
    tw_settings->tw_add(settings->fit3D_reweight,"E_3D (l1nrm?)","group=Fitting");
    tw_settings->tw_add(settings->fit3D_backface_check,"E_3D (occlus?)","group=Fitting");
    tw_settings->tw_add(settings->fit3D_point2plane,"E_3D (p2P?)","group=Fitting");
    ///--- 2D fitting
    tw_settings->tw_add(settings->fit2D_enable,"E_2D (enable)","group=Fitting");
    tw_settings->tw_add(settings->fit2D_weight,"E_2D (weight)","group=Fitting");

#ifdef WITH_CUDA
    cudax::CudaHelper::init();
    cudax::CublasHelper::init();

    ///--- Run some tests before we get started
    kernel_memory_tests();

    ///--- Init worker for GPU computation of normals
    distance_transform.init(camera->width(), camera->height());

    ///--- init resource mapper for cuda
    render_color.init(offscreenrend->fb->color_tex_id());
    render_xyz.init(offscreenrend->fb->extra_tex_id());
    render_normals.init(offscreenrend->fb->norms_tex_id());
    sensor_depth.init(sensor_depth_texture->texid());

    // LOG(INFO ) << camera->inv_projection_matrix();
    kernel_init(this->settings, camera->width(), camera->height(), num_thetas, camera->focal_length_x(), camera->focal_length_y(), camera->inv_projection_matrix().data());
    CHECK_ERROR_GL();
#endif
}
Ejemplo n.º 26
0
/**
 * @brief This function is the entry point after a system reset
 *
 * After a system reset, the following steps are necessary and carried out:
 * 1. load data section from flash to ram
 * 2. overwrite uninitialized data section (BSS) with zeros
 * 3. initialize the newlib
 * 4. initialize the board (sync clock, setup std-IO)
 * 5. initialize and start RIOTs kernel
 */
void reset_handler(void)
{
    uint32_t *dst;
    uint32_t *src = &_etext;

    /* load data section from flash to ram */
    for (dst = &_srelocate; dst < &_erelocate; ) {
        *(dst++) = *(src++);
    }

    /* default bss section to zero */
    for (dst = &_szero; dst < &_ezero; ) {
        *(dst++) = 0;
    }

    /* initialize the board and startup the kernel */
    board_init();
    /* initialize std-c library (this should be done after board_init) */
    __libc_init_array();
    /* startup the kernel */
    kernel_init();
}
Ejemplo n.º 27
0
int main(void)
{
    char buf[40];
    char str[32];
    int i=0;
    struct queue_event *ev;

    /* Clear it all! */
    SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);

    /* This enables the serial Rx interrupt, to be able to exit into the
       debugger when you hit CTRL-C */
    SCR1 |= 0x40;
    SCR1 &= ~0x80;
    IPRE |= 0xf000; /* Set to highest priority */

    debugf("OK. Let's go\n");

    kernel_init();

    enable_irq();

    tick_add_task(testfunc);
    
    debugf("sleeping 10s...\n");
    sleep(HZ*10);
    debugf("woke up\n");
    
    queue_init(&main_q);
    
    create_thread(t1, s1, 1024, 0);
    create_thread(t2, s2, 1024, 0);

    while(1)
    {
        ev = queue_wait(&main_q);
        debugf("Thread 0 got an event. ID: %d\n", ev->id);
    }
}
int
main (void)
{
    // Configire LEDS
    pio_config_set (LED0_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED1_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED2_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED3_PIO, PIO_OUTPUT_HIGH);
    
    i2c_slave1 = i2c_slave_init (&i2c_bus_cfg, &i2c_slave1_cfg); // Initialise as I2C slave
    extint1 = extint_init (&extint1_cfg);       // Initialise I2C Interrupt
    
    // Initialise comms_data
    uint8_t cd_photo_ready = 0;
    uint8_t cd_fault = 0;
    comms_data[CD_PHOTO_READY-ARRAY_OFFSET] = &cd_photo_ready;
    comms_data[CD_PHOTO_NEXT_LINE-ARRAY_OFFSET] = image;
    comms_data[CD_FAULT-ARRAY_OFFSET] = &cd_fault;
    
    extint_enable (extint1);    // Enable I2C Interrupt
    tcm8230_init (&cfg);        // Initialise Camera
    kernel_init ();             // Initialise Kernel
    
    // Register Tasks for kernel
    kernel_taskRegister (command_task, COMMAND_TASK, &comms_data, 200);
    kernel_taskRegister (capture_task, CAPTURE_TASK, 0, 500);
    kernel_taskRegister (photo_ready_flash_task, PHOTO_READY_FLASH_TASK, 0, 200);
    
    // Block any currently uneeded task
    kernelTaskBlocked (CAPTURE_TASK);
    kernelTaskBlocked (PHOTO_READY_FLASH_TASK);
    
    
    // Finally start the kernel, no code beyone here will be run
    kernel_start ();

    return 0;
}
Ejemplo n.º 29
0
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	arch_early_init();

	// do any super early platform initialization
	platform_early_init();

	// do any super early target initialization
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	heap_init();

	// initialize the kernel
	kernel_init();

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
Ejemplo n.º 30
-11
int
main ()
{
    pio_config_set (LED_GREEN_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED_ORANGE_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED_RED_PIO, PIO_OUTPUT_HIGH);
    pio_config_set (LED_BLUE_PIO, PIO_OUTPUT_HIGH);

    /* Initialise i2c */
    i2c_motor = i2c_master_init (&i2c_bus_cfg, &i2c_motor_cfg);
    i2c_camera = i2c_master_init (&i2c_bus_cfg, &i2c_camera_cfg);

    /* Initialise bluetooth */
    bluetooth_t btconn = bluetooth_init(115200);
    kernel_init ();
    
    
    kernel_taskRegister (bluetooth_comms_task, BLUETOOTH_COMMS_TASK, btconn, 10);
    kernel_taskRegister (action_commands_task, ACTION_COMMANDS_TASK, btconn, 100);
    
    kernel_start ();
    
    return 0;
   
}