2436 Commits

Author SHA1 Message Date
Martin Ling
2f26ebffd4 Keep buffer base & size mask in high registers.
The high registers (r8-r14) cannot be used directly by most of the
instructions in the Cortex-M0 instruction set.

One of the few instructions that can use them is mov, which can use
any pair of registers.

This allows saving two cycles, by replacing two loads (2 cycles each)
with moves (1 cycle each), after stashing the required values in high
registers at startup.
2022-01-03 18:48:04 +00:00
Martin Ling
8f43dc1be5 Use a register to hold base address of SGPIO interrupt registers.
This allows us to use ldr/str with an immediate offset to access the
SGPIO interrupt registers, rather than first having to load a register
with the specific address we want to access.

This change saves a total of 6 cycles, by eliminating two loads (2
cycles each), one of which could be executed twice.
2022-01-03 18:48:04 +00:00
Martin Ling
9206a8b752 Free up two registers by accessing SGPIO in two 16-byte chunks.
The current code does reads and writes in two chunks: one of
6 words, followed by one of 2.

Instead, use two chunks of 4 words each. This takes the same number of
total cycles, but frees up two registers for other uses.

Note that we can't do things in one chunk, because we'd need eight
registers to hold the data, plus a ninth to hold the buffer pointer. The
ldm/stm instructions can only use the eight low registers, r0-r7.

So we have to use two chunks, and the most register-efficient way to do
that is to use two equal chunks.
2022-01-03 18:48:04 +00:00
Martin Ling
c6362381d1 Initialise register with a constant value before SGIO loop.
Previously this register was reloaded with the same value during each loop.
Initialising it once, outside the loop, saves two cycles.

Note the separation of the loop start ("loop") from the entry point ("main").
Code between these labels will be run once, at startup.
2022-01-03 18:48:04 +00:00
Martin Ling
f61a03dead Assign names to registers which are used for a single purpose.
This is just to improve readability; there is no change to the code.
2022-01-03 18:48:04 +00:00
Martin Ling
dc0f8f48c5 Use defines for offsets into SGPIO shadow registers.
This is just to make the SGPIO code less cryptic, and to place
the explanation of the offsets closer to where they are defined.
2022-01-03 18:48:04 +00:00
Martin Ling
5b2a390728 Move M0 offset and tx variables into a state struct.
These variables are already placed together; this commit just groups
them into a struct and declares this in a new header.

This commit should not result in any change to the firmware binary.
Only the names of symbols are changed.
2022-01-03 18:47:58 +00:00
Martin Ling
39c6f3385e Remove usb_bulk_buffer.c containing unused variable definition.
This removes the definition of the offset variable,

volatile uint32_t usb_bulk_buffer_offset = 0;

which is actually superfluous. This variable, along with its neighbour
usb_bulk_buffer_tx, is placed explicitly by the linker script. Its type
is defined by the declaration in usb_bulk_buffer.h.

There is no need to define it here, and doing so gives the misleading
impression that its initial value can be changed by modifying this line!

The initialization to zero never actually takes effect, because the
variable is not placed in the .data or .bss sections which are
initialised by the startup code.

The offset and tx variables are both set in set_transceiver_mode
before SGPIO streaming is started, so the M0 code does not use
them uninitialised.
2022-01-03 18:47:33 +00:00
Martin Ling
3d9802260e Document purpose and timing of existing M0 code.
This commit does not modify the code; it only updates comments.
2022-01-03 18:47:24 +00:00
Mike Walters
4df805c85f Merge pull request #1015 from greatscottgadgets/subdirectory-build-actions
add subdirectory builds to GitHub Actions
2021-12-13 10:58:32 +00:00
Michael Ossmann
b1b11e6269 update Opera Cake documentation (#1017) 2021-12-12 17:06:53 -05:00
Michael Ossmann
39c829e499 add subdirectory builds to GitHub Actions
Build in the libhackrf and hackrf-tools subdirectories in addtion to the
top host directory.
2021-12-08 18:10:38 -07:00
Michael Ossmann
d46c8e14d5 Merge pull request #1014 from greatscottgadgets/revert-664-cmake_cleanup
Revert "Cleanup of host software CMake build system"
2021-12-08 17:06:36 -07:00
Michael Ossmann
aa0485d4df Revert "Cleanup of host software CMake build system (#664)"
This reverts commit d60fb83320cea49fd20305f22838f948557f1b81.
2021-12-08 16:59:05 -07:00
Straithe
113a870c4d Create CODE_OF_CONDUCT.md (#1009) 2021-12-06 13:38:23 -05:00
Jamie Smith
d60fb83320 Cleanup of host software CMake build system (#664)
* Clean up the CMake build system and improve the FindFFTW3 module.

* Fixes for Linux build

* Include winsock.h to get struct timeval

* Couple more fixes for MSVC, also add new FindMath module

* Update host build README for new CMake changes (esp. Windows)

* Try to fix Travis OS X build error

* Add docs about pthread-win32

* Whoops, AppVeyor caught a bug in FindFFTW where the includes not being found weren't generating a fatal error.

* Travis rebuild bump

* One more fix: replace hardcoded include paths with a PATH_SUFFIX to standard include paths

* Invert Windows preprocessor flag so it's only needed when using a static build.  This preserves compatibility with the previous system.

* Fix copy-paste error

* Update cmake modules from amber-cmake upstream, incorporate TryLinkLibrary into FindUSB1

* Fix missing include
2021-12-03 14:11:04 -05:00
Martin Ling
e9dd7eb291 Merge pull request #1004 from gibbi/AG-FixRateChange
fix stream glitch on rate change
2021-12-02 16:34:41 +00:00
Andreas Gibhardt
fc8b3c18d6 fix stream glitch on rate change 2021-12-02 16:27:43 +01:00
Michael Ossmann
22267f3b8e Merge pull request #996 from straithe/updateDocumentation
Update docs
2021-11-19 20:05:41 -07:00
straithe
7415764b84 Update docs 2021-11-18 20:16:30 -05:00
Michael Ossmann
26c0f70b6b Merge pull request #995 from greatscottgadgets/transfer-struct-doc
libhackrf: document hackrf_transfer struct
2021-11-18 13:06:03 -07:00
Michael Ossmann
0f4f1addd1 libhackrf: document hackrf_transfer struct 2021-11-17 18:38:00 -07:00
Michael Ossmann
80948a2252 Merge pull request #994 from straithe/master
Remove links to mailing list
2021-11-15 17:49:37 -07:00
straithe
19c99909b2 Remove links to mailing list 2021-11-15 19:29:01 -05:00
Mike Walters
01675961cb Merge pull request #993 from greatscottgadgets/sweep-num_samples
hackrf_sweep: simplify dwell time, bin width, and time stamps
2021-11-15 21:59:12 +00:00
Michael Ossmann
c8695e0a44 hackrf_sweep: correct -w (bin_width) minimum 2021-11-14 12:21:29 -07:00
Michael Ossmann
8a3547e71e hackrf_sweep: improve -w (bin_width) guidance 2021-11-14 12:05:29 -07:00
Michael Ossmann
9856452215 hackrf_sweep: eliminate -n option (num_samples)
The firmware has the capability to dwell on each frequency for a
configurable duration in sweep mode, but the hackrf_sweep host tool did
not behave correctly when asked to use a non-default dwell time. The
option has never worked properly, and it is not a feature anyone seems
to want.
2021-11-14 11:41:56 -07:00
Michael Ossmann
2775279fd0 hackrf_sweep: eliminate time stamp adjustment
We previously attempted to adjust the output time stamp according to the
sample rate and placement of the samples within the USB transfer data,
but the end result was a fixed time offset with respect to the time of
USB transfer completion. We are using only those samples closest to the
end of the transfer, so it makes sense to simply use the time the USB
transfer ends and not try to correct that fixed offset.

It may be possible in the future to have a more accurate time stamp
generated in firmware, but I don't think it is worth complicating the
host code with minor time adjustments until and unless firmware-based
time stamps become available.
2021-11-14 11:20:31 -07:00
Michael Ossmann
bd4b786136 Merge pull request #990 from miek/fix_m0_rebuild
Fix automatic rebuilding of M0 code
2021-11-11 17:03:12 -07:00
Michael Ossmann
74fb86f8bc Do not set USB device address to zero (#987)
When setting the USB configuration to zero  return from the
configured state to the address state according to the USB
specification.
2021-11-10 11:22:08 -05:00
Mike Walters
6d56217762 Fix automatic rebuilding of M0 code
This uses `add_custom_command` to run a cmake script instead of using
`configure_file` directly, which allows for adding dependencies and
creates an ouput that can be depended on.

It also uses `add_custom_command` instead of `add_custom_target` to
create the M0 binary, since custom targets have no output file to depend
on.

Unfortunately, multiple targets cannot depend on the same generated file
or cmake tries to run the generation multiple times in parallel. So, the
.bin/.s generation is now duplicated for each target so they don't
conflict.

fixes #693
2021-11-10 11:31:42 +00:00
Michael Ossmann
d94295edcf add list of hardware revisions (#988) 2021-11-08 18:29:16 -05:00
Michael Ossmann
39017551f1 Merge pull request #986 from straithe/removeTravis
Remove Travis file
2021-11-08 14:14:55 -07:00
straithe
fd99b1e688 Remove Travis file 2021-11-08 16:10:04 -05:00
Michael Ossmann
ec3cf3dac9 Merge pull request #985 from lyusupov/master
sgpio_cpld_stream_rx_set_decimation() is no longer available
2021-11-08 14:08:03 -07:00
Linar Yusupov
909c0ca17f sgpio_cpld_stream_rx_set_decimation() is no longer available 2021-11-08 16:45:11 +03:00
Michael Ossmann
681d0c165b Merge pull request #981 from straithe/updateDocsHackRFPage
Update HackRF one docs page
2021-11-03 15:01:49 -06:00
straithe
5a56fff91a Update HackRF one docs pag 2021-11-02 21:07:20 -04:00
Michael Ossmann
f92d49ab23 Merge pull request #961 from straithe/updatedOperatingSystemsPage
Update installing hackrf software documentation
2021-11-02 16:39:14 -06:00
Michael Ossmann
3589bc4ed3 Merge pull request #950 from miek/operacake-cleanup
Opera Cake CLI/API cleanup
2021-10-28 17:00:55 -06:00
straithe
dcc23c40d0 Remove non-HackRF references 2021-10-25 17:41:12 -04:00
Michael Ossmann
c030776792 Merge pull request #971 from ffontaine/master
cmake/modules/FindFFTW.cmake: fix build without fftw3
2021-10-20 10:45:26 -06:00
Fabrice Fontaine
3e32f46c79 cmake/modules/FindFFTW.cmake: fix build without fftw3
Build on Linux fails if libfftw3 is not available since commit
a8c1fc92e9
which replaced
pkg_check_modules(FFTW REQUIRED fftw3f)
by
find_package(FFTW REQUIRED)

Fix this build failure by updating FindFFTW.cmake to check for fftw3f

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-10-15 23:42:03 +02:00
Mike Walters
f5a7132805 hackrf_operacake: make main options mutually exclusive
ref #930
2021-10-15 14:45:38 +01:00
Mike Walters
4ecbd5d2c9 hackrf_operacake: add option for default dwell time
This allows for usage like this:

  $ hackrf_operacake -m time -w 1e6 -t A1 -t A2 -t A3
  $ hackrf_transfer -r /dev/null -s 1e6

ref #930
2021-10-15 14:45:38 +01:00
Mike Walters
38ed075437 operacake: replace hackrf_set_operacake_ranges with hackrf_set_operacake_freq_ranges 2021-10-15 14:45:38 +01:00
Mike Walters
0e68be7771 hackrf_operacake: simplify frequency range parsing 2021-10-15 14:45:38 +01:00
Mike Walters
07a9dd73d8 hackrf_operacake: swap argument order for frequency-switching
ref #930
2021-10-15 14:45:38 +01:00
Mike Walters
f9b923fce2 hackrf_operacake: default to address 0
ref #930
2021-10-15 14:45:38 +01:00