Exemplo n.º 1
0
int main(void)
{
	clock_setup();
	gpio_setup();
	systick_setup();
	adc_off(ADC1);
	usart_enable_all_pins();
	usart_console_setup();
	printf("hello!\n");
	// power up the RHT chip...
	dht_power(true);
	delay_ms(2000);
	setup_tim7();
	platform_simrf_init();
	// interrupt pin from mrf
	platform_mrf_interrupt_enable();

	simrf_soft_reset();
	simrf_init();
	simrf_immediate_sleep();

	simrf_pan_write(0xcafe);
	uint16_t pan_sanity_check = simrf_pan_read();
	printf("pan read back in as %#x\n", pan_sanity_check);
	simrf_address16_write(0x1111);

	adc_power_on(ADC1);
	adc_reset_calibration(ADC1);
	adc_calibration(ADC1);

	jack_setup(&jack1, &state.jack_machine1);
	jack_setup(&jack2, &state.jack_machine2);

	//state.rf_dest_id = 0x4202;
	state.rf_dest_id = 0x1;

	while (1) {
		struct jacks_result_t jr1, jr2;
		simrf_check_flags(NULL, &handle_tx);
		loop_forever();
		jack_run_task(&state.jack_machine1, &jr1);
		if (jr1.ready) {
			printf("Channel 1 result: %d\n", jr1.value);
		}
		jack_run_task(&state.jack_machine2, &jr2);
		if (jr2.ready) {
			printf("Channel 2 result: %d\n", jr2.value);
		}
		task_send_data(&state);
		__WFI();
	}

	return 0;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
	if (argc > 1) {
		printf("Josh Tool ------- Version: 1.29 \n");
		return 0;
	}

	init();
	loop_forever();

	/* this should never happen .. */
	return 0;
}
Exemplo n.º 3
0
static void stop_benchmark(uint64_t stop, uint64_t driver_runtime,
        uint64_t drv_pkt_count)
{
    // FIXME: Make sure that all data is gone
//    uint64_t stop = rdtsc();
    uint64_t delta = stop - start_tx;

    // sending debug message marking the stop of benchmark
//    lwip_benchmark_control(connection_type, BMS_STOP_REQUEST, 0, 0);


    printf("U: Test [%s], PBUF type %s\n", TEST_TYPE,
            connection_type?"PBUF_RAM":"PBUF_POOL");
    lwip_print_interesting_stats();
    printf("U: Time taken by APP %"PU" to send %"PRIu64" packets"
            "(%"PRIu64" failed)\n",
            in_seconds(delta), iter, failed);
    if (driver_runtime > 0) {
        printf("U: Time taken by DRV %"PU" to send %"PRIu64" packets\n",
                in_seconds(driver_runtime), drv_pkt_count);
    }
    uint64_t data_size = iter * MAX_DATA;
    printf("U: TX speed (app view) = data(%"PRIu64") / time(%"PU") = [%f] KB \n",
            data_size, in_seconds(delta), ((data_size/in_seconds(delta))/1024));

    if (driver_runtime > 0) {
        data_size = drv_pkt_count * MAX_DATA;
        printf("U: TX speed (DRV view) = data(%"PRIu64") / time(%"PU") = [%f] KB \n",
            data_size, in_seconds(driver_runtime),
            ((data_size/in_seconds(driver_runtime))/1024));
    }
    for (int j = 0; j < 6; ++j) {
        printf("U: Stats  %d: [%"PRIu64"] \n", j, stats[j]);
    }

    loop_forever();
}
Exemplo n.º 4
0
void
htab_initialize(void)
{
	unsigned long table, htab_size_bytes;
	unsigned long pteg_count;
	unsigned long mode_rw, mask;

#if 0
	/* Can't really do the call below since it calls the normal RTAS
	 * entry point and we're still relocate off at the moment.
	 * Temporarily diabling until it can call through the relocate off
	 * RTAS entry point.  -Peter
	 */
	ppc64_boot_msg(0x05, "htab init");
#endif
	/*
	 * Calculate the required size of the htab.  We want the number of
	 * PTEGs to equal one half the number of real pages.
	 */ 
	htab_size_bytes = 1UL << naca->pftSize;
	pteg_count = htab_size_bytes >> 7;

	/* For debug, make the HTAB 1/8 as big as it normally would be. */
	ifppcdebug(PPCDBG_HTABSIZE) {
		pteg_count >>= 3;
		htab_size_bytes = pteg_count << 7;
	}

	htab_data.htab_num_ptegs = pteg_count;
	htab_data.htab_hash_mask = pteg_count - 1;

	if(naca->platform == PLATFORM_PSERIES) {
		/* Find storage for the HPT.  Must be contiguous in
		 * the absolute address space.
		 */
		table = lmb_alloc(htab_size_bytes, htab_size_bytes);
		if ( !table ) {
			ppc64_terminate_msg(0x20, "hpt space");
			loop_forever();
		}
		htab_data.htab = (HPTE *)__a2v(table);

		/* htab absolute addr + encoded htabsize */
		_SDR1 = table + __ilog2(pteg_count) - 11;

		/* Initialize the HPT with no entries */
		memset((void *)table, 0, htab_size_bytes);
	} else {
		/* Using a hypervisor which owns the htab */
		htab_data.htab = NULL;
		_SDR1 = 0; 
	}

	mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX;
	mask = pteg_count-1;

	/* XXX we currently map kernel text rw, should fix this */
	if ((naca->platform & PLATFORM_PSERIES) &&
	   cpu_has_largepage() && (naca->physicalMemorySize > 256*MB)) {
		create_pte_mapping((unsigned long)KERNELBASE, 
				   KERNELBASE + 256*MB, mode_rw, mask, 0);
		create_pte_mapping((unsigned long)KERNELBASE + 256*MB, 
				   KERNELBASE + (naca->physicalMemorySize), 
				   mode_rw, mask, 1);
	} else {
		create_pte_mapping((unsigned long)KERNELBASE, 
				   KERNELBASE+(naca->physicalMemorySize), 
				   mode_rw, mask, 0);
	}
#if 0
	/* Can't really do the call below since it calls the normal RTAS
	 * entry point and we're still relocate off at the moment.
	 * Temporarily diabling until it can call through the relocate off
	 * RTAS entry point.  -Peter
	 */
	ppc64_boot_msg(0x06, "htab done");
#endif
}