aboutsummaryrefslogtreecommitdiff
path: root/cc3200
diff options
context:
space:
mode:
authorDamien George2015-10-30 23:03:58 +0000
committerPaul Sokolovsky2015-10-31 19:14:30 +0300
commit731f359292c0e2630873df1a19c5baac7287024f (patch)
tree3aef09fd15b82baa9fff7c72fe3bc7e05a869614 /cc3200
parent0bd3f3291d3ea0252a91653a1edcbfa83d524834 (diff)
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.
Diffstat (limited to 'cc3200')
-rw-r--r--cc3200/bootmgr/main.c1
-rw-r--r--cc3200/fatfs/src/drivers/sd_diskio.c2
-rw-r--r--cc3200/fatfs/src/drivers/sflash_diskio.c1
-rw-r--r--cc3200/ftp/ftp.c1
-rw-r--r--cc3200/ftp/updater.c1
-rw-r--r--cc3200/hal/cc3200_hal.c10
-rw-r--r--cc3200/hal/cc3200_hal.h7
-rw-r--r--cc3200/main.c2
-rw-r--r--cc3200/misc/FreeRTOSHooks.c2
-rw-r--r--cc3200/misc/mperror.c2
-rw-r--r--cc3200/misc/mpirq.c1
-rw-r--r--cc3200/misc/mpsystick.c2
-rw-r--r--cc3200/mods/modmachine.c2
-rw-r--r--cc3200/mods/modnetwork.c2
-rw-r--r--cc3200/mods/modubinascii.c1
-rw-r--r--cc3200/mods/modusocket.c1
-rw-r--r--cc3200/mods/modussl.c1
-rw-r--r--cc3200/mods/modutime.c2
-rw-r--r--cc3200/mods/modwipy.c1
-rw-r--r--cc3200/mods/modwlan.c2
-rw-r--r--cc3200/mods/pybadc.c1
-rw-r--r--cc3200/mods/pybi2c.c2
-rw-r--r--cc3200/mods/pybpin.c1
-rw-r--r--cc3200/mods/pybrtc.c1
-rw-r--r--cc3200/mods/pybsd.c1
-rw-r--r--cc3200/mods/pybsleep.c2
-rw-r--r--cc3200/mods/pybspi.c1
-rw-r--r--cc3200/mods/pybtimer.c2
-rw-r--r--cc3200/mods/pybuart.c2
-rw-r--r--cc3200/mods/pybwdt.c2
-rw-r--r--cc3200/mpconfigport.h3
-rw-r--r--cc3200/mptask.c2
-rw-r--r--cc3200/serverstask.c2
-rw-r--r--cc3200/telnet/telnet.c2
-rw-r--r--cc3200/util/gccollect.c1
35 files changed, 23 insertions, 46 deletions
diff --git a/cc3200/bootmgr/main.c b/cc3200/bootmgr/main.c
index 1ec7d2950..d20cd5dad 100644
--- a/cc3200/bootmgr/main.c
+++ b/cc3200/bootmgr/main.c
@@ -30,7 +30,6 @@
#include "std.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "hw_ints.h"
#include "hw_types.h"
#include "hw_gpio.h"
diff --git a/cc3200/fatfs/src/drivers/sd_diskio.c b/cc3200/fatfs/src/drivers/sd_diskio.c
index cdc0cf0fe..a1fd72375 100644
--- a/cc3200/fatfs/src/drivers/sd_diskio.c
+++ b/cc3200/fatfs/src/drivers/sd_diskio.c
@@ -38,7 +38,7 @@
#include <stdbool.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
+#include "py/mphal.h"
#include "hw_types.h"
#include "hw_memmap.h"
#include "hw_ints.h"
diff --git a/cc3200/fatfs/src/drivers/sflash_diskio.c b/cc3200/fatfs/src/drivers/sflash_diskio.c
index 5bb229694..d0cfe0f98 100644
--- a/cc3200/fatfs/src/drivers/sflash_diskio.c
+++ b/cc3200/fatfs/src/drivers/sflash_diskio.c
@@ -3,7 +3,6 @@
#include "std.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "simplelink.h"
#include "diskio.h"
diff --git a/cc3200/ftp/ftp.c b/cc3200/ftp/ftp.c
index dc21ebb48..252a3d756 100644
--- a/cc3200/ftp/ftp.c
+++ b/cc3200/ftp/ftp.c
@@ -29,7 +29,6 @@
#include "std.h"
#include "py/mpstate.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
diff --git a/cc3200/ftp/updater.c b/cc3200/ftp/updater.c
index 2a2d47072..fece70095 100644
--- a/cc3200/ftp/updater.c
+++ b/cc3200/ftp/updater.c
@@ -28,7 +28,6 @@
#include <stdbool.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "simplelink.h"
#include "flc.h"
diff --git a/cc3200/hal/cc3200_hal.c b/cc3200/hal/cc3200_hal.c
index e5ac4f088..f0987ae9d 100644
--- a/cc3200/hal/cc3200_hal.c
+++ b/cc3200/hal/cc3200_hal.c
@@ -34,7 +34,7 @@
#include "py/mpstate.h"
-#include MICROPY_HAL_H
+#include "py/mphal.h"
#include "py/runtime.h"
#include "py/objstr.h"
#include "inc/hw_types.h"
@@ -104,11 +104,11 @@ void HAL_IncrementTick(void) {
HAL_tickCount++;
}
-uint32_t mp_hal_ticks_ms(void) {
+mp_uint_t mp_hal_ticks_ms(void) {
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
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
#ifdef USE_FREERTOS
@@ -140,7 +140,7 @@ void mp_hal_stdout_tx_str(const char *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_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);
@@ -153,7 +153,7 @@ void mp_hal_stdout_tx_strn(const char *str, uint32_t 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;
const char *_str = str;
diff --git a/cc3200/hal/cc3200_hal.h b/cc3200/hal/cc3200_hal.h
index c0dc9ebef..054d5035a 100644
--- a/cc3200/hal/cc3200_hal.h
+++ b/cc3200/hal/cc3200_hal.h
@@ -62,14 +62,7 @@
extern void HAL_SystemInit (void);
extern void HAL_SystemDeInit (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 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_ */
diff --git a/cc3200/main.c b/cc3200/main.c
index b217e20a1..78b4e3161 100644
--- a/cc3200/main.c
+++ b/cc3200/main.c
@@ -29,7 +29,7 @@
#include <ctype.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
+#include "py/mphal.h"
#include "mptask.h"
#include "simplelink.h"
#include "pybwdt.h"
diff --git a/cc3200/misc/FreeRTOSHooks.c b/cc3200/misc/FreeRTOSHooks.c
index 24971453c..dac9a9282 100644
--- a/cc3200/misc/FreeRTOSHooks.c
+++ b/cc3200/misc/FreeRTOSHooks.c
@@ -29,7 +29,7 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
+#include "py/mphal.h"
#include "py/obj.h"
#include "inc/hw_memmap.h"
#include "pybuart.h"
diff --git a/cc3200/misc/mperror.c b/cc3200/misc/mperror.c
index 5fa8442fd..044994b11 100644
--- a/cc3200/misc/mperror.c
+++ b/cc3200/misc/mperror.c
@@ -30,9 +30,9 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
+#include "py/mphal.h"
#include "hw_ints.h"
#include "hw_types.h"
#include "hw_gpio.h"
diff --git a/cc3200/misc/mpirq.c b/cc3200/misc/mpirq.c
index e780c78b6..29cc4a7bd 100644
--- a/cc3200/misc/mpirq.c
+++ b/cc3200/misc/mpirq.c
@@ -27,7 +27,6 @@
#include "std.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "py/gc.h"
diff --git a/cc3200/misc/mpsystick.c b/cc3200/misc/mpsystick.c
index 63b6c2d9d..7c35354e1 100644
--- a/cc3200/misc/mpsystick.c
+++ b/cc3200/misc/mpsystick.c
@@ -26,8 +26,8 @@
*/
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
+#include "py/mphal.h"
#include "mpsystick.h"
#include "systick.h"
#include "inc/hw_types.h"
diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c
index 2508c661c..896aa9917 100644
--- a/cc3200/mods/modmachine.c
+++ b/cc3200/mods/modmachine.c
@@ -30,7 +30,7 @@
#include "py/mpstate.h"
#include "py/runtime.h"
-#include MICROPY_HAL_H
+#include "py/mphal.h"
#include "irq.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
diff --git a/cc3200/mods/modnetwork.c b/cc3200/mods/modnetwork.c
index f8dbd9c53..b11b03638 100644
--- a/cc3200/mods/modnetwork.c
+++ b/cc3200/mods/modnetwork.c
@@ -28,10 +28,10 @@
#include <std.h>
#include "py/mpstate.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/nlr.h"
#include "py/runtime.h"
+#include "py/mphal.h"
#include "modnetwork.h"
#include "mpexception.h"
#include "serverstask.h"
diff --git a/cc3200/mods/modubinascii.c b/cc3200/mods/modubinascii.c
index 563c44aa6..add46f91b 100644
--- a/cc3200/mods/modubinascii.c
+++ b/cc3200/mods/modubinascii.c
@@ -26,7 +26,6 @@
*/
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/binary.h"
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 6b69e91ee..622a026c2 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -30,7 +30,6 @@
#include "simplelink.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/objstr.h"
#include "py/runtime.h"
diff --git a/cc3200/mods/modussl.c b/cc3200/mods/modussl.c
index ce3067d96..4239c444b 100644
--- a/cc3200/mods/modussl.c
+++ b/cc3200/mods/modussl.c
@@ -29,7 +29,6 @@
#include "simplelink.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/objstr.h"
#include "py/runtime.h"
diff --git a/cc3200/mods/modutime.c b/cc3200/mods/modutime.c
index 14ac10ad1..c669d32a5 100644
--- a/cc3200/mods/modutime.c
+++ b/cc3200/mods/modutime.c
@@ -29,10 +29,10 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/nlr.h"
#include "py/obj.h"
#include "py/smallint.h"
+#include "py/mphal.h"
#include "timeutils.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
diff --git a/cc3200/mods/modwipy.c b/cc3200/mods/modwipy.c
index 08c3f0029..2cfd640b0 100644
--- a/cc3200/mods/modwipy.c
+++ b/cc3200/mods/modwipy.c
@@ -1,5 +1,4 @@
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "mperror.h"
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index fb7a8a6fa..2997e8d38 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -30,10 +30,10 @@
#include "simplelink.h"
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/objstr.h"
#include "py/runtime.h"
+#include "py/mphal.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
diff --git a/cc3200/mods/pybadc.c b/cc3200/mods/pybadc.c
index 2cb1cad08..005c36501 100644
--- a/cc3200/mods/pybadc.c
+++ b/cc3200/mods/pybadc.c
@@ -29,7 +29,6 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/binary.h"
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index e9c634310..52a0851f2 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -29,8 +29,8 @@
#include <string.h>
#include "py/mpstate.h"
-#include MICROPY_HAL_H
#include "py/runtime.h"
+#include "py/mphal.h"
#include "bufhelper.h"
#include "inc/hw_types.h"
#include "inc/hw_i2c.h"
diff --git a/cc3200/mods/pybpin.c b/cc3200/mods/pybpin.c
index 4a2c313ed..ce0e386ff 100644
--- a/cc3200/mods/pybpin.c
+++ b/cc3200/mods/pybpin.c
@@ -30,7 +30,6 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "py/gc.h"
diff --git a/cc3200/mods/pybrtc.c b/cc3200/mods/pybrtc.c
index ce5b12876..8d6b9b13e 100644
--- a/cc3200/mods/pybrtc.c
+++ b/cc3200/mods/pybrtc.c
@@ -28,7 +28,6 @@
#include <std.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "inc/hw_types.h"
diff --git a/cc3200/mods/pybsd.c b/cc3200/mods/pybsd.c
index 74eaa42aa..ea81f30f8 100644
--- a/cc3200/mods/pybsd.c
+++ b/cc3200/mods/pybsd.c
@@ -25,7 +25,6 @@
*/
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "inc/hw_types.h"
diff --git a/cc3200/mods/pybsleep.c b/cc3200/mods/pybsleep.c
index e3a9deeac..ced7fef85 100644
--- a/cc3200/mods/pybsleep.c
+++ b/cc3200/mods/pybsleep.c
@@ -28,8 +28,8 @@
#include <string.h>
#include "py/mpstate.h"
-#include MICROPY_HAL_H
#include "py/runtime.h"
+#include "py/mphal.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_nvic.h"
diff --git a/cc3200/mods/pybspi.c b/cc3200/mods/pybspi.c
index ed3abf588..b7e4310ae 100644
--- a/cc3200/mods/pybspi.c
+++ b/cc3200/mods/pybspi.c
@@ -29,7 +29,6 @@
#include <string.h>
#include "py/mpstate.h"
-#include MICROPY_HAL_H
#include "py/runtime.h"
#include "bufhelper.h"
#include "inc/hw_types.h"
diff --git a/cc3200/mods/pybtimer.c b/cc3200/mods/pybtimer.c
index 089724b97..95eeb083c 100644
--- a/cc3200/mods/pybtimer.c
+++ b/cc3200/mods/pybtimer.c
@@ -30,11 +30,11 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/gc.h"
+#include "py/mphal.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index f4c29d7e2..660453b75 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -31,11 +31,11 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "py/objlist.h"
#include "py/stream.h"
+#include "py/mphal.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
diff --git a/cc3200/mods/pybwdt.c b/cc3200/mods/pybwdt.c
index 7619404d0..8448054ce 100644
--- a/cc3200/mods/pybwdt.c
+++ b/cc3200/mods/pybwdt.c
@@ -27,9 +27,9 @@
#include <stdint.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
+#include "py/mphal.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 8584eaa03..8e6d1742c 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -180,7 +180,6 @@ typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
typedef long mp_off_t;
-void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
@@ -204,7 +203,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
// Include board specific configuration
#include "mpconfigboard.h"
-#define MICROPY_HAL_H "cc3200_hal.h"
+#define MICROPY_MPHALPORT_H "cc3200_hal.h"
#define MICROPY_PORT_HAS_TELNET (1)
#define MICROPY_PORT_HAS_FTP (1)
#define MICROPY_PY_SYS_PLATFORM "WiPy"
diff --git a/cc3200/mptask.c b/cc3200/mptask.c
index ec904f833..7346ddaf2 100644
--- a/cc3200/mptask.c
+++ b/cc3200/mptask.c
@@ -28,10 +28,10 @@
#include <stdint.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
#include "py/runtime.h"
#include "py/gc.h"
+#include "py/mphal.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
diff --git a/cc3200/serverstask.c b/cc3200/serverstask.c
index e22f7f98f..355966420 100644
--- a/cc3200/serverstask.c
+++ b/cc3200/serverstask.c
@@ -28,9 +28,9 @@
#include <string.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/misc.h"
#include "py/nlr.h"
+#include "py/mphal.h"
#include "serverstask.h"
#include "simplelink.h"
#include "debug.h"
diff --git a/cc3200/telnet/telnet.c b/cc3200/telnet/telnet.c
index 70e606886..6980ed51b 100644
--- a/cc3200/telnet/telnet.c
+++ b/cc3200/telnet/telnet.c
@@ -27,8 +27,8 @@
#include <stdint.h>
#include "py/mpconfig.h"
-#include MICROPY_HAL_H
#include "py/obj.h"
+#include "py/mphal.h"
#include "telnet.h"
#include "simplelink.h"
#include "modnetwork.h"
diff --git a/cc3200/util/gccollect.c b/cc3200/util/gccollect.c
index a1b0f802a..094ca73bc 100644
--- a/cc3200/util/gccollect.c
+++ b/cc3200/util/gccollect.c
@@ -32,7 +32,6 @@
#include "py/gc.h"
#include "gccollect.h"
#include "gchelper.h"
-#include MICROPY_HAL_H
/******************************************************************************
DECLARE PRIVATE DATA