Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fw: Add void to function signatures meant to be used without args
Browse files Browse the repository at this point in the history
mchack-work committed Mar 18, 2024
1 parent db00a06 commit 7424098
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions hw/application_fpga/fw/testfw/main.c
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ uint32_t wait_timer_tick(uint32_t last_timer)
}
}

void zero_fwram()
void zero_fwram(void)
{
for (int i = 0; i < TK1_MMIO_FW_RAM_SIZE; i++) {
fw_ram[i] = 0x00;
@@ -149,7 +149,7 @@ void failmsg(char *s)
puts("\r\n");
}

int main()
int main(void)
{
// Function pointer to blake2s()
volatile int (*fw_blake2s)(void *, unsigned long, const void *,
2 changes: 1 addition & 1 deletion hw/application_fpga/fw/tk1/led.c
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ void set_led(uint32_t led_value)
*led = led_value;
}

void forever_redflash()
void forever_redflash(void)
{
int led_on = 0;

2 changes: 1 addition & 1 deletion hw/application_fpga/fw/tk1/led.h
Original file line number Diff line number Diff line change
@@ -18,5 +18,5 @@
// clang-format on

void set_led(uint32_t led_value);
void forever_redflash();
void forever_redflash(void);
#endif
14 changes: 7 additions & 7 deletions hw/application_fpga/fw/tk1/main.c
Original file line number Diff line number Diff line change
@@ -42,9 +42,9 @@ struct context {
uint8_t uss[32]; // User Supplied Secret, if any
};

static void print_hw_version();
static void print_hw_version(void);
static void print_digest(uint8_t *md);
static uint32_t rnd_word();
static uint32_t rnd_word(void);
static void compute_cdi(const uint8_t *digest, const uint8_t use_uss,
const uint8_t *uss);
static void copy_name(uint8_t *buf, const size_t bufsiz, const uint32_t word);
@@ -55,9 +55,9 @@ static enum state loading_commands(const struct frame_header *hdr,
const uint8_t *cmd, enum state state,
struct context *ctx);
static void run(const struct context *ctx);
static void scramble_ram();
static void scramble_ram(void);

static void print_hw_version()
static void print_hw_version(void)
{
htif_puts("Hello, I'm firmware with");
htif_puts(" tk1_name0:");
@@ -81,7 +81,7 @@ static void print_digest(uint8_t *md)
htif_lf();
}

static uint32_t rnd_word()
static uint32_t rnd_word(void)
{
while ((*trng_status & (1 << TK1_MMIO_TRNG_STATUS_READY_BIT)) == 0) {
}
@@ -362,7 +362,7 @@ static void run(const struct context *ctx)
__builtin_unreachable();
}

static void scramble_ram()
static void scramble_ram(void)
{
uint32_t *ram = (uint32_t *)(TK1_RAM_BASE);
uint32_t rnd = rnd_word();
@@ -384,7 +384,7 @@ static void scramble_ram()
*ram_scramble = rnd_word();
}

int main()
int main(void)
{
struct context ctx = {0};
struct frame_header hdr = {0};
2 changes: 1 addition & 1 deletion hw/application_fpga/fw/tk1/proto.c
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ static void write(uint8_t *buf, size_t nbytes)
}
}

uint8_t readbyte()
uint8_t readbyte(void)
{
for (;;) {
if (*can_rx) {
2 changes: 1 addition & 1 deletion hw/application_fpga/fw/tk1/proto.h
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ struct frame_header {
};

void writebyte(uint8_t b);
uint8_t readbyte();
uint8_t readbyte(void);
void fwreply(struct frame_header hdr, enum fwcmd rspcode, uint8_t *buf);
int readcommand(struct frame_header *hdr, uint8_t *cmd, int state);
#endif

0 comments on commit 7424098

Please sign in to comment.