hackrf/firmware/common/rffc5071.h
Martin Ling 2ad78ce6de
Some checks failed
Build / host (3.10.0, map[os:ubuntu shell:bash]) (push) Failing after 8s
Build / host (3.21.0, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / host (3.16.0, map[os:ubuntu shell:bash]) (push) Failing after 8s
Build / host (4.0.0, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / host (latest, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / firmware (HACKRF_ONE, 3.10.0, ubuntu) (push) Failing after 4s
Build / firmware (HACKRF_ONE, latest, ubuntu) (push) Failing after 5s
Build / firmware (JAWBREAKER, latest, ubuntu) (push) Failing after 7s
Build / firmware (JAWBREAKER, 3.10.0, ubuntu) (push) Failing after 7s
Build / firmware (PRALINE, 3.10.0, ubuntu) (push) Failing after 9s
Build / firmware (PRALINE, latest, ubuntu) (push) Failing after 9s
Build / firmware (RAD1O, 3.10.0, ubuntu) (push) Failing after 11s
Build / firmware (RAD1O, latest, ubuntu) (push) Failing after 9s
Build / firmware (UNIVERSAL, 3.10.0, ubuntu) (push) Failing after 10s
Build / firmware (UNIVERSAL, latest, ubuntu) (push) Failing after 9s
Check code style / clang-format (push) Failing after 13s
Check code style / clang-format-1 (push) Failing after 14s
Check code style / clang-format-2 (push) Failing after 13s
Check code style / clang-format-3 (push) Failing after 7s
Check includes / includes-check (HACKRF_ONE, 3.10.0) (push) Failing after 3s
Check includes / includes-check (HACKRF_ONE, latest) (push) Failing after 4s
Check includes / includes-check (JAWBREAKER, 3.10.0) (push) Failing after 4s
Check includes / includes-check (JAWBREAKER, latest) (push) Failing after 5s
Check includes / includes-check (PRALINE, 3.10.0) (push) Failing after 6s
Check includes / includes-check (PRALINE, latest) (push) Failing after 8s
Check includes / includes-check (RAD1O, 3.10.0) (push) Failing after 9s
Check includes / includes-check (RAD1O, latest) (push) Failing after 9s
Check includes / includes-check (UNIVERSAL, 3.10.0) (push) Failing after 7s
Check includes / includes-check (UNIVERSAL, latest) (push) Failing after 6s
Build / host (4.0.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (latest, --install-prefix=/usr/local, map[os:windows shell:msys2]) (push) Has been cancelled
Build / host (3.10.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (3.16.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (3.21.0, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (3.21.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (4.0.0, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (latest, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (latest, map[os:macos shell:bash]) (push) Has been cancelled
Build / firmware (HACKRF_ONE, latest, windows) (push) Has been cancelled
Build / firmware (JAWBREAKER, latest, windows) (push) Has been cancelled
Build / firmware (PRALINE, 3.10.0, macos) (push) Has been cancelled
Build / firmware (PRALINE, latest, macos) (push) Has been cancelled
Build / firmware (PRALINE, latest, windows) (push) Has been cancelled
Build / firmware (UNIVERSAL, latest, macos) (push) Has been cancelled
Build / firmware (UNIVERSAL, latest, windows) (push) Has been cancelled
Build / firmware (RAD1O, latest, windows) (push) Has been cancelled
Build / firmware (UNIVERSAL, 3.10.0, macos) (push) Has been cancelled
Use IS macros for all conditional compilation.
2026-04-14 12:11:01 +01:00

73 lines
2.6 KiB
C

/*
* Copyright 2012-2014 Great Scott Gadgets <info@greatscottgadgets.com>
* Copyright 2014 Jared Boone <jared@sharebrained.com>
*
* This file is part of HackRF.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "gpio.h"
#include "platform_detect.h"
#include "spi_bus.h"
/* 31 registers, each containing 16 bits of data. */
#define RFFC5071_NUM_REGS 31
typedef struct {
spi_bus_t* const bus;
gpio_t gpio_reset;
#if defined(IS_PRALINE)
gpio_t gpio_ld;
#endif
uint16_t regs[RFFC5071_NUM_REGS];
uint32_t regs_dirty;
} rffc5071_driver_t;
/* Initialize chip. Call _setup() externally, as it calls _init(). */
extern void rffc5071_init(rffc5071_driver_t* const drv);
extern void rffc5071_setup(rffc5071_driver_t* const drv);
extern void rffc5071_lock_test(rffc5071_driver_t* const drv);
/* Read a register via SPI. Save a copy to memory and return
* value. Discard any uncommited changes and mark CLEAN. */
extern uint16_t rffc5071_reg_read(rffc5071_driver_t* const drv, uint8_t r);
/* Write value to register via SPI and save a copy to memory. Mark
* CLEAN. */
extern void rffc5071_reg_write(rffc5071_driver_t* const drv, uint8_t r, uint16_t v);
/* Write all dirty registers via SPI from memory. Mark all clean. Some
* operations require registers to be written in a certain order. Use
* provided routines for those operations. */
extern void rffc5071_regs_commit(rffc5071_driver_t* const drv);
/* Set frequency (Hz). */
extern uint64_t rffc5071_set_frequency(rffc5071_driver_t* const drv, uint64_t hz);
extern void rffc5071_enable(rffc5071_driver_t* const drv);
extern void rffc5071_disable(rffc5071_driver_t* const drv);
extern void rffc5071_set_gpo(rffc5071_driver_t* const drv, uint8_t);
#if defined(IS_PRALINE)
extern bool rffc5071_poll_ld(rffc5071_driver_t* const drv, uint8_t* prelock_state);
#endif
extern bool rffc5071_check_lock(rffc5071_driver_t* const drv);