mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
all: Simplify mp_int_t/mp_uint_t definition.
Assuming proper C99 language support, we can select "the int type as big as a pointer" (most of the time) or "the 64-bit int type" (nanboxing with REPR_D), and then define everything else automatically. This simplifies port configuration files. And the types can still be overridden if needed. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
eac81de4e0
commit
007f127a61
@@ -50,7 +50,7 @@ void mp_hal_init(void) {
|
||||
uart_attached_to_dupterm = 0;
|
||||
}
|
||||
|
||||
void MP_FASTCODE(mp_hal_delay_us)(uint32_t us) {
|
||||
void MP_FASTCODE(mp_hal_delay_us)(mp_uint_t us) {
|
||||
uint32_t start = system_get_time();
|
||||
while (system_get_time() - start < us) {
|
||||
mp_event_handle_nowait();
|
||||
|
||||
@@ -57,17 +57,17 @@ extern int uart_attached_to_dupterm;
|
||||
void mp_hal_init(void);
|
||||
void mp_hal_rtc_init(void);
|
||||
|
||||
__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_us(void) {
|
||||
__attribute__((always_inline)) static inline mp_uint_t mp_hal_ticks_us(void) {
|
||||
return system_get_time();
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {
|
||||
__attribute__((always_inline)) static inline mp_uint_t mp_hal_ticks_cpu(void) {
|
||||
uint32_t ccount;
|
||||
__asm__ __volatile__ ("rsr %0,ccount" : "=a" (ccount));
|
||||
return ccount;
|
||||
return (mp_uint_t)ccount;
|
||||
}
|
||||
|
||||
void mp_hal_delay_us(uint32_t);
|
||||
void mp_hal_delay_us(mp_uint_t);
|
||||
void mp_hal_set_interrupt_char(int c);
|
||||
uint32_t mp_hal_get_cpu_freq(void);
|
||||
|
||||
|
||||
@@ -153,8 +153,6 @@
|
||||
|
||||
#define MP_SSIZE_MAX (0x7fffffff)
|
||||
|
||||
typedef int32_t mp_int_t; // must be pointer size
|
||||
typedef uint32_t mp_uint_t; // must be pointer size
|
||||
typedef long mp_off_t;
|
||||
typedef uint32_t sys_prot_t; // for modlwip
|
||||
// ssize_t, off_t as required by POSIX-signatured functions in stream.h
|
||||
|
||||
Reference in New Issue
Block a user