Fix missing protoype warning, change TUD_EPBUF_TYPE_DEF order (#2889)

* change TUD_EPBUF_TYPE_DEF order
* add and fix -Wmissing-prototypes warnings  for   cmake (skip  make)
This commit is contained in:
Ha Thach
2024-11-27 18:28:12 +07:00
committed by GitHub
parent 2732aff7dd
commit dbc2c8d972
18 changed files with 54 additions and 48 deletions

View File

@@ -39,6 +39,9 @@
#define sys_read _read
#endif
int sys_write(int fhdl, const char *buf, size_t count) TU_ATTR_USED;
int sys_read(int fhdl, char *buf, size_t count) TU_ATTR_USED;
#if defined(LOGGER_RTT)
// Logging with RTT
@@ -46,13 +49,13 @@
#if !(defined __SES_ARM) && !(defined __SES_RISCV) && !(defined __CROSSWORKS_ARM)
#include "SEGGER_RTT.h"
TU_ATTR_USED int sys_write(int fhdl, const char *buf, size_t count) {
int sys_write(int fhdl, const char *buf, size_t count) {
(void) fhdl;
SEGGER_RTT_Write(0, (const char *) buf, (int) count);
return (int) count;
}
TU_ATTR_USED int sys_read(int fhdl, char *buf, size_t count) {
int sys_read(int fhdl, char *buf, size_t count) {
(void) fhdl;
int rd = (int) SEGGER_RTT_Read(0, buf, count);
return (rd > 0) ? rd : -1;
@@ -64,7 +67,7 @@ TU_ATTR_USED int sys_read(int fhdl, char *buf, size_t count) {
// Logging with SWO for ARM Cortex
#include "board_mcu.h"
TU_ATTR_USED int sys_write (int fhdl, const char *buf, size_t count) {
int sys_write (int fhdl, const char *buf, size_t count) {
(void) fhdl;
uint8_t const* buf8 = (uint8_t const*) buf;
@@ -75,7 +78,7 @@ TU_ATTR_USED int sys_write (int fhdl, const char *buf, size_t count) {
return (int) count;
}
TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
int sys_read (int fhdl, char *buf, size_t count) {
(void) fhdl;
(void) buf;
(void) count;
@@ -85,12 +88,12 @@ TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
#else
// Default logging with on-board UART
TU_ATTR_USED int sys_write (int fhdl, const char *buf, size_t count) {
int sys_write (int fhdl, const char *buf, size_t count) {
(void) fhdl;
return board_uart_write(buf, (int) count);
}
TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
int sys_read (int fhdl, char *buf, size_t count) {
(void) fhdl;
int rd = board_uart_read((uint8_t*) buf, (int) count);
return (rd > 0) ? rd : -1;
@@ -98,12 +101,12 @@ TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
#endif
//TU_ATTR_USED int _close(int fhdl) {
//int _close(int fhdl) {
// (void) fhdl;
// return 0;
//}
//TU_ATTR_USED int _fstat(int file, struct stat *st) {
//int _fstat(int file, struct stat *st) {
// memset(st, 0, sizeof(*st));
// st->st_mode = S_IFCHR;
//}