diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 57085422799b49f2c26e8a2bf4b52a3158060e1b..0f73fe93ea43b62cfb886fa4b8c5178a7d88e1b6 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -1,3 +1,16 @@ +# Phytium FreeRTOS SDK 2024-05-10 ChangeLog + +Change Log since 2024-05-09 + +## example + +- rework gpio example and use standalone drivers api +- add d2000 support in gpio example + +## drivers + +- remove fgpio_os + # Phytium FreeRTOS SDK 2024-05-14 v1.0.0 ChangeLog Change Log since 2024-05-10 diff --git a/drivers/Kconfig b/drivers/Kconfig index eae2e0ca86df03c17c29ff616bd889923332340a..27e5425c632912275a179f21112bda66a0188367 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -46,13 +46,6 @@ menu "Freertos Eth Drivers" default n endmenu -menu "Freertos Gpio Drivers" - config FREERTOS_USE_GPIO - bool - prompt "Use Freertos gpio driver" - default n -endmenu - menu "Freertos Spim Drivers" config FREERTOS_USE_FSPIM bool diff --git a/drivers/dma/fddma/fddma_os.h b/drivers/dma/fddma/fddma_os.h old mode 100644 new mode 100755 diff --git a/drivers/gpio/fgpio/fgpio_os.c b/drivers/gpio/fgpio/fgpio_os.c deleted file mode 100644 index 4d51d25b2da75e9692be9bfa048c0dd820996700..0000000000000000000000000000000000000000 --- a/drivers/gpio/fgpio/fgpio_os.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: fgpio_os.c - * Date: 2022-07-22 11:33:51 - * LastEditTime: 2022-07-22 11:33:51 - * Description:  This file is for required function implementations of gpio driver used in FreeRTOS. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/7/27 init commit - * 2.0 wangzq 2024/4/22 add no letter shell mode, adapt to auto-test system - */ -/***************************** Include Files *********************************/ -#include -#include -#include -#include "fdebug.h" -#include "fcpu_info.h" - -#include "fgpio_os.h" -/************************** Constant Definitions *****************************/ - -/**************************** Type Definitions *******************************/ - -/************************** Variable Definitions *****************************/ -static FFreeRTOSFGpio gpio[FGPIO_NUM]; /* instance of all gpio ctrl */ - -/***************** Macros (Inline Functions) Definitions *********************/ -#define FGPIO_DEBUG_TAG "FGPIO-OS" -#define FGPIO_ERROR(format, ...) FT_DEBUG_PRINT_E(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) -#define FGPIO_WARN(format, ...) FT_DEBUG_PRINT_W(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) -#define FGPIO_INFO(format, ...) FT_DEBUG_PRINT_I(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) -#define FGPIO_DEBUG(format, ...) FT_DEBUG_PRINT_D(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) - -/************************** Function Prototypes ******************************/ - -/*****************************************************************************/ -static inline FError FGpioOsTakeSema(SemaphoreHandle_t locker) -{ - FASSERT_MSG((NULL != locker), "Locker not exists."); - if (pdFALSE == xSemaphoreTake(locker, portMAX_DELAY)) - { - FGPIO_ERROR("Failed to give locker!!!"); - return FFREERTOS_GPIO_SEMA_ERR; - } - - return FFREERTOS_GPIO_OK; -} - -static inline void FGpioOsGiveSema(SemaphoreHandle_t locker) -{ - FASSERT_MSG((NULL != locker), "Locker not exists."); - if (pdFALSE == xSemaphoreGive(locker)) - { - FGPIO_ERROR("Failed to give locker!!!"); - } - - return; -} - -/** - * @name: FGpioOsGetId - * @msg: get gpio ctrl, pin and port by pin index - * @return {*} - * @param {u32} pin_idx, gpio pin id - * @param {FGpioPinId} *pin_id, input pin instance - */ -static inline void FGpioOsGetId(u32 pin_idx, FGpioPinId *pin_id) -{ - FASSERT(pin_id); - - /* convert u32 pin_idx to FGpioPinId pin_id */ - pin_id->ctrl = FFREERTOS_GPIO_PIN_CTRL_ID(pin_idx); - pin_id->port = FFREERTOS_GPIO_PIN_PORT_ID(pin_idx); - pin_id->pin = FFREERTOS_GPIO_PIN_ID(pin_idx); - FGPIO_INFO("Pin index = 0x%x", pin_idx); - FGPIO_INFO("is gpio-%d-%d-%d", pin_id->ctrl, pin_id->port, pin_id->pin); -} - -/* setup gpio interrupt */ -static void FGpioOSSetupGpioIRQ(FFreeRTOSFGpio *const instance, FGpioPin *const pin, const FFreeRTOSGpioPinConfig *config) -{ - u32 cpu_id; - FGpio *ctrl = &instance->ctrl; - u32 irq_num = ctrl->config.irq_num[pin->index.pin]; - - GetCpuId(&cpu_id); - FGPIO_INFO("cpu_id is cpu_id %d", cpu_id); - - InterruptSetTargetCpus(irq_num, cpu_id); - - /* setup interrupt */ - InterruptSetPriority(irq_num, FFREERTOS_GPIO_IRQ_PRIORITY); - - /* register intr handler */ - InterruptInstall(irq_num, FGpioInterruptHandler, ctrl, NULL); - - InterruptUmask(irq_num); - - return; -} - -/** - * @name: FFreeRTOSGpioInit - * @msg: init and get gpio instance - * @return {*} - * @param {u32} id, gpio instance id - * @param {FFreeRTOSGpioConfig} *input_config, input configuration - */ -FFreeRTOSFGpio *FFreeRTOSGpioInit(u32 id, const FFreeRTOSGpioConfig *input_config) -{ - FASSERT_MSG(id < FGPIO_NUM, "Invalid gpio id."); - FFreeRTOSFGpio *instance = &gpio[id]; - FGpio *ctrl = &instance->ctrl; - FGpioConfig *config = &ctrl->config; - FError err = FT_SUCCESS; - - if (FT_COMPONENT_IS_READY == ctrl->is_ready) - { - FGPIO_WARN("gpio-%d already init.", config->instance_id); - return instance; - } - - /* no scheduler during init */ - taskENTER_CRITICAL(); - - *config = *FGpioLookupConfig(id); - err = FGpioCfgInitialize(ctrl, config); - if (FGPIO_SUCCESS != err) - { - goto err_exit; - } - - FASSERT_MSG(NULL == instance->locker, "Locker exists!!!"); - FASSERT_MSG((instance->locker = xSemaphoreCreateMutex()) != NULL, "Create mutex failed!!!"); - -err_exit: - taskEXIT_CRITICAL(); /* allow schedule after init */ - return (FT_SUCCESS == err) ? instance : NULL; /* exit with NULL if failed */ -} - -/** - * @name: FFreeRTOSGpioDeInit - * @msg: deinit gpio instance - * @return {*} - * @param {FFreeRTOSFGpio} *instance, freertos gpio instance - */ -FError FFreeRTOSGpioDeInit(FFreeRTOSFGpio *const instance) -{ - FASSERT(instance); - FGpio *ctrl = &instance->ctrl; - FError err = FT_SUCCESS; - - if (FT_COMPONENT_IS_READY != ctrl->is_ready) - { - FGPIO_WARN("gpio-%d not yet init.", ctrl->config.instance_id); - return FFREERTOS_GPIO_NOT_INIT; - } - - /* no scheduler during deinit */ - taskENTER_CRITICAL(); - - FGpioDeInitialize(ctrl); - - FASSERT_MSG(NULL != instance->locker, "Locker not exists!!!"); - vSemaphoreDelete(instance->locker); - instance->locker = NULL; - - taskEXIT_CRITICAL(); /* allow schedule after init */ - return err; -} - -/** - * @name: FFreeRTOSSetupPin - * @msg: config and setup pin - * @return {*} - * @param {FFreeRTOSFGpio} *instance, freertos gpio instance - * @param {FFreeRTOSGpioPinConfig} *config, gpio pin configuration - */ -FError FFreeRTOSSetupPin(FFreeRTOSFGpio *const instance, const FFreeRTOSGpioPinConfig *config) -{ - FASSERT(instance && config); - FGpio *ctrl = &instance->ctrl; - FGpioPinId pin_id; - - FGpioOsGetId(config->pin_idx, &pin_id); /* convert pin id */ - u32 ctrl_id = ctrl->config.instance_id; - FASSERT_MSG((ctrl_id == pin_id.ctrl), "Invalid instance for pin."); - FGpioPin *const pin = &instance->pins[pin_id.port][pin_id.pin]; - FError err = FT_SUCCESS; - boolean irq_one_time = TRUE; - FGpioIrqType irq_type = config->irq_type; - - err = FGpioOsTakeSema(instance->locker); - if (FFREERTOS_GPIO_OK != err) - { - return err; - } - - /* de-init pin if setup */ - if (FT_COMPONENT_IS_READY == pin->is_ready) - { - FGpioPinDeInitialize(pin); - } - - /* init pin */ - err = FGpioPinInitialize(ctrl, pin, pin_id); - if (FGPIO_SUCCESS != err) - { - FGPIO_ERROR("Init pin %d-%d failed, err: 0x%x", - pin_id.port, - pin_id.pin, - err); - goto err_exit; - } - - /* setup pin direction */ - FGpioSetDirection(pin, config->mode); - FGPIO_INFO("Set GPIO-%d-%c-%d direction %s", - pin_id.ctrl, - (FGPIO_PORT_A == pin_id.port) ? 'a' : 'b', - pin_id.pin, - (FGPIO_DIR_INPUT == config->mode) ? "IN" : "OUT"); - if (FGPIO_DIR_INPUT == FGpioGetDirection(pin)) - { - FGpioSetInterruptMask(pin, FALSE); /* disable pin irq */ - } - /* setup input-pin irq */ - if (TRUE == config->en_irq) - { - FGpioOSSetupGpioIRQ(instance, pin, config); - FGpioRegisterInterruptCB(pin, config->irq_handler, config->irq_args, irq_one_time); /* register intr callback */ - FGpioSetInterruptType(pin, irq_type);/*set pin irq type */ - FGpioSetInterruptMask(pin, config->en_irq);/*enable pin irq */ - } - -err_exit: - FGpioOsGiveSema(instance->locker); - return err; -} - -/** - * @name: FFreeRTOSPinWrite - * @msg: set output pin value - * @return {*} - * @param {FFreeRTOSFGpio} *instance, freertos gpio instance - * @param {u32} pin_idx, index of gpio pin - * @param {u32} value, level set to gpio pin - */ -FError FFreeRTOSPinWrite(FFreeRTOSFGpio *const instance, u32 pin_idx, u32 value) -{ - FASSERT(instance); - FGpioPinId pin_id; - FGpioOsGetId(pin_idx, &pin_id); /* convert pin id */ - FGpio *ctrl = &instance->ctrl; - u32 ctrl_id = ctrl->config.instance_id; - FASSERT_MSG((ctrl_id == pin_id.ctrl), "Invalid instance for pin."); - FGpioPin *const pin = &instance->pins[pin_id.port][pin_id.pin]; - FError err = FT_SUCCESS; - - err = FGpioOsTakeSema(instance->locker); - if (FFREERTOS_GPIO_OK != err) - { - return err; - } - - err = FGpioSetOutputValue(pin, (FGpioPinVal)value); - - FGpioOsGiveSema(instance->locker); - return err; -} - -/** - * @name: FFreeRTOSPinRead - * @msg: get input pin value - * @return {u32} level input by pin - * @param {FFreeRTOSFGpio} *instance, freertos gpio instance - * @param {u32} pin_idx, index of gpio pin - */ -u32 FFreeRTOSPinRead(FFreeRTOSFGpio *const instance, u32 pin_idx) -{ - FASSERT(instance); - FGpio *ctrl = &instance->ctrl; - FGpioPinId pin_id; - FGpioOsGetId(pin_idx, &pin_id); /* convert pin id */ - u32 ctrl_id = ctrl->config.instance_id; - FASSERT_MSG((ctrl_id == pin_id.ctrl), "Invalid instance for pin."); - FGpioPin *const pin = &instance->pins[pin_id.port][pin_id.pin]; - FError err = FT_SUCCESS; - FGpioPinVal val = FGPIO_PIN_LOW; - - err = FGpioOsTakeSema(instance->locker); - if (FFREERTOS_GPIO_OK != err) - { - return val; - } - - val = FGpioGetInputValue(pin); - - FGpioOsGiveSema(instance->locker); - return val; -} \ No newline at end of file diff --git a/drivers/gpio/fgpio/fgpio_os.h b/drivers/gpio/fgpio/fgpio_os.h deleted file mode 100644 index 2fc1ede535d45717ba9962dd164f7ed3424b2271..0000000000000000000000000000000000000000 --- a/drivers/gpio/fgpio/fgpio_os.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: fgpio_os.h - * Date: 2022-07-22 11:33:45 - * LastEditTime: 2022-07-22 11:33:45 - * Description:  This file is for providing function related definitions of gpio driver used in FreeRTOS. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/7/27 init commit - */ - -#ifndef FGPIO_OS_H -#define FGPIO_OS_H -/***************************** Include Files *********************************/ -#include -#include -#include - -#include "fkernel.h" -#include "fparameters.h" -#include "fgpio.h" -/************************** Constant Definitions *****************************/ -#ifdef __cplusplus -extern "C" -{ -#endif - -#define FFREERTOS_GPIO_OK FT_SUCCESS -#define FFREERTOS_GPIO_NOT_INIT FT_CODE_ERR(ErrModPort, ErrBspGpio, 0) -#define FFREERTOS_GPIO_SEMA_ERR FT_CODE_ERR(ErrModPort, ErrBspGpio, 1) -#define FFREERTOS_GPIO_ALREADY_INIT FT_CODE_ERR(ErrModPort, ErrBspGpio, 2) -#define FFREERTOS_GPIO_NOT_SUPPORT FT_CODE_ERR(ErrModPort, ErrBspGpio, 3) -#define FFREERTOS_GPIO_WAIT_EVT_TIMOUT FT_CODE_ERR(ErrModPort, ErrBspGpio, 4) - -#define FFREERTOS_GPIO_IRQ_PRIORITY IRQ_PRIORITY_VALUE_12 - -/* format gpio pin index */ -#define FFREERTOS_GPIO_PIN_INDEX(ctrl, port, pin) SET_REG32_BITS(ctrl, 31, 16) | \ - SET_REG32_BITS(port, 15, 12) | \ - SET_REG32_BITS(pin, 11, 0) -#define FFREERTOS_GPIO_PIN_CTRL_ID(pin_idx) GET_REG32_BITS(pin_idx, 31, 16) -#define FFREERTOS_GPIO_PIN_PORT_ID(pin_idx) GET_REG32_BITS(pin_idx, 15, 12) -#define FFREERTOS_GPIO_PIN_ID(pin_idx) GET_REG32_BITS(pin_idx, 11, 0) - - -#define FFREERTOS_GPIO_LEVEL_LOW 0U -#define FFREERTOS_GPIO_LEVEL_HIGH 1U -/**************************** Type Definitions *******************************/ - -typedef struct -{ - FGpio ctrl; /* driver instance */ - FGpioPin pins[FGPIO_PORT_NUM][FGPIO_PIN_NUM]; /* pin instance */ - SemaphoreHandle_t locker; /* locker of freertos instance */ -} FFreeRTOSFGpio; /* freertos gpio instance */ - -typedef void (*FFreeRTOSFGpioPinIrqHandler)(s32 vector, void *param); - -typedef struct -{ - -} FFreeRTOSGpioConfig; /* freertos gpio config, reserved for future use */ - -typedef struct -{ - u32 pin_idx; /* use FFREERTOS_GPIO_PIN_INDEX to define */ - FGpioDirection mode; /* pin direction */ - boolean en_irq; /* TRUE: enable irq */ - FGpioIrqType irq_type; /* pin irq type */ - FFreeRTOSFGpioPinIrqHandler irq_handler; - void *irq_args; -} FFreeRTOSGpioPinConfig; /* freertos pin config */ - -/************************** Variable Definitions *****************************/ - -/***************** Macros (Inline Functions) Definitions *********************/ - -/************************** Function Prototypes ******************************/ - -/*****************************************************************************/ -/* init and get gpio instance */ -FFreeRTOSFGpio *FFreeRTOSGpioInit(u32 instance_id, const FFreeRTOSGpioConfig *config); - -/* deinit gpio instance */ -FError FFreeRTOSGpioDeInit(FFreeRTOSFGpio *const instance); - -/* config and setup pin */ -FError FFreeRTOSSetupPin(FFreeRTOSFGpio *const instance, const FFreeRTOSGpioPinConfig *config); - -/* set output pin value */ -FError FFreeRTOSPinWrite(FFreeRTOSFGpio *const instance, u32 pin, u32 value); - -/* get input pin value */ -u32 FFreeRTOSPinRead(FFreeRTOSFGpio *const instance, u32 pin); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/drivers/gpio/src.mk b/drivers/gpio/src.mk deleted file mode 100644 index de5f55809a24161d1e0f8d1872af35cea369e3a7..0000000000000000000000000000000000000000 --- a/drivers/gpio/src.mk +++ /dev/null @@ -1,4 +0,0 @@ -ifdef CONFIG_ENABLE_FGPIO -DRIVERS_CSRCS += \ - gpio/fgpio/fgpio_os.c -endif diff --git a/drivers/include.mk b/drivers/include.mk index fc6cf46b7e55dcc97a7add2e00693a76ad0f39c5..cabe9ec06137718994c395779ded7358fd2db106 100644 --- a/drivers/include.mk +++ b/drivers/include.mk @@ -25,11 +25,6 @@ ifdef CONFIG_ENABLE_Pl011_UART BUILD_INC_PATH_DIR += $(OS_DRV_CUR_DIR)/serial/fpl011 endif #CONFIG_ENABLE_Pl011_UART -# gpio -ifdef CONFIG_ENABLE_FGPIO - BUILD_INC_PATH_DIR += $(OS_DRV_CUR_DIR)/gpio/fgpio -endif - # spi ifdef CONFIG_USE_FSPIM BUILD_INC_PATH_DIR += $(OS_DRV_CUR_DIR)/spi/fspim diff --git a/drivers/makefile b/drivers/makefile index 74276bd85945e307324c3f628a8beb8d088892d8..014f23071dd5f93a3aa2ec054e55815c335d587c 100644 --- a/drivers/makefile +++ b/drivers/makefile @@ -4,7 +4,6 @@ include adc/src.mk include can/src.mk include dma/src.mk include eth/src.mk -include gpio/src.mk include i2c/src.mk include media/src.mk include pwm/src.mk diff --git a/example/freertos_feature/task/README.md b/example/freertos_feature/task/README.md old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/inc/feature_task.h b/example/freertos_feature/task/inc/feature_task.h old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/main.c b/example/freertos_feature/task/main.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/block_state.c b/example/freertos_feature/task/src/block_state.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/change_priority.c b/example/freertos_feature/task/src/change_priority.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/creating_tasks.c b/example/freertos_feature/task/src/creating_tasks.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/idle_task_hook.c b/example/freertos_feature/task/src/idle_task_hook.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/priority_task.c b/example/freertos_feature/task/src/priority_task.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/task_cmd.c b/example/freertos_feature/task/src/task_cmd.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/task_combining_blocking_non_blocking.c b/example/freertos_feature/task/src/task_combining_blocking_non_blocking.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/task_delay_until.c b/example/freertos_feature/task/src/task_delay_until.c old mode 100644 new mode 100755 diff --git a/example/freertos_feature/task/src/using_task_parameter.c b/example/freertos_feature/task/src/using_task_parameter.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/README.md b/example/network/wlan/README.md old mode 100644 new mode 100755 diff --git a/example/network/wlan/inc/wlan_ap_config.h b/example/network/wlan/inc/wlan_ap_config.h old mode 100644 new mode 100755 diff --git a/example/network/wlan/inc/wlan_common.h b/example/network/wlan/inc/wlan_common.h old mode 100644 new mode 100755 diff --git a/example/network/wlan/inc/wlan_station_connect.h b/example/network/wlan/inc/wlan_station_connect.h old mode 100644 new mode 100755 diff --git a/example/network/wlan/inc/wlan_station_scan.h b/example/network/wlan/inc/wlan_station_scan.h old mode 100644 new mode 100755 diff --git a/example/network/wlan/main.c b/example/network/wlan/main.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/cmd_ap.c b/example/network/wlan/src/cmd_ap.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/cmd_station.c b/example/network/wlan/src/cmd_station.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/wlan_ap_config.c b/example/network/wlan/src/wlan_ap_config.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/wlan_common.c b/example/network/wlan/src/wlan_common.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/wlan_station_connect.c b/example/network/wlan/src/wlan_station_connect.c old mode 100644 new mode 100755 diff --git a/example/network/wlan/src/wlan_station_scan.c b/example/network/wlan/src/wlan_station_scan.c old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/README.md b/example/peripheral/dma/ddma/README.md old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/figs/phytiumpi.png b/example/peripheral/dma/ddma/figs/phytiumpi.png old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/inc/ddma_spi_loopback.h b/example/peripheral/dma/ddma/inc/ddma_spi_loopback.h old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/main.c b/example/peripheral/dma/ddma/main.c old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/src/cmd_ddma.c b/example/peripheral/dma/ddma/src/cmd_ddma.c old mode 100644 new mode 100755 diff --git a/example/peripheral/dma/ddma/src/ddma_spi_loopback.c b/example/peripheral/dma/ddma/src/ddma_spi_loopback.c old mode 100644 new mode 100755 diff --git a/example/peripheral/gpio/README.md b/example/peripheral/gpio/README.md index fda1a66ee226cee13a4bedd6d0de3665151754d0..72223275cc8b636aacb4841f3b6eeee461d89e65 100644 --- a/example/peripheral/gpio/README.md +++ b/example/peripheral/gpio/README.md @@ -14,7 +14,7 @@ GPIO (General-purpose input/output),即通用型输入输出,其引脚可以 - [Phytium Standalone SDK](https://gitee.com/phytium_embedded/phytium-standalone-sdk) ### 2.1 硬件配置方法 -- E2000 D/Q Demo 板 或 飞腾派 +- E2000 D/Q Demo 板 / 飞腾派 / D2000 Test 板 - 杜邦线 #### 2.1.1 对于E2000 D/Q Demo 板 @@ -22,11 +22,18 @@ GPIO (General-purpose input/output),即通用型输入输出,其引脚可以 ![](./figs/pin_gpio_intr_board.png) #### 2.1.2 对于飞腾派 -- 需要用杜邦线短接GPIO3_1与GPIO3_2,分别对应飞腾派上的J1组引脚的第11号与第16号引脚 + +- 需要用杜邦线短接GPIO0_0与GPIO4_13,如下图所示,分别为 36 号和 37 号引脚 ![](./figs/firefly_gpio_board.png) 注:在上述例程中,若想使用其他GPIO进行测试,则需要在例程gpio_io_irq.c文件中修改GPIO引脚号IN_PIN_INDEX,OUT_PIN_INDEX,并重新编译烧写。 +#### 2.1.3 对于D2000 Test 板 + +- 需要用杜邦线短接GPIO1_A_6与GPIO1_A_7,分别对应飞腾派上的J1组引脚的第11号与第16号引脚,对应SPI0排线,如下图所示 左侧排线的最下面脚(SPI0-SO 对应 GPIO 1-A-7)和右侧排线的最上面脚(SPI0-SCK 对应 GPIO 1-A-6) + +![](./figs/d2000_gpio_pin.png) + ### 2.2 SDK配置方法 本例程需要, diff --git a/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config b/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config new file mode 100644 index 0000000000000000000000000000000000000000..25b8fff6397ecc1cce51062c897523ebb4ea41ab --- /dev/null +++ b/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config @@ -0,0 +1,351 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +# CONFIG_ARCH_ARMV8_AARCH64 is not set +CONFIG_ARCH_ARMV8_AARCH32=y + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH32=y +CONFIG_ARCH_EXECUTION_STATE="aarch32" + +# +# Fpu configuration +# +CONFIG_CRYPTO_NEON_FP_ARMV8=y +# CONFIG_VFPV4 is not set +# CONFIG_VFPV4_D16 is not set +# CONFIG_VFPV3 is not set +# CONFIG_VFPV3_D16 is not set +CONFIG_ARM_MFPU="crypto-neon-fp-armv8" +CONFIG_MFLOAT_ABI_HARD=y +# CONFIG_MFLOAT_ABI_SOFTFP is not set +CONFIG_ARM_MFLOAT_ABI="hard" +# end of Fpu configuration +# end of Compiler configuration + +CONFIG_USE_CACHE=y +# CONFIG_USE_L3CACHE is not set +CONFIG_USE_MMU=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arm architecture configuration +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +CONFIG_TARGET_D2000=y +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="d2000" +CONFIG_SOC_CORE_NUM=8 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="test" +CONFIG_D2000_TEST_BOARD=y + +# +# IO mux configuration when board start up +# +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="gpio" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Image information configuration +# +# CONFIG_IMAGE_INFO is not set +# end of Image information configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +CONFIG_ENABLE_IOCTRL=y +# CONFIG_ENABLE_IOPAD is not set +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +CONFIG_USE_GPIO=y +CONFIG_ENABLE_FGPIO=y +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_USB is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +# CONFIG_DEBUG_NOOPT is not set +# CONFIG_DEBUG_CUSTOMOPT is not set +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x1000000 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +# CONFIG_USE_CHERRY_USB is not set +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config b/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config new file mode 100644 index 0000000000000000000000000000000000000000..0a8064d35893e18ceea493573115e3de1f05ac27 --- /dev/null +++ b/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config @@ -0,0 +1,340 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_USE_CACHE=y +# CONFIG_USE_L3CACHE is not set +CONFIG_USE_MMU=y +# CONFIG_BOOT_WITH_FLUSH_CACHE is not set +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +CONFIG_TARGET_D2000=y +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="d2000" +CONFIG_SOC_CORE_NUM=8 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="test" +CONFIG_D2000_TEST_BOARD=y + +# +# IO mux configuration when board start up +# +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="gpio" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Image information configuration +# +# CONFIG_IMAGE_INFO is not set +# end of Image information configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +CONFIG_ENABLE_IOCTRL=y +# CONFIG_ENABLE_IOPAD is not set +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +CONFIG_USE_GPIO=y +CONFIG_ENABLE_FGPIO=y +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_USB is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +# CONFIG_DEBUG_NOOPT is not set +# CONFIG_DEBUG_CUSTOMOPT is not set +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x1000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +# CONFIG_USE_CHERRY_USB is not set +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config b/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config index 5ceb7b8a46b3b5d474f073ba8fa0755a21726060..d228f6b83159785fe1c43418d2333075be3d1f6e 100644 --- a/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config @@ -60,7 +60,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -254,12 +253,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config b/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config index 42d5d1e86b7308aea0246ed1ac552f1442805b41..4e519923ec63186766de357151b7d994c03b02f7 100644 --- a/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config @@ -54,7 +54,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -243,12 +242,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config b/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config index 3af45c31726d73a3d3bc3ccbae56c15e97db0afa..7b94d88be1158235e7763f82037c49120e641cac 100644 --- a/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config @@ -60,7 +60,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -253,12 +252,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config b/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config index a05697d0a1c604843587cef48009cc8848d5a67a..76053a37b775467b313cbb1765a6f09c6dace6e9 100644 --- a/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config @@ -54,7 +54,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -242,12 +241,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config b/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config index e3d13c45d1ff691824b74bc6a4daf6ed0591b098..2394dd530df46410155737742b985485347249d1 100644 --- a/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config +++ b/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config @@ -59,7 +59,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -252,12 +251,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config b/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config index cddd0fe6a8acfbd2ae071208a388bb02827ad307..285769ffdab2e3ab25a73caae786368af90d4c7f 100644 --- a/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config +++ b/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config @@ -53,7 +53,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -241,12 +240,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/figs/d2000_gpio_pin.png b/example/peripheral/gpio/figs/d2000_gpio_pin.png new file mode 100644 index 0000000000000000000000000000000000000000..0d4c8c30580f29dc120c6beaf87cf136335de583 Binary files /dev/null and b/example/peripheral/gpio/figs/d2000_gpio_pin.png differ diff --git a/example/peripheral/gpio/figs/firefly.png b/example/peripheral/gpio/figs/firefly.png new file mode 100644 index 0000000000000000000000000000000000000000..3d0a2df00c5d989e43c2129ea26f0dbf820172dc Binary files /dev/null and b/example/peripheral/gpio/figs/firefly.png differ diff --git a/example/peripheral/gpio/figs/firefly_gpio_board.png b/example/peripheral/gpio/figs/firefly_gpio_board.png index 9da0b5fac853feacfe759fa59d16d30a054d34cb..a9082f064cb251c4ff10f9b24daa67b3a97b9d5e 100644 Binary files a/example/peripheral/gpio/figs/firefly_gpio_board.png and b/example/peripheral/gpio/figs/firefly_gpio_board.png differ diff --git a/example/peripheral/gpio/inc/gpio_io_irq.h b/example/peripheral/gpio/inc/gpio_intr_example.h similarity index 96% rename from example/peripheral/gpio/inc/gpio_io_irq.h rename to example/peripheral/gpio/inc/gpio_intr_example.h index 07fb3a6a08d63db1f18080c5bbac915c64de9fd8..a873e764aa84fc9c53ebccacec370f56f7ac2ea3 100644 --- a/example/peripheral/gpio/inc/gpio_io_irq.h +++ b/example/peripheral/gpio/inc/gpio_intr_example.h @@ -21,8 +21,8 @@ * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/8/26 init commit */ -#ifndef GPIO_IO_IRQ_H -#define GPIO_IO_IRQ_H +#ifndef GPIO_INTR_EXAMPLE_H +#define GPIO_INTR_EXAMPLE_H #include "FreeRTOS.h" diff --git a/example/peripheral/gpio/main.c b/example/peripheral/gpio/main.c index 66341f2deba7256e42cd31a39511db05e9f81533..85cec53ff2f8e05434461ead6ec25c9cfd127470 100644 --- a/example/peripheral/gpio/main.c +++ b/example/peripheral/gpio/main.c @@ -34,7 +34,7 @@ #include "shell_port.h" #else #include "task.h" -#include "gpio_io_irq.h" +#include "gpio_intr_example.h" #define GPIO_EXAMPLE_TASK_PRIORITY 2 diff --git a/example/peripheral/gpio/sdkconfig b/example/peripheral/gpio/sdkconfig index cddd0fe6a8acfbd2ae071208a388bb02827ad307..285769ffdab2e3ab25a73caae786368af90d4c7f 100644 --- a/example/peripheral/gpio/sdkconfig +++ b/example/peripheral/gpio/sdkconfig @@ -53,7 +53,6 @@ CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 CONFIG_TARGET_E2000=y -# CONFIG_USE_SPINLOCK is not set CONFIG_DEFAULT_DEBUG_PRINT_UART1=y # CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set # CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set @@ -241,12 +240,6 @@ CONFIG_FREERTOS_USE_UART=y # CONFIG_FREERTOS_USE_GMAC is not set # end of Freertos Eth Drivers -# -# Freertos Gpio Drivers -# -CONFIG_FREERTOS_USE_GPIO=y -# end of Freertos Gpio Drivers - # # Freertos Spim Drivers # diff --git a/example/peripheral/gpio/sdkconfig.h b/example/peripheral/gpio/sdkconfig.h index b35ea0bbcd02ab2f51917097b1ed9ce3ff842434..c24b49d1c45c3ea1e3889e727d7c3bf2d32b2b3a 100644 --- a/example/peripheral/gpio/sdkconfig.h +++ b/example/peripheral/gpio/sdkconfig.h @@ -51,7 +51,6 @@ #define CONFIG_F64BIT_MEMORY_ADDRESS 0x2000000000 #define CONFIG_F64BIT_MEMORY_LENGTH 0x800000000 #define CONFIG_TARGET_E2000 -/* CONFIG_USE_SPINLOCK is not set */ #define CONFIG_DEFAULT_DEBUG_PRINT_UART1 /* CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set */ /* CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set */ @@ -217,11 +216,6 @@ /* CONFIG_FREERTOS_USE_GMAC is not set */ /* end of Freertos Eth Drivers */ -/* Freertos Gpio Drivers */ - -#define CONFIG_FREERTOS_USE_GPIO -/* end of Freertos Gpio Drivers */ - /* Freertos Spim Drivers */ /* CONFIG_FREERTOS_USE_FSPIM is not set */ diff --git a/example/peripheral/gpio/src/cmd_gpio.c b/example/peripheral/gpio/src/cmd_gpio.c index 9e226e3c2ef5844cc5f3f78f91c430e5711417c6..b18358e35425cd9a33bf0deda4184d1729e6fa9d 100644 --- a/example/peripheral/gpio/src/cmd_gpio.c +++ b/example/peripheral/gpio/src/cmd_gpio.c @@ -21,6 +21,7 @@ * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/8/26 init commit * 2.0 wangzq 2024/4/22 add no letter shell mode, adapt to auto-test system + * 3.0 zhugengyu 2024/5/10 rework gpio example */ /***************************** Include Files *********************************/ #include @@ -32,8 +33,7 @@ #ifdef CONFIG_USE_LETTER_SHELL #include "../src/shell.h" -#include "fgpio_os.h" -#include "gpio_io_irq.h" +#include "gpio_intr_example.h" /************************** Constant Definitions *****************************/ /************************** Variable Definitions *****************************/ diff --git a/example/peripheral/gpio/src/gpio_io_irq.c b/example/peripheral/gpio/src/gpio_intr_example.c similarity index 35% rename from example/peripheral/gpio/src/gpio_io_irq.c rename to example/peripheral/gpio/src/gpio_intr_example.c index ed5282fa4923b1d9eb854029331e8beff0277f23..f053e6fd729af2d30d6e09bb99fb06afb9db320a 100644 --- a/example/peripheral/gpio/src/gpio_io_irq.c +++ b/example/peripheral/gpio/src/gpio_intr_example.c @@ -11,62 +11,71 @@ * See the Phytium Public License for more details. * * - * FilePath: gpio_io_irq.c + * FilePath: gpio_intr_example.c * Date: 2022-07-22 13:57:42 * LastEditTime: 2022-07-22 13:57:43 - * Description:  This file is for gpio io irq implementation. + * Description:  This file is for gpio irq implementation. * * Modify History: * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/8/26 init commit * 2.0 wangzq 2024/4/22 add no letter shell mode, adapt to auto-test system + * 3.0 zhugengyu 2024/5/10 rework gpio example */ /***************************** Include Files *********************************/ #include #include #include "FreeRTOS.h" +#include "queue.h" +#include "event_groups.h" #include "task.h" #include "fdebug.h" #include "fio_mux.h" -#include "fgpio_os.h" -#include "gpio_io_irq.h" +#include "fgpio_hw.h" +#include "fgpio.h" /************************** Constant Definitions *****************************/ -#if defined(CONFIG_E2000D_DEMO_BOARD) || defined(CONFIG_E2000Q_DEMO_BOARD) - #define IN_PIN_INDEX FFREERTOS_GPIO_PIN_INDEX(4, 0, 11) /* GPIO 4-A-11 */ - #define OUT_PIN_INDEX FFREERTOS_GPIO_PIN_INDEX(4, 0, 12) -#endif +#define GPIO_IRQ_TEST_TASK_PRIORITY 3U +#define GPIO_IRQ_TEST_TASK_STACK_SIZE 4096U +#define GPIO_IRQ_TEST_TIMEOUT (pdMS_TO_TICKS(4000UL)) + +#define GPIO_IRQ_EVENT_OCCIRRED (1 << 0) +/**************************** Type Definitions *******************************/ -#ifdef CONFIG_FIREFLY_DEMO_BOARD - #define IN_PIN_INDEX FFREERTOS_GPIO_PIN_INDEX(3, 0, 1) - #define OUT_PIN_INDEX FFREERTOS_GPIO_PIN_INDEX(3, 0, 2) +/************************** Variable Definitions *****************************/ +#if defined(CONFIG_FIREFLY_DEMO_BOARD) +static const u32 input_pin_index = FGPIO_ID(FGPIO_CTRL_0, FGPIO_PIN_0); +static const u32 output_pin_index = FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_13); +#elif defined(CONFIG_E2000D_DEMO_BOARD) || defined(CONFIG_E2000Q_DEMO_BOARD) +static const u32 input_pin_index = FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_11); +static const u32 output_pin_index = FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_12); +#elif defined(CONFIG_D2000_TEST_BOARD) +static const u32 input_pin_index = FGPIO_ID(FGPIO_CTRL_1, FGPIO_PORT_A, FGPIO_PIN_6); +static const u32 output_pin_index = FGPIO_ID(FGPIO_CTRL_1, FGPIO_PORT_A, FGPIO_PIN_7); #endif -#define PIN_IRQ_OCCURED BIT(0) -#define GPIO_IRQ_TEST_TASK_PRIORITY 3 -#define TIMER_OUT (pdMS_TO_TICKS(4000UL)) -/**************************** Type Definitions *******************************/ -enum +static FGpioIrqType irq_type = FGPIO_IRQ_TYPE_LEVEL_HIGH; +static const char *irq_type_names[] = { - GPIO_IRQ_TEST_SUCCESS = 0, - GPIO_IRQ_TEST_UNKNOWN = 1, - GPIO_INIT_ERROR = 2, - GPIO_IRQ_TEST_ERROR = 3, + [FGPIO_IRQ_TYPE_EDGE_FALLING] = "falling edge", + [FGPIO_IRQ_TYPE_EDGE_RISING] = "rising edge", + [FGPIO_IRQ_TYPE_LEVEL_LOW] = "level low", + [FGPIO_IRQ_TYPE_LEVEL_HIGH] = "level high" }; -/************************** Variable Definitions *****************************/ -static FFreeRTOSFGpio *in_gpio = NULL; -static FFreeRTOSGpioConfig in_gpio_cfg; -static FFreeRTOSFGpio *out_gpio = NULL; -static FFreeRTOSGpioConfig out_gpio_cfg; -static QueueHandle_t xQueue = NULL; -static EventGroupHandle_t event = NULL; +static QueueHandle_t gpio_queue = NULL; +static EventGroupHandle_t gpio_event = NULL; static boolean is_running = FALSE; + +static FGpio input_pin_instance; +static FGpioConfig input_cfg; +static FGpio output_pin_instance; +static FGpioConfig output_cfg; /***************** Macros (Inline Functions) Definitions *********************/ -#define FGPIO_DEBUG_TAG "GPIO-IRQ" +#define FGPIO_DEBUG_TAG "GPIO-IRQ-EXAMPLE" #define FGPIO_ERROR(format, ...) FT_DEBUG_PRINT_E(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) #define FGPIO_WARN(format, ...) FT_DEBUG_PRINT_W(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) #define FGPIO_INFO(format, ...) FT_DEBUG_PRINT_I(FGPIO_DEBUG_TAG, format, ##__VA_ARGS__) @@ -75,136 +84,150 @@ static boolean is_running = FALSE; /************************** Function Prototypes ******************************/ /*****************************************************************************/ -/*exit the gpio irq example task and deinit the gpio */ -static void GpioIOIrqExit(void) -{ - printf("Exiting...\r\n"); - /* deinit iomux */ - FIOMuxDeInit(); - if (FT_SUCCESS != FFreeRTOSGpioDeInit(in_gpio)) - { - FGPIO_ERROR("Delete gpio failed."); - } - in_gpio = NULL; - - if (FFREERTOS_GPIO_PIN_CTRL_ID(OUT_PIN_INDEX) != FFREERTOS_GPIO_PIN_CTRL_ID(IN_PIN_INDEX)) /* check if pin in diff ctrl */ - { - if (FT_SUCCESS != FFreeRTOSGpioDeInit(out_gpio)) - { - FGPIO_ERROR("Delete gpio failed."); - } - } - out_gpio = NULL; - - if (event) - { - vEventGroupDelete(event); - event = NULL; - } - - is_running = FALSE; -} - -/*gpio irq callback function*/ -static void GpioIOAckPinIrq(s32 vector, void *param) +static void GpioAckPinIrq(s32 vector, void *param) { BaseType_t xhigher_priority_task_woken = pdFALSE; BaseType_t x_result = pdFALSE; - x_result = xEventGroupSetBitsFromISR(event, PIN_IRQ_OCCURED, + FASSERT(gpio_event); + x_result = xEventGroupSetBitsFromISR(gpio_event, GPIO_IRQ_EVENT_OCCIRRED, &xhigher_priority_task_woken); printf("Ack pin irq\r\n"); return; -} +} -/*gpio init function*/ static FError GpioInit(void) { FError ret = FT_SUCCESS; - FFreeRTOSGpioPinConfig in_pin_config; - memset(&in_pin_config, 0, sizeof(in_pin_config)); - /* init iomux fuction */ + u32 cpu_id; + u32 irq_num; + u32 irq_priority = IRQ_PRIORITY_VALUE_12; /* change priority for FreeRTOS */ + + GetCpuId(&cpu_id); + + memset(&input_pin_instance, 0, sizeof(input_pin_instance)); + memset(&output_pin_instance, 0, sizeof(output_pin_instance)); + + input_cfg = *FGpioLookupConfig(input_pin_index); + output_cfg = *FGpioLookupConfig(output_pin_index); + FIOMuxInit(); - /* init output/input pin */ - FIOPadSetGpioMux(FFREERTOS_GPIO_PIN_CTRL_ID(OUT_PIN_INDEX), FFREERTOS_GPIO_PIN_ID(OUT_PIN_INDEX)); /* set io pad */ - FIOPadSetGpioMux(FFREERTOS_GPIO_PIN_CTRL_ID(IN_PIN_INDEX), FFREERTOS_GPIO_PIN_ID(IN_PIN_INDEX)); /* set io pad */ - out_gpio = FFreeRTOSGpioInit(FFREERTOS_GPIO_PIN_CTRL_ID(OUT_PIN_INDEX), &out_gpio_cfg); - if (FFREERTOS_GPIO_PIN_CTRL_ID(OUT_PIN_INDEX) != FFREERTOS_GPIO_PIN_CTRL_ID(IN_PIN_INDEX)) + /* init input/output GPIO pins */ + ret = FGpioCfgInitialize(&input_pin_instance, &input_cfg); + if (ret != FT_SUCCESS) { - in_gpio = FFreeRTOSGpioInit(FFREERTOS_GPIO_PIN_CTRL_ID(IN_PIN_INDEX), &in_gpio_cfg); + return ret; } - else + + ret = FGpioCfgInitialize(&output_pin_instance, &output_cfg); + if (ret != FT_SUCCESS) { - in_gpio = out_gpio; /* no need to init if in-pin and out-pin under same ctrl */ + return ret; } - in_pin_config.pin_idx = IN_PIN_INDEX; - in_pin_config.mode = FGPIO_DIR_INPUT; - in_pin_config.en_irq = TRUE; - in_pin_config.irq_type = FGPIO_IRQ_TYPE_EDGE_RISING; - in_pin_config.irq_handler = GpioIOAckPinIrq; - in_pin_config.irq_args = NULL; + /* set iomux for GPIO pins */ +#if defined(CONFIG_D2000_TEST_BOARD) + FIOPadSetGpioMux(input_pin_instance.config.ctrl, input_pin_instance.config.port, (u32)input_pin_instance.config.pin); + FIOPadSetGpioMux(output_pin_instance.config.ctrl, output_pin_instance.config.port, (u32)output_pin_instance.config.pin); +#else + FIOPadSetGpioMux(input_pin_instance.config.ctrl, (u32)input_pin_instance.config.pin); + FIOPadSetGpioMux(output_pin_instance.config.ctrl, (u32)output_pin_instance.config.pin); +#endif + + /* set direction of GPIO pins */ + FGpioSetDirection(&input_pin_instance, FGPIO_DIR_INPUT); + FGpioSetDirection(&output_pin_instance, FGPIO_DIR_OUTPUT); - ret = FFreeRTOSSetupPin(in_gpio, &in_pin_config);/*set the input pin config*/ - if (ret != FT_SUCCESS) + /* set input interrupt trigger type */ + FGpioSetInterruptType(&input_pin_instance, FGPIO_IRQ_TYPE_EDGE_RISING); + + /* set outpu pin as low level first, then raise output pin level to trigger the interrupt */ + FGpioSetOutputValue(&output_pin_instance, FGPIO_PIN_LOW); + + /* input pin irq set */ + irq_num = input_pin_instance.config.irq_num; + FGpioSetInterruptMask(&input_pin_instance, FALSE); /* disable pin irq */ + if (input_pin_instance.config.cap & FGPIO_CAP_IRQ_NONE) { - FGPIO_ERROR("Init input gpio pin failed."); - goto exit; + printf("input gpio %u-%u-%u do not support interrupt\r\n", + input_pin_instance.config.ctrl, + input_pin_instance.config.port, + input_pin_instance.config.pin); + return FGPIO_ERR_INVALID_PARA; } -exit: + InterruptSetTargetCpus(irq_num, cpu_id); + InterruptSetPriority(irq_num, irq_priority); /* setup interrupt */ + + FGpioRegisterInterruptCB(&input_pin_instance, + GpioAckPinIrq, + NULL); /* register intr callback to intr map */ + + InterruptInstall(irq_num, + FGpioInterruptHandler, + NULL, + NULL); /* register intr handler */ + + InterruptUmask(irq_num); + return ret; } -/*set output pin high level and toggle it*/ -static FError GpioIrqSetOutput(void) +static void GpioDeInit(void) { - FError ret = FT_SUCCESS; - const TickType_t toggle_delay = pdMS_TO_TICKS(500UL); /* toggle every 500 ms */ - FFreeRTOSGpioPinConfig out_pin_config; - memset(&out_pin_config, 0, sizeof(out_pin_config)); + FIOMuxDeInit(); + + if (input_pin_instance.is_ready == FT_COMPONENT_IS_READY) + { + InterruptMask(input_pin_instance.config.irq_num); - out_pin_config.pin_idx = OUT_PIN_INDEX; - out_pin_config.mode = FGPIO_DIR_OUTPUT; - out_pin_config.en_irq = FALSE; + FGpioSetInterruptMask(&input_pin_instance, FALSE); - ret = FFreeRTOSSetupPin(out_gpio, &out_pin_config);/*set the output pin config*/ + /* deinit ctrl and pin instance */ + FGpioDeInitialize(&input_pin_instance); + } - if (ret != FT_SUCCESS) + if (output_pin_instance.is_ready == FT_COMPONENT_IS_READY) { - FGPIO_ERROR("Init output gpio pin failed."); - goto exit; + FGpioDeInitialize(&output_pin_instance); } +} + +static FError GpioToggleOutput(void) +{ + FError ret = FT_SUCCESS; + + FGpioSetInterruptMask(&input_pin_instance, TRUE); - ret = FFreeRTOSPinWrite(out_gpio, OUT_PIN_INDEX, FGPIO_PIN_LOW); /* start with low level */ + /* create rising edge to trigger the input interrupt */ + ret = FGpioSetOutputValue(&output_pin_instance, FGPIO_PIN_HIGH); if (ret != FT_SUCCESS) { - FGPIO_ERROR("GpioSetOutput failed."); - goto exit; + return ret; } - vTaskDelay(toggle_delay); - ret = FFreeRTOSPinWrite(out_gpio, OUT_PIN_INDEX, FGPIO_PIN_HIGH); /* toggle */ + vTaskDelay(pdMS_TO_TICKS(2000U)); + + FGpioSetInterruptMask(&input_pin_instance, FALSE); + + ret = FGpioSetOutputValue(&output_pin_instance, FGPIO_PIN_LOW); if (ret != FT_SUCCESS) { - FGPIO_ERROR("GpioSetOutput toggle failed."); - goto exit; + return ret; } -exit: return ret; } -/*wait for the input pin irq to occur*/ -static FError GpioIOWaitIrqOccurr(void) +static FError GpioWaitIrqOccur(void) { const TickType_t wait_delay = pdMS_TO_TICKS(2000U); /* just check 2sec wait */ FError ret = TRUE; - EventBits_t ev = xEventGroupWaitBits(event, - PIN_IRQ_OCCURED, + EventBits_t ev = xEventGroupWaitBits(gpio_event, + GPIO_IRQ_EVENT_OCCIRRED, pdTRUE, pdFALSE, wait_delay); - if ((ev & PIN_IRQ_OCCURED)) + if ((ev & GPIO_IRQ_EVENT_OCCIRRED)) { ret = FT_SUCCESS; } @@ -218,86 +241,92 @@ exit: return ret; } -/*gpio irq test task*/ static void GpioIrqTestTask(void) { - int task_res = GPIO_IRQ_TEST_SUCCESS; FError ret = FT_SUCCESS; + ret = GpioInit(); if (ret != FT_SUCCESS) { - FGPIO_ERROR("GpioInitFunction failed."); - task_res = GPIO_INIT_ERROR; + FGPIO_ERROR("GpioInit failed."); goto task_exit; } - ret = GpioIrqSetOutput(); + + ret = GpioToggleOutput(); if (ret != FT_SUCCESS) { - FGPIO_ERROR("GpioInitFunction failed."); - task_res = GPIO_INIT_ERROR; + FGPIO_ERROR("GpioToggleOutput failed."); goto task_exit; } - ret = GpioIOWaitIrqOccurr(); + + ret = GpioWaitIrqOccur(); if (ret != FT_SUCCESS) { - FGPIO_ERROR("GpioIOWaitIrqOccurr failed."); - task_res = GPIO_IRQ_TEST_ERROR; + FGPIO_ERROR("GpioWaitIrqOccur failed."); goto task_exit; } task_exit: - xQueueSend(xQueue, &task_res, 0); + GpioDeInit(); + + xQueueSend(gpio_queue, &ret, 0); vTaskDelete(NULL); } /*gpio irq example entry function*/ BaseType_t FFreeRTOSRunGpioIrq(void) { - BaseType_t xReturn = pdPASS; /* pdPASS */ - int task_res = GPIO_IRQ_TEST_UNKNOWN; + BaseType_t ret = pdPASS; /* pdPASS */ + FError task_res = FT_SUCCESS; if (is_running) { FGPIO_ERROR("The task is running."); - return pdPASS; + return ret; } is_running = TRUE; - FASSERT_MSG(NULL == event, "Event group exists."); - FASSERT_MSG((event = xEventGroupCreate()) != NULL, "Create event group failed."); - xQueue = xQueueCreate(1, sizeof(int)); /* create queue for task communication */ - if (xQueue == NULL) + FASSERT_MSG(NULL == gpio_event, "Event group exists."); + FASSERT_MSG((gpio_event = xEventGroupCreate()) != NULL, "Create event group failed."); + FASSERT_MSG(NULL == gpio_queue, "Task queue exists."); + FASSERT_MSG((gpio_queue = xQueueCreate(1, sizeof(FError))) != NULL, "Create task group failed."); + + ret = xTaskCreate((TaskFunction_t)GpioIrqTestTask, /* 任务入口函数 */ + (const char *)"GpioIrqTestTask", /* 任务名字 */ + (uint16_t)GPIO_IRQ_TEST_TASK_STACK_SIZE, /* 任务栈大小 */ + NULL, /* 任务入口函数参数 */ + (UBaseType_t)GPIO_IRQ_TEST_TASK_PRIORITY, /* 任务优先级 */ + NULL); /* 任务句柄 */ + if (ret == pdFAIL) { - FGPIO_ERROR("xQueue create failed."); + FGPIO_ERROR("Create GpioIrqTestTask failed !!!"); goto exit; } - xReturn = xTaskCreate((TaskFunction_t)GpioIrqTestTask, /* 任务入口函数 */ - (const char *)"GpioIrqTestTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ - NULL, /* 任务入口函数参数 */ - (UBaseType_t)GPIO_IRQ_TEST_TASK_PRIORITY, /* 任务优先级 */ - NULL); /* 任务句柄 */ - if (xReturn == pdFAIL) + ret = xQueueReceive(gpio_queue, &task_res, GPIO_IRQ_TEST_TIMEOUT); + if (ret == pdFAIL) { - FGPIO_ERROR("xTaskCreate GpioIrqTask failed."); + FGPIO_ERROR("wait GpioIrqTestTask timeout !!!"); goto exit; } - xReturn = xQueueReceive(xQueue, &task_res, TIMER_OUT); - if (xReturn == pdFAIL) + +exit: + if (gpio_event != NULL) { - FGPIO_ERROR("xQueue receive timeout."); - goto exit; + vEventGroupDelete(gpio_event); + gpio_event = NULL; } -exit: - if (xQueue != NULL) + if (gpio_queue != NULL) { - vQueueDelete(xQueue); + vQueueDelete(gpio_queue); + gpio_queue = NULL; } + + is_running = FALSE; + printf("task_res = %d\r\n", task_res); - GpioIOIrqExit(); - if (task_res != GPIO_IRQ_TEST_SUCCESS) + if (task_res != FT_SUCCESS) { printf("%s@%d: Gpio irq example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); return pdFAIL; @@ -307,5 +336,4 @@ exit: printf("%s@%d: Gpio irq example [success].\r\n", __func__, __LINE__); return pdTRUE; } - -} +} \ No newline at end of file diff --git a/example/storage/fatfs/README.md b/example/storage/fatfs/README.md old mode 100644 new mode 100755 diff --git a/example/storage/fatfs/inc/fatfs_examples.h b/example/storage/fatfs/inc/fatfs_examples.h old mode 100644 new mode 100755 diff --git a/example/storage/fatfs/main.c b/example/storage/fatfs/main.c old mode 100644 new mode 100755 diff --git a/example/storage/fatfs/src/cmd_fatfs.c b/example/storage/fatfs/src/cmd_fatfs.c old mode 100644 new mode 100755 diff --git a/example/storage/fatfs/src/fatfs_examples.c b/example/storage/fatfs/src/fatfs_examples.c old mode 100644 new mode 100755 diff --git a/example/storage/spim_spiffs/README.md b/example/storage/spim_spiffs/README.md old mode 100644 new mode 100755 diff --git a/example/storage/spim_spiffs/inc/spim_spiffs_example.h b/example/storage/spim_spiffs/inc/spim_spiffs_example.h old mode 100644 new mode 100755 diff --git a/example/storage/spim_spiffs/main.c b/example/storage/spim_spiffs/main.c old mode 100644 new mode 100755 diff --git a/example/storage/spim_spiffs/src/cmd_spiffs.c b/example/storage/spim_spiffs/src/cmd_spiffs.c old mode 100644 new mode 100755 diff --git a/example/storage/spim_spiffs/src/spim_spiffs_example.c b/example/storage/spim_spiffs/src/spim_spiffs_example.c old mode 100644 new mode 100755 diff --git a/install.py b/install.py index 946be44cb3c4d1abe3f431f821d2daa52d08b336..aac311cb50dc01d099b5651a20fb619bd48d12fd 100755 --- a/install.py +++ b/install.py @@ -36,7 +36,7 @@ freertos_sdk_path = install_path print("Standalone SDK at {}".format(freertos_sdk_path)) # Add standalone sdk -standalone_sdk_v="2c7372083baba48fd0694b34ff0c8b6fc3bce6b7" +standalone_sdk_v="588db75e0ca38c0559563303d4ab8cbabab0e3ec" if (install_platform == windows_x64): standalone_path=freertos_sdk_path + '\\standalone' else: diff --git a/third-party/fsl_wifi/port/sdio/wifi_bt_config.c b/third-party/fsl_wifi/port/sdio/wifi_bt_config.c old mode 100644 new mode 100755 index b34753b5b0381aeec1ff021325b79d9e86fc8676..ff29c143ca3451a86b861b16b946a82293ccf1bb --- a/third-party/fsl_wifi/port/sdio/wifi_bt_config.c +++ b/third-party/fsl_wifi/port/sdio/wifi_bt_config.c @@ -36,8 +36,7 @@ static sdmmchost_config_t s_inst_config; static FGpio gpio; static FGpioConfig gpio_config; -static FGpioPinId PDn_index; -static FGpioPin PDn; /* external PDn assertion */ +static u32 gpio_power_index = FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_11); /******************************************************************************* * Code @@ -60,24 +59,25 @@ void BOARD_WIFI_BT_Enable(bool enable) static void SdioMW8801PowerUp(void) { - gpio_config = *FGpioLookupConfig(FGPIO4_ID); + gpio_config = *FGpioLookupConfig(gpio_power_index); (void)FGpioCfgInitialize(&gpio, &gpio_config); - PDn_index.ctrl = FGPIO4_ID; - PDn_index.port = FGPIO_PORT_A; - PDn_index.pin = FGPIO_PIN_11; - FIOPadSetGpioMux(PDn_index.ctrl, (u32)PDn_index.pin); - (void)FGpioPinInitialize(&gpio, &PDn, PDn_index); - (void)FGpioSetDirection(&PDn, FGPIO_DIR_OUTPUT); + FIOMuxInit(); + + FIOPadSetGpioMux(gpio_config.ctrl, (u32)gpio_config.pin); + + (void)FGpioSetDirection(&gpio, FGPIO_DIR_OUTPUT); /* transitions from low to high for PDn pin to reset sdio card */ - FGpioSetOutputValue(&PDn, FGPIO_PIN_LOW); + FGpioSetOutputValue(&gpio, FGPIO_PIN_LOW); SDMMC_OSADelay(50); - FGpioSetOutputValue(&PDn, FGPIO_PIN_HIGH); + FGpioSetOutputValue(&gpio, FGPIO_PIN_HIGH); SDMMC_OSADelay(50); FGpioDeInitialize(&gpio); + FIOMuxDeInit(); + printf("Assert PDn to power-up MW8801 \r\n"); } diff --git a/third-party/spiffs-0.3.7/ports/fspim/fspim_spiffs_port.c b/third-party/spiffs-0.3.7/ports/fspim/fspim_spiffs_port.c old mode 100644 new mode 100755