@@ -129,15 +129,15 @@ static char* get_ch_name(const char* type, int id)
129129}
130130
131131/* returns adrv9009 phy device */
132- static struct iio_device * get_adrv9009_phy (struct iio_context * ctx )
132+ static struct iio_device * get_adrv9009_phy (void )
133133{
134134 struct iio_device * dev = iio_context_find_device (ctx , "adrv9009-phy" );
135135 IIO_ENSURE (dev && "No adrv9009-phy found" );
136136 return dev ;
137137}
138138
139139/* finds adrv9009 streaming IIO devices */
140- static bool get_adrv9009_stream_dev (struct iio_context * ctx , enum iodev d , struct iio_device * * dev )
140+ static bool get_adrv9009_stream_dev (enum iodev d , struct iio_device * * dev )
141141{
142142 switch (d ) {
143143 case TX : * dev = iio_context_find_device (ctx , "axi-adrv9009-tx-hpc" ); return * dev != NULL ;
@@ -147,7 +147,7 @@ static bool get_adrv9009_stream_dev(struct iio_context *ctx, enum iodev d, struc
147147}
148148
149149/* finds adrv9009 streaming IIO channels */
150- static bool get_adrv9009_stream_ch (__notused struct iio_context * ctx , enum iodev d , struct iio_device * dev , int chid , char modify , struct iio_channel * * chn )
150+ static bool get_adrv9009_stream_ch (enum iodev d , struct iio_device * dev , int chid , char modify , struct iio_channel * * chn )
151151{
152152 * chn = iio_device_find_channel (dev , modify ? get_ch_name_mod ("voltage" , chid , modify ) : get_ch_name ("voltage" , chid ), d == TX );
153153 if (!* chn )
@@ -156,37 +156,37 @@ static bool get_adrv9009_stream_ch(__notused struct iio_context *ctx, enum iodev
156156}
157157
158158/* finds adrv9009 phy IIO configuration channel with id chid */
159- static bool get_phy_chan (struct iio_context * ctx , enum iodev d , int chid , struct iio_channel * * chn )
159+ static bool get_phy_chan (enum iodev d , int chid , struct iio_channel * * chn )
160160{
161161 switch (d ) {
162- case RX : * chn = iio_device_find_channel (get_adrv9009_phy (ctx ), get_ch_name ("voltage" , chid ), false); return * chn != NULL ;
163- case TX : * chn = iio_device_find_channel (get_adrv9009_phy (ctx ), get_ch_name ("voltage" , chid ), true); return * chn != NULL ;
162+ case RX : * chn = iio_device_find_channel (get_adrv9009_phy (), get_ch_name ("voltage" , chid ), false); return * chn != NULL ;
163+ case TX : * chn = iio_device_find_channel (get_adrv9009_phy (), get_ch_name ("voltage" , chid ), true); return * chn != NULL ;
164164 default : IIO_ENSURE (0 ); return false;
165165 }
166166}
167167
168168/* finds adrv9009 local oscillator IIO configuration channels */
169- static bool get_lo_chan (struct iio_context * ctx , struct iio_channel * * chn )
169+ static bool get_lo_chan (struct iio_channel * * chn )
170170{
171171 // LO chan is always output, i.e. true
172- * chn = iio_device_find_channel (get_adrv9009_phy (ctx ), get_ch_name ("altvoltage" , 0 ), true); return * chn != NULL ;
172+ * chn = iio_device_find_channel (get_adrv9009_phy (), get_ch_name ("altvoltage" , 0 ), true); return * chn != NULL ;
173173}
174174
175175/* applies streaming configuration through IIO */
176- bool cfg_adrv9009_streaming_ch (struct iio_context * ctx , struct stream_cfg * cfg , int chid )
176+ bool cfg_adrv9009_streaming_ch (struct stream_cfg * cfg , int chid )
177177{
178178 struct iio_channel * chn = NULL ;
179179
180180 // Configure phy and lo channels
181181 printf ("* Acquiring ADRV9009 phy channel %d\n" , chid );
182- if (!get_phy_chan (ctx , true, chid , & chn )) { return false; }
182+ if (!get_phy_chan (true, chid , & chn )) { return false; }
183183
184184 rd_ch_lli (chn , "rf_bandwidth" );
185185 rd_ch_lli (chn , "sampling_frequency" );
186186
187187 // Configure LO channel
188188 printf ("* Acquiring ADRV9009 TRX lo channel\n" );
189- if (!get_lo_chan (ctx , & chn )) { return false; }
189+ if (!get_lo_chan (& chn )) { return false; }
190190 wr_ch_lli (chn , "frequency" , cfg -> lo_hz );
191191 return true;
192192}
@@ -216,17 +216,17 @@ int main (__notused int argc, __notused char **argv)
216216 IIO_ENSURE (iio_context_get_devices_count (ctx ) > 0 && "No devices" );
217217
218218 printf ("* Acquiring ADRV9009 streaming devices\n" );
219- IIO_ENSURE (get_adrv9009_stream_dev (ctx , TX , & tx ) && "No tx dev found" );
220- IIO_ENSURE (get_adrv9009_stream_dev (ctx , RX , & rx ) && "No rx dev found" );
219+ IIO_ENSURE (get_adrv9009_stream_dev (TX , & tx ) && "No tx dev found" );
220+ IIO_ENSURE (get_adrv9009_stream_dev (RX , & rx ) && "No rx dev found" );
221221
222222 printf ("* Configuring ADRV9009 for streaming\n" );
223- IIO_ENSURE (cfg_adrv9009_streaming_ch (ctx , & trxcfg , 0 ) && "TRX device not found" );
223+ IIO_ENSURE (cfg_adrv9009_streaming_ch (& trxcfg , 0 ) && "TRX device not found" );
224224
225225 printf ("* Initializing ADRV9009 IIO streaming channels\n" );
226- IIO_ENSURE (get_adrv9009_stream_ch (ctx , RX , rx , 0 , 'i' , & rx0_i ) && "RX chan i not found" );
227- IIO_ENSURE (get_adrv9009_stream_ch (ctx , RX , rx , 0 , 'q' , & rx0_q ) && "RX chan q not found" );
228- IIO_ENSURE (get_adrv9009_stream_ch (ctx , TX , tx , 0 , 0 , & tx0_i ) && "TX chan i not found" );
229- IIO_ENSURE (get_adrv9009_stream_ch (ctx , TX , tx , 1 , 0 , & tx0_q ) && "TX chan q not found" );
226+ IIO_ENSURE (get_adrv9009_stream_ch (RX , rx , 0 , 'i' , & rx0_i ) && "RX chan i not found" );
227+ IIO_ENSURE (get_adrv9009_stream_ch (RX , rx , 0 , 'q' , & rx0_q ) && "RX chan q not found" );
228+ IIO_ENSURE (get_adrv9009_stream_ch (TX , tx , 0 , 0 , & tx0_i ) && "TX chan i not found" );
229+ IIO_ENSURE (get_adrv9009_stream_ch (TX , tx , 1 , 0 , & tx0_q ) && "TX chan q not found" );
230230
231231 printf ("* Enabling IIO streaming channels\n" );
232232 iio_channel_enable (rx0_i );
0 commit comments