esp32: Fix use of mp_int_t, size_t and uintptr_t.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
0fc0ccabec
commit
59dbbe9be7
|
@ -255,8 +255,8 @@ STATIC uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t *
|
|||
uint8_t appbuf_sample_size_in_bytes = (self->bits / 8) * (self->format == STEREO ? 2: 1);
|
||||
uint32_t num_bytes_needed_from_dma = appbuf->len * (I2S_RX_FRAME_SIZE_IN_BYTES / appbuf_sample_size_in_bytes);
|
||||
while (num_bytes_needed_from_dma) {
|
||||
uint32_t num_bytes_requested_from_dma = MIN(sizeof(self->transform_buffer), num_bytes_needed_from_dma);
|
||||
uint32_t num_bytes_received_from_dma = 0;
|
||||
size_t num_bytes_requested_from_dma = MIN(sizeof(self->transform_buffer), num_bytes_needed_from_dma);
|
||||
size_t num_bytes_received_from_dma = 0;
|
||||
|
||||
TickType_t delay;
|
||||
if (self->io_mode == UASYNCIO) {
|
||||
|
@ -312,12 +312,12 @@ STATIC uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t *
|
|||
return a_index;
|
||||
}
|
||||
|
||||
STATIC uint32_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
|
||||
STATIC size_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
|
||||
if ((self->bits == I2S_BITS_PER_SAMPLE_32BIT) && (self->format == STEREO)) {
|
||||
swap_32_bit_stereo_channels(appbuf);
|
||||
}
|
||||
|
||||
uint32_t num_bytes_written = 0;
|
||||
size_t num_bytes_written = 0;
|
||||
|
||||
TickType_t delay;
|
||||
if (self->io_mode == UASYNCIO) {
|
||||
|
@ -518,7 +518,7 @@ STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_arg
|
|||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t machine_i2s_obj_init(mp_uint_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t machine_i2s_obj_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
machine_i2s_obj_t *self = pos_args[0];
|
||||
machine_i2s_deinit(self);
|
||||
machine_i2s_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args);
|
||||
|
@ -731,12 +731,12 @@ STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in,
|
|||
mp_buffer_info_t appbuf;
|
||||
appbuf.buf = (void *)buf_in;
|
||||
appbuf.len = size;
|
||||
uint32_t num_bytes_written = copy_appbuf_to_dma(self, &appbuf);
|
||||
size_t num_bytes_written = copy_appbuf_to_dma(self, &appbuf);
|
||||
return num_bytes_written;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
|
||||
STATIC mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
||||
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_uint_t ret;
|
||||
mp_uint_t flags = arg;
|
||||
|
|
|
@ -121,7 +121,7 @@ STATIC mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *ar
|
|||
return mp_const_none;
|
||||
}
|
||||
}
|
||||
STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t machine_rtc_datetime(size_t n_args, const mp_obj_t *args) {
|
||||
return machine_rtc_datetime_helper(n_args, args);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
|
||||
|
@ -142,7 +142,7 @@ STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
|
|||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
|
||||
|
||||
#if MICROPY_HW_RTC_USER_MEM_MAX > 0
|
||||
STATIC mp_obj_t machine_rtc_memory(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t machine_rtc_memory(size_t n_args, const mp_obj_t *args) {
|
||||
if (n_args == 1) {
|
||||
// read RTC memory
|
||||
uint8_t rtcram[MICROPY_HW_RTC_USER_MEM_MAX];
|
||||
|
|
|
@ -229,7 +229,7 @@ STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
|
|||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
|
||||
|
||||
STATIC mp_obj_t machine_timer_init(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
return machine_timer_init_helper(args[0], n_args - 1, args + 1, kw_args);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
|
||||
|
|
|
@ -443,7 +443,7 @@ STATIC mp_uint_t machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uin
|
|||
return bytes_written;
|
||||
}
|
||||
|
||||
STATIC mp_uint_t machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
|
||||
STATIC mp_uint_t machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
||||
machine_uart_obj_t *self = self_in;
|
||||
mp_uint_t ret;
|
||||
if (request == MP_STREAM_POLL) {
|
||||
|
|
|
@ -109,7 +109,7 @@ STATIC mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_m
|
|||
|
||||
// Check that all pins are allowed
|
||||
if (args[ARG_pins].u_obj != mp_const_none) {
|
||||
mp_uint_t len = 0;
|
||||
size_t len = 0;
|
||||
mp_obj_t *elem;
|
||||
mp_obj_get_array(args[ARG_pins].u_obj, &len, &elem);
|
||||
ext1_pins = 0;
|
||||
|
|
|
@ -108,7 +108,7 @@ int mp_hal_stdin_rx_chr(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
|
||||
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
|
||||
// Only release the GIL if many characters are being sent
|
||||
bool release_gil = len > 20;
|
||||
if (release_gil) {
|
||||
|
|
Loading…
Reference in New Issue