X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fchronovu-la8%2Fchronovu-la8.c;h=da9eea9b714cb97cb2e9042f226cae358b08feea;hb=4362438f1e2da14d04678327c403f9d75c4c0a48;hp=44ab838421269995cf3a93c0724c130041efd0a7;hpb=309397702f747ea6326492d841a31fddd2d76a9f;p=libsigrok.git diff --git a/hardware/chronovu-la8/chronovu-la8.c b/hardware/chronovu-la8/chronovu-la8.c index 44ab8384..da9eea9b 100644 --- a/hardware/chronovu-la8/chronovu-la8.c +++ b/hardware/chronovu-la8/chronovu-la8.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -50,17 +51,14 @@ struct la8 { /** The current sampling limit (in number of samples). */ uint64_t limit_samples; - /** The number of probes. */ - int num_probes; - /** TODO */ gpointer session_id; /** - * An 8MB buffer containing the (mangled) samples from the device. + * An 4KB buffer containing some (mangled) samples from the device. * Format: Pretty mangled-up (due to hardware reasons), see code. */ - uint8_t *mangled_buf; + uint8_t mangled_buf[4096]; /** * An 8MB buffer where we'll store the de-mangled samples. @@ -477,9 +475,8 @@ static int hw_init(const char *deviceinfo) la8->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */ la8->limit_msec = 0; la8->limit_samples = 0; - la8->num_probes = NUM_PROBES; la8->session_id = NULL; - la8->mangled_buf = NULL; + memset(la8->mangled_buf, 0, 4096); la8->final_buf = NULL; la8->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */ la8->trigger_mask = 0x00; /* All probes are "don't care". */ @@ -488,18 +485,11 @@ static int hw_init(const char *deviceinfo) la8->block_counter = 0; la8->divcount = 0; /* 10ns sample period == 100MHz samplerate */ - /* Allocate memory for the raw (mangled) data from the LA8. */ - if (!(la8->mangled_buf = g_try_malloc(SDRAM_SIZE))) { - sr_err("la8: %s: mangled_buf malloc failed", __func__); - ret = SR_ERR_MALLOC; - goto err_free_la8; - } - /* Allocate memory where we'll store the de-mangled data. */ if (!(la8->final_buf = g_try_malloc(SDRAM_SIZE))) { sr_err("la8: %s: final_buf malloc failed", __func__); ret = SR_ERR_MALLOC; - goto err_free_mangled_buf; + goto err_free_la8; } /* Allocate memory for the FTDI context (ftdic) and initialize it. */ @@ -547,8 +537,6 @@ err_free_ftdic: free(la8->ftdic); /* NOT g_free()! */ err_free_final_buf: g_free(la8->final_buf); -err_free_mangled_buf: - g_free(la8->mangled_buf); err_free_la8: g_free(la8); err_free_nothing: @@ -671,7 +659,6 @@ static void hw_closedev(int device_index) sdi->status = SR_ST_INACTIVE; sr_dbg("la8: %s: freeing sample buffers", __func__); - free(la8->mangled_buf); free(la8->final_buf); } @@ -993,7 +980,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) gettimeofday(&header.starttime, NULL); header.samplerate = la8->cur_samplerate; header.protocol_id = SR_PROTO_RAW; - header.num_logic_probes = la8->num_probes; + header.num_logic_probes = NUM_PROBES; header.num_analog_probes = 0; sr_session_bus(session_device_id, &packet);