Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions firmware/common/cpld_jtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "gpio.h"

typedef struct jtag_gpio_t {
typedef struct {
gpio_t gpio_tck;
#ifndef PRALINE
gpio_t gpio_tms;
Expand All @@ -38,7 +38,7 @@ typedef struct jtag_gpio_t {
#endif
} jtag_gpio_t;

typedef struct jtag_t {
typedef struct {
jtag_gpio_t* const gpio;
} jtag_t;

Expand Down
6 changes: 2 additions & 4 deletions firmware/common/fault_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
// TODO: Move all this to a Cortex-M(?) include file, since these
// structures are supposedly the same between processors (to an
// undetermined extent).
typedef struct armv7m_scb_t armv7m_scb_t;

struct armv7m_scb_t {
typedef struct {
volatile const uint32_t CPUID;
volatile uint32_t ICSR;
volatile uint32_t VTOR;
Expand Down Expand Up @@ -63,7 +61,7 @@ struct armv7m_scb_t {
volatile const uint32_t ID_ISAR4;
volatile const uint32_t __reserved_0x74_0x87[5];
volatile uint32_t CPACR;
} __attribute__((packed));
} __attribute__((packed)) armv7m_scb_t;

static armv7m_scb_t* const SCB = (armv7m_scb_t*) SCB_BASE;

Expand Down
7 changes: 2 additions & 5 deletions firmware/common/fpga.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ typedef enum {
FPGA_QUARTER_SHIFT_MODE_DOWN = 0b01,
} fpga_quarter_shift_mode_t;

struct fpga_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct fpga_driver_t fpga_driver_t;

struct fpga_driver_t {
typedef struct {
ice40_spi_driver_t* bus;
uint8_t regs[FPGA_NUM_REGS];
uint8_t regs_dirty;
};
} fpga_driver_t;

struct fpga_loader_t {
/* Start address added as an offset to all read() calls. */
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/gpio_lpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* register #defines and API declarations into separate header files.
*/

typedef struct gpio_port {
typedef struct {
volatile uint32_t dir; /* +0x000 */
uint32_t _reserved0[31];
volatile uint32_t mask; /* +0x080 */
Expand Down
13 changes: 5 additions & 8 deletions firmware/common/i2c_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,18 @@
#include <stddef.h>
#include <stdint.h>

struct i2c_bus_t; // IWYU pragma: keep - fixed in #1704
typedef struct i2c_bus_t i2c_bus_t;

struct i2c_bus_t {
typedef struct _i2c_bus_t {
void* const obj;
void (*start)(i2c_bus_t* const bus, const void* const config);
void (*stop)(i2c_bus_t* const bus);
void (*start)(struct _i2c_bus_t* const bus, const void* const config);
void (*stop)(struct _i2c_bus_t* const bus);
void (*transfer)(
i2c_bus_t* const bus,
struct _i2c_bus_t* const bus,
const uint_fast8_t peripheral_address,
const uint8_t* const tx,
const size_t tx_count,
uint8_t* const rx,
const size_t rx_count);
};
} i2c_bus_t;

void i2c_bus_start(i2c_bus_t* const bus, const void* const config);
void i2c_bus_stop(i2c_bus_t* const bus);
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/i2c_lpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "i2c_bus.h"

typedef struct i2c_lpc_config_t {
typedef struct {
const uint16_t duty_cycle_count;
} i2c_lpc_config_t;

Expand Down
7 changes: 2 additions & 5 deletions firmware/common/ice40_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@
#include "gpio.h"
#include "spi_bus.h"

struct ice40_spi_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct ice40_spi_driver_t ice40_spi_driver_t;

struct ice40_spi_driver_t {
typedef struct {
spi_bus_t* const bus;
gpio_t gpio_select;
gpio_t gpio_creset;
gpio_t gpio_cdone;
};
} ice40_spi_driver_t;

void ice40_spi_target_init(ice40_spi_driver_t* const drv);
uint8_t ice40_spi_read(ice40_spi_driver_t* const drv, uint8_t r);
Expand Down
13 changes: 6 additions & 7 deletions firmware/common/max2831.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,21 @@ typedef enum {
MAX2831_RX_HPF_600_KHZ = 3,
} max2831_rx_hpf_freq_t;

struct max2831_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct max2831_driver_t max2831_driver_t;

struct max2831_driver_t {
typedef struct _max2831_driver_t {
spi_bus_t* bus;
gpio_t gpio_enable;
gpio_t gpio_rxtx;
gpio_t gpio_rxhp;
gpio_t gpio_ld;
void (*target_init)(max2831_driver_t* const drv);
void (*set_mode)(max2831_driver_t* const drv, const max2831_mode_t new_mode);
void (*target_init)(struct _max2831_driver_t* const drv);
void (*set_mode)(
struct _max2831_driver_t* const drv,
const max2831_mode_t new_mode);
max2831_mode_t mode;
uint16_t regs[MAX2831_NUM_REGS];
uint16_t regs_dirty;
uint32_t desired_lpf_bw;
};
} max2831_driver_t;

/* Initialize chip. */
extern void max2831_setup(max2831_driver_t* const drv);
Expand Down
13 changes: 6 additions & 7 deletions firmware/common/max2837.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,19 @@ typedef enum {
MAX2837_MODE_RX
} max2837_mode_t;

struct max2837_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct max2837_driver_t max2837_driver_t;

struct max2837_driver_t {
typedef struct _max2837_driver_t {
spi_bus_t* bus;
gpio_t gpio_enable;
gpio_t gpio_rx_enable;
gpio_t gpio_tx_enable;
void (*target_init)(max2837_driver_t* const drv);
void (*set_mode)(max2837_driver_t* const drv, const max2837_mode_t new_mode);
void (*target_init)(struct _max2837_driver_t* const drv);
void (*set_mode)(
struct _max2837_driver_t* const drv,
const max2837_mode_t new_mode);
max2837_mode_t mode;
uint16_t regs[MAX2837_NUM_REGS];
uint32_t regs_dirty;
};
} max2837_driver_t;

/* Initialize chip. */
extern void max2837_setup(max2837_driver_t* const drv);
Expand Down
13 changes: 6 additions & 7 deletions firmware/common/max2839.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,18 @@ typedef enum {
MAX2839_MODE_CLKOUT,
} max2839_mode_t;

struct max2839_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct max2839_driver_t max2839_driver_t;

struct max2839_driver_t {
typedef struct _max2839_driver_t {
spi_bus_t* bus;
gpio_t gpio_enable;
gpio_t gpio_rxtx;
void (*target_init)(max2839_driver_t* const drv);
void (*set_mode)(max2839_driver_t* const drv, const max2839_mode_t new_mode);
void (*target_init)(struct _max2839_driver_t* const drv);
void (*set_mode)(
struct _max2839_driver_t* const drv,
const max2839_mode_t new_mode);
max2839_mode_t mode;
uint16_t regs[MAX2839_NUM_REGS];
uint32_t regs_dirty;
};
} max2839_driver_t;

/* Initialize chip. */
extern void max2839_setup(max2839_driver_t* const drv);
Expand Down
9 changes: 3 additions & 6 deletions firmware/common/max5864.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@

#include "spi_bus.h"

struct max5864_driver_t; // IWYU pragma: keep - fixed in #1704
typedef struct max5864_driver_t max5864_driver_t;

struct max5864_driver_t {
typedef struct _max5864_driver_t {
spi_bus_t* const bus;
void (*target_init)(max5864_driver_t* const drv);
};
void (*target_init)(struct _max5864_driver_t* const drv);
} max5864_driver_t;

void max5864_setup(max5864_driver_t* const drv);

Expand Down
2 changes: 1 addition & 1 deletion firmware/common/portapack.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static void portapack_sleep_milliseconds(const uint32_t milliseconds)
delay(milliseconds * 40800);
}

typedef struct portapack_if_t {
typedef struct {
gpio_t gpio_dir;
gpio_t gpio_lcd_rdx;
gpio_t gpio_lcd_wrx;
Expand Down
14 changes: 7 additions & 7 deletions firmware/common/portapack.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@

#define ARRAY_SIZEOF(x) (sizeof(x) / sizeof(x[0]))

typedef struct ui_color_t {
typedef struct {
uint16_t v;
} ui_color_t;

typedef struct ui_point_t {
typedef struct {
int16_t x;
int16_t y;
} ui_point_t;

typedef struct ui_size_t {
typedef struct {
int16_t width;
int16_t height;
} ui_size_t;

typedef struct ui_rect_t {
typedef struct {
ui_point_t point;
ui_size_t size;
} ui_rect_t;

typedef struct ui_bitmap_t {
typedef struct {
ui_size_t size;
const uint8_t* const data;
} ui_bitmap_t;

typedef struct ui_font_t {
typedef struct {
const ui_size_t glyph_size;
const uint8_t* const data;
char c_start;
size_t c_count;
size_t data_stride;
} ui_font_t;

typedef struct portapack_t {
typedef struct {
} portapack_t;

void portapack_init(void);
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ typedef enum {
*/
typedef fp_40_24_t (*sample_rate_fn)(const fp_40_24_t sample_rate, const bool program);

typedef struct radio_t {
typedef struct {
radio_config_mode_t config_mode;
uint64_t config[RADIO_NUM_BANKS][RADIO_NUM_REGS];
volatile uint32_t regs_dirty;
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/rf_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef enum {
RF_PATH_FILTER_HIGH_PASS = 2,
} rf_path_filter_t;

typedef struct rf_path_t {
typedef struct {
uint8_t switchctrl;
#ifdef HACKRF_ONE
gpio_t gpio_hp;
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/rffc5071_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "gpio.h"
#include "spi_bus.h"

typedef struct rffc5071_spi_config_t {
typedef struct {
gpio_t gpio_select;
gpio_t gpio_clock;
gpio_t gpio_data;
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/sgpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef enum {
SGPIO_DIRECTION_TX,
} sgpio_direction_t;

typedef struct sgpio_config_t {
typedef struct {
gpio_t gpio_q_invert;
#ifndef PRALINE
gpio_t gpio_trigger_enable;
Expand Down
18 changes: 9 additions & 9 deletions firmware/common/spi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ typedef struct {
const size_t count;
} spi_transfer_t;

struct spi_bus_t; // IWYU pragma: keep - fixed in #1704
typedef struct spi_bus_t spi_bus_t;

struct spi_bus_t {
typedef struct _spi_bus_t {
void* const obj;
const void* config;
void (*start)(spi_bus_t* const bus, const void* const config);
void (*stop)(spi_bus_t* const bus);
void (*transfer)(spi_bus_t* const bus, void* const data, const size_t count);
void (*start)(struct _spi_bus_t* const bus, const void* const config);
void (*stop)(struct _spi_bus_t* const bus);
void (*transfer)(
struct _spi_bus_t* const bus,
void* const data,
const size_t count);
void (*transfer_gather)(
spi_bus_t* const bus,
struct _spi_bus_t* const bus,
const spi_transfer_t* const transfers,
const size_t count);
};
} spi_bus_t;

void spi_bus_start(spi_bus_t* const bus, const void* const config);
void spi_bus_stop(spi_bus_t* const bus);
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/spi_ssp.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "gpio.h"
#include "spi_bus.h"

typedef struct ssp_config_t {
typedef struct {
ssp_datasize_t data_bits;
ssp_cpol_cpha_t spi_mode;
uint8_t serial_clock_rate;
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/ui_portapack.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static ui_point_t portapack_lcd_draw_string(ui_point_t point, const char* s)
return point;
}

typedef struct draw_list_t {
typedef struct {
const ui_bitmap_t* bitmap;
const ui_point_t point;
} draw_list_t;
Expand Down
12 changes: 5 additions & 7 deletions firmware/common/usb_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,25 @@

#include "usb_type.h"

typedef struct _usb_transfer_t usb_transfer_t;
typedef struct _usb_queue_t usb_queue_t;
typedef void (*transfer_completion_cb)(void*, unsigned int);

// This is an opaque datatype. Thou shall not touch these members.
struct _usb_transfer_t {
typedef struct _usb_transfer_t {
struct _usb_transfer_t* next;
usb_transfer_descriptor_t td ATTR_ALIGNED(64);
unsigned int maximum_length;
struct _usb_queue_t* queue;
transfer_completion_cb completion_cb;
void* user_data;
};
} usb_transfer_t;

// This is an opaque datatype. Thou shall not touch these members.
struct _usb_queue_t {
struct usb_endpoint_t* endpoint;
typedef struct _usb_queue_t {
usb_endpoint_t* endpoint;
const unsigned int pool_size;
usb_transfer_t* volatile free_transfers;
usb_transfer_t* volatile active;
};
} usb_queue_t;

#define USB_DECLARE_QUEUE(endpoint_name) struct _usb_queue_t endpoint_name##_queue;
#define USB_DEFINE_QUEUE(endpoint_name, _pool_size) \
Expand Down
Loading
Loading