291 Commits

Author SHA1 Message Date
Martin Ling
03551cb1fd Detect whether the M0 missed its deadline.
Counter-intuitively, this actually saves us two cycles because we unroll
the first iteration of the loop that spins on the interrupt flag, saving
a branch in the case that the flag is clear the first time.
2024-11-26 19:34:29 +00:00
Martin Ling
d4ed8474e5 Merge pull request #1442 from martinling/example-fix
Correct prototype of flush callback in example code.
2024-05-02 16:40:04 +01:00
Simon Ruderich
658829fdd5 hackrf.h: fix typos in documentation comments 2024-04-26 08:10:25 +02:00
Martin Ling
c201c14a7e Correct prototype of flush callback in example code. 2024-04-11 10:35:30 +01:00
Demetri Maltsiniotis
3d83a2f911 * Fix quoting issue causing bad library include path, add install step hackrf-tools.
* Add artifact publish step for Windows libraries and host tools.
* Replace runner.workspace with github.workspace.
* Update checkout task to v4 to supress warning.
* Update CMAKE for libhackrf and hackrf-tools to also install DLLs on WIN32 platforms.
* Update uploadartifact task to v4 since v3 uses an end-of-life node version 16.
* Add a new windows variable for the vcpkg cmake toolchain makefile.
2024-02-29 18:39:03 -06:00
Michael Ossmann
5bed412018 Set libhackrf API version to 0.9 2024-02-22 14:01:59 -05:00
Michael Ossmann
d0bb89643a Merge pull request #1403 from smburdick/build-updates
Update CMAKE minimum version to 2.8.12
2024-02-22 13:56:15 -05:00
Michael Ossmann
24ac1edf5a Support detection of HackRF One r10 2024-02-21 23:48:54 -05:00
Sam Burdick
3b55d5a65e Min CMAKE Version -> 2.8.12 2024-02-01 09:18:31 -08:00
Sam Burdick
f445c265b1 Update CMAKE minimum version 2024-01-15 18:31:42 -08:00
Michael Ossmann
1fd67f66ca Merge pull request #1346 from Sasszem/libhackrf_usb_api_versions
libhackrf: document required library versions
2023-09-13 11:23:31 -04:00
bsdmp
ed8a1a6f53 mask all signals in libhackrf transfer_threadproc (#1330)
* mask all signals in libhackrf transfer_threadproc

hackrf_transfer uses pause() and SIGALRM to print statistics and POSIX doesn't
specify which thread must recieve the signal, block all signals here, so we
don't interrupt their reception by hackrf_transfer or any other app which uses
the library (#1323)

* fix windows build and remove empty line
2023-09-13 11:20:14 -04:00
Jonathan Suite
dab548bf29 Firmware updates to allow fine-grained control of biast from command line (#1314)
* Initial commit of hackrf_biast

* Cleaned up hackrf_biast

* Cleaned up usage info

* Include getopt.h for non-GNU systems

* Add support for overriding HackRF's default antenna power behavior in firmware.  Add support for specifying antenna power behavior in libhackrf.

* Moved bias tee config routines into user_config.c, cleaned up operation of hackrf_biast

* hackrf_biast now calls usage() and exits when invoked with no arguments

* Fixed minor documentation error in usage()

* minor syntax cleanup

* Add some documentation to the host API call

* Add proper declaration magic in hackrf.h to hackrf_set_user_bias_t_opts() to appease Visual Studio

* Documentation changes suggested by @martinling

* Moved bias t setting above switch statement, removed line that explicit turned bias t off when entering OFF mode

* Change hackrf_set_user_bias_t_opts() to use a friendly struct() instead of a bitmask.  User friendliness fixes to hackrf_biast options.  More clang-format appeasement.

* Removed support for integer mode args from hackrf_biast

* clang-format error fixes

* Tweaked position of comment for clang-format v14

* Reformat files with clang-format v14 instead of 16

* Remove internal numeric modes for bias T settings

Co-authored-by: Martin Ling <martin-github@earth.li>

* Fix documentation error in hackrf_biast.c

---------

Co-authored-by: Martin Ling <martin-github@earth.li>
2023-09-13 11:15:30 -04:00
Sasszem
9910c88ac3 libhackrf: document required library versions 2023-07-06 01:37:08 +02:00
László Baráth
17269d3a7c Document libhackrf functions using Doxygen (#1244)
* Document & comment code

* document functions & add pages for groups

* Run clang-format

* Fix most review change requests

* Fix typos, add information on using multiple Opera Cake boards

* Update documentation

* Changes requested by @Straithe
- update project brief
- set paper type to letter
- move doxyfile

* Changes requested by @martinling
Excluding the USB API versioning

* Remove incomplete USB version info
The required versions were only noted at a few places. Will add complete info later, but for now, it's removed
2023-04-22 22:03:49 -04:00
Michael Ossmann
6f26b74e90 Merge pull request #1253 from Sasszem/memory-waste
Fix memory waste in allocated_transfers
2023-01-05 15:34:27 -05:00
Mike Walters
5084a84a3d libhackrf: add function to lookup platform ID from board ID 2023-01-05 15:13:06 +00:00
Sasszem
b52631b6f5 Fix memory waste in allocated_transfers
Did a search for allocations & all others were fine
2023-01-04 22:09:49 +01:00
Michael Ossmann
3d39660be1 Merge pull request #1237 from greatscottgadgets/tuning
restrict IF to 2170-2740 MHz
2022-12-23 11:56:38 -05:00
Michael Ossmann
3d687a20fd increase forceable IF range to 2000-3000 MHz 2022-12-23 06:06:22 -05:00
Michael Ossmann
173612ac77 add --led option to hackrf_debug
and corresponding changes to libhackrf and firmware
2022-12-18 07:22:17 -05:00
Michael Ossmann
86c1d8ce6e restrict IF to 2170-2740 MHz 2022-12-09 09:12:37 -05:00
Michael Ossmann
219abf7a4c Merge pull request #1180 from martinling/fix-transfer-locking
Improve transfer locking
2022-09-28 05:06:07 -04:00
Martin Ling
f7c219e30f Merge all_finished_lock with transfer_lock. 2022-09-26 14:01:16 +01:00
Martin Ling
367ce3d7b3 Hold transfer lock during initial submissions in prepare_transfers. 2022-09-26 14:01:15 +01:00
Martin Ling
559a45bd6b Extend scope of transfer_lock in callback. 2022-09-26 13:42:22 +01:00
Michael Ossmann
06b9d7bee0 Clean up source code copyright notices. 2022-09-23 14:46:52 -04:00
Martin Ling
2e73a4f2db If TX callback sets valid_length to 0, treat as end of data. 2022-09-23 12:46:49 +01:00
Martin Ling
0becbc6b4a Indicate success or failure to flush callback. 2022-09-23 05:19:29 -04:00
Martin Ling
4810d1f992 Fold transfer_finished function into libusb transfer callback. 2022-09-23 05:19:29 -04:00
Martin Ling
1484b78c05 Expand lock scope in libusb transfer callback.
This is required since cancel_transfers will also cancel the flush.
2022-09-23 05:19:29 -04:00
Martin Ling
770416f122 Cancel flush transfer if shutting down. 2022-09-23 05:19:29 -04:00
Martin Ling
14093fe73b Provide a callback for completion of a TX transfer. 2022-09-23 05:19:29 -04:00
Martin Ling
b872647e97 Provide a callback for TX flush, rather than a wait function. 2022-09-23 05:19:29 -04:00
Michael Ossmann
8e83506da1 Merge pull request #1166 from martinling/tx-disconnect-hang
Fix hang in TX when a libusb error occurs.
2022-09-19 21:28:49 -04:00
Martin Ling
e53b9d5717 Fix hang in TX when a libusb error occurs.
Where our callback is called with a status other than COMPLETED,
something abnormal has happened and we no longer want to either
submit further transfers or await a flush. So clear the streaming
and flush flags, and proceed to transfer_finished.

Do the same in the case where libusb_submit_transfer fails when
called to submit the flush transfer.
2022-09-20 02:07:21 +01:00
Michael Ossmann
471c5bc5de libhackrf: #define outdated board IDs 2022-09-19 19:55:33 -04:00
Michael Ossmann
22635bf07d libhackrf: update hackrf_transfer struct comment 2022-09-18 05:13:25 -04:00
Martin Ling
6ab17209d7 Disable flush when cancelling transfers. 2022-09-16 15:55:20 +01:00
Martin Ling
55fdddd81e Merge remote-tracking branch 'origin/master' into tx-transfer-sizing 2022-09-15 15:32:20 +01:00
Martin Ling
1b166a5b05 Pad the last data in a transmission to the next 512 byte boundary. 2022-09-15 15:27:53 +01:00
Martin Ling
69823397b1 Submit flush transfer as soon as end of data is reached. 2022-09-15 15:12:41 +01:00
Martin Ling
22846b5682 Make libhackrf honour the valid_length set by TX callback. 2022-09-14 15:48:34 +01:00
Michael Ossmann
9329c5e44e Detect hardware platform at run-time.
Firmware now detects the hardware it is running on at startup and
refuses to run if it is compiled for the wrong platform. The board ID
returned by firmware to the host is now derived from run-time detection
rather than a compile-time value. A separate method to retrieve
compile-time supported platform is added.

On HackRF One, pin straps are checked to determine hardware revision.
This is informational to aid troubleshooting and does not affect any
function.
2022-09-14 07:08:47 -04:00
Michael Ossmann
fdfe310f9a Merge pull request #1139 from martinling/tx-flush
Support flushing the device TX buffer before ending transmission
2022-09-14 05:45:40 -04:00
Michael Ossmann
70a04855ac libhackrf: add transfer buffer size access calls
Applications may need to learn the size of the USB transfer buffer
queue, for example to determine how many bytes will be preloaded with
calls to the TX callback.
2022-09-09 16:16:24 -04:00
Martin Ling
d556f0abab Add API to support flushing the device buffer when TX finishes. 2022-08-24 23:48:22 +01:00
Martin Ling
9d2e163a2d Call TX callback to fill transfers before initial submission. 2022-08-23 13:21:43 +01:00
Martin Ling
8bd8dedddc Use an early return to reduce indentation in prepare_transfers. 2022-08-23 13:03:53 +01:00
Martin Ling
5881b3b6a1 Add defines for TX and RX endpoint addresses. 2022-08-23 12:24:00 +01:00