initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

7
hal/hal_gpio/config.mk Executable file
View File

@@ -0,0 +1,7 @@
SRC += $(wildcard $(HAL_DIR)/hal_gpio/*.c)
CFLAGS += -I$(HAL_DIR)/hal_gpio
ifdef MOD_GPIO
SRC += $(wildcard $(HAL_DIR)/hal_gpio/$(MOD_GPIO)/*.c)
else
$(warning warning you sure no gpio?)
endif

View File

@@ -0,0 +1,43 @@
#include "hal_interface_gpio.h"
#include "hlog.h"
#define TAG "TAG_GPIO"
uint32_t hal_gpio_init(){
hlogi("%s ok", __func__);
return 0;
}
uint32_t hal_gpio_deinit(){
return 0;
}
static int32_t gpio_output(int32_t argc, char **argv)
{
CHECK_LESS_RETURN(argc, 2);
{
int32_t io = atoi(argv[0]);
int32_t lvl = atoi(argv[1]);
hal_gpio_output(io, lvl);
hlogi("%s argc:%u io:%d, lvl:%d", __func__, argc, io, lvl);
}
return 0;
}
static int32_t gpio_input(int32_t argc, char **argv)
{
CHECK_LESS_RETURN(argc, 1);
{
int32_t io = atoi(argv[0]);
hal_gpio_input(io);
hlogi("%s argc:%u io:%d", __func__, argc, io);
}
return 0;
}
unittest_cmd g_ut_cmd_gpio[UT_CMDCNT_GPIO] =
{
DECLAR_UT_CMD(gpio_output, NULL, "output", "output 1 1/0"),
DECLAR_UT_CMD(gpio_input, NULL, "input", "No Param"),
};

View File

@@ -0,0 +1,32 @@
#ifndef __HAL_GPIO_H__
#define __HAL_GPIO_H__
#include "hal.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define UT_CMDCNT_GPIO (2)
extern unittest_cmd g_ut_cmd_gpio[UT_CMDCNT_GPIO];
/*gpio init interface define,should be implement if needed*/
uint32_t hal_gpio_init();
/*gpio deinit interface define,should be implement if needed*/
uint32_t hal_gpio_deinit();
//level can be 1 or 0 only
uint32_t hal_gpio_output(uint32_t io, uint32_t level);
uint32_t hal_gpio_input(uint32_t io);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HAL_GPIO_H__ */

View File

@@ -0,0 +1,10 @@
#include "hal_interface_gpio.h"
#include "hlog.h"
uint32_t hal_gpio_output(uint32_t io, uint32_t level){
return 0;
}
uint32_t hal_gpio_input(uint32_t io){
return 0;
}