Mark code sections to be left alone by clang-format.

This commit is contained in:
Martin Ling
2022-06-27 12:32:02 +01:00
parent b4c828915a
commit dbcc46d221
9 changed files with 21 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
// clang-format off
typedef enum { typedef enum {
CPLD_XC2C_IR_INTEST = 0b00000010, CPLD_XC2C_IR_INTEST = 0b00000010,
CPLD_XC2C_IR_BYPASS = 0b11111111, CPLD_XC2C_IR_BYPASS = 0b11111111,
@ -52,6 +53,7 @@ typedef enum {
CPLD_XC2C_IR_STCTEST = 0b00010110, CPLD_XC2C_IR_STCTEST = 0b00010110,
CPLD_XC2C_IR_ISC_NOOP = 0b11100000, CPLD_XC2C_IR_ISC_NOOP = 0b11100000,
} cpld_xc2c_ir_t; } cpld_xc2c_ir_t;
// clang-format on
static bool cpld_xc2c_jtag_clock(const jtag_t* const jtag, const uint32_t tms, const uint32_t tdi) { static bool cpld_xc2c_jtag_clock(const jtag_t* const jtag, const uint32_t tms, const uint32_t tdi) {
// 8 ns TMS/TDI to TCK setup // 8 ns TMS/TDI to TCK setup

View File

@ -56,6 +56,7 @@ static struct gpio_t gpio_led[] = {
#endif #endif
}; };
// clang-format off
static struct gpio_t gpio_1v8_enable = GPIO(3, 6); static struct gpio_t gpio_1v8_enable = GPIO(3, 6);
/* MAX2837 GPIO (XCVR_CTL) PinMux */ /* MAX2837 GPIO (XCVR_CTL) PinMux */
@ -135,6 +136,7 @@ static struct gpio_t gpio_cpld_pp_tdo = GPIO(1, 8);
static struct gpio_t gpio_hw_sync_enable = GPIO(5,12); static struct gpio_t gpio_hw_sync_enable = GPIO(5,12);
static struct gpio_t gpio_rx_q_invert = GPIO(0, 13); static struct gpio_t gpio_rx_q_invert = GPIO(0, 13);
// clang-format on
i2c_bus_t i2c0 = { i2c_bus_t i2c0 = {
.obj = (void*)I2C0_BASE, .obj = (void*)I2C0_BASE,
@ -521,6 +523,7 @@ static void cpu_clock_pll1_max_speed(void)
/* 5. Reconfigure PLL1 to produce the final output frequency, with the /* 5. Reconfigure PLL1 to produce the final output frequency, with the
* crystal oscillator as clock source. */ * crystal oscillator as clock source. */
reg_val = CGU_PLL1_CTRL; reg_val = CGU_PLL1_CTRL;
// clang-format off
reg_val &= ~( CGU_PLL1_CTRL_CLK_SEL_MASK | reg_val &= ~( CGU_PLL1_CTRL_CLK_SEL_MASK |
CGU_PLL1_CTRL_PD_MASK | CGU_PLL1_CTRL_PD_MASK |
CGU_PLL1_CTRL_FBSEL_MASK | CGU_PLL1_CTRL_FBSEL_MASK |
@ -537,6 +540,7 @@ static void cpu_clock_pll1_max_speed(void)
CGU_PLL1_CTRL_MSEL(16) | CGU_PLL1_CTRL_MSEL(16) |
CGU_PLL1_CTRL_FBSEL(0) | CGU_PLL1_CTRL_FBSEL(0) |
CGU_PLL1_CTRL_DIRECT(1); CGU_PLL1_CTRL_DIRECT(1);
// clang-format on
CGU_PLL1_CTRL = reg_val; CGU_PLL1_CTRL = reg_val;
/* 6. Wait for PLL1 to lock. */ /* 6. Wait for PLL1 to lock. */

View File

@ -29,6 +29,7 @@
#define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x)
/* Stub functions for null UI function table */ /* Stub functions for null UI function table */
// clang-format off
void hackrf_ui_init_null(void) { } void hackrf_ui_init_null(void) { }
void hackrf_ui_deinit_null(void) { } void hackrf_ui_deinit_null(void) { }
void hackrf_ui_set_frequency_null(uint64_t frequency) { UNUSED(frequency); } void hackrf_ui_set_frequency_null(uint64_t frequency) { UNUSED(frequency); }
@ -45,6 +46,7 @@ void hackrf_ui_set_antenna_bias_null(bool antenna_bias) { UNUSED(antenna_bias);
void hackrf_ui_set_clock_source_null(clock_source_t source) { UNUSED(source); } void hackrf_ui_set_clock_source_null(clock_source_t source) { UNUSED(source); }
void hackrf_ui_set_transceiver_mode_null(transceiver_mode_t mode) { UNUSED(mode); } void hackrf_ui_set_transceiver_mode_null(transceiver_mode_t mode) { UNUSED(mode); }
bool hackrf_ui_operacake_gpio_compatible_null(void) { return true; } bool hackrf_ui_operacake_gpio_compatible_null(void) { return true; }
// clang-format on
/* Null UI function table, used if there's no hardware UI detected. Eliminates the /* Null UI function table, used if there's no hardware UI detected. Eliminates the
* need to check for null UI before calling a function in the table. * need to check for null UI before calling a function in the table.

View File

@ -259,6 +259,7 @@ typedef struct {
uint32_t ft; uint32_t ft;
} max2837_ft_t; } max2837_ft_t;
// clang-format off
static const max2837_ft_t max2837_ft[] = { static const max2837_ft_t max2837_ft[] = {
{ 1750000, MAX2837_FT_1_75M }, { 1750000, MAX2837_FT_1_75M },
{ 2500000, MAX2837_FT_2_5M }, { 2500000, MAX2837_FT_2_5M },
@ -278,6 +279,7 @@ static const max2837_ft_t max2837_ft[] = {
{ 28000000, MAX2837_FT_28M }, { 28000000, MAX2837_FT_28M },
{ 0, 0 }, { 0, 0 },
}; };
//clang-format on
uint32_t max2837_set_lpf_bandwidth(max2837_driver_t* const drv, const uint32_t bandwidth_hz) { uint32_t max2837_set_lpf_bandwidth(max2837_driver_t* const drv, const uint32_t bandwidth_hz) {
const max2837_ft_t* p = max2837_ft; const max2837_ft_t* p = max2837_ft;

View File

@ -5,6 +5,7 @@
#include "gpio_lpc.h" #include "gpio_lpc.h"
/* RFFC5071 GPIO serial interface PinMux */ /* RFFC5071 GPIO serial interface PinMux */
// clang-format off
#if (defined JAWBREAKER || defined HACKRF_ONE) #if (defined JAWBREAKER || defined HACKRF_ONE)
static struct gpio_t gpio_rffc5072_select = GPIO(2, 13); static struct gpio_t gpio_rffc5072_select = GPIO(2, 13);
static struct gpio_t gpio_rffc5072_clock = GPIO(5, 6); static struct gpio_t gpio_rffc5072_clock = GPIO(5, 6);
@ -19,6 +20,7 @@ static struct gpio_t gpio_vco_le = GPIO(2, 14);
static struct gpio_t gpio_vco_mux = GPIO(5, 25); static struct gpio_t gpio_vco_mux = GPIO(5, 25);
static struct gpio_t gpio_synt_rfout_en = GPIO(3, 5); static struct gpio_t gpio_synt_rfout_en = GPIO(3, 5);
#endif #endif
// clang-format on
#if (defined JAWBREAKER || defined HACKRF_ONE) #if (defined JAWBREAKER || defined HACKRF_ONE)
const rffc5071_spi_config_t rffc5071_spi_config = { const rffc5071_spi_config_t rffc5071_spi_config = {

View File

@ -31,6 +31,7 @@ static void portapack_sleep_milliseconds(const uint32_t milliseconds) {
delay(milliseconds * 40800); delay(milliseconds * 40800);
} }
// clang-format off
static struct gpio_t gpio_io_stbx = GPIO(5, 0); /* P2_0 */ static struct gpio_t gpio_io_stbx = GPIO(5, 0); /* P2_0 */
static struct gpio_t gpio_addr = GPIO(5, 1); /* P2_1 */ static struct gpio_t gpio_addr = GPIO(5, 1); /* P2_1 */
__attribute__((unused)) __attribute__((unused))
@ -40,6 +41,7 @@ static struct gpio_t gpio_unused = GPIO(5, 7); /* P2_8 */
static struct gpio_t gpio_lcd_rdx = GPIO(5, 4); /* P2_4 */ static struct gpio_t gpio_lcd_rdx = GPIO(5, 4); /* P2_4 */
static struct gpio_t gpio_lcd_wrx = GPIO(1, 10); /* P2_9 */ static struct gpio_t gpio_lcd_wrx = GPIO(1, 10); /* P2_9 */
static struct gpio_t gpio_dir = GPIO(1, 13); /* P2_13 */ static struct gpio_t gpio_dir = GPIO(1, 13); /* P2_13 */
// clang-format on
typedef struct portapack_if_t { typedef struct portapack_if_t {
gpio_t gpio_dir; gpio_t gpio_dir;

View File

@ -240,6 +240,7 @@ static void switchctrl_set(rf_path_t* const rf_path, const uint8_t gpo) {
void rf_path_pin_setup(rf_path_t* const rf_path) { void rf_path_pin_setup(rf_path_t* const rf_path) {
#ifdef HACKRF_ONE #ifdef HACKRF_ONE
/* Configure RF switch control signals */ /* Configure RF switch control signals */
// clang-format off
scu_pinmux(SCU_HP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_HP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_LP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_LP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_TX_MIX_BP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_TX_MIX_BP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
@ -253,6 +254,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path) {
scu_pinmux(SCU_AMP_BYPASS, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_AMP_BYPASS, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_RX_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_RX_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_NO_RX_AMP_PWR, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_NO_RX_AMP_PWR, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
// clang-format on
/* Configure RF power supply (VAA) switch */ /* Configure RF power supply (VAA) switch */
scu_pinmux(SCU_NO_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_NO_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
@ -279,6 +281,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path) {
switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS); switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS);
#elif RAD1O #elif RAD1O
/* Configure RF switch control signals */ /* Configure RF switch control signals */
// clang-format off
scu_pinmux(SCU_BY_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_BY_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_BY_AMP_N, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); scu_pinmux(SCU_BY_AMP_N, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
scu_pinmux(SCU_TX_RX, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_TX_RX, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
@ -290,6 +293,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path) {
scu_pinmux(SCU_TX_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_TX_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_RX_LNA, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); scu_pinmux(SCU_RX_LNA, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
scu_pinmux(SCU_MIXER_EN, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); scu_pinmux(SCU_MIXER_EN, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
// clang-format on
/* Configure RF power supply (VAA) switch */ /* Configure RF power supply (VAA) switch */
scu_pinmux(SCU_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0); scu_pinmux(SCU_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);

View File

@ -63,6 +63,7 @@ typedef enum {
} iap_cmd_code_t; } iap_cmd_code_t;
/* ISP/IAP Return Code */ /* ISP/IAP Return Code */
// clang-format off
typedef enum typedef enum
{ {
CMD_SUCCESS = 0x00000000, /* CMD_SUCCESS Command is executed successfully. CMD_SUCCESS = 0x00000000, /* CMD_SUCCESS Command is executed successfully.
@ -94,6 +95,7 @@ typedef enum
/* Special Error */ /* Special Error */
ERROR_IAP_NOT_IMPLEMENTED = 0x00000100 /* IAP is not implemented in this part */ ERROR_IAP_NOT_IMPLEMENTED = 0x00000100 /* IAP is not implemented in this part */
} isp_iap_ret_code_t; } isp_iap_ret_code_t;
// clang-format on
typedef struct typedef struct
{ {

View File

@ -159,6 +159,7 @@ uint8_t usb_descriptor_string_languages[] = {
USB_WORD(USB_STRING_LANGID), // wLANGID USB_WORD(USB_STRING_LANGID), // wLANGID
}; };
// clang-format off
uint8_t usb_descriptor_string_manufacturer[] = { uint8_t usb_descriptor_string_manufacturer[] = {
40, // bLength 40, // bLength
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType