Esempio n. 1
0
bool
LogicAnalyzer::end() {

    assert(dalloc.dma_chan >= 0);

    dma.set_channel(dalloc.dma_chan);
    DMA::s_DMA_CS& status = dma.cs();

    while ( get_interrupts() < dma_blocks.size() )
        usleep(10);

    unsigned s = status.END;        // Capture status
    free_dma();                     // Release reservation on DMA

    return !!s;                     // True if status.END == 1
}
Esempio n. 2
0
/** 
 * setup device option.
 * all device options may have common parameters. Here we handle these common parameters.
 * 
 */
int
setup_device_option (char *option_name, void *dev_option,
		     int num_params, const char *params[])
{
	char name[MAX_PARAM_NAME], value[MAX_PARAM_NAME];
	struct common_config conf;
	int i;

	memset (&conf, 0, sizeof (conf));
	conf.type = NULL;
	conf.name = NULL;

	for (i = 0; i < num_params; i++) {
		if (split_param (params[i], name, value) < 0)
			SKYEYE_ERR
				("Error: \"%s\" has wrong parameter \"%s\".\n",
				 option_name, name);
		if (!strncmp ("type", name, strlen (name))) {
			conf.type = strdup (value);
		}
		else if (!strncmp ("name", name, strlen (name))) {
			conf.name = strdup (value);
		}
		else if (!strncmp ("base", name, strlen (name))) {
			conf.base = strtoul (value, NULL, 0);
		}
		else if (!strncmp ("size", name, strlen (name))) {
			conf.size = strtoul (value, NULL, 0);
		}
		else if (!strncmp ("int", name, strlen (name))) {
			get_interrupts (value, conf.interrupts);
		}
	}
	skyeye_config_t* config;
	config = get_current_config();
	setup_device (option_name, &conf, dev_option, config->mach);
	if (conf.type)
		free (conf.type);
	if (conf.name)
		free (conf.name);
	return 0;

}