int main( int argc, char ** argv ) {

	libnxt_error error = init_messaging();
	if ( error ) {
		printf( "Error initialising: %s\n", libnxt_error_message( error ) );
		return 1;
	}

	unsigned char endPoints[2] = {0, 8};
	error = send( endPoints, sizeof ( endPoints ) );

	unsigned char * report = NULL;
	uint16_t reportLength = 0;

	size_t i;
	do {
		error = receive( &report, &reportLength );
		if ( error ) {
			printf( "Error receiving: %s\n", libnxt_error_message( error ) );
		} else {
			for ( i = 0; i < reportLength; i++ ) {
				printf( "%c", report[i] );
			}
			printf( "\n" );
			free_message( report );
			report = NULL;
		}
	} while( ( ! error ) && reportLength > 0 );

	exit_messaging();
	return ( error ? 1 : 0 );
}
Esempio n. 2
0
/* Called very early during startup to mark boot cpu as online */
void __init smp_prepare_boot_cpu(void)
{
	int cpu = smp_processor_id();
	set_cpu_online(cpu, 1);
	set_cpu_present(cpu, 1);
	__this_cpu_write(cpu_state, CPU_ONLINE);

	init_messaging();
}
Esempio n. 3
0
/* Called very early during startup to mark boot cpu as online */
void __init smp_prepare_boot_cpu(void)
{
	int cpu = smp_processor_id();
	set_cpu_online(cpu, 1);
	set_cpu_present(cpu, 1);
	__get_cpu_var(cpu_state) = CPU_ONLINE;

	init_messaging();
}
Esempio n. 4
0
static void init_env(void) {
	SCM smob;
	char *ver;
	SOURCE_HANDLE *handle;
	init_log();
	init_alsa_module();
	ver = scm_to_locale_string(scm_version());
	log_msg("Guile version %s\n", ver);
	free(ver);
	init_messaging(msg_port);
	init_time();
	init_json();
	init_scheduler();
	init_audiofile();
	if (use_jack) init_jackport();
	init_feeds();
	init_recorder();
	init_stream();
	init_source_mod();
	init_ladspa();
	init_unitgen();
	fader = (SOURCE_OBJ *)my_malloc(sizeof(SOURCE_OBJ), "main fader");
	handle = (SOURCE_HANDLE *)my_gc_malloc(sizeof(SOURCE_HANDLE), "mains",
				"mains");
	handle->body = (void *)fader;
	handle->src = fader;
	init_source(fader);
	mains_tag = scm_make_smob_type("mains", sizeof(SOURCE_OBJ));
	SCM_NEWSMOB(smob, mains_tag, handle);
	scm_c_define("mains", smob);
	if (use_jack) {
		scm_c_define("jack-client-name",
			scm_from_locale_string(client_name));
		scm_c_define_gsubr("patch-out", 2, 0, 0, patch_out);
		scm_c_define_gsubr("unpatch-out", 2, 0, 0, unpatch_out);
		}
	scm_c_define_gsubr("quit", 0, 0, 0, qmx_quit);
	scm_c_define_gsubr("db", 1, 0, 0, db20);
	scm_c_define_gsubr("period-duty-cycle", 0, 0, 0, get_duty_cycle);
	scm_permanent_object(console_display =
			scm_c_eval_string(console_display_src));
	scm_permanent_object(catch_display =
			scm_c_eval_string(catch_display_src));
	return;
	}
Esempio n. 5
0
/*
 * Activate a secondary processor.  Very minimal; don't add anything
 * to this path without knowing what you're doing, since SMP booting
 * is pretty fragile.
 */
static void start_secondary(void)
{
	int cpuid;

	preempt_disable();

	cpuid = smp_processor_id();

	/* Set our thread pointer appropriately. */
	set_my_cpu_offset(__per_cpu_offset[cpuid]);

	/*
	 * In large machines even this will slow us down, since we
	 * will be contending for for the printk spinlock.
	 */
	/* printk(KERN_DEBUG "Initializing CPU#%d\n", cpuid); */

	/* Initialize the current asid for our first page table. */
	__this_cpu_write(current_asid, min_asid);

	/* Set up this thread as another owner of the init_mm */
	mmgrab(&init_mm);
	current->active_mm = &init_mm;
	if (current->mm)
		BUG();
	enter_lazy_tlb(&init_mm, current);

	/* Allow hypervisor messages to be received */
	init_messaging();
	local_irq_enable();

	/* Indicate that we're ready to come up. */
	/* Must not do this before we're ready to receive messages */
	if (cpumask_test_and_set_cpu(cpuid, &cpu_started)) {
		pr_warn("CPU#%d already started!\n", cpuid);
		for (;;)
			local_irq_enable();
	}

	smp_nap();
}