This commit is contained in:
zhugengyu
2022-09-21 08:57:41 +08:00
committed by sakumisu
parent 7837e34f75
commit e2a4fb11d8
16 changed files with 3114 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#
# For a description of the syntax of this configuration file,
# see tools/kconfiglib/kconfig-language.txt.
#
mainmenu "Phytium Freertos Configuration"
menu "Freertos Configuration"
config TARGET_NAME
string "Build Target Name"
default "freertos"
help
Build Target name for the demo
endmenu
source "$(FREERTOS_SDK_ROOT)/Kconfig"

View File

@@ -0,0 +1,3 @@
# how to use
1. install [Phytium FreeRTOS SDK](https://gitee.com/phytium_embedded/phytium-free-rtos-sdk)
2. make and flash image to Phytium-E2000-Dev Board

View File

@@ -0,0 +1,50 @@
/*
* 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: usb_host.h
* Date: 2022-07-19 09:26:25
* LastEditTime: 2022-07-19 09:26:25
* Description:  This files is for
*
* Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#ifndef EXAMPLE_USB_HOST_H
#define EXAMPLE_USB_HOST_H
#ifdef __cplusplus
extern "C"
{
#endif
/***************************** Include Files *********************************/
/************************** Constant Definitions *****************************/
/************************** Variable Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
/*****************************************************************************/
BaseType_t FFreeRTOSInitUsb(void);
BaseType_t FFreeRTOSWriteReadUsbDisk(void);
BaseType_t FFreeRTOSRecvHidInput(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,43 @@
/*
* 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: main.c
* Date: 2022-06-17 08:17:59
* LastEditTime: 2022-06-17 08:17:59
* Description: This file is for c main entry
*
* Modify History:
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------
* 1.0 zhugengyu 2022/9/20 init commit
*/
#include "shell.h"
#include "shell_port.h"
#include <stdio.h>
int main(void)
{
BaseType_t ret;
ret = LSUserShellTask();
if(ret != pdPASS)
goto FAIL_EXIT;
vTaskStartScheduler(); /* 启动任务,开启调度 */
while (1); /* 正常不会执行到这里 */
FAIL_EXIT:
printf("failed 0x%x \r\n", ret);
return 0;
}

View File

@@ -0,0 +1,29 @@
export PROJECT_DIR ?= $(shell pwd)
export USR_SRC_DIR = $(PROJECT_DIR) \
./src
export USR_INC_DIR = $(PROJECT_DIR) \
./inc
# 用户定义的编译目标文件上传路径
ifeq ($(OS),Windows_NT)
USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp
else
USR_BOOT_DIR ?= /mnt/d/tftboot
endif
# 设置启动镜像名
BOOT_IMG_NAME ?= freertos
# 指定编译freertos项目使用的makefile
include $(FREERTOS_SDK_ROOT)/make/build_freertos.mk
# 完成编译
boot:
make -j
@cp ./$(CONFIG_TARGET_NAME).elf $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf
@cp ./$(CONFIG_TARGET_NAME).bin $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).bin
@ls -l $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).*

View File

@@ -0,0 +1,223 @@
#
# Freertos Configuration
#
CONFIG_TARGET_NAME="e2000d_freertos_a64"
# end of Freertos Configuration
#
# Standalone Setting
#
CONFIG_USE_FREERTOS=y
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
CONFIG_USE_CACHE=y
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
# CONFIG_MMU_DEBUG_PRINTS is not set
# end of Arch Configuration
#
# Board Configuration
#
# CONFIG_TARGET_F2000_4 is not set
# CONFIG_TARGET_D2000 is not set
# CONFIG_TARGET_E2000Q is not set
CONFIG_TARGET_E2000D=y
# CONFIG_TARGET_E2000S is not set
CONFIG_TARGET_E2000=y
CONFIG_DEFAULT_DEBUG_PRINT_UART1=y
# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set
# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set
# end of Board Configuration
#
# Components Configuration
#
CONFIG_USE_SPI=y
CONFIG_USE_FSPIM=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_ENABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# 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=y
# CONFIG_ENABLE_FGDMA is not set
CONFIG_ENABLE_FDDMA=y
# 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
# end of Components Configuration
CONFIG_USE_NEW_LIBC=y
# end of Standalone Setting
#
# Building Option
#
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_DEBUG=y
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y
CONFIG_INTERRUPT_ROLE_MASTER=y
# CONFIG_INTERRUPT_ROLE_SLAVE is not set
CONFIG_LOG_EXTRA_INFO=y
# CONFIG_BOOTUP_DEBUG_PRINTS is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=1
CONFIG_STACK_SIZE=0x100000
CONFIG_FPU_STACK_SIZE=0x1000
# end of Linker Options
#
# Compiler Options
#
CONFIG_OUTPUT_BINARY=y
# end of Compiler Options
# end of Building Option
#
# 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
# end of Freertos Eth Drivers
#
# Freertos Gpio Drivers
#
# CONFIG_FREERTOS_USE_GPIO is not set
# end of Freertos Gpio Drivers
#
# Freertos Spim Drivers
#
CONFIG_FREERTOS_USE_FSPIM=y
# end of Freertos Spim Drivers
#
# Freertos DMA Drivers
#
CONFIG_FREERTOS_USE_FDDMA=y
# CONFIG_FREERTOS_USE_FGDMA is not set
# end of Freertos DMA Drivers
#
# Freertos MMC Drivers
#
# CONFIG_FREERTOS_USE_FSDIO is not set
# end of Freertos MMC Drivers
#
# Freertos Adc Drivers
#
# CONFIG_FREERTOS_USE_ADC is not set
# end of Freertos Adc Drivers
# end of Component Configuration
#
# FreeRTOS Setting
#
# CONFIG_USE_LWIP is not set
CONFIG_USE_BACKTRACE=y
# CONFIG_USE_FATFS is not set
# CONFIG_USE_SFUD is not set
# CONFIG_USE_SPIFFS is not set
# CONFIG_USE_AMP 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_TLSF=y
# CONFIG_USE_SDMMC_CMD is not set
CONFIG_USE_CHERRY_USB=y
#
# CherryUSB Configuration
#
CONFIG_CHERRY_USB_PORT_XHCI=y
# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set
CONFIG_CHERRYUSB_HOST=y
# CONFIG_CHERRYUSB_DEVICE is not set
CONFIG_CHERRY_USB_HOST_HUB=y
CONFIG_CHERRY_USB_HOST_MSC=y
CONFIG_CHERRY_USB_HOST_HID=y
# CONFIG_CHERRY_USB_HOST_MTP is not set
# CONFIG_CHERRY_USB_HOST_CDC is not set
# CONFIG_CHERRY_USB_HOST_PRINTER is not set
# CONFIG_CHERRY_USB_HOST_AXU_NET is not set
# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set
# end of CherryUSB Configuration
# end of FreeRTOS Setting

View File

@@ -0,0 +1,200 @@
#ifndef SDK_CONFIG_H__
#define SDK_CONFIG_H__
/* Freertos Configuration */
#define CONFIG_TARGET_NAME "e2000d_freertos_a64"
/* end of Freertos Configuration */
/* Standalone Setting */
#define CONFIG_USE_FREERTOS
/* Arch Configuration */
/* CONFIG_TARGET_ARMV8_AARCH32 is not set */
#define CONFIG_TARGET_ARMV8_AARCH64
#define CONFIG_USE_CACHE
#define CONFIG_USE_MMU
#define CONFIG_USE_SYS_TICK
/* CONFIG_MMU_DEBUG_PRINTS is not set */
/* end of Arch Configuration */
/* Board Configuration */
/* CONFIG_TARGET_F2000_4 is not set */
/* CONFIG_TARGET_D2000 is not set */
/* CONFIG_TARGET_E2000Q is not set */
#define CONFIG_TARGET_E2000D
/* CONFIG_TARGET_E2000S is not set */
#define CONFIG_TARGET_E2000
#define CONFIG_DEFAULT_DEBUG_PRINT_UART1
/* CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set */
/* CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set */
/* end of Board Configuration */
/* Components Configuration */
#define CONFIG_USE_SPI
#define CONFIG_USE_FSPIM
/* CONFIG_USE_QSPI is not set */
#define CONFIG_USE_GIC
#define CONFIG_ENABLE_GICV3
#define CONFIG_USE_SERIAL
/* Usart Configuration */
#define CONFIG_ENABLE_Pl011_UART
/* end of Usart Configuration */
/* CONFIG_USE_GPIO is not set */
/* 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 */
#define CONFIG_USE_DMA
/* CONFIG_ENABLE_FGDMA is not set */
#define CONFIG_ENABLE_FDDMA
/* 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 */
/* end of Components Configuration */
#define CONFIG_USE_NEW_LIBC
/* end of Standalone Setting */
/* Building Option */
/* CONFIG_LOG_VERBOS is not set */
#define CONFIG_LOG_DEBUG
/* CONFIG_LOG_INFO is not set */
/* CONFIG_LOG_WARN is not set */
/* CONFIG_LOG_ERROR is not set */
/* CONFIG_LOG_NONE is not set */
#define CONFIG_USE_DEFAULT_INTERRUPT_CONFIG
#define CONFIG_INTERRUPT_ROLE_MASTER
/* CONFIG_INTERRUPT_ROLE_SLAVE is not set */
#define CONFIG_LOG_EXTRA_INFO
/* CONFIG_BOOTUP_DEBUG_PRINTS is not set */
/* Linker Options */
/* CONFIG_AARCH32_RAM_LD is not set */
#define CONFIG_AARCH64_RAM_LD
/* CONFIG_USER_DEFINED_LD is not set */
#define CONFIG_LINK_SCRIPT_ROM
#define CONFIG_ROM_START_UP_ADDR 0x80100000
#define CONFIG_ROM_SIZE_MB 1
#define CONFIG_LINK_SCRIPT_RAM
#define CONFIG_RAM_START_UP_ADDR 0x81000000
#define CONFIG_RAM_SIZE_MB 64
#define CONFIG_HEAP_SIZE 1
#define CONFIG_STACK_SIZE 0x100000
#define CONFIG_FPU_STACK_SIZE 0x1000
/* end of Linker Options */
/* Compiler Options */
#define CONFIG_OUTPUT_BINARY
/* end of Compiler Options */
/* end of Building Option */
/* Component Configuration */
/* Freertos Uart Drivers */
#define CONFIG_FREERTOS_USE_UART
/* 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 */
/* end of Freertos Eth Drivers */
/* Freertos Gpio Drivers */
/* CONFIG_FREERTOS_USE_GPIO is not set */
/* end of Freertos Gpio Drivers */
/* Freertos Spim Drivers */
#define CONFIG_FREERTOS_USE_FSPIM
/* end of Freertos Spim Drivers */
/* Freertos DMA Drivers */
#define CONFIG_FREERTOS_USE_FDDMA
/* CONFIG_FREERTOS_USE_FGDMA is not set */
/* end of Freertos DMA Drivers */
/* Freertos MMC Drivers */
/* CONFIG_FREERTOS_USE_FSDIO is not set */
/* end of Freertos MMC Drivers */
/* Freertos Adc Drivers */
/* CONFIG_FREERTOS_USE_ADC is not set */
/* end of Freertos Adc Drivers */
/* end of Component Configuration */
/* FreeRTOS Setting */
/* CONFIG_USE_LWIP is not set */
#define CONFIG_USE_BACKTRACE
/* CONFIG_USE_FATFS is not set */
/* CONFIG_USE_SFUD is not set */
/* CONFIG_USE_SPIFFS is not set */
/* CONFIG_USE_AMP is not set */
#define CONFIG_USE_LETTER_SHELL
/* Letter Shell Configuration */
#define CONFIG_LS_PL011_UART
#define CONFIG_DEFAULT_LETTER_SHELL_USE_UART1
/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set */
/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set */
/* end of Letter Shell Configuration */
#define CONFIG_USE_TLSF
/* CONFIG_USE_SDMMC_CMD is not set */
#define CONFIG_USE_CHERRY_USB
/* CherryUSB Configuration */
#define CONFIG_CHERRY_USB_PORT_XHCI
/* CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set */
#define CONFIG_CHERRYUSB_HOST
/* CONFIG_CHERRYUSB_DEVICE is not set */
#define CONFIG_CHERRY_USB_HOST_HUB
#define CONFIG_CHERRY_USB_HOST_MSC
#define CONFIG_CHERRY_USB_HOST_HID
/* CONFIG_CHERRY_USB_HOST_MTP is not set */
/* CONFIG_CHERRY_USB_HOST_CDC is not set */
/* CONFIG_CHERRY_USB_HOST_PRINTER is not set */
/* CONFIG_CHERRY_USB_HOST_AXU_NET is not set */
/* CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set */
/* end of CherryUSB Configuration */
/* end of FreeRTOS Setting */
#endif

View File

@@ -0,0 +1,225 @@
#
# Freertos Configuration
#
CONFIG_TARGET_NAME="e2000d_freertos_a64"
CONFIG_XHCI_HOST_INSTANCE_0=y
# CONFIG_XHCI_HOST_INSTANCE_1 is not set
# end of Freertos Configuration
#
# Standalone Setting
#
CONFIG_USE_FREERTOS=y
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
CONFIG_USE_CACHE=y
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
# CONFIG_MMU_DEBUG_PRINTS is not set
# end of Arch Configuration
#
# Board Configuration
#
# CONFIG_TARGET_F2000_4 is not set
# CONFIG_TARGET_D2000 is not set
# CONFIG_TARGET_E2000Q is not set
CONFIG_TARGET_E2000D=y
# CONFIG_TARGET_E2000S is not set
CONFIG_TARGET_E2000=y
CONFIG_DEFAULT_DEBUG_PRINT_UART1=y
# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set
# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set
# end of Board Configuration
#
# Components Configuration
#
CONFIG_USE_SPI=y
CONFIG_USE_FSPIM=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_ENABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# 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=y
# CONFIG_ENABLE_FGDMA is not set
CONFIG_ENABLE_FDDMA=y
# 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
# end of Components Configuration
CONFIG_USE_NEW_LIBC=y
# end of Standalone Setting
#
# Building Option
#
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_DEBUG=y
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y
CONFIG_INTERRUPT_ROLE_MASTER=y
# CONFIG_INTERRUPT_ROLE_SLAVE is not set
CONFIG_LOG_EXTRA_INFO=y
# CONFIG_BOOTUP_DEBUG_PRINTS is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=1
CONFIG_STACK_SIZE=0x100000
CONFIG_FPU_STACK_SIZE=0x1000
# end of Linker Options
#
# Compiler Options
#
CONFIG_OUTPUT_BINARY=y
# end of Compiler Options
# end of Building Option
#
# 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
# end of Freertos Eth Drivers
#
# Freertos Gpio Drivers
#
# CONFIG_FREERTOS_USE_GPIO is not set
# end of Freertos Gpio Drivers
#
# Freertos Spim Drivers
#
CONFIG_FREERTOS_USE_FSPIM=y
# end of Freertos Spim Drivers
#
# Freertos DMA Drivers
#
CONFIG_FREERTOS_USE_FDDMA=y
# CONFIG_FREERTOS_USE_FGDMA is not set
# end of Freertos DMA Drivers
#
# Freertos MMC Drivers
#
# CONFIG_FREERTOS_USE_FSDIO is not set
# end of Freertos MMC Drivers
#
# Freertos Adc Drivers
#
# CONFIG_FREERTOS_USE_ADC is not set
# end of Freertos Adc Drivers
# end of Component Configuration
#
# FreeRTOS Setting
#
# CONFIG_USE_LWIP is not set
CONFIG_USE_BACKTRACE=y
# CONFIG_USE_FATFS is not set
# CONFIG_USE_SFUD is not set
# CONFIG_USE_SPIFFS is not set
# CONFIG_USE_AMP 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_TLSF=y
# CONFIG_USE_SDMMC_CMD is not set
CONFIG_USE_CHERRY_USB=y
#
# CherryUSB Configuration
#
CONFIG_CHERRY_USB_PORT_XHCI=y
# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set
CONFIG_CHERRYUSB_HOST=y
# CONFIG_CHERRYUSB_DEVICE is not set
CONFIG_CHERRY_USB_HOST_HUB=y
CONFIG_CHERRY_USB_HOST_MSC=y
CONFIG_CHERRY_USB_HOST_HID=y
# CONFIG_CHERRY_USB_HOST_MTP is not set
# CONFIG_CHERRY_USB_HOST_CDC is not set
# CONFIG_CHERRY_USB_HOST_PRINTER is not set
# CONFIG_CHERRY_USB_HOST_AXU_NET is not set
# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set
# end of CherryUSB Configuration
# end of FreeRTOS Setting

View File

@@ -0,0 +1,55 @@
/*
* 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: cmd_usb.c
* Date: 2022-09-19 14:34:44
* LastEditTime: 2022-09-19 14:34:45
* Description:  This files is for letter shell command implmentation
*
* Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
* 1.0 zhugengyu 2022/9/20 init commit
*/
#include <string.h>
#include <stdio.h>
#include "strto.h"
#include "sdkconfig.h"
#include "FreeRTOS.h"
#include "../src/shell.h"
#include "usb_host.h"
static int USBCmdEntry(int argc, char *argv[])
{
int ret = 0;
u32 bytes = 32;
u32 usb_id = 0U;
if (!strcmp(argv[1], "init"))
{
ret = FFreeRTOSInitUsb();
}
else if (!strcmp(argv[1], "disk"))
{
}
else if (!strcmp(argv[1], "hid"))
{
}
return ret;
}
SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos usb driver);

View File

@@ -0,0 +1,149 @@
/*
* 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: usb_host.c
* Date: 2022-07-22 13:57:42
* LastEditTime: 2022-07-22 13:57:43
* Description:  This files is for cherry usb host function implementation
*
* Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
* 1.0 zhugengyu 2022/9/20 init commit
*/
/***************************** Include Files *********************************/
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "ft_assert.h"
#include "interrupt.h"
#include "cpu_info.h"
#include "ft_debug.h"
#include "usbh_core.h"
#include "fmemory_pool.h"
/************************** Constant Definitions *****************************/
#define FUSB_MEMP_TOTAL_SIZE SZ_1M
/**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/
static FMemp memp;
static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE];
/***************** Macros (Inline Functions) Definitions *********************/
#define FUSB_DEBUG_TAG "USB-HC"
#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__)
#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__)
#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__)
#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__)
/************************** Function Prototypes ******************************/
extern void USBH_IRQHandler(void);
/*****************************************************************************/
static void UsbHcInterrruptHandler(s32 vector, void *param)
{
USBH_IRQHandler();
}
static void UsbHcSetupInterrupt(void)
{
u32 cpu_id;
u32 irq_num = CONFIG_XHCI_IRQ_NUM;
u32 irq_priority = 13U;
GetCpuId(&cpu_id);
InterruptSetTargetCpus(irq_num, cpu_id);
InterruptSetPriority(irq_num, irq_priority);
/* register intr callback */
InterruptInstall(irq_num,
UsbHcInterrruptHandler,
NULL,
NULL);
/* enable irq */
InterruptUmask(irq_num);
}
void UsbHcSetupMemp(void)
{
if (FT_COMPONENT_IS_READY != memp.is_ready)
{
USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE));
}
}
/* implement cherryusb */
void usb_hc_low_level_init(void)
{
UsbHcSetupMemp();
UsbHcSetupInterrupt();
}
void *usb_hc_malloc(size_t size)
{
return usb_hc_malloc_align(sizeof(void *), size);
}
void *usb_hc_malloc_align(size_t align, size_t size)
{
void *result = FMempMallocAlign(&memp, size, align);
if (result)
memset(result, 0U, size);
return result;
}
void usb_hc_free(void *ptr)
{
if (NULL != ptr)
FMempFree(&memp, ptr);
}
void usb_assert(const char *filename, int linenum)
{
FAssert(filename, linenum, 0xff);
}
static void UsbInitTask(void * args)
{
usbh_initialize();
vTaskDelete(NULL);
}
BaseType_t FFreeRTOSInitUsb(void)
{
BaseType_t ret = pdPASS;
taskENTER_CRITICAL(); /* no schedule when create task */
ret = xTaskCreate((TaskFunction_t )UsbInitTask,
(const char* )"UsbInitTask",
(uint16_t )2048,
NULL,
(UBaseType_t )configMAX_PRIORITIES - 1,
NULL);
FASSERT_MSG(pdPASS == ret, "create task failed");
taskEXIT_CRITICAL(); /* allow schedule since task created */
return ret;
}