Example #1
0
int main(void) {
    // leds:
    led_init();

    // init clock sources:
    clocksource_init();

    // init ios
    io_init();

    // init debug
    debug_init();

    // init wdt timer
    wdt_init();

    // enable timeout routines
    timeout_init();

    // init storage
    storage_init();

    // init frsky core
    frsky_init();

    // init adc
    adc_init();

    // init output
#ifdef SBUS_ENABLED
    sbus_init();
#else  // SBUS_ENABLED
    ppm_init();
#endif  // SBUS_ENABLED

    // init failsafe
    failsafe_init();

    // init telemetry
    telemetry_init();

    // run main
    debug("main: init done\n");

    // frsky_frame_sniffer();
    frsky_main();

    debug("main: frsky main ended?! THIS SHOULD NOT HAPPEN!");
    while (1) {}
}
Example #2
0
void
machdep(void)
{
    pdc_init();
#ifdef notyet
    debug_init();
#endif
    cninit();

#ifdef PDCDEBUG
    if (debug) {
        int i;

        printf("SSTOR:\n");
        printf("pri_boot=");
        DEVPATH_PRINT(&sstor.ss_pri_boot);
        printf("alt_boot=");
        DEVPATH_PRINT(&sstor.ss_alt_boot);
        printf("console =");
        DEVPATH_PRINT(&sstor.ss_console);
        printf("keyboard=");
        DEVPATH_PRINT(&sstor.ss_keyboard);
        printf("mem=%d, fn=%s, osver=%d\nos={",
               sstor.ss_fast_size, sstor.ss_filenames,
               sstor.ss_os_version);
        for (i = 0; i < sizeof(sstor.ss_os); i++)
            printf ("%x%c", sstor.ss_os[i], (i%8)? ',' : '\n');

        printf("}\nPAGE0:\n");
        printf("ivec=%x, pf=%p[%u], toc=%p[%u], rndz=%p, clk/10ms=%u\n",
               PAGE0->ivec_special, PAGE0->ivec_mempf,
               PAGE0->ivec_mempflen, PAGE0->ivec_toc,
               PAGE0->ivec_toclen, PAGE0->ivec_rendz,
               PAGE0->mem_10msec);
        printf ("mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
                "cpu_hpa=%x, pdc=%p, imm_hpa=%p[%u,%u], soft=%u\n",
                PAGE0->memc_cont, PAGE0->memc_phsize, PAGE0->memc_adsize,
                PAGE0->memc_resv, PAGE0->mem_free, PAGE0->mem_hpa,
                PAGE0->mem_pdc, PAGE0->imm_hpa, PAGE0->imm_spa_size,
                PAGE0->imm_max_mem, PAGE0->imm_soft_boot);

        printf("console:  ");
        PZDEV_PRINT(&PAGE0->mem_cons);
        printf("boot:     ");
        PZDEV_PRINT(&PAGE0->mem_boot);
        printf("keyboard: ");
        PZDEV_PRINT(&PAGE0->mem_kbd);
    }
#endif
}
Example #3
0
// application entry point
int main () {
    osjob_t initjob;

    // initialize runtime env
    os_init();
    // initialize debug library
    debug_init();
    // setup initial job
    os_setCallback(&initjob, initfunc);
    // execute scheduled jobs and events
    os_runloop();
    // (not reached)
    return 0;
}
Example #4
0
/* get the flags to use for a given channel, possibly setting them too in case of lazy init */
unsigned char __tgmlog_dbg_get_channel_flags( struct __tgmlog_debug_channel *channel )
{
	if (nb_debug_options == -1) debug_init();

	if (nb_debug_options)
	{
		struct __tgmlog_debug_channel *opt = bsearch( channel->name, debug_options, nb_debug_options,
			sizeof(debug_options[0]), cmp_name );
		if (opt) return opt->flags;
	}
	/* no option for this channel */
	if (channel->flags & (1 << __TGMLOG_DBCL_INIT)) channel->flags = default_flags;
	return default_flags;
}
Example #5
0
File: init.c Project: xcodevn/rxv6
void i386_init() {

	extern char edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	// memset(edata, 0, end - edata);

  debug_init();

  // call `main` function written in Rust
   main();
}
Example #6
0
void
machdep()
{
	pdc_init();
#ifdef notyet
	debug_init();
#endif
	cninit();

#ifdef PDCDEBUG
	if (debug) {
		printf("SSTOR:\n");
		printf("pri_boot=");	DEVPATH_PRINT(&sstor.ss_pri_boot);
		printf("alt_boot=");	DEVPATH_PRINT(&sstor.ss_alt_boot);
		printf("console =");	DEVPATH_PRINT(&sstor.ss_console);
		printf("keyboard=");	DEVPATH_PRINT(&sstor.ss_keyboard);
		printf("mem=%d, fn=%s, osver=%d\n"
		       "os={%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\n"
		           "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x}\n",
		       sstor.ss_fast_size, sstor.ss_filenames,
		       sstor.ss_os_version,
		       sstor.ss_os[0], sstor.ss_os[1], sstor.ss_os[2],
		       sstor.ss_os[3], sstor.ss_os[4], sstor.ss_os[5],
		       sstor.ss_os[6], sstor.ss_os[7], sstor.ss_os[8],
		       sstor.ss_os[9], sstor.ss_os[10], sstor.ss_os[11],
		       sstor.ss_os[12], sstor.ss_os[13], sstor.ss_os[14],
		       sstor.ss_os[15], sstor.ss_os[16], sstor.ss_os[17],
		       sstor.ss_os[18], sstor.ss_os[19], sstor.ss_os[20],
		       sstor.ss_os[21]);

		printf("PAGE0:\n");
		printf("ivec=%x, pf=%p[%u], toc=%p[%u], rendz=%p\n"
		       "mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
		       "cpu_hpa=%p, pdc=%p, imm_hpa=%p[%u,%u]\n"
		       "soft=%u, tic/10ms=%u\n",
		       PAGE0->ivec_special, PAGE0->ivec_mempf,
		       PAGE0->ivec_mempflen, PAGE0->ivec_toc,
		       PAGE0->ivec_toclen, PAGE0->ivec_rendz,
		       PAGE0->memc_cont, PAGE0->memc_phsize, PAGE0->memc_adsize,
		       PAGE0->memc_resv, PAGE0->mem_free, PAGE0->mem_hpa,
		       PAGE0->mem_pdc, PAGE0->imm_hpa, PAGE0->imm_spa_size,
		       PAGE0->imm_max_mem, PAGE0->imm_soft_boot,
		       PAGE0->mem_10msec);
		printf("console:  ");	PZDEV_PRINT(&PAGE0->mem_cons);
		printf("boot:     ");	PZDEV_PRINT(&PAGE0->mem_boot);
		printf("keyboard: ");	PZDEV_PRINT(&PAGE0->mem_kbd);
	}
#endif
}
Example #7
0
void startup(void)
{
#ifdef DEBUG
	debug_init();
#endif
	board_init();
	system_initial();
	__goto_psp_mode();
	system_thread_create();
	__goto_user_mode();
	user_thread_create();
	thread_start();
	
	while(1);
}
Example #8
0
File: rddbg.c Project: CromFr/gdb
void *
read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_messages)
{
  void *dhandle;
  bfd_boolean found;

  dhandle = debug_init ();
  if (dhandle == NULL)
    return NULL;

  if (! read_section_stabs_debugging_info (abfd, syms, symcount, dhandle,
					   &found))
    return NULL;

  if (bfd_get_flavour (abfd) == bfd_target_aout_flavour)
    {
      if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle,
					      &found))
	return NULL;
    }

  if (bfd_get_flavour (abfd) == bfd_target_ieee_flavour)
    {
      if (! read_ieee_debugging_info (abfd, dhandle, &found))
	return NULL;
    }

  /* Try reading the COFF symbols if we didn't find any stabs in COFF
     sections.  */
  if (! found
      && bfd_get_flavour (abfd) == bfd_target_coff_flavour
      && symcount > 0)
    {
      if (! parse_coff (abfd, syms, symcount, dhandle))
	return NULL;
      found = TRUE;
    }

  if (! found)
    {
      if (! no_messages)
	non_fatal (_("%s: no recognized debugging information"),
		   bfd_get_filename (abfd));
      return NULL;
    }

  return dhandle;
}
Example #9
0
//init
//Initializes variables in main and in other files
void init() {
  seconds = 0;

  #ifdef DEBUG_ACTIVE
  //Only if we are debugging, we initialize the varialbes in the debug file
  debug_init();
  #endif
  init_update();

  //We initialize variables in other files
  #ifdef DEBUG_ACTIVE
  movement_init();
  #endif
  phase1_init();
  phase2_init();
}
Example #10
0
void main_loops_init(void) {
    system_init();
    debug_init();
    input_init();
    button_init();
    comm_init();
    draw_init(TGL_UPDATE_RATE);
    pacer_init(DISPLAY_TASK_RATE);

    tinygl_font_set (TGL_FONT);
    tinygl_text_speed_set (TGL_TEXT_SPEED);
    tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE);
    tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL);
    
    TRACE("\n\n\n**UCFK initialised.**\n");
}
Example #11
0
File: main.c Project: yhecnu/esn
int main(void)
{
	bsp_init();

	debug_init(DBG_LEVEL_TRACE | DBG_LEVEL_INFO | DBG_LEVEL_WARNING |
	           DBG_LEVEL_ERROR);

	esn_detect_init();
	esn_active_init();

	stack_init();

	vTaskStartScheduler();

	return 0;
}
Example #12
0
int main(int argc, char **argv)
{
  
  //si_ui_init();
	debug_init();
	init_random();
	Lift = lift_create();
	sem_init(&mutex,0,0);
        // Create tasks as appropriate here
	/* create tasks */ 
	//pthread_t user_thread_handle;
	pthread_t lift_thread_handle;
	//pthread_create(&user_thread_handle, NULL, user_thread, 0);
	pthread_create(&lift_thread_handle, NULL, lift_thread, 0);

		
	int i;
	for(i = 0; i < MAX_N_PERSONS; i++){
	  pthread_t handle;
	  pthread_create(&handle, NULL, passenger_thread, (void*) &i);
	  
	  sem_wait(&mutex);
	  
	  // Set the real-time priority of the current thread to 5
	  // If you want to set the priority of another thread, specify the
	  // appropriate pthread_t instead of the pthread_self() function.
	  struct sched_param p;
	  if(i == 2){
	    p.sched_priority = 10;
	  }else{
	    p.sched_priority = 1;
	  }
	  if(pthread_setschedparam(handle, SCHED_RR, &p) != 0){
	    perror("Could not set the thread priority");
	  }
	  
	  
	  pthread_detach(handle); // Ensure resources are reclaimed appropriately
	}
	
	
	pthread_join(lift_thread_handle, NULL);
	//pthread_join(user_thread_handle, NULL);
	
	
	return 0;
}
Example #13
0
int main(void)
{
    //run at 8 Mhz
    CLKPR = 0x80;
    CLKPR = 0x00;

    io_init();
    edge_interrupts_init();
    usart_init();
    buffers_init();
    debug_init();

    sei();

    for(;;)
    {
        if(UCSR0A & (1 << RXC0))
        {
            cli();
            if(rx_buffer_size_cache == 0)
            {
                rx_buffer_cahce = UDR0;
                rx_buffer_size_cache++;
                sei();
            }
            else
            {
                if(rx_buffer_size_cache <= BUF_MAX_SIZE)
                {
                    buffer_put(&rx_buffer, UDR0);
                    rx_buffer_size_cache++;
                }
                sei();
            }
        }


        if(tx_buffer_size_cache != 0)
        {
            usart_send(buffer_take(&tx_buffer));
            tx_buffer_size_cache--;
        }

    }

    return 0;
}
Example #14
0
/* Start a new debug line in *LINE, logged at level LEVEL or higher,
   and starting with the formatted string FORMAT.  */
void
_gpgme_debug_begin(void **line, int level, const char *format, ...)
{
    va_list arg_ptr;

    debug_init();
    if(debug_level < level)
    {
        /* Disable logging of this line.  */
        *line = NULL;
        return;
    }

    va_start(arg_ptr, format);
    vasprintf((char **) line, format, arg_ptr);
    va_end(arg_ptr);
}
Example #15
0
int main(int argc, const char *argv[])
{
	const char *mips_elf_filename;
	const char *new_argv[argc];
	int i, new_argc = 0;

	debug_init("/tmp/hoodwink.log");
	debug("Hoodwink starting\n");

	/* skip hoodwink program name */
	argv++;
	argc--;

	if (argc && !strcmp(argv[0], "-U")) {
		argv += 2;
		argc -= 2;
	}

	if (argc && !strcmp(argv[0], "-0")) {
		argv += 2;
		argc -= 2;
	}

	if (argc < 1) {
		debug("No MIPS ELF specified\n");
		sys_exit(1);
	} else {
		mips_elf_filename = argv[0];
		argv++;
		argc--;
	}

	debug("MIPS ELF: \"%s\"\n", mips_elf_filename);

	new_argv[new_argc++] = mips_elf_filename;

	for (i = 0; i < argc; i++)
		new_argv[new_argc++] = argv[i];

	debug("Arguments:\n");
	for (i = 0; i < new_argc; i++)
		debug("  [%d] = \"%s\"\n", i, new_argv[i]);

	frontend_init(mips_elf_filename, new_argc, new_argv);
	return 0;
}
Example #16
0
int main(void)
{
	uint32_t err_code;
	bool erase_bonds;
	
	/* Initialise debugging port */
  debug_init();
  debug_printf("Debug port opened... Initialising...\r\n");
	
	/* Initialise GPIO subsystem */
	err_code = nrf_drv_gpiote_init();
	if (err_code == NRF_SUCCESS)
		debug_printf("GPIOTE initialised!\r\n");
	else
	{
			debug_printf("Ooops.. Something is wrong with initialising GPIOTE..\r\n");
			APP_ERROR_CHECK(err_code);
	}

	led_init();
	adc_init();
	debug_printf("Visual feedback should be active!\r\n");
	
	timers_init();
	ble_stack_init();
	beacon_adv_init();
	device_manager_init(erase_bonds);
	gap_params_init();
	advertising_init();
	services_init();
	conn_params_init();
	
	application_timers_start();
  advertising_start();
	
	led_rgb_set(LED_RED, true);
	led_rgb_set(LED_GREEN, false);
	led_rgb_set(LED_BLUE, false);
	
	debug_printf("Readyyy.. \r\n");
	
  while (true)
  {
		power_manage();
	}
}
Example #17
0
/* set the flags to use for a given channel; return 0 if the channel is not available to set */
int __tgmlog_dbg_set_channel_flags( struct __tgmlog_debug_channel *channel,
								 unsigned char set, unsigned char clear )
{
	if (nb_debug_options == -1) debug_init();

	if (nb_debug_options)
	{
		struct __tgmlog_debug_channel *opt = bsearch( channel->name, debug_options, nb_debug_options,
			sizeof(debug_options[0]), cmp_name );
		if (opt)
		{
			opt->flags = (opt->flags & ~clear) | set;
			return 1;
		}
	}
	return 0;
}
Example #18
0
int main(void) {
	platform_init();

	debug_init();
	DEBUG_PRINT("Booting...\n\n");

	com_init();
	
	spi_init();

	init_framebuffer(framebuffer1);
	init_framebuffer(framebuffer2);

	DEBUG_PRINT("Booted.\n");

	while(1);
}
Example #19
0
int main(void) {
    // Set the system clock to the full 120MHz
    uint32_t sysClkFreq = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000);


    debug_init(sysClkFreq);
    status_led_init();
    network_driver_init(sysClkFreq);
    networking_init();
    telemetry_init();
    transducer_init();
    thermocouple_init();
    solenoid_init();

    debug_print("Initialization complete. starting main loop.\r\n");

    // Set up the SysTick timer and its interrupts
    SysTickPeriodSet(6000); // 40 kHz
    SysTickIntRegister(sys_tick);
    SysTickIntEnable();
    SysTickEnable();

    uint32_t loopIterations = 0;
    uint32_t frame_start = systick_clock;



    while(1) {
        status_led_periodic();
        network_driver_periodic();
        telemetry_periodic();
        solenoid_periodic();

        //	debug_print_u32(systick_clock);

        //count loop iterations per second
        loopIterations++;
        if(systick_clock - frame_start >= 1000) {
            loops_per_second = loopIterations;
            loopIterations = 0;
            frame_start = systick_clock;
        }

    }
}
Example #20
0
/*
 * Loader main routine
 *
 * We assume that the following machine state has
 * been already set before this routine.
 *	- CPU is initialized.
 *	- DRAM is configured.
 *	- Loader BSS section is filled with 0.
 *	- Loader stack is configured.
 *	- All interrupts are disabled.
 */
int
main(void)
{
	entry_t entry;

	memset(bootinfo, 0, BOOTINFOSZ);

	/*
	 * Initialize debug port.
	 */
	debug_init();

	DPRINTF(("Prex Boot Loader\n"));

	/*
	 * Do platform dependent initialization.
	 */
	startup();

	/*
	 * Show splash screen.
	 */
	splash();

	/*
	 * Load OS modules to appropriate locations.
	 */
	load_os();

	/*
	 * Dump boot infomation for debug.
	 */
	dump_bootinfo();

	/*
	 * Launch kernel.
	 */
	entry = (entry_t)kvtop(bootinfo->kernel.entry);
	DPRINTF(("Entering kernel (at 0x%lx) ...\n\n", (long)entry));
	(*entry)();

	panic("Oops!");
	/* NOTREACHED */
	return 0;
}
Example #21
0
/* Log the formatted string FORMAT at debug level LEVEL or higher.  */
void
_gpgme_debug(int level, const char *format, ...)
{
    va_list arg_ptr;

    debug_init();
    if(debug_level < level)
        return;

    va_start(arg_ptr, format);
    LOCK(debug_lock);
    vfprintf(errfp, format, arg_ptr);
    va_end(arg_ptr);
    if(format && *format && format[strlen(format) - 1] != '\n')
        putc('\n', errfp);
    UNLOCK(debug_lock);
    fflush(errfp);
}
Example #22
0
int main(void)
{
	int i;

	rcc_clock_setup_in_hsi_out_48mhz();
	debug_init();
	printf("Device UP!\nFW version %s\n", FW_VERSION);

	cmd_init();

	CMD_REGISTER_LIST(main_cmds);
	init_modules();
	printf("Init complete..\n");

	while (1) {
		cmd_poll();
	}
}
Example #23
0
int
main(int argc, char **argv) {
    FILE *f=0;
    int i;

    do {
	f = fopen("c:/tmp/service_t", "w");
	debug_init(DEBUG_INFO, debug_func_stdio, f);

	debug(DEBUG_INFO, 
	      ("service_t main argc=%d argv[0]=%s\n", 
	       argc, argv[0]))

	i = service_init(argc, argv, service_main_func);
    } while(0);
    if( f ) fclose(f);
    return i;
}
Example #24
0
/**@brief Function for application main entry.
 */
int main(void)
{
    // Initialization of various modules.
    debug_init();
    leds_init();
    buttons_init();
    ble_stack_init();
    client_handling_init();
    device_manager_init();

    // Start scanning for devices.
    scan_start();

    for (;;)
    {
        power_manage();
    }
}
Example #25
0
void dram_system_sim (char *debug_file_name)
{
	struct dram_system_t *dram_system;

	/* Initialize */
	debug_init();
	esim_init();
	dram_system_init();
	dram_debug_category = debug_new_category(debug_file_name);

	/* Getting the simulation name */
	if (!*dram_sim_system_name)
		panic("%s: no DRAM simulation name", __FUNCTION__);
	dram_system = dram_system_find(dram_sim_system_name);
	if (!dram_system)
		fatal("%s: DRAM system does not exist", dram_sim_system_name);

	esim_process_events(TRUE);
	while (1)
	{
		long long cycle;

		cycle = esim_domain_cycle(dram_domain_index);

		if (cycle >= dram_system_max_cycles)
			break;

		if ((list_count(dram_system->dram_request_list)) &&
				dram_system_get_request(dram_system))
			list_dequeue(dram_system->dram_request_list);
		dram_system_process(dram_system);

		/* Next Cycle */
		dram_debug("___cycle %lld___\n", cycle);
		esim_process_events(TRUE);
	}

	dram_system_done();
	esim_done();
	debug_done();

	mhandle_done();
	exit(0);
}
Example #26
0
/*********************************************************************
  
	Main Program Loop

**********************************************************************/
int main()
{

  /* Initializations */
  debug_init();
  timer_init();

  /* Main Program Loop */
  while (1)
  {

  }

  /* De-initializations */
  timer_deinit();
  debug_deinit();

  return 0;
}
Example #27
0
int main(int argc, char *argv[])
{
    char ch;

    signal(SIGINT, sigint);
    ctrl_c_hit = 0;

    setup_raw_input();
    debug_init();

    while (!ctrl_c_hit) {
	if (read(STDIN_FILENO, &ch, 1) == 1)
	    process_debug_char(ch);
    }
    restore_terminal();

    return 0;

}
Example #28
0
int main() {
    intptr_t ptr = 1;
    int i;

    debug_init(DEBUG_INFO, 0, 0);

    debug_leak_init();
   
    ptr++;
    debug(DEBUG_INFO, ("ptr=%p\n", (void*)ptr));
    debug_leak_create((void*)ptr);
    debug_leak_stack((void*)ptr);
    debug_leak_delete((void*)ptr);
    
    ptr++;
    debug(DEBUG_INFO, ("ptr=%p\n", (void*)ptr));
    debug_leak_create((void*)ptr);
    debug_leak_delete((void*)ptr);

    ptr++;
    debug(DEBUG_INFO, ("ptr=%p\n", (void*)ptr));
    debug_leak_create((void*)ptr);
    debug_leak_stack((void*)ptr);
    //debug_leak_delete((void*)ptr);

    ptr++;
    debug(DEBUG_INFO, ("ptr=%p\n", (void*)ptr));
    //debug_leak_create((void*)ptr);
    debug_leak_stack((void*)ptr);
    debug_leak_delete((void*)ptr);

    for(i=0; i<5; i++) {
	if( i >= 0 ) debug_leak_create((void*)ptr++);
	if( i >= 1 ) debug_leak_create((void*)ptr++);
	if( i >= 2 ) debug_leak_create((void*)ptr++);
	debug_leak_by_line();
    }

    debug_leak_dump();
    debug_leak_fini();

    return 0;
}
Example #29
0
/* Main task, initialize hardware and start the FreeRTOS scheduler */
int main(void)
{
	// stop the watchdog timer
	WDTCTL = WDTPW | WDTHOLD | WDTCNTCL | WDTSSEL;
	
	immediate_debug(pdFALSE);
	
	/******************************************************/
	/* Initialize the SmartGrains hardware                */
	/******************************************************/
	hardware_setup();
	debug_init(0);

	queue_app = xQueueCreate( 4, sizeof( main_event_t ) );
	// buffers initialization
	if (buffers_init()!=START_SUCCESS) { debug("Buffer init failed!!\r\n"); }
	

	/********************************************************/
	/* Initialize the STACK including smart_mac & smart_nwk */
	/********************************************************/
	if (stack_init()==START_SUCCESS) { debug("OK\r\n");}
	else { debug("failed!!\r\n"); }
	address_utils_debug_address(&lgaddr_mac, ADDR_FULL);


	// blinking LEDs
	// Code is Green-Red-Green
	LEDS_OFF_CHECK_MODE(led_mode);
	LED0_ON_CHECK_MODE(led_mode);		// G
	clock_pause(200); LED0_OFF_CHECK_MODE(led_mode); clock_pause(200);
	LED1_ON_CHECK_MODE(led_mode);		// R
	clock_pause(200); LED1_OFF_CHECK_MODE(led_mode); clock_pause(200);
	LED0_ON_CHECK_MODE(led_mode);		// G
	clock_pause(200); LED0_OFF_CHECK_MODE(led_mode);
	
	// Demo App
	xTaskCreate( vDemo, "AppDemo", configMINIMAL_STACK_SIZE+200, NULL, (tskIDLE_PRIORITY + 1 ), NULL );
	
	vTaskStartScheduler();
	return 0;
}
Example #30
0
/**@brief Main function of the connectivity application. */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

#if ( defined(SER_PHY_HCI_DEBUG_ENABLE) || defined(SER_PHY_DEBUG_APP_ENABLE))
	debug_init(NULL);
#endif	
	
    /* Initialize scheduler queue. */
    APP_SCHED_INIT(SER_CONN_SCHED_MAX_EVENT_DATA_SIZE, SER_CONN_SCHED_QUEUE_SIZE);
    /* Initialize SoftDevice.
     * SoftDevice Event IRQ is not scheduled but immediately copies BLE events to the application
     * scheduler queue */
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);

    
    /* Subscribe for BLE events. */
    err_code = softdevice_ble_evt_handler_set(ser_conn_ble_event_handle);
    APP_ERROR_CHECK(err_code);

    /* Open serialization HAL Transport layer and subscribe for HAL Transport events. */
    err_code = ser_hal_transport_open(ser_conn_hal_transport_event_handle);
    APP_ERROR_CHECK(err_code);
    
    /* Enter main loop. */
    for (;;)
    {   
        /* Process SoftDevice events. */
        app_sched_execute();

        /* Process received packets.
         * We can NOT add received packets as events to the application scheduler queue because
         * received packets have to be processed before SoftDevice events but the scheduler queue
         * does not have priorities. */
        err_code = ser_conn_rx_process();
        APP_ERROR_CHECK(err_code);

        /* Sleep waiting for an application event. */
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}