Skip to content

Commit 731f359

Browse files
dpgeorgepfalcon
authored andcommitted
all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such as stdio and delay/ticks, which ports should provide definitions for. A port will also provide mphalport.h with further HAL declarations.
1 parent 0bd3f32 commit 731f359

100 files changed

Lines changed: 156 additions & 174 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bare-arm/mphalport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// empty file

cc3200/bootmgr/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "std.h"
3131

3232
#include "py/mpconfig.h"
33-
#include MICROPY_HAL_H
3433
#include "hw_ints.h"
3534
#include "hw_types.h"
3635
#include "hw_gpio.h"

cc3200/fatfs/src/drivers/sd_diskio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <stdbool.h>
3939

4040
#include "py/mpconfig.h"
41-
#include MICROPY_HAL_H
41+
#include "py/mphal.h"
4242
#include "hw_types.h"
4343
#include "hw_memmap.h"
4444
#include "hw_ints.h"

cc3200/fatfs/src/drivers/sflash_diskio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "std.h"
44

55
#include "py/mpconfig.h"
6-
#include MICROPY_HAL_H
76
#include "py/obj.h"
87
#include "simplelink.h"
98
#include "diskio.h"

cc3200/ftp/ftp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "std.h"
3030

3131
#include "py/mpstate.h"
32-
#include MICROPY_HAL_H
3332
#include "py/obj.h"
3433
#include "inc/hw_types.h"
3534
#include "inc/hw_ints.h"

cc3200/ftp/updater.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <stdbool.h>
2929

3030
#include "py/mpconfig.h"
31-
#include MICROPY_HAL_H
3231
#include "py/obj.h"
3332
#include "simplelink.h"
3433
#include "flc.h"

cc3200/hal/cc3200_hal.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
#include "py/mpstate.h"
37-
#include MICROPY_HAL_H
37+
#include "py/mphal.h"
3838
#include "py/runtime.h"
3939
#include "py/objstr.h"
4040
#include "inc/hw_types.h"
@@ -104,11 +104,11 @@ void HAL_IncrementTick(void) {
104104
HAL_tickCount++;
105105
}
106106

107-
uint32_t mp_hal_ticks_ms(void) {
107+
mp_uint_t mp_hal_ticks_ms(void) {
108108
return HAL_tickCount;
109109
}
110110

111-
void mp_hal_delay_ms(uint32_t delay) {
111+
void mp_hal_delay_ms(mp_uint_t delay) {
112112
// only if we are not within interrupt context and interrupts are enabled
113113
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
114114
#ifdef USE_FREERTOS
@@ -140,7 +140,7 @@ void mp_hal_stdout_tx_str(const char *str) {
140140
mp_hal_stdout_tx_strn(str, strlen(str));
141141
}
142142

143-
void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
143+
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
144144
if (MP_STATE_PORT(os_term_dup_obj)) {
145145
if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) {
146146
uart_tx_strn(MP_STATE_PORT(os_term_dup_obj)->stream_o, str, len);
@@ -153,7 +153,7 @@ void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
153153
telnet_tx_strn(str, len);
154154
}
155155

156-
void mp_hal_stdout_tx_strn_cooked (const char *str, uint32_t len) {
156+
void mp_hal_stdout_tx_strn_cooked (const char *str, size_t len) {
157157
int32_t nslen = 0;
158158
const char *_str = str;
159159

cc3200/hal/cc3200_hal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@
6262
extern void HAL_SystemInit (void);
6363
extern void HAL_SystemDeInit (void);
6464
extern void HAL_IncrementTick(void);
65-
extern uint32_t mp_hal_ticks_ms(void);
66-
extern void mp_hal_delay_ms(uint32_t delay);
6765
extern NORETURN void mp_hal_raise(int errno);
6866
extern void mp_hal_set_interrupt_char (int c);
6967

70-
int mp_hal_stdin_rx_chr(void);
71-
void mp_hal_stdout_tx_str(const char *str);
72-
void mp_hal_stdout_tx_strn(const char *str, uint32_t len);
73-
void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
74-
7568
#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */

cc3200/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <ctype.h>
3030

3131
#include "py/mpconfig.h"
32-
#include MICROPY_HAL_H
32+
#include "py/mphal.h"
3333
#include "mptask.h"
3434
#include "simplelink.h"
3535
#include "pybwdt.h"

cc3200/misc/FreeRTOSHooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <string.h>
3030

3131
#include "py/mpconfig.h"
32-
#include MICROPY_HAL_H
32+
#include "py/mphal.h"
3333
#include "py/obj.h"
3434
#include "inc/hw_memmap.h"
3535
#include "pybuart.h"

0 commit comments

Comments
 (0)