Commit 731f3592 authored by Damien George's avatar Damien George Committed by Paul Sokolovsky
Browse files

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.
parent 0bd3f329
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "std.h" #include "std.h"
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "hw_ints.h" #include "hw_ints.h"
#include "hw_types.h" #include "hw_types.h"
#include "hw_gpio.h" #include "hw_gpio.h"
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H #include "py/mphal.h"
#include "hw_types.h" #include "hw_types.h"
#include "hw_memmap.h" #include "hw_memmap.h"
#include "hw_ints.h" #include "hw_ints.h"
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "std.h" #include "std.h"
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "simplelink.h" #include "simplelink.h"
#include "diskio.h" #include "diskio.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "std.h" #include "std.h"
#include "py/mpstate.h" #include "py/mpstate.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
#include "inc/hw_ints.h" #include "inc/hw_ints.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <stdbool.h> #include <stdbool.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "simplelink.h" #include "simplelink.h"
#include "flc.h" #include "flc.h"
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "py/mpstate.h" #include "py/mpstate.h"
#include MICROPY_HAL_H #include "py/mphal.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/objstr.h" #include "py/objstr.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
...@@ -104,11 +104,11 @@ void HAL_IncrementTick(void) { ...@@ -104,11 +104,11 @@ void HAL_IncrementTick(void) {
HAL_tickCount++; HAL_tickCount++;
} }
uint32_t mp_hal_ticks_ms(void) { mp_uint_t mp_hal_ticks_ms(void) {
return HAL_tickCount; return HAL_tickCount;
} }
void mp_hal_delay_ms(uint32_t delay) { void mp_hal_delay_ms(mp_uint_t delay) {
// only if we are not within interrupt context and interrupts are enabled // only if we are not within interrupt context and interrupts are enabled
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) { if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
#ifdef USE_FREERTOS #ifdef USE_FREERTOS
...@@ -140,7 +140,7 @@ void mp_hal_stdout_tx_str(const char *str) { ...@@ -140,7 +140,7 @@ void mp_hal_stdout_tx_str(const char *str) {
mp_hal_stdout_tx_strn(str, strlen(str)); mp_hal_stdout_tx_strn(str, strlen(str));
} }
void mp_hal_stdout_tx_strn(const char *str, uint32_t len) { void mp_hal_stdout_tx_strn(const char *str, size_t len) {
if (MP_STATE_PORT(os_term_dup_obj)) { if (MP_STATE_PORT(os_term_dup_obj)) {
if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) { if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) {
uart_tx_strn(MP_STATE_PORT(os_term_dup_obj)->stream_o, str, len); 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) { ...@@ -153,7 +153,7 @@ void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
telnet_tx_strn(str, len); telnet_tx_strn(str, len);
} }
void mp_hal_stdout_tx_strn_cooked (const char *str, uint32_t len) { void mp_hal_stdout_tx_strn_cooked (const char *str, size_t len) {
int32_t nslen = 0; int32_t nslen = 0;
const char *_str = str; const char *_str = str;
......
...@@ -62,14 +62,7 @@ ...@@ -62,14 +62,7 @@
extern void HAL_SystemInit (void); extern void HAL_SystemInit (void);
extern void HAL_SystemDeInit (void); extern void HAL_SystemDeInit (void);
extern void HAL_IncrementTick(void); extern void HAL_IncrementTick(void);
extern uint32_t mp_hal_ticks_ms(void);
extern void mp_hal_delay_ms(uint32_t delay);
extern NORETURN void mp_hal_raise(int errno); extern NORETURN void mp_hal_raise(int errno);
extern void mp_hal_set_interrupt_char (int c); extern void mp_hal_set_interrupt_char (int c);
int mp_hal_stdin_rx_chr(void);
void mp_hal_stdout_tx_str(const char *str);
void mp_hal_stdout_tx_strn(const char *str, uint32_t len);
void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */ #endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <ctype.h> #include <ctype.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H #include "py/mphal.h"
#include "mptask.h" #include "mptask.h"
#include "simplelink.h" #include "simplelink.h"
#include "pybwdt.h" #include "pybwdt.h"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <string.h> #include <string.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H #include "py/mphal.h"
#include "py/obj.h" #include "py/obj.h"
#include "inc/hw_memmap.h" #include "inc/hw_memmap.h"
#include "pybuart.h" #include "pybuart.h"
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#include <string.h> #include <string.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/mphal.h"
#include "hw_ints.h" #include "hw_ints.h"
#include "hw_types.h" #include "hw_types.h"
#include "hw_gpio.h" #include "hw_gpio.h"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "std.h" #include "std.h"
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/gc.h" #include "py/gc.h"
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
*/ */
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/mphal.h"
#include "mpsystick.h" #include "mpsystick.h"
#include "systick.h" #include "systick.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "py/mpstate.h" #include "py/mpstate.h"
#include "py/runtime.h" #include "py/runtime.h"
#include MICROPY_HAL_H #include "py/mphal.h"
#include "irq.h" #include "irq.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
#include "inc/hw_gpio.h" #include "inc/hw_gpio.h"
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
#include <std.h> #include <std.h>
#include "py/mpstate.h" #include "py/mpstate.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/nlr.h" #include "py/nlr.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/mphal.h"
#include "modnetwork.h" #include "modnetwork.h"
#include "mpexception.h" #include "mpexception.h"
#include "serverstask.h" #include "serverstask.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
*/ */
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/nlr.h" #include "py/nlr.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/binary.h" #include "py/binary.h"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "simplelink.h" #include "simplelink.h"
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/objstr.h" #include "py/objstr.h"
#include "py/runtime.h" #include "py/runtime.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "simplelink.h" #include "simplelink.h"
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/objstr.h" #include "py/objstr.h"
#include "py/runtime.h" #include "py/runtime.h"
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
#include <string.h> #include <string.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/nlr.h" #include "py/nlr.h"
#include "py/obj.h" #include "py/obj.h"
#include "py/smallint.h" #include "py/smallint.h"
#include "py/mphal.h"
#include "timeutils.h" #include "timeutils.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
#include "inc/hw_ints.h" #include "inc/hw_ints.h"
......
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "mperror.h" #include "mperror.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment