Fix -Wsign-compare warnings
This commit is contained in:
		
				
					committed by
					
						
						Graham Sanderson
					
				
			
			
				
	
			
			
			
						parent
						
							d3ecf3ef2e
						
					
				
				
					commit
					a33a7c0b2c
				
			@ -355,7 +355,7 @@ static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_mov_statu
 | 
				
			|||||||
 * \return the default state machine configuration which can then be modified.
 | 
					 * \return the default state machine configuration which can then be modified.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static inline pio_sm_config pio_get_default_sm_config(void) {
 | 
					static inline pio_sm_config pio_get_default_sm_config(void) {
 | 
				
			||||||
    pio_sm_config c = {0, 0, 0};
 | 
					    pio_sm_config c = {0, 0, 0, 0};
 | 
				
			||||||
    sm_config_set_clkdiv_int_frac(&c, 1, 0);
 | 
					    sm_config_set_clkdiv_int_frac(&c, 1, 0);
 | 
				
			||||||
    sm_config_set_wrap(&c, 0, 31);
 | 
					    sm_config_set_wrap(&c, 0, 31);
 | 
				
			||||||
    sm_config_set_in_shift(&c, true, false, 32);
 | 
					    sm_config_set_in_shift(&c, true, false, 32);
 | 
				
			||||||
 | 
				
			|||||||
@ -42,8 +42,9 @@ void pio_sm_unclaim(PIO pio, uint sm) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pio_claim_unused_sm(PIO pio, bool required) {
 | 
					int pio_claim_unused_sm(PIO pio, bool required) {
 | 
				
			||||||
    uint which = pio_get_index(pio);
 | 
					    // PIO index is 0 or 1.
 | 
				
			||||||
    uint base = which * NUM_PIO_STATE_MACHINES;
 | 
					    int which = (int)pio_get_index(pio);
 | 
				
			||||||
 | 
					    int base = which * NUM_PIO_STATE_MACHINES;
 | 
				
			||||||
    int index = hw_claim_unused_from_range((uint8_t*)&claimed, required, base,
 | 
					    int index = hw_claim_unused_from_range((uint8_t*)&claimed, required, base,
 | 
				
			||||||
                                      base + NUM_PIO_STATE_MACHINES - 1, "No PIO state machines are available");
 | 
					                                      base + NUM_PIO_STATE_MACHINES - 1, "No PIO state machines are available");
 | 
				
			||||||
    return index >= base ? index - base : -1;
 | 
					    return index >= base ? index - base : -1;
 | 
				
			||||||
@ -87,7 +88,7 @@ bool pio_can_add_program(PIO pio, const pio_program_t *program) {
 | 
				
			|||||||
static bool _pio_can_add_program_at_offset(PIO pio, const pio_program_t *program, uint offset) {
 | 
					static bool _pio_can_add_program_at_offset(PIO pio, const pio_program_t *program, uint offset) {
 | 
				
			||||||
    assert(offset < PIO_INSTRUCTION_COUNT);
 | 
					    assert(offset < PIO_INSTRUCTION_COUNT);
 | 
				
			||||||
    assert(offset + program->length <= PIO_INSTRUCTION_COUNT);
 | 
					    assert(offset + program->length <= PIO_INSTRUCTION_COUNT);
 | 
				
			||||||
    if (program->origin >= 0 && program->origin != offset) return false;
 | 
					    if (program->origin >= 0 && (uint)program->origin != offset) return false;
 | 
				
			||||||
    uint32_t used_mask = _used_instruction_space[pio_get_index(pio)];
 | 
					    uint32_t used_mask = _used_instruction_space[pio_get_index(pio)];
 | 
				
			||||||
    uint32_t program_mask = (1u << program->length) - 1;
 | 
					    uint32_t program_mask = (1u << program->length) - 1;
 | 
				
			||||||
    return !(used_mask & (program_mask << offset));
 | 
					    return !(used_mask & (program_mask << offset));
 | 
				
			||||||
 | 
				
			|||||||
@ -151,8 +151,8 @@ void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vect
 | 
				
			|||||||
    } while (seq < count_of(cmd_sequence));
 | 
					    } while (seq < count_of(cmd_sequence));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LOCKOUT_MAGIC_START 0x73a8831e
 | 
					#define LOCKOUT_MAGIC_START 0x73a8831eu
 | 
				
			||||||
#define LOCKOUT_MAGIC_END (LOCKOUT_MAGIC_START ^ -1)
 | 
					#define LOCKOUT_MAGIC_END (~LOCKOUT_MAGIC_START)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static_assert(SIO_IRQ_PROC1 == SIO_IRQ_PROC0 + 1, "");
 | 
					static_assert(SIO_IRQ_PROC1 == SIO_IRQ_PROC0 + 1, "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,7 @@ static stdio_driver_t *filter;
 | 
				
			|||||||
auto_init_mutex(print_mutex);
 | 
					auto_init_mutex(print_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool stdout_serialize_begin(void) {
 | 
					bool stdout_serialize_begin(void) {
 | 
				
			||||||
    int core_num = get_core_num();
 | 
					    uint core_num = get_core_num();
 | 
				
			||||||
    uint32_t owner;
 | 
					    uint32_t owner;
 | 
				
			||||||
    if (!mutex_try_enter(&print_mutex, &owner)) {
 | 
					    if (!mutex_try_enter(&print_mutex, &owner)) {
 | 
				
			||||||
        if (owner == core_num) {
 | 
					        if (owner == core_num) {
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ void stdio_uart_init_full(struct uart_inst *uart, uint baud_rate, int tx_pin, in
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void stdio_uart_out_chars(const char *buf, int length) {
 | 
					static void stdio_uart_out_chars(const char *buf, int length) {
 | 
				
			||||||
    for (uint i = 0; i <length; i++) {
 | 
					    for (int i = 0; i <length; i++) {
 | 
				
			||||||
        uart_putc(uart_default, buf[i]);
 | 
					        uart_putc(uart_default, buf[i]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -69,7 +69,6 @@ target_compile_options(kitchen_sink_options INTERFACE
 | 
				
			|||||||
        -Wno-shadow
 | 
					        -Wno-shadow
 | 
				
			||||||
        -Wno-missing-field-initializers
 | 
					        -Wno-missing-field-initializers
 | 
				
			||||||
        -Wno-missing-braces
 | 
					        -Wno-missing-braces
 | 
				
			||||||
        -Wno-sign-compare
 | 
					 | 
				
			||||||
        -Wno-multichar
 | 
					        -Wno-multichar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # todo useful but fix later
 | 
					        # todo useful but fix later
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user