Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation warnings #1516

Merged
merged 3 commits into from
Dec 16, 2024
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
30 changes: 15 additions & 15 deletions firmware/common/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void usb_clear_pending_interrupts(const uint32_t mask)
USB0_ENDPTCOMPLETE = USB0_ENDPTCOMPLETE & mask;
}

static void usb_clear_all_pending_interrupts()
static void usb_clear_all_pending_interrupts(void)
{
usb_clear_pending_interrupts(0xFFFFFFFF);
}
Expand Down Expand Up @@ -122,7 +122,7 @@ static void usb_flush_primed_endpoints(const uint32_t mask)
usb_wait_for_endpoint_flushing_to_finish(mask);
}

static void usb_flush_all_primed_endpoints()
static void usb_flush_all_primed_endpoints(void)
{
usb_flush_primed_endpoints(0xFFFFFFFF);
}
Expand Down Expand Up @@ -315,22 +315,22 @@ void usb_endpoint_reset_data_toggle(const usb_endpoint_t* const endpoint)
}
}

static void usb_controller_run()
static void usb_controller_run(void)
{
USB0_USBCMD_D |= USB0_USBCMD_D_RS;
}

static void usb_controller_stop()
static void usb_controller_stop(void)
{
USB0_USBCMD_D &= ~USB0_USBCMD_D_RS;
}

static uint_fast8_t usb_controller_is_resetting()
static uint_fast8_t usb_controller_is_resetting(void)
{
return (USB0_USBCMD_D & USB0_USBCMD_D_RST) != 0;
}

static void usb_controller_set_device_mode()
static void usb_controller_set_device_mode(void)
{
// Set USB0 peripheral mode
USB0_USBMODE_D = USB0_USBMODE_D_CM1_0(2);
Expand Down Expand Up @@ -366,7 +366,7 @@ static void usb_clear_status(const uint32_t status)
USB0_USBSTS_D = status;
}

static uint32_t usb_get_status()
static uint32_t usb_get_status(void)
{
// Mask status flags with enabled flag interrupts.
const uint32_t status = USB0_USBSTS_D & USB0_USBINTR_D;
Expand All @@ -384,7 +384,7 @@ static void usb_clear_endpoint_setup_status(const uint32_t endpoint_setup_status
USB0_ENDPTSETUPSTAT = endpoint_setup_status;
}

static uint32_t usb_get_endpoint_setup_status()
static uint32_t usb_get_endpoint_setup_status(void)
{
return USB0_ENDPTSETUPSTAT;
}
Expand All @@ -394,12 +394,12 @@ static void usb_clear_endpoint_complete(const uint32_t endpoint_complete)
USB0_ENDPTCOMPLETE = endpoint_complete;
}

static uint32_t usb_get_endpoint_complete()
static uint32_t usb_get_endpoint_complete(void)
{
return USB0_ENDPTCOMPLETE;
}

static void usb_disable_all_endpoints()
static void usb_disable_all_endpoints(void)
{
// Endpoint 0 is always enabled. TODO: So why set ENDPTCTRL0?
USB0_ENDPTCTRL0 &= ~(USB0_ENDPTCTRL0_RXE | USB0_ENDPTCTRL0_TXE);
Expand Down Expand Up @@ -427,14 +427,14 @@ void usb_set_address_deferred(const usb_device_t* const device, const uint_fast8
}
}

static void usb_reset_all_endpoints()
static void usb_reset_all_endpoints(void)
{
usb_disable_all_endpoints();
usb_clear_all_pending_interrupts();
usb_flush_all_primed_endpoints();
}

static void usb_controller_reset()
static void usb_controller_reset(void)
{
// TODO: Good to disable some USB interrupts to avoid priming new
// new endpoints before the controller is reset?
Expand Down Expand Up @@ -505,7 +505,7 @@ void usb_device_init(const uint_fast8_t device_ordinal, usb_device_t* const devi
void usb_run(usb_device_t* const device)
{
usb_interrupt_enable(device);
usb_controller_run(device);
usb_controller_run();
}

static void copy_setup(usb_setup_t* const dst, const volatile uint8_t* const src)
Expand Down Expand Up @@ -562,7 +562,7 @@ void usb_endpoint_init(const usb_endpoint_t* const endpoint)
usb_endpoint_enable(endpoint);
}

static void usb_check_for_setup_events()
static void usb_check_for_setup_events(void)
{
const uint32_t endptsetupstat = usb_get_endpoint_setup_status();
if (endptsetupstat) {
Expand Down Expand Up @@ -595,7 +595,7 @@ static void usb_check_for_setup_events()
}
}

static void usb_check_for_transfer_events()
static void usb_check_for_transfer_events(void)
{
const uint32_t endptcomplete = usb_get_endpoint_complete();
if (endptcomplete) {
Expand Down
4 changes: 2 additions & 2 deletions firmware/common/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "usb_type.h"

void usb_peripheral_reset();
void usb_phy_enable();
void usb_peripheral_reset(void);
void usb_phy_enable(void);

void usb_device_init(const uint_fast8_t device_ordinal, usb_device_t* const device);

Expand Down
Loading