[USRP-users] ֻC API questions

Martin Braun martin.braun at ettus.com
Mon Jul 17 17:07:30 EDT 2017


On 07/16/2017 12:54 AM, Sivan Toledo via USRP-users wrote:
> OK, tried it and I clearly need to call the "make" functions, otherwise
> the code segfaults.

Yes, UHD won't allocate memory implicitly in the C-API.

-- M
> 
> On Sat, Jul 15, 2017 at 7:02 PM, Sivan Toledo <stoledo at tau.ac.il
> <mailto:stoledo at tau.ac.il>> wrote:
> 
>     Like question 1: 
> 
>     Do I need to "make" the uhd_meta_range_handle or will the call
>     to uhd_usrp_get_rx_gain_range make it? 
> 
>     If I need to make it, I assume that I also need to free it. 
>     If I don't need to make it, do I still need to free it?
> 
>     On Sat, Jul 15, 2017 at 1:46 PM, Sivan Toledo <stoledo at tau.ac.il
>     <mailto:stoledo at tau.ac.il>> wrote:
> 
>         I'm converting a CPP code from UHD 3.8.5 to the C api for 3.10.
>         (The main reason for the conversion is that I binaries of my CPP
>         programs don't run on both Ubuntu 14 and 16 because of
>         incompatible libboost; hopefully using the C API and the Ubuntu
>         uhd-host package will resolve this). 
> 
>         I have a few questions:
> 
>         1. Is the following correct, or do I have to "make" the
>         string_vector_handle before I pass it to get_rx_gain_names? The
>         manual says to always make, but my intuition is that
>         get_rx_gain_names will make it for me, given that it gets a
>         pointer to the handle, not the handle itself.
> 
>           uhd_string_vector_handle gain_names; 
>           uhd_usrp_get_rx_gain_names(usrp, 0 /* channel */, &gain_names); 
> 
>         2. Is there a C api version of set_rx_gain
>         <https://files.ettus.com/manual/classuhd_1_1usrp_1_1multi__usrp.html#a8234968ad1fefef299ef9541cc193915> (double
>         gain, size_t chan=0)? In the header files I found only
>         set_rx_gain but with a gain_name argument. The CPP api has two
>         overloaded methods, one with a gain-name argument and the other
>         without it. Is the convenience method missing from the C API?
>         Can I invoke it by passing NULL for the gain name?
> 
>         Thanks, Sivan Toledo
> 
> 
> 
> 
> 
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
> 





More information about the USRP-users mailing list