Browse Source

fix ac5 warnnings sync

lyon1998 2 years ago
parent
commit
813bb30b75

+ 1 - 1
package/PikaStdDevice/PikaStdDevice_GPIO.c

@@ -131,7 +131,7 @@ void PikaStdDevice_GPIO_setCallback(PikaObj* self,
     _PikaStdDevice_setCallback(self, eventCallback, (uintptr_t)dev);
     /* regist event to pika_hal */
     pika_hal_GPIO_config cfg_cb = {0};
-    cfg_cb.event_callback = (void*)_PikaStdDevice_event_handler;
+    cfg_cb.event_callback = _PikaStdDevice_GPIO_event_handler;
     cfg_cb.event_callback_filter = filter;
     cfg_cb.event_callback_ena = PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE;
     pika_hal_ioctl(dev, PIKA_HAL_IOCTL_CONFIG, &cfg_cb);

+ 1 - 2
package/PikaStdDevice/PikaStdDevice_Timer.c

@@ -37,7 +37,6 @@ static pika_dev* _get_dev(PikaObj* self) {
         obj_setPtr(self, "pika_dev", dev);
         return dev;
     }
-    return dev;
 }
 
 void PikaStdDevice_Timer___init__(PikaObj* self) {
@@ -94,7 +93,7 @@ void PikaStdDevice_Timer_setCallback(PikaObj* self, Arg* callback, int filter) {
         _PikaStdDevice_setCallback(self, callback, (uintptr_t)dev);
         /* regist event to pika_hal */
         pika_hal_TIM_config cfg_cb = {0};
-        cfg_cb.event_callback = (void*)_PikaStdDevice_event_handler;
+        cfg_cb.event_callback = _PikaStdDevice_TIM_event_handler;
         cfg_cb.event_callback_filter = filter;
         cfg_cb.event_callback_ena = PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE;
         pika_hal_ioctl(dev, PIKA_HAL_IOCTL_CONFIG, &cfg_cb);

+ 2 - 2
package/PikaStdDevice/PikaStdDevice_UART.c

@@ -28,7 +28,7 @@ void PikaStdDevice_UART_enable(PikaObj* self) {
     cfg.baudrate = obj_getInt(self, "baudRate");
     cfg.flow_control = obj_getInt(self, "flowControl");
     cfg.stop_bits = obj_getInt(self, "stopBits");
-    cfg.parity = obj_getInt(self, "parity");
+    cfg.parity = (PIKA_HAL_UART_PARITY)obj_getInt(self, "parity");
     cfg.data_bits = obj_getInt(self, "dataBits");
     if (!strEqu(obj_getStr(self, "TXpin"), "none")) {
         cfg.TX = pika_hal_open(PIKA_HAL_GPIO, obj_getStr(self, "TXpin"));
@@ -183,7 +183,7 @@ void PikaStdDevice_UART_setCallback(PikaObj* self,
     _PikaStdDevice_setCallback(self, eventCallBack, (uintptr_t)dev);
     /* regist event to pika_hal */
     pika_hal_UART_config cfg_cb = {0};
-    cfg_cb.event_callback = (void*)_PikaStdDevice_event_handler;
+    cfg_cb.event_callback = _PikaStdDevice_UART_event_handler;
     cfg_cb.event_callback_filter = filter;
     cfg_cb.event_callback_ena = PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE;
     pika_hal_ioctl(dev, PIKA_HAL_IOCTL_CONFIG, &cfg_cb);

+ 14 - 1
package/PikaStdDevice/PikaStdDevice_common.c

@@ -1,7 +1,20 @@
 #include "PikaStdDevice_common.h"
 
 extern PikaEventListener* g_pika_device_event_listener;
-void _PikaStdDevice_event_handler(pika_dev* dev, int signal) {
+void _PikaStdDevice_GPIO_event_handler(pika_dev* dev,
+                                       PIKA_HAL_GPIO_EVENT_SIGNAL signal) {
+    pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
+                                  signal);
+}
+
+void _PikaStdDevice_TIM_event_handler(pika_dev* dev,
+                                      PIKA_HAL_TIM_EVENT_SIGNAL signal) {
+    pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
+                                  signal);
+}
+
+void _PikaStdDevice_UART_event_handler(pika_dev* dev,
+                                       PIKA_HAL_UART_EVENT_SIGNAL signal) {
     pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
                                   signal);
 }

+ 6 - 1
package/PikaStdDevice/PikaStdDevice_common.h

@@ -7,6 +7,11 @@ void _PikaStdDevice_setCallback(PikaObj* self,
                                 Arg* eventCallback,
                                 uintptr_t eventId);
 
-void _PikaStdDevice_event_handler(pika_dev* dev, int signal);
+void _PikaStdDevice_GPIO_event_handler(pika_dev* dev,
+                                       PIKA_HAL_GPIO_EVENT_SIGNAL signal);
+void _PikaStdDevice_TIM_event_handler(pika_dev* dev,
+                                      PIKA_HAL_TIM_EVENT_SIGNAL signal);
+void _PikaStdDevice_UART_event_handler(pika_dev* dev,
+                                       PIKA_HAL_UART_EVENT_SIGNAL signal);
 
 #endif

+ 0 - 4
package/PikaStdDevice/pika_hal.c

@@ -153,10 +153,6 @@ int pika_hal_ioctl(pika_dev* dev, PIKA_HAL_IOCTL_CMD cmd, ...) {
     pika_debug("pika_hal_ioctl, dev[0x%p], type[%d], cmd[%d]", dev, dev->type,
                cmd);
     cmd = _pika_hal_get_arg_cnt(cmd_origin);
-    if (cmd < 0) {
-        pika_platform_printf("Error: cmd invalied.\r\n");
-        return -1;
-    }
     pika_dev_impl* impl = _pika_dev_get_impl(dev->type);
     if (impl->ioctl == NULL) {
         pika_platform_printf("Error: ioctl not support.\r\n");

+ 6 - 3
port/linux/package/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_common.c

@@ -1,17 +1,20 @@
 #include "PikaStdDevice_common.h"
 
 extern PikaEventListener* g_pika_device_event_listener;
-void _PikaStdDevice_GPIO_event_handler(pika_dev* dev, PIKA_HAL_GPIO_EVENT_SIGNAL signal) {
+void _PikaStdDevice_GPIO_event_handler(pika_dev* dev,
+                                       PIKA_HAL_GPIO_EVENT_SIGNAL signal) {
     pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
                                   signal);
 }
 
-void _PikaStdDevice_TIM_event_handler(pika_dev* dev, PIKA_HAL_TIM_EVENT_SIGNAL signal) {
+void _PikaStdDevice_TIM_event_handler(pika_dev* dev,
+                                      PIKA_HAL_TIM_EVENT_SIGNAL signal) {
     pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
                                   signal);
 }
 
-void _PikaStdDevice_UART_event_handler(pika_dev* dev, PIKA_HAL_UART_EVENT_SIGNAL signal) {
+void _PikaStdDevice_UART_event_handler(pika_dev* dev,
+                                       PIKA_HAL_UART_EVENT_SIGNAL signal) {
     pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
                                   signal);
 }

+ 6 - 3
port/linux/package/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_common.h

@@ -7,8 +7,11 @@ void _PikaStdDevice_setCallback(PikaObj* self,
                                 Arg* eventCallback,
                                 uintptr_t eventId);
 
-void _PikaStdDevice_GPIO_event_handler(pika_dev* dev, PIKA_HAL_GPIO_EVENT_SIGNAL signal);
-void _PikaStdDevice_TIM_event_handler(pika_dev* dev, PIKA_HAL_TIM_EVENT_SIGNAL signal);
-void _PikaStdDevice_UART_event_handler(pika_dev* dev, PIKA_HAL_UART_EVENT_SIGNAL signal);
+void _PikaStdDevice_GPIO_event_handler(pika_dev* dev,
+                                       PIKA_HAL_GPIO_EVENT_SIGNAL signal);
+void _PikaStdDevice_TIM_event_handler(pika_dev* dev,
+                                      PIKA_HAL_TIM_EVENT_SIGNAL signal);
+void _PikaStdDevice_UART_event_handler(pika_dev* dev,
+                                       PIKA_HAL_UART_EVENT_SIGNAL signal);
 
 #endif

+ 2 - 3
src/PikaCompiler.c

@@ -379,9 +379,8 @@ static int32_t __foreach_handler_libWriteIndex(Arg* argEach,
         pika_platform_memcpy(block_buff, module_name,
                              name_size + 1); /* add '\0' after name */
         /* should write the size without align */
-        pika_platform_memcpy(
-            block_buff + linker->block_size - sizeof(uint32_t),
-            &bytecode_size, sizeof(uint32_t));
+        pika_platform_memcpy(block_buff + linker->block_size - sizeof(uint32_t),
+                             &bytecode_size, sizeof(uint32_t));
 
         /* write the block to file */
         linker_fwrite(linker, (uint8_t*)block_buff, linker->block_size);

+ 1 - 1
src/PikaVersion.h

@@ -2,4 +2,4 @@
 #define PIKA_VERSION_MINOR 13
 #define PIKA_VERSION_MICRO 2
 
-#define PIKA_EDIT_TIME "2024/02/25 01:45:50"
+#define PIKA_EDIT_TIME "2024/03/02 14:19:24"