mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-11 00:39:57 +00:00
fix print lu format warnings with clang
This commit is contained in:
parent
62331f0207
commit
c097c85dcf
@ -272,7 +272,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
|
||||
|
||||
sampFreq = (uint32_t)((audio_control_cur_4_t *)pBuff)->bCur;
|
||||
|
||||
TU_LOG2("Clock set current freq: %lu\r\n", sampFreq);
|
||||
TU_LOG2("Clock set current freq: %" PRIu32 "\r\n", sampFreq);
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ static bool tud_audio_clock_get_request(uint8_t rhport, audio_control_request_t
|
||||
{
|
||||
if (request->bRequest == AUDIO_CS_REQ_CUR)
|
||||
{
|
||||
TU_LOG1("Clock get current freq %lu\r\n", current_sample_rate);
|
||||
TU_LOG1("Clock get current freq %" PRIu32 "\r\n", current_sample_rate);
|
||||
|
||||
audio_control_cur_4_t curf = { (int32_t) tu_htole32(current_sample_rate) };
|
||||
return tud_audio_buffer_and_schedule_control_xfer(rhport, (tusb_control_request_t const *)request, &curf, sizeof(curf));
|
||||
@ -118,7 +118,7 @@ static bool tud_audio_clock_set_request(uint8_t rhport, audio_control_request_t
|
||||
|
||||
current_sample_rate = (uint32_t) ((audio_control_cur_4_t const *)buf)->bCur;
|
||||
|
||||
TU_LOG1("Clock set current freq: %ld\r\n", current_sample_rate);
|
||||
TU_LOG1("Clock set current freq: %" PRIu32 "\r\n", current_sample_rate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ static bool tud_audio_clock_get_request(uint8_t rhport, audio_control_request_t
|
||||
{
|
||||
if (request->bRequest == AUDIO_CS_REQ_CUR)
|
||||
{
|
||||
TU_LOG1("Clock get current freq %lu\r\n", current_sample_rate);
|
||||
TU_LOG1("Clock get current freq %" PRIu32 "\r\n", current_sample_rate);
|
||||
|
||||
audio_control_cur_4_t curf = { (int32_t) tu_htole32(current_sample_rate) };
|
||||
return tud_audio_buffer_and_schedule_control_xfer(rhport, (tusb_control_request_t const *)request, &curf, sizeof(curf));
|
||||
@ -206,7 +206,7 @@ static bool tud_audio_clock_set_request(uint8_t rhport, audio_control_request_t
|
||||
|
||||
current_sample_rate = (uint32_t) ((audio_control_cur_4_t const *)buf)->bCur;
|
||||
|
||||
TU_LOG1("Clock set current freq: %ld\r\n", current_sample_rate);
|
||||
TU_LOG1("Clock set current freq: %" PRIu32 "\r\n", current_sample_rate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -420,5 +420,5 @@ static void print_utf16(uint16_t *temp_buf, size_t buf_len) {
|
||||
_convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len);
|
||||
((uint8_t*) temp_buf)[utf8_len] = '\0';
|
||||
|
||||
printf((char*)temp_buf);
|
||||
printf("%s", (char*)temp_buf);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void tuh_cdc_rx_cb(uint8_t idx) {
|
||||
uint32_t count = tuh_cdc_read(idx, buf, bufsize);
|
||||
buf[count] = 0;
|
||||
|
||||
printf((char *) buf);
|
||||
printf("%s", (char *) buf);
|
||||
}
|
||||
|
||||
void tuh_cdc_mount_cb(uint8_t idx) {
|
||||
@ -131,7 +131,7 @@ void tuh_cdc_mount_cb(uint8_t idx) {
|
||||
// otherwise you need to call tuh_cdc_set_line_coding() first
|
||||
cdc_line_coding_t line_coding = { 0 };
|
||||
if (tuh_cdc_get_local_line_coding(idx, &line_coding)) {
|
||||
printf(" Baudrate: %lu, Stop Bits : %u\r\n", line_coding.bit_rate, line_coding.stop_bits);
|
||||
printf(" Baudrate: %" PRIu32 ", Stop Bits : %u\r\n", line_coding.bit_rate, line_coding.stop_bits);
|
||||
printf(" Parity : %u, Data Width: %u\r\n", line_coding.parity, line_coding.data_bits);
|
||||
}
|
||||
#endif
|
||||
|
@ -47,8 +47,8 @@ bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const *cb_dat
|
||||
uint32_t const block_count = tuh_msc_get_block_count(dev_addr, cbw->lun);
|
||||
uint32_t const block_size = tuh_msc_get_block_size(dev_addr, cbw->lun);
|
||||
|
||||
printf("Disk Size: %lu MB\r\n", block_count / ((1024 * 1024) / block_size));
|
||||
printf("Block Count = %lu, Block Size: %lu\r\n", block_count, block_size);
|
||||
printf("Disk Size: %" PRIu32 " MB\r\n", block_count / ((1024 * 1024) / block_size));
|
||||
printf("Block Count = %" PRIu32 ", Block Size: %" PRIu32 "\r\n", block_count, block_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_da
|
||||
uint32_t const block_count = tuh_msc_get_block_count(dev_addr, cbw->lun);
|
||||
uint32_t const block_size = tuh_msc_get_block_size(dev_addr, cbw->lun);
|
||||
|
||||
printf("Disk Size: %lu MB\r\n", block_count / ((1024*1024)/block_size));
|
||||
printf("Disk Size: %" PRIu32 " MB\r\n", block_count / ((1024*1024)/block_size));
|
||||
// printf("Block Count = %lu, Block Size: %lu\r\n", block_count, block_size);
|
||||
|
||||
// For simplicity: we only mount 1 LUN per device
|
||||
@ -541,10 +541,10 @@ void cli_cmd_ls(EmbeddedCli *cli, char *args, void *context)
|
||||
printf("%-40s", fno.fname);
|
||||
if (fno.fsize < 1024)
|
||||
{
|
||||
printf("%lu B\r\n", fno.fsize);
|
||||
printf("%" PRIu32 " B\r\n", fno.fsize);
|
||||
}else
|
||||
{
|
||||
printf("%lu KB\r\n", fno.fsize / 1024);
|
||||
printf("%" PRIu32 " KB\r\n", fno.fsize / 1024);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ function(add_tinyusb TARGET)
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../lib/networking
|
||||
)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wall
|
||||
-Wextra
|
||||
|
@ -43,10 +43,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
enum
|
||||
{
|
||||
BULK_PACKET_SIZE = (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
};
|
||||
#define BULK_PACKET_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -176,9 +173,11 @@ uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
|
||||
uint16_t ret = tu_fifo_write_n(&p_cdc->tx_ff, buffer, (uint16_t) TU_MIN(bufsize, UINT16_MAX));
|
||||
|
||||
// flush if queue more than packet size
|
||||
// may need to suppress -Wunreachable-code since most of the time CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE
|
||||
if ( (tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE) || ((CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE) && tu_fifo_full(&p_cdc->tx_ff)) )
|
||||
{
|
||||
if ( tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE
|
||||
#if CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE
|
||||
|| tu_fifo_full(&p_cdc->tx_ff) // check full if fifo size is less than packet size
|
||||
#endif
|
||||
) {
|
||||
tud_cdc_n_write_flush(itf);
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ uint16_t usbtmcd_open_cb(uint8_t rhport, tusb_desc_interface_t const * itf_desc,
|
||||
// processing a command (such as a clear). Returns true if it was
|
||||
// in the NAK state and successfully transitioned to the ACK wait
|
||||
// state.
|
||||
bool tud_usbtmc_start_bus_read()
|
||||
bool tud_usbtmc_start_bus_read(void)
|
||||
{
|
||||
usbtmcd_state_enum oldState = usbtmc_state.state;
|
||||
switch(oldState)
|
||||
|
@ -147,7 +147,7 @@ static void start_dma(volatile uint32_t* reg_startep) {
|
||||
|
||||
static void edpt_dma_start(volatile uint32_t* reg_startep) {
|
||||
if (atomic_flag_test_and_set(&_dcd.dma_running)) {
|
||||
usbd_defer_func((osal_task_func_t) edpt_dma_start, (void*) (uintptr_t) reg_startep, true);
|
||||
usbd_defer_func((osal_task_func_t)(uintptr_t ) edpt_dma_start, (void*) (uintptr_t) reg_startep, true);
|
||||
} else {
|
||||
start_dma(reg_startep);
|
||||
}
|
||||
|
@ -177,7 +177,8 @@ deps_optional = {
|
||||
'20285262657d1b482d132d20d755c8c330d55c1f',
|
||||
'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2x'
|
||||
'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5'
|
||||
'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'],
|
||||
'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'
|
||||
'sam3x samd11 samd21 samd51 same5x same7x saml2x samg'],
|
||||
'lib/sct_neopixel': ['https://github.com/gsteiert/sct_neopixel.git',
|
||||
'e73e04ca63495672d955f9268e003cffe168fcd8',
|
||||
'lpc55'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user