Skip to content

Commit dbd627a

Browse files
committed
firmware: standardize struct+typedef usage
1 parent 5f8601b commit dbd627a

14 files changed

Lines changed: 23 additions & 31 deletions

firmware/common/cpld_jtag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "gpio.h"
2727

28-
typedef struct jtag_gpio_t {
28+
typedef struct {
2929
gpio_t gpio_tck;
3030
#ifndef PRALINE
3131
gpio_t gpio_tms;

firmware/common/fault_handler.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
// TODO: Move all this to a Cortex-M(?) include file, since these
3030
// structures are supposedly the same between processors (to an
3131
// undetermined extent).
32-
typedef struct armv7m_scb_t armv7m_scb_t;
33-
34-
struct armv7m_scb_t {
32+
typedef struct {
3533
volatile const uint32_t CPUID;
3634
volatile uint32_t ICSR;
3735
volatile uint32_t VTOR;
@@ -63,7 +61,7 @@ struct armv7m_scb_t {
6361
volatile const uint32_t ID_ISAR4;
6462
volatile const uint32_t __reserved_0x74_0x87[5];
6563
volatile uint32_t CPACR;
66-
} __attribute__((packed));
64+
} __attribute__((packed)) armv7m_scb_t;
6765

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

firmware/common/fpga.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,11 @@ typedef enum {
3636
FPGA_QUARTER_SHIFT_MODE_DOWN = 0b01,
3737
} fpga_quarter_shift_mode_t;
3838

39-
struct fpga_driver_t; // IWYU pragma: keep - fixed in #1704
40-
typedef struct fpga_driver_t fpga_driver_t;
41-
42-
struct fpga_driver_t {
39+
typedef struct {
4340
ice40_spi_driver_t* bus;
4441
uint8_t regs[FPGA_NUM_REGS];
4542
uint8_t regs_dirty;
46-
};
43+
} fpga_driver_t;
4744

4845
struct fpga_loader_t {
4946
/* Start address added as an offset to all read() calls. */

firmware/common/gpio_lpc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* register #defines and API declarations into separate header files.
3030
*/
3131

32-
typedef struct gpio_port {
32+
typedef struct {
3333
volatile uint32_t dir; /* +0x000 */
3434
uint32_t _reserved0[31];
3535
volatile uint32_t mask; /* +0x080 */

firmware/common/i2c_lpc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "i2c_bus.h"
3030

31-
typedef struct i2c_lpc_config_t {
31+
typedef struct {
3232
const uint16_t duty_cycle_count;
3333
} i2c_lpc_config_t;
3434

firmware/common/ice40_spi.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@
2828
#include "gpio.h"
2929
#include "spi_bus.h"
3030

31-
struct ice40_spi_driver_t; // IWYU pragma: keep - fixed in #1704
32-
typedef struct ice40_spi_driver_t ice40_spi_driver_t;
33-
34-
struct ice40_spi_driver_t {
31+
typedef struct {
3532
spi_bus_t* const bus;
3633
gpio_t gpio_select;
3734
gpio_t gpio_creset;
3835
gpio_t gpio_cdone;
39-
};
36+
} ice40_spi_driver_t;
4037

4138
void ice40_spi_target_init(ice40_spi_driver_t* const drv);
4239
uint8_t ice40_spi_read(ice40_spi_driver_t* const drv, uint8_t r);

firmware/common/portapack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void portapack_sleep_milliseconds(const uint32_t milliseconds)
3838
delay(milliseconds * 40800);
3939
}
4040

41-
typedef struct portapack_if_t {
41+
typedef struct {
4242
gpio_t gpio_dir;
4343
gpio_t gpio_lcd_rdx;
4444
gpio_t gpio_lcd_wrx;

firmware/common/portapack.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,39 @@
2828

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

31-
typedef struct ui_color_t {
31+
typedef struct {
3232
uint16_t v;
3333
} ui_color_t;
3434

35-
typedef struct ui_point_t {
35+
typedef struct {
3636
int16_t x;
3737
int16_t y;
3838
} ui_point_t;
3939

40-
typedef struct ui_size_t {
40+
typedef struct {
4141
int16_t width;
4242
int16_t height;
4343
} ui_size_t;
4444

45-
typedef struct ui_rect_t {
45+
typedef struct {
4646
ui_point_t point;
4747
ui_size_t size;
4848
} ui_rect_t;
4949

50-
typedef struct ui_bitmap_t {
50+
typedef struct {
5151
ui_size_t size;
5252
const uint8_t* const data;
5353
} ui_bitmap_t;
5454

55-
typedef struct ui_font_t {
55+
typedef struct {
5656
const ui_size_t glyph_size;
5757
const uint8_t* const data;
5858
char c_start;
5959
size_t c_count;
6060
size_t data_stride;
6161
} ui_font_t;
6262

63-
typedef struct portapack_t {
63+
typedef struct {
6464
} portapack_t;
6565

6666
void portapack_init(void);

firmware/common/radio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ typedef enum {
215215
*/
216216
typedef fp_40_24_t (*sample_rate_fn)(const fp_40_24_t sample_rate, const bool program);
217217

218-
typedef struct radio_t {
218+
typedef struct {
219219
radio_config_mode_t config_mode;
220220
uint64_t config[RADIO_NUM_BANKS][RADIO_NUM_REGS];
221221
volatile uint32_t regs_dirty;

firmware/common/rf_path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ typedef enum {
4545
RF_PATH_FILTER_HIGH_PASS = 2,
4646
} rf_path_filter_t;
4747

48-
typedef struct rf_path_t {
48+
typedef struct {
4949
uint8_t switchctrl;
5050
#ifdef HACKRF_ONE
5151
gpio_t gpio_hp;

0 commit comments

Comments
 (0)