示例#1
0
static int fatfs_provider_open(void *ip, posix_stream_t *s, const char *path,
		int mode) {
	FATFS *fs = (FATFS*) ip;
	FIL *fd = new_fil();

	(void) fs;

	s->vmt = &fatfs_vmt;
	s->ip = fd;
	if (wf_open(fd, path, posix_mode_to_ffmode(mode)) != FR_OK)
		return -1;
	return 0;
}
示例#2
0
int main(int argc, char* argv[])
{
  int frequency;
  int gain = AUTO_GAIN;
  struct dab_state_t* dab;

  if ((argc < 3) || (argc > 5)) {
    usage();
    return 1;
  }

  frequency = atoi(argv[2]);

  std::string device_arg(argv[1]);

  if (device_arg == "-w") {
    if (wf_open(&wf,"/dev/wavefinder0") >= 0) {
      init_dab_state(&dab,&wf,eti_callback);
      dab->device_type = DAB_DEVICE_WAVEFINDER;
      do_wf_decode(dab,frequency);
    }
    else {
      fprintf(stderr, "Could not open wavefinder\n");
    }
  }
  else if (device_arg == "-r") {
    if (argc > 3) { gain = atoi(argv[3]); }
    init_dab_state(&dab,&sdr,eti_callback);
    dab->device_type = DAB_DEVICE_RTLSDR;
    do_sdr_decode(dab,frequency,gain);
  }
  else if (device_arg == "-h") {
    if (argc > 3) { hackrf_vga_gain = atoi(argv[3]); }
    if (argc > 4) { hackrf_lna_gain = atoi(argv[4]); }
    init_dab_state(&dab,&sdr,eti_callback);
    dab->device_type = DAB_DEVICE_HACKRF;
    do_sdr_decode(dab,frequency,gain);
  }
  else {
    usage();
    return 1;
  }
}
示例#3
0
文件: dab2eti.c 项目: ashh87/dabtools
int main(int argc, char* argv[])
{
  int frequency;
  int gain = AUTO_GAIN;
  struct dab_state_t* dab;

  if ((argc < 2) || (argc > 3)) {
    usage();
    return 1;
  }

  frequency = atoi(argv[1]);
  if (argc > 2) { gain = atoi(argv[2]); }

  if (wf_open(&wf,"/dev/wavefinder0") >= 0) {
    init_dab_state(&dab,&wf,eti_callback);
    dab->device_type = DAB_DEVICE_WAVEFINDER;
    do_wf_decode(dab,frequency);
  } else {
    init_dab_state(&dab,&sdr,eti_callback);
    dab->device_type = DAB_DEVICE_RTLSDR;
    do_sdr_decode(dab,frequency,gain);
  }
}