demo工程暂存 优化菜单界面UI和功能
This commit is contained in:
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* FreeRTOS V202112.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include "app_config.h"
|
||||
|
||||
#if defined(__ICCARM__) || defined(__GNUC__) || defined(__ARMCC_VERSION)
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
/* Cortex M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( FREERTOS_MAX_PRIORITY )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#if defined(__GNUC__) && !defined(__ARMCC_VERSION)
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#else
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#endif
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#if defined(__ICCARM__) || defined(__GNUC__) || defined(__ARMCC_VERSION)
|
||||
extern volatile unsigned int CPU_RunTime;
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() CPU_RunTime
|
||||
#endif
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
111
MCU/examples/application/ble_simple_periphreal/Inc/app_config.h
Normal file
111
MCU/examples/application/ble_simple_periphreal/Inc/app_config.h
Normal file
@ -0,0 +1,111 @@
|
||||
#ifndef _APP_CONFIG_H
|
||||
#define _APP_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= SYSTEM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> SYSTEM Configuration
|
||||
|
||||
// <o> SYSTEM_CLOCK_SEL
|
||||
// <i> used to define system working clock
|
||||
// <24000000=> 24MHz
|
||||
// <48000000=> 48MHz
|
||||
// <96000000=> 96MHz
|
||||
// <144000000=> 144MHz
|
||||
// <192000000=> 192MHz
|
||||
// <240000000=> 240MHz
|
||||
#define SYSTEM_CLOCK_SEL 24000000
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= FreeRTOS configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> FreeRTOS Configuration
|
||||
|
||||
// <o> ENABLE_RTOS_MONITOR
|
||||
// <i> check to enable or disable RTOS monitor, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define ENABLE_RTOS_MONITOR 1
|
||||
|
||||
// <o> FREERTOS_MAX_PRIORITY
|
||||
// <i> used to define priority of monitor task
|
||||
// <1-10:1>
|
||||
#define FREERTOS_MAX_PRIORITY 10
|
||||
|
||||
// <o> MONITOR_TASK_PRIORITY
|
||||
// <i> used to define priority of monitor task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define MONITOR_TASK_PRIORITY 1
|
||||
#if MONITOR_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "MONITOR_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> APP_TASK_PRIORITY
|
||||
// <i> used to define priority of app task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define APP_TASK_PRIORITY 2
|
||||
#if APP_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "APP_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> HOST_TASK_PRIORITY
|
||||
// <i> used to define priority of host task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define HOST_TASK_PRIORITY 5
|
||||
#if HOST_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "HOST_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> RPMSG_TASK_PRIORITY
|
||||
// <i> used to define priority of rpmsg task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define RPMSG_TASK_PRIORITY 6
|
||||
#if RPMSG_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "RPMSG_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> MONITOR_TASK_STACK_SIZE
|
||||
// <i> used to define priority of monitor task
|
||||
#define MONITOR_TASK_STACK_SIZE 128
|
||||
|
||||
// <o> APP_TASK_STACK_SIZE
|
||||
// <i> used to define priority of APP task
|
||||
#define APP_TASK_STACK_SIZE 256
|
||||
|
||||
// <o> HOST_TASK_STACK_SIZE
|
||||
// <i> used to define priority of btdm-host task
|
||||
#define HOST_TASK_STACK_SIZE 2048
|
||||
|
||||
// <o> RPMSG_TASK_STACK_SIZE
|
||||
// <i> used to define priority of RPMSG task
|
||||
#define RPMSG_TASK_STACK_SIZE 2048
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= BTDM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> BTDM STACK Configuration
|
||||
|
||||
// <o> BTDM_STACK_ENABLE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE 1
|
||||
|
||||
// <o> BTDM_STACK_HCI_BAUDRATE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <1500000=> 1500000
|
||||
// <921600=> 921600
|
||||
// <460800=> 460800
|
||||
// <115200=> 115200
|
||||
#define BTDM_STACK_HCI_BAUDRATE 1500000
|
||||
|
||||
// </h>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // _APP_CONFIG_H
|
38
MCU/examples/application/ble_simple_periphreal/Inc/fal_cfg.h
Normal file
38
MCU/examples/application/ble_simple_periphreal/Inc/fal_cfg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-05-17 armink the first version
|
||||
*/
|
||||
|
||||
#ifndef _FAL_CFG_H_
|
||||
#define _FAL_CFG_H_
|
||||
|
||||
#define FAL_DEBUG 1
|
||||
#define FAL_PART_HAS_TABLE_CFG
|
||||
#define FAL_USING_SFUD_PORT
|
||||
|
||||
#define NOR_FLASH_DEV_NAME "norflash0"
|
||||
|
||||
/* ===================== Flash device Configuration ========================= */
|
||||
extern const struct fal_flash_dev onchip_flash;
|
||||
//extern struct fal_flash_dev nor_flash0;
|
||||
|
||||
/* flash device table */
|
||||
#define FAL_FLASH_DEV_TABLE \
|
||||
{ \
|
||||
&onchip_flash, \
|
||||
}
|
||||
/* ====================== Partition Configuration ========================== */
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
/* partition table */
|
||||
#define FAL_PART_TABLE \
|
||||
{ \
|
||||
{FAL_PART_MAGIC_WORD, "FlashEnv", "flashdb_onchip", 800*1024, 12*1024, 0}, \
|
||||
}
|
||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||
|
||||
#endif /* _FAL_CFG_H_ */
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,892 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc; *.md</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp; *.cc; *.cxx</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>0</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>7</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>13</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2V8M.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2V8M</Key>
|
||||
<Name>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\cmsis\core_cm33.h</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm33.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\app_at.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_at.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\app_ble.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_ble.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\app_btdm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_btdm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\app_task.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_task.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Inc\app_config.h</PathWithFileName>
|
||||
<FilenameWithoutPath>app_config.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\autonavi_handler.c</PathWithFileName>
|
||||
<FilenameWithoutPath>autonavi_handler.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\autonavi_profile.c</PathWithFileName>
|
||||
<FilenameWithoutPath>autonavi_profile.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\btdm_mem.c</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_mem.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>host.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller.c</PathWithFileName>
|
||||
<FilenameWithoutPath>controller.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_code_single_ota.s</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_code_single_ota.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_code_split_ota.s</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_code_split_ota.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\SWD.c</PathWithFileName>
|
||||
<FilenameWithoutPath>SWD.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fal_flash_port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash_port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fdb_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_app.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_fr30xx.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_cali.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_frspim.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu_iwdt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_qspi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>4</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\btdm\btdm_host.lib</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_host.lib</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_log.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_log.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_util.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_util.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_partition.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_kvdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_utils.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\croutine.c</PathWithFileName>
|
||||
<FilenameWithoutPath>croutine.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\event_groups.c</PathWithFileName>
|
||||
<FilenameWithoutPath>event_groups.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stream_buffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>45</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\tasks.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tasks.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>46</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\timers.c</PathWithFileName>
|
||||
<FilenameWithoutPath>timers.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>47</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>48</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>portasm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>49</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap_6.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>50</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</PathWithFileName>
|
||||
<FilenameWithoutPath>freertos_sleep.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>51</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</PathWithFileName>
|
||||
<FilenameWithoutPath>cpu_context.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/heap</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>52</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\heap\heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
@ -0,0 +1,774 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6140000::V6.14::ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM33_DSP_FP</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM33_DSP_FP$Device\ARM\ARMCM33\Include\ARMCM33_DSP_FP.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>Project</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>"..\..\..\..\components\tools\keil\post_process.bat" "@L" "#L" "$J"</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName></SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll></SimDlgDll>
|
||||
<SimDlgDllArguments></SimDlgDllArguments>
|
||||
<TargetDllName>SARMV8M.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM33</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4102</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2V8M.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M33"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>1</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>1</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>4</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x200000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x60000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x1ffc0000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0xa0000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20200000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>3</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>3</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>6</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\components\btdm\include;..\..\..\..\components\drivers\cmsis;..\..\..\..\components\drivers\device;..\..\..\..\components\drivers\device\fr30xx;..\..\..\..\components\drivers\peripheral\Inc;..\..\..\..\components\modules\common\include;..\..\..\..\components\modules\FlashDB\flashdb\inc;..\..\..\..\components\modules\FlashDB\port\fal\inc;..\..\..\..\components\modules\FreeRTOS\include;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ;..\..\..\..\components\modules\heap;..\..\..\common\btdm;..\..\..\common\flashdb;..\Inc;..\Src;..\Src\SWD</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>..\..\..\..\components\tools\keil\xip_flash_add_psram.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm33.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\cmsis\core_cm33.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\main.c</FilePath>
|
||||
<FileOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>2</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>2</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<FileArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_at.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_at.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_ble.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_ble.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_btdm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_btdm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Inc\app_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\btdm_mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code_single_ota.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code_single_ota.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code_split_ota.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code_split_ota.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>SWD.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\SWD.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal_flash_port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fal_flash_port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fdb_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_fr30xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_cali.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_frspim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu_iwdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_qspi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_host.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\..\..\components\btdm\btdm_host.lib</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>co_log.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_log.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_util.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_util.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_partition.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_kvdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>croutine.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\croutine.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>event_groups.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\event_groups.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stream_buffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tasks.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\tasks.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portasm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap_6.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>freertos_sleep.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpu_context.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/heap</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\heap\heap.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cbundle="ARM Compiler" Cclass="Compiler" Cgroup="I/O" Csub="STDERR" Cvariant="Breakpoint" Cvendor="Keil" Cversion="1.2.0" condition="ARMCC Cortex-M">
|
||||
<package name="ARM_Compiler" schemaVersion="1.6.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.6.3"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Project"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName><Project Info></LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
@ -0,0 +1,24 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'Project'
|
||||
* Target: 'Project'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
/*
|
||||
* Define the Device Header File:
|
||||
*/
|
||||
#define CMSIS_device_header "ARMCM33_DSP_FP.h"
|
||||
|
||||
/* Keil.ARM Compiler::Compiler:I/O:STDERR:Breakpoint:1.2.0 */
|
||||
#define RTE_Compiler_IO_STDERR /* Compiler I/O: STDERR */
|
||||
#define RTE_Compiler_IO_STDERR_BKPT /* Compiler I/O: STDERR Breakpoint */
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
387
MCU/examples/application/ble_simple_periphreal/Src/app_at.c
Normal file
387
MCU/examples/application/ble_simple_periphreal/Src/app_at.c
Normal file
@ -0,0 +1,387 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "co_util.h"
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "me_api.h"
|
||||
#include "hfg_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#define AT_RECV_MAX_LEN 32
|
||||
|
||||
static uint8_t app_at_recv_char;
|
||||
static uint8_t at_recv_buffer[AT_RECV_MAX_LEN];
|
||||
static uint8_t at_recv_index = 0;
|
||||
static uint8_t at_recv_state = 0;
|
||||
|
||||
void btdm_host_send_vendor_cmd(uint8_t type, uint8_t length, void *data);
|
||||
|
||||
void btdm_host_vendor_cmd_cmp_evt(uint8_t status, uint8_t len, uint8_t const *param)
|
||||
{
|
||||
printf("status: 0x%02x.\r\n", status);
|
||||
for (uint32_t i=0; i<len; i++) {
|
||||
printf("%02x ", param[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
void btdm_host_recv_vendor_evt(uint8_t len, uint8_t *param)
|
||||
{
|
||||
if (param[1] == 0x10) {
|
||||
float acc[3];
|
||||
memcpy((void *)&acc[0], ¶m[3], sizeof(float) * 3);
|
||||
printf("%0.6f, %0.6f, %0.6f\r\n", acc[0], acc[1], acc[2]);
|
||||
return;
|
||||
}
|
||||
printf("EVENT: ");
|
||||
for (uint32_t i=0; i<len; i++) {
|
||||
printf("%02x ", param[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_A(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd)
|
||||
{
|
||||
// case 'A':
|
||||
// {
|
||||
// mac_addr_t addr;
|
||||
// addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
// addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
// addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
// addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
// addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
// addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
// gap_start_conn(&addr, ascii_strn2val((const char *)&data[12], 16, 2), 64, 64, 0, 500);
|
||||
// }
|
||||
// break;
|
||||
// case 'B':
|
||||
// {
|
||||
// gap_stop_conn();
|
||||
// }
|
||||
// break;
|
||||
case 'A':
|
||||
{
|
||||
uint8_t addr = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x00, 1, &addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'B':
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x01, 2, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
uint32_t addr = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x02, 4, (void *)&addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
uint32_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x03, 8, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
// case 'C':
|
||||
// {
|
||||
// btdm_host_send_vendor_cmd(0x15, 0, NULL);
|
||||
// }
|
||||
// printf("OK\r\n");
|
||||
// break;
|
||||
// case 'D':
|
||||
// {
|
||||
// uint8_t mode = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
// btdm_host_send_vendor_cmd(0x14, 1, &mode);
|
||||
// }
|
||||
// printf("OK\r\n");
|
||||
// break;
|
||||
case 'E':
|
||||
{
|
||||
// btdm_host_send_vendor_cmd(0x11, 0, NULL);
|
||||
|
||||
uint8_t sleep_dur[2];
|
||||
sleep_dur[0] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
sleep_dur[1] = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x16, 2, &sleep_dur);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'F':
|
||||
{
|
||||
static uint8_t hour = 0;
|
||||
static uint8_t minute = 0;
|
||||
static uint8_t second = 0;
|
||||
static uint16_t mini_second = 0;
|
||||
uint8_t gsensor_cmd[] = {0x00, 0xe7, 0x07, 0x09, 0x12, 0x14, 0x36, 0x10, 0x20, 0x00, 0x2c, 0x01};
|
||||
mini_second += 200;
|
||||
if (mini_second >= 1000) {
|
||||
mini_second = 0;
|
||||
second++;
|
||||
if (second >= 60) {
|
||||
second = 0;
|
||||
minute++;
|
||||
if (minute >= 60) {
|
||||
minute = 0;
|
||||
hour++;
|
||||
}
|
||||
}
|
||||
}
|
||||
gsensor_cmd[5] = hour;
|
||||
gsensor_cmd[6] = minute;
|
||||
gsensor_cmd[7] = second;
|
||||
gsensor_cmd[8] = mini_second;
|
||||
gsensor_cmd[9] = mini_second >> 8;
|
||||
btdm_host_send_vendor_cmd(0x12, sizeof(gsensor_cmd), gsensor_cmd);
|
||||
}
|
||||
break;
|
||||
case 'G':
|
||||
printf("hello world!\r\n");
|
||||
break;
|
||||
case 'H':
|
||||
printf("VAL: 0x%08x.\r\n", *(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8));
|
||||
break;
|
||||
case 'I':
|
||||
*(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8) = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'J':
|
||||
printf("OOL VAL: 0x%02x.\r\n", ool_read(ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
break;
|
||||
case 'K':
|
||||
ool_write(ascii_strn2val((const char *)&data[0], 16, 2), ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'L':
|
||||
printf("VAL: 0x%02x.\r\n", *(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)));
|
||||
break;
|
||||
case 'M':
|
||||
*(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)) = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
// case 'P':
|
||||
// co_printf("VAL: 0x%02x.\r\n", *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
// break;
|
||||
// case 'Q':
|
||||
// *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)) = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
// case 'S':
|
||||
// co_printf("VAL: 0x%02x.\r\n", frspim_rd(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1));
|
||||
// break;
|
||||
// case 'T':
|
||||
// frspim_wr(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1, ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
case 'U':
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *)(ascii_strn2val((const char *)&data[0], 16, 8) & (~3));
|
||||
uint8_t count = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
uint32_t *start = (uint32_t *)((uint32_t)ptr & (~0x0f));
|
||||
for(uint8_t i=0; i<count;) {
|
||||
if(((uint32_t)start & 0x0c) == 0) {
|
||||
printf("0x%08x: ", (uint32_t)start);
|
||||
}
|
||||
if(start < ptr) {
|
||||
printf(" ");
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
printf("%08x", *start);
|
||||
}
|
||||
if(((uint32_t)start & 0x0c) == 0x0c) {
|
||||
printf("\r\n");
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char *)&data[0], 16, 8), ascii_strn2val((const char *)&data[9], 16, 8));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_B(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
struct gap_ble_addr peer_addr;
|
||||
BD_ADDR addr;
|
||||
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
// AT#BA00
|
||||
//app_ble_advertising_start(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'B':
|
||||
// AT#BB01
|
||||
//app_ble_advertising_stop(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'C':
|
||||
//app_ble_scan_start();
|
||||
break;
|
||||
case 'D':
|
||||
//app_ble_scan_stop();
|
||||
break;
|
||||
case 'E':
|
||||
// AT#BE0123456789ab_01
|
||||
peer_addr.addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
peer_addr.addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
peer_addr.addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
peer_addr.addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
peer_addr.addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
peer_addr.addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
peer_addr.addr_type = ascii_strn2val((const char *)&data[13], 16, 2);
|
||||
//app_ble_conn_start(&peer_addr);
|
||||
break;
|
||||
case 'F':
|
||||
//app_ble_conn_stop();
|
||||
break;
|
||||
case 'H':
|
||||
ME_Inquiry(BT_IAC_GIAC, 5, 5);
|
||||
break;
|
||||
case 'I':
|
||||
ME_CancelInquiry();
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
BtStatus status;
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
|
||||
//status = HFG_CreateServiceLink(&hfg_channel[0], &addr);
|
||||
|
||||
if (status == BT_STATUS_PENDING) {
|
||||
printf("Opening Channel...\r\n");
|
||||
} else {
|
||||
printf("Could not open channel, status: %d\r\n", status);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
// {
|
||||
// uint8_t battery_level[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
// struct gatt_send_event ntf[6];
|
||||
// uint8_t i=0;
|
||||
// for(i=0;i<6;i++){
|
||||
// ntf[i].conidx = 0;
|
||||
// ntf[i].svc_id = svc_id;
|
||||
// ntf[i].att_idx = 2;
|
||||
// ntf[i].data_len = 15;
|
||||
// ntf[i].p_data = &battery_level[0];
|
||||
// gatt_notification(&ntf[i]);
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_D(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char*)&data[0],16,8), 0x1000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length)
|
||||
{
|
||||
switch(data[0])
|
||||
{
|
||||
case 'A':
|
||||
app_at_recv_cmd_A(data[1], &data[2]);
|
||||
break;
|
||||
case 'B':
|
||||
app_at_recv_cmd_B(data[1], &data[2]);
|
||||
break;
|
||||
case 'D':
|
||||
app_at_recv_cmd_D(data[1], &data[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_c(uint8_t c)
|
||||
{
|
||||
switch(at_recv_state)
|
||||
{
|
||||
case 0:
|
||||
if(c == 'A')
|
||||
{
|
||||
at_recv_state++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(c == 'T')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
if(c == '#')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 3:
|
||||
at_recv_buffer[at_recv_index++] = c;
|
||||
if((c == '\n')
|
||||
||(at_recv_index >= AT_RECV_MAX_LEN))
|
||||
{
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_AT_CMD, at_recv_index, false);
|
||||
if(event) {
|
||||
memcpy(event->param, at_recv_buffer, at_recv_index);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
at_recv_state = 0;
|
||||
at_recv_index = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
app_at_recv_c(app_at_recv_char);
|
||||
if (handle) {
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
14
MCU/examples/application/ble_simple_periphreal/Src/app_at.h
Normal file
14
MCU/examples/application/ble_simple_periphreal/Src/app_at.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _APP_AT_H
|
||||
#define _APP_AT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver_uart.h"
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length);
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
#endif // _APP_AT_H
|
436
MCU/examples/application/ble_simple_periphreal/Src/app_ble.c
Normal file
436
MCU/examples/application/ble_simple_periphreal/Src/app_ble.c
Normal file
@ -0,0 +1,436 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "co_log.h"
|
||||
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "fdb_app.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "portable.h"
|
||||
#include "btdm_mem.h"
|
||||
|
||||
#define SP_SVC_UUID 0xFFF0
|
||||
#define SP_CHAR1_UUID 0xFFF3
|
||||
#define SP_CHAR2_UUID {0xba, 0x5c, 0xFF, 0xF4, 0x04, 0xa3, 0x40, 0x71, 0xa0, 0xb5, 0x35, 0x85, 0x3e, 0xb0, 0x83, 0x07}
|
||||
|
||||
// Element index of gatt service table
|
||||
enum
|
||||
{
|
||||
SP_IDX_SERVICE,
|
||||
|
||||
SP_IDX_CHAR1_DECLARATION,
|
||||
SP_IDX_CHAR1_VALUE,
|
||||
SP_IDX_CHAR1_CFG,
|
||||
SP_IDX_CHAR1_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_CHAR2_DECLARATION,
|
||||
SP_IDX_CHAR2_VALUE,
|
||||
SP_IDX_CHAR2_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_NB,
|
||||
};
|
||||
|
||||
// Simple GATT Profile Service UUID: 0xFFF0
|
||||
static const uint8_t sp_svc_uuid[] = UUID16_ARR(SP_SVC_UUID);
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 UUID: 0xFFF3
|
||||
// Characteristic 1 data
|
||||
#define SP_CHAR1_VALUE_LEN 20
|
||||
static uint8_t sp_char1_value[SP_CHAR1_VALUE_LEN] = {0};
|
||||
|
||||
#define SP_CHAR1_USER_DESC_LEN 17
|
||||
static char sp_char1_user_desc_data[] = "Characteristic 1";
|
||||
|
||||
static uint8_t desc_data[2] = {0};
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 UUID: 0xBA5C-FFF4-04A3-4071-A0B5-3585-3EB0-8307
|
||||
// Characteristic 2 data
|
||||
#define SP_CHAR2_VALUE_LEN 5
|
||||
static uint8_t sp_char2_value[SP_CHAR2_VALUE_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55};
|
||||
|
||||
#define SP_CHAR2_USER_DESC_LEN 17
|
||||
static char sp_char2_user_desc_data[] = "Characteristic 2";
|
||||
|
||||
static const gatt_attribute_t simple_profile_att_table[] =
|
||||
{
|
||||
// Simple gatt Service Declaration
|
||||
[SP_IDX_SERVICE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
UUID_SIZE_2, /* Max size of the value */ /* Service UUID size in service declaration */
|
||||
(uint8_t*)sp_svc_uuid, /* Value of the attribute */ /* Service UUID value in service declaration */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 Declaration
|
||||
[SP_IDX_CHAR1_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
// Characteristic 1 Value
|
||||
[SP_IDX_CHAR1_VALUE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(SP_CHAR1_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_NOTI | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
SP_CHAR1_VALUE_LEN, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 1 client characteristic configuration
|
||||
[SP_IDX_CHAR1_CFG] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
2, /* Max size of the value */
|
||||
desc_data, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
},
|
||||
|
||||
// Characteristic 1 User Description
|
||||
[SP_IDX_CHAR1_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR1_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char1_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 Declaration
|
||||
[SP_IDX_CHAR2_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
|
||||
// Characteristic 2 Value
|
||||
[SP_IDX_CHAR2_VALUE] = {
|
||||
{ UUID_SIZE_16, SP_CHAR2_UUID }, /* UUID */
|
||||
GATT_PROP_READ , /* Permissions */
|
||||
SP_CHAR2_VALUE_LEN, /* Max size of the value */
|
||||
sp_char2_value, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 2 User Description
|
||||
[SP_IDX_CHAR2_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR2_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char2_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
};
|
||||
|
||||
static void app_ble_start_advertising(void);
|
||||
|
||||
static char local_device_name[] = "30xx_Ble_Periphreal";
|
||||
static adv_handle adv;
|
||||
|
||||
/*
|
||||
* Advertising data, max size is 28 bytes
|
||||
*/
|
||||
static uint8_t adv_data[] = {
|
||||
/* gatt service information */
|
||||
0x03, //length of this AD
|
||||
GAP_ADVTYPE_16BIT_MORE, //16bit service uuid AD type
|
||||
0xff, 0xf0, //value.service uuid:0xFFF0
|
||||
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'3','0','x','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
/*
|
||||
* Advertising scan response data, max size is 31 bytes
|
||||
*/
|
||||
static uint8_t adv_scan_rsp_data[] = {
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'3','0','x','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
uint8_t service_id;
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
// printf("gap_callback: type = %d\r\n", event->type);
|
||||
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
//gap_get_link_version(event->param.connect.conidx);
|
||||
//gap_get_link_rssi(event->param.connect.conidx);
|
||||
//gap_get_link_features(event->param.connect.conidx);
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
gatt_mtu_exchange_req(service_id, event->param.connect.conidx, 247);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t gatt_callback(struct gatt_msg *p_msg)
|
||||
{
|
||||
uint8_t uuid_temp[16];
|
||||
uint16_t uuid_2 = 0;
|
||||
|
||||
switch(p_msg->msg_evt) {
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
{
|
||||
switch(p_msg->param.gatt_op_cmp.operation) {
|
||||
case GATT_OP_NOTIFY:
|
||||
/*opearation of notification is complete */
|
||||
printf("notify cmp, conidx:%d, status:0x%02X\r\n", p_msg->conn_idx, p_msg->param.gatt_op_cmp.status);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a read request from the peer device */
|
||||
case GATTS_MSG_READ_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_READ_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
/*
|
||||
* Because the buffer pointer of SP_IDX_CHAR1_VALUE is NULL,
|
||||
* read requests will be report to the application layer for user response
|
||||
*/
|
||||
uint8_t read_rsp_data[] = {0x00, 0x01, 0x02, 0x03, 0x04};
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, read_rsp_data, sizeof(read_rsp_data));
|
||||
|
||||
/* Return the length of response data */
|
||||
return (sizeof(read_rsp_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a write request from the peer device */
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_WRITE_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
printf("recv data: 0x");
|
||||
for(uint8_t i=0; i<p_msg->param.gatt_data.msg_len; i++)
|
||||
printf("%02X", p_msg->param.gatt_data.p_msg_data[i]);
|
||||
printf("\r\n");
|
||||
}
|
||||
else if(p_msg->att_idx == SP_IDX_CHAR1_CFG)
|
||||
{
|
||||
uint8_t data[2];
|
||||
memcpy(data, p_msg->param.gatt_data.p_msg_data, 2);
|
||||
if(data[0] & 0x01)
|
||||
{
|
||||
/* peer device enable notify */
|
||||
printf("ntf enable, att_idx:%d\r\n", p_msg->att_idx);
|
||||
uint8_t send_data[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = p_msg->conn_idx;
|
||||
ntf.att_idx = SP_IDX_CHAR1_VALUE;
|
||||
ntf.p_data = send_data;
|
||||
ntf.data_len = sizeof(send_data);
|
||||
ntf.svc_id = service_id;
|
||||
|
||||
/* Send a notification to the peer device */
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
printf("gatt linkk create, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
printf("gatt linkk lost, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void app_ble_add_service(void)
|
||||
{
|
||||
struct gatt_service service;
|
||||
|
||||
service.att_nb = SP_IDX_NB;
|
||||
service.p_att_tb = simple_profile_att_table;
|
||||
service.gatt_msg_handler = gatt_callback; //set GATT event callback
|
||||
|
||||
service_id = gatt_add_service(&service);
|
||||
}
|
||||
|
||||
static void app_ble_start_advertising(void)
|
||||
{
|
||||
/* creat a handle of advertising*/
|
||||
adv = gap_adv_create();
|
||||
|
||||
gap_adv_param_t adv_param = {
|
||||
.own_addr_type = GAP_ADDR_TYPE_STATIC, //own address type
|
||||
.adv_mode = GAP_ADV_MODE_UNDIRECT,
|
||||
.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC,
|
||||
.adv_chnl_map = GAP_ADV_CHAN_ALL,
|
||||
.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY, //Policy for filtering scanning or connection requests from peer devices
|
||||
.phy_mode = GAP_PHY_TYPE_LE_1M,
|
||||
.adv_intv_min = 160, //advertising min interval, in unit of 0.625ms
|
||||
.adv_intv_max = 160, //advertising max interval, in unit of 0.625ms
|
||||
};
|
||||
|
||||
/* set advertising param */
|
||||
gap_adv_set_param(adv, &adv_param);
|
||||
/* set advertising data */
|
||||
gap_adv_set_adv_data(adv, adv_data, sizeof(adv_data));
|
||||
/* set advertising scan response data */
|
||||
gap_adv_set_scan_rsp(adv, adv_scan_rsp_data, sizeof(adv_scan_rsp_data));
|
||||
/* start sadvertising */
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
printf("app_ble_init\r\n");
|
||||
|
||||
/* set GAP event callback*/
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
/* set security param */
|
||||
struct gap_security_param smp_param;
|
||||
smp_param.mitm = true;
|
||||
smp_param.secure_connection = false;
|
||||
smp_param.bond = true;
|
||||
smp_param.rsp_mode = ENABLE_AUTO_RSP;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
|
||||
gap_security_param_init(&smp_param);
|
||||
|
||||
/* add service profile, The GAP callback event is GATT_EVT_PROFILE_ADDED*/
|
||||
app_ble_add_service();
|
||||
}
|
||||
|
||||
|
19
MCU/examples/application/ble_simple_periphreal/Src/app_ble.h
Normal file
19
MCU/examples/application/ble_simple_periphreal/Src/app_ble.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _APP_BLE_H
|
||||
#define _APP_BLE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "gap_api.h"
|
||||
|
||||
void app_ble_init(void);
|
||||
|
||||
void app_ble_advertising_start(uint8_t adv_chn);
|
||||
void app_ble_advertising_stop(uint8_t adv_chn);
|
||||
|
||||
void app_ble_scan_start(void);
|
||||
void app_ble_scan_stop(void);
|
||||
|
||||
void app_ble_conn_start(struct gap_ble_addr *addr);
|
||||
void app_ble_conn_stop(void);
|
||||
|
||||
#endif // _APP_BLE_H
|
107
MCU/examples/application/ble_simple_periphreal/Src/app_btdm.c
Normal file
107
MCU/examples/application/ble_simple_periphreal/Src/app_btdm.c
Normal file
@ -0,0 +1,107 @@
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#include "controller.h"
|
||||
#include "host.h"
|
||||
|
||||
typedef int32_t app_btdm_ret_t;
|
||||
|
||||
static const uint8_t bt_addr[] = {0x12, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
static const uint8_t ble_public_addr[] = {0x13, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
static const uint8_t ble_static_addr[] = {0x13, 0x00, 0x12, 0x12, 0x12, 0xc2};
|
||||
|
||||
void app_btdm_start(void)
|
||||
{
|
||||
app_ble_init();
|
||||
}
|
||||
|
||||
void host_ready_cb(void)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
/* notify application BTDM stack is ready. */
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_HOST_INITED, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
|
||||
void app_btdm_init(void)
|
||||
{
|
||||
/* prepare for BTDM stack */
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
|
||||
extern uint8_t CONTROLLER_CODE_OTA_BASE;
|
||||
uint32_t controller_code_base_addr = (uint32_t)&CONTROLLER_CODE_OTA_BASE;
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr, controller_code_base_addr);
|
||||
#elif defined(__GNUC__) || defined(__ICCARM__)
|
||||
extern const uint8_t controller_code_buffer[];
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr, (uint32_t)&controller_code_buffer[0]);
|
||||
#else
|
||||
#error "not supported platform"
|
||||
#endif
|
||||
|
||||
host_ble_start(BTDM_STACK_HCI_BAUDRATE, HOST_TASK_STACK_SIZE, HOST_TASK_PRIORITY, ble_static_addr);
|
||||
|
||||
/*
|
||||
* init MCU->BT pin, configure PMU_PIN_8 output BBG_EN signal, this pin is used to
|
||||
* notice BT core that MCU is in working mode.
|
||||
*/
|
||||
ool_write(PMU_REG_DIAG_CTRL, 0x82);
|
||||
ool_write(PMU_REG_PIN_IOMUX_H, 0x03);
|
||||
/* disable PMU pin input as default setting */
|
||||
ool_write16(PMU_REG_PIN_INPUT_EN, 0x0002);
|
||||
|
||||
/*
|
||||
* init BT->MCU pin, system should not enter sleep mode when this pin is low level.
|
||||
* This pin is used by BT core to notice MCU than BT core is in working mode.
|
||||
*/
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
pmu_gpio_int_init(PMU_PIN_9, PMU_GPIO_PULL_UP, 0);
|
||||
pmu_enable_isr(PMU_GPIO_PMU_INT_MSK_BIT);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_access_mode_set(uint8_t mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_connect(uint8_t *peer_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_profile_enable(uint16_t profiles)
|
||||
{
|
||||
return -1;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
#ifndef _APP_BTDM_H
|
||||
#define _APP_BTDM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum {
|
||||
APP_BTDM_EVT_BLE_CONNECTED,
|
||||
APP_BTDM_EVT_BLE_DISCONNECTED,
|
||||
|
||||
APP_BTDM_EVT_BT_CONNECTED,
|
||||
APP_BTDM_EVT_BT_DISCONNECTED,
|
||||
APP_BTDM_EVT_HF_INCOMING,
|
||||
APP_BTDM_EVT_HF_CALL_ACTIVE,
|
||||
APP_BTDM_EVT_HF_CALL_REMOVE,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STARTED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STOPPED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_DATA,
|
||||
APP_BTDM_EVT_AVRCP_VOL_CHANGE,
|
||||
APP_BTDM_EVT_AVRCP_NEXT,
|
||||
APP_BTDM_EVT_AVRCP_PREV,
|
||||
APP_BTDM_EVT_AVRCP_PAUSE,
|
||||
APP_BTDM_EVT_AVRCP_FAST_FORWARD,
|
||||
APP_BTDM_EVT_AVRCP_FAST_BACKWARD,
|
||||
APP_BTDM_EVT_SCO_CREATED,
|
||||
APP_BTDM_EVT_SCO_REMOVED,
|
||||
APP_BTDM_EVT_SCO_DATA,
|
||||
};
|
||||
|
||||
enum {
|
||||
APP_BTDM_CODEC_SBC,
|
||||
APP_BTDM_CODEC_AAC,
|
||||
APP_BTDM_CODEC_mSBC,
|
||||
APP_BTDM_CODEC_PCM,
|
||||
APP_BTDM_CODEC_UNKNOWN,
|
||||
};
|
||||
|
||||
struct app_btdm_event_t {
|
||||
uint8_t event;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} a2dp_data;
|
||||
struct {
|
||||
uint8_t codec_type;
|
||||
uint32_t sample_rate;
|
||||
} a2dp_codec;
|
||||
struct {
|
||||
bool valid;
|
||||
uint8_t codec_type;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} sco_data;
|
||||
struct {
|
||||
void *hf_channel;
|
||||
uint8_t codec_type;
|
||||
} sco_codec;
|
||||
} param;
|
||||
};
|
||||
|
||||
typedef void (*app_btdm_callback_t)(struct app_btdm_event_t *e);
|
||||
|
||||
void app_btdm_start(void);
|
||||
void app_btdm_init(void);
|
||||
|
||||
#endif // _APP_BTDM_H
|
134
MCU/examples/application/ble_simple_periphreal/Src/app_task.c
Normal file
134
MCU/examples/application/ble_simple_periphreal/Src/app_task.c
Normal file
@ -0,0 +1,134 @@
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_config.h"
|
||||
|
||||
static struct co_list event_list;
|
||||
|
||||
extern TaskHandle_t app_task_handle;
|
||||
|
||||
void hci_controller_read(void);
|
||||
void hci_host_read(void);
|
||||
|
||||
static void app_gpio_wakeup_demo_init(void)
|
||||
{
|
||||
printf("pmu_io0 wakeup init\r\n");
|
||||
|
||||
/*PMU_IO0 Wakeup Init */
|
||||
pmu_gpio_int_init(PMU_PIN_0, PMU_GPIO_PULL_UP, 1);
|
||||
pmu_enable_isr(PMU_GPIO_PMU_INT_MSK_BIT);
|
||||
|
||||
/* gpio_PD Wakeup Init */
|
||||
printf("gpio_PD wakeup init\r\n");
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->PortD_InputCutoffDisable= 0x0000ffff;
|
||||
|
||||
pmu_enable_isr(PMU_GPIO_GROUPH_INT_MSK_BIT | PMU_GPIO_GROUPL_INT_MSK_BIT);
|
||||
ool_write(PMU_REG_WKUP_INT_EN,0x03);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
}
|
||||
|
||||
static void app_task_event_handler(void)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
vTaskSuspendAll();
|
||||
event = (struct app_task_event *)co_list_pop_front(&event_list);
|
||||
xTaskResumeAll();
|
||||
|
||||
if(event) {
|
||||
switch(event->event_type) {
|
||||
case APP_TASK_EVENT_AT_CMD:
|
||||
app_at_cmd_recv_handler(event->param, event->param_len);
|
||||
break;
|
||||
case APP_TASK_EVENT_HOST_INITED:
|
||||
app_btdm_start();
|
||||
break;
|
||||
case APP_TASK_EVENT_PMU_WAKEUP:
|
||||
printf("this is pmu_io0 wakeup\r\n");
|
||||
break;
|
||||
case APP_TASK_EVENT_GPIO_PD_WAKEUP:
|
||||
printf("this is gpio_PD wakeup\r\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
vPortFree((void *)event);
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high)
|
||||
{
|
||||
uint32_t old_basepri;
|
||||
|
||||
if(xPortIsInsideInterrupt()) {
|
||||
old_basepri = taskENTER_CRITICAL_FROM_ISR();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL_FROM_ISR(old_basepri);
|
||||
vTaskNotifyGiveFromISR(app_task_handle, NULL);
|
||||
}
|
||||
else {
|
||||
taskENTER_CRITICAL();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
xTaskNotifyGive(app_task_handle);
|
||||
}
|
||||
}
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
while(event == NULL) {
|
||||
event = pvPortMalloc(sizeof(struct app_task_event) + param_len);
|
||||
if (event == NULL) {
|
||||
if (block) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event->event_type = event_type;
|
||||
event->param_len = param_len;
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static void app_task(void *arg)
|
||||
{
|
||||
co_list_init(&event_list);
|
||||
|
||||
app_btdm_init();
|
||||
|
||||
//wake up demo init
|
||||
// app_gpio_wakeup_demo_init();
|
||||
|
||||
while(1) {
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
app_task_event_handler();
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_init(void)
|
||||
{
|
||||
xTaskCreate(app_task, "app", APP_TASK_STACK_SIZE, NULL, APP_TASK_PRIORITY, &app_task_handle);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
#ifndef _APP_TASK_H
|
||||
#define _APP_TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "co_list.h"
|
||||
|
||||
#define APP_TASK_EVENT_AT_CMD 0x00
|
||||
#define APP_TASK_EVENT_HOST_INITED 0x01
|
||||
#define APP_TASK_EVENT_PMU_WAKEUP 0x02
|
||||
#define APP_TASK_EVENT_GPIO_PD_WAKEUP 0x03
|
||||
|
||||
struct app_task_event {
|
||||
struct co_list_hdr hdr;
|
||||
|
||||
uint8_t event_type;
|
||||
|
||||
uint16_t param_len;
|
||||
uint8_t param[];
|
||||
};
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high);
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block);
|
||||
|
||||
void app_task_init(void);
|
||||
|
||||
#endif // _APP_TASK_H
|
331
MCU/examples/application/ble_simple_periphreal/Src/main.c
Normal file
331
MCU/examples/application/ble_simple_periphreal/Src/main.c
Normal file
@ -0,0 +1,331 @@
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "fdb_app.h"
|
||||
#include "host.h"
|
||||
|
||||
#include "app_task.h"
|
||||
#include "app_at.h"
|
||||
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef Uart3_handle;
|
||||
static CALI_HandleTypeDef cali_handle;
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* FreeRTOS running status monitor task */
|
||||
static TaskHandle_t monitor_task_handle;
|
||||
volatile unsigned int CPU_RunTime;
|
||||
static uint8_t CPU_RunInfo[2048];
|
||||
#endif
|
||||
|
||||
/* APP task */
|
||||
TaskHandle_t app_task_handle;
|
||||
|
||||
void controller_start(void);
|
||||
void host_start(void);
|
||||
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
|
||||
int fputc(int c, FILE *fp)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)ptr, len);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __ICCARM__
|
||||
int putchar(int c)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
static void monitor_task(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
vTaskDelay(2000000);
|
||||
|
||||
memset(CPU_RunInfo,0,2048);
|
||||
vTaskList((char *)&CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
printf("name state priority stack seq\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
|
||||
memset(CPU_RunInfo,0,400);
|
||||
vTaskGetRunTimeStats((char *)&CPU_RunInfo);
|
||||
printf("name counter usage\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
void vApplicationTickHook(void)
|
||||
{
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
CPU_RunTime++;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cali_done_handle(CALI_HandleTypeDef *hcali, uint32_t result)
|
||||
{
|
||||
system_set_LPRCCLK(cali_calc_rc_freq(hcali, result));
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
}
|
||||
|
||||
__RAM_CODE bool user_deep_sleep_check(void)
|
||||
{
|
||||
return host_before_sleep_check();
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_before_sleep(void)
|
||||
{
|
||||
ool_write16(PMU_REG_PIN_PULL_EN, 0x3fff);
|
||||
ool_write16(PMU_REG_PIN_PULL_SEL, 0x3fff);
|
||||
|
||||
/* gpio_PD Wakeup Init */
|
||||
SYSTEM->PortD_InputCutoffDisable = 0x0000ffff;
|
||||
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) | 0x40);
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_after_sleep(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
|
||||
host_hci_reinit();
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) & (~0x40));
|
||||
NVIC_SetPriority(UART0_IRQn, 2);
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
|
||||
/* configure PA0 and PA1 to UART0 function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 115200;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
/* restart calibration */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 60;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 2);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
system_delay_us(1000000);
|
||||
|
||||
/* configure all interrupt priority to 2 */
|
||||
*(volatile uint32_t *)0xE000E400 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E404 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E408 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E40C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E410 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E414 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E418 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E41C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E420 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E424 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E428 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E42C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E430 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E434 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E438 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E43C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E440 = 0x40404040;
|
||||
|
||||
pmu_init();
|
||||
/* Power Keep: 32KB PRAM, 128KB SRAM */
|
||||
ool_write16(PMU_REG_PKSRAM_GATE, ~0x0063);
|
||||
|
||||
/* reinit flash controller */
|
||||
system_cache_enable(true);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_enable_quad(QSPI0);
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_DUAL, FLASH_WR_TYPE_SINGLE);
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART2: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 115200;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
NVIC_SetPriority(UART3_IRQn, 4);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
|
||||
/* do calibration, get current RC frequency */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 200;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 4);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
|
||||
/* init flashdb to store user data */
|
||||
flashdb_init();
|
||||
printf("start running\r\n");
|
||||
/* Create tasks */
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
xTaskCreate(monitor_task, "monitor", MONITOR_TASK_STACK_SIZE, NULL, MONITOR_TASK_PRIORITY, &monitor_task_handle);
|
||||
#endif
|
||||
|
||||
/* create application task */
|
||||
app_task_init();
|
||||
|
||||
/* initialize AT command */
|
||||
app_at_init(&Uart3_handle);
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
|
||||
/* enable sleep */
|
||||
// system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
|
||||
printf("FR5090: BTDM test: 0x%04x.\r\n", ool_read16(PMU_REG_PIN_INPUT_EN));
|
||||
|
||||
/* Start the scheduler itself. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uart3_irq(void)
|
||||
{
|
||||
uart_IRQHandler(&Uart3_handle);
|
||||
}
|
||||
|
||||
void PMU_GPIO_GROUPH_IRQHandler(void)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_GPIO_PD_WAKEUP, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
}
|
||||
|
||||
void PMU_GPIO_PMU_IRQHandler(void)
|
||||
{
|
||||
uint16_t data = ool_read16(PMU_REG_PIN_DATA);
|
||||
uint16_t result = ool_read16(PMU_REG_PIN_XOR_RESULT);
|
||||
|
||||
/* update last value with latest data */
|
||||
ool_write16(PMU_REG_PIN_LAST_V, data);
|
||||
/* clear last XOR result */
|
||||
ool_write16(PMU_REG_PIN_XOR_CLR, result);
|
||||
|
||||
if (((data & PMU_PIN_0) == 0) &(ool_read(PMU_REG_PIN_XOR_EN) & PMU_PIN_0)) {
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_PMU_WAKEUP, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (data & PMU_PIN_9) {
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
else {
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
}
|
||||
|
||||
void cali_irq(void)
|
||||
{
|
||||
cali_IRQHandler(&cali_handle);
|
||||
}
|
||||
|
173
MCU/examples/application/bootloader/Inc/FreeRTOSConfig.h
Normal file
173
MCU/examples/application/bootloader/Inc/FreeRTOSConfig.h
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* FreeRTOS V202112.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include "app_config.h"
|
||||
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
/* Cortex M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( FREERTOS_MAX_PRIORITY )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
extern volatile unsigned int CPU_RunTime;
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() CPU_RunTime
|
||||
#endif
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
14
MCU/examples/application/bootloader/Inc/app_at.h
Normal file
14
MCU/examples/application/bootloader/Inc/app_at.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _APP_AT_H
|
||||
#define _APP_AT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver_uart.h"
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length);
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
#endif // _APP_AT_H
|
19
MCU/examples/application/bootloader/Inc/app_ble.h
Normal file
19
MCU/examples/application/bootloader/Inc/app_ble.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _APP_BLE_H
|
||||
#define _APP_BLE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "gap_api.h"
|
||||
|
||||
void app_ble_init(void);
|
||||
|
||||
void app_ble_advertising_start(uint8_t adv_chn);
|
||||
void app_ble_advertising_stop(uint8_t adv_chn);
|
||||
|
||||
void app_ble_scan_start(void);
|
||||
void app_ble_scan_stop(void);
|
||||
|
||||
void app_ble_conn_start(struct gap_ble_addr *addr);
|
||||
void app_ble_conn_stop(void);
|
||||
|
||||
#endif // _APP_BLE_H
|
67
MCU/examples/application/bootloader/Inc/app_btdm.h
Normal file
67
MCU/examples/application/bootloader/Inc/app_btdm.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef _APP_BTDM_H
|
||||
#define _APP_BTDM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum {
|
||||
APP_BTDM_EVT_BLE_CONNECTED,
|
||||
APP_BTDM_EVT_BLE_DISCONNECTED,
|
||||
|
||||
APP_BTDM_EVT_BT_CONNECTED,
|
||||
APP_BTDM_EVT_BT_DISCONNECTED,
|
||||
APP_BTDM_EVT_HF_INCOMING,
|
||||
APP_BTDM_EVT_HF_CALL_ACTIVE,
|
||||
APP_BTDM_EVT_HF_CALL_REMOVE,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STARTED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STOPPED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_DATA,
|
||||
APP_BTDM_EVT_AVRCP_VOL_CHANGE,
|
||||
APP_BTDM_EVT_AVRCP_NEXT,
|
||||
APP_BTDM_EVT_AVRCP_PREV,
|
||||
APP_BTDM_EVT_AVRCP_PAUSE,
|
||||
APP_BTDM_EVT_AVRCP_FAST_FORWARD,
|
||||
APP_BTDM_EVT_AVRCP_FAST_BACKWARD,
|
||||
APP_BTDM_EVT_SCO_CREATED,
|
||||
APP_BTDM_EVT_SCO_REMOVED,
|
||||
APP_BTDM_EVT_SCO_DATA,
|
||||
};
|
||||
|
||||
enum {
|
||||
APP_BTDM_CODEC_SBC,
|
||||
APP_BTDM_CODEC_AAC,
|
||||
APP_BTDM_CODEC_mSBC,
|
||||
APP_BTDM_CODEC_PCM,
|
||||
APP_BTDM_CODEC_UNKNOWN,
|
||||
};
|
||||
|
||||
struct app_btdm_event_t {
|
||||
uint8_t event;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} a2dp_data;
|
||||
struct {
|
||||
uint8_t codec_type;
|
||||
uint32_t sample_rate;
|
||||
} a2dp_codec;
|
||||
struct {
|
||||
bool valid;
|
||||
uint8_t codec_type;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} sco_data;
|
||||
struct {
|
||||
void *hf_channel;
|
||||
uint8_t codec_type;
|
||||
} sco_codec;
|
||||
} param;
|
||||
};
|
||||
|
||||
typedef void (*app_btdm_callback_t)(struct app_btdm_event_t *e);
|
||||
|
||||
void app_btdm_start(void);
|
||||
void app_btdm_init(void);
|
||||
|
||||
#endif // _APP_BTDM_H
|
122
MCU/examples/application/bootloader/Inc/app_config.h
Normal file
122
MCU/examples/application/bootloader/Inc/app_config.h
Normal file
@ -0,0 +1,122 @@
|
||||
#ifndef _APP_CONFIG_H
|
||||
#define _APP_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= SYSTEM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> SYSTEM Configuration
|
||||
|
||||
// <o> SYSTEM_CLOCK_SEL
|
||||
// <i> used to define system working clock
|
||||
// <24000000=> 24MHz
|
||||
// <48000000=> 48MHz
|
||||
// <96000000=> 96MHz
|
||||
// <144000000=> 144MHz
|
||||
// <192000000=> 192MHz
|
||||
// <240000000=> 240MHz
|
||||
#define SYSTEM_CLOCK_SEL 24000000
|
||||
|
||||
|
||||
#define BOARD_EVB_FR5090 1
|
||||
#define BOARD_EVB_FR3092E 2
|
||||
#define BOARD_EVB_FR3092E_CM 3
|
||||
// <o> BOARD_SEL
|
||||
// <i> board EVB selection, default: BOARD_EVB_FR5090
|
||||
// <1=> BOARD_EVB_FR5090
|
||||
// <2=> BOARD_EVB_FR3092E
|
||||
// <3=> BOARD_EVB_FR3092E_CM
|
||||
#define BOARD_SEL 3
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= FreeRTOS configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> FreeRTOS Configuration
|
||||
|
||||
// <o> ENABLE_RTOS_MONITOR
|
||||
// <i> check to enable or disable RTOS monitor, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define ENABLE_RTOS_MONITOR 0
|
||||
|
||||
// <o> FREERTOS_MAX_PRIORITY
|
||||
// <i> used to define priority of monitor task
|
||||
// <1-10:1>
|
||||
#define FREERTOS_MAX_PRIORITY 10
|
||||
|
||||
// <o> MONITOR_TASK_PRIORITY
|
||||
// <i> used to define priority of monitor task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define MONITOR_TASK_PRIORITY 1
|
||||
#if MONITOR_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "MONITOR_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> APP_TASK_PRIORITY
|
||||
// <i> used to define priority of app task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define APP_TASK_PRIORITY 2
|
||||
#if APP_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "APP_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> HOST_TASK_PRIORITY
|
||||
// <i> used to define priority of host task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define HOST_TASK_PRIORITY 5
|
||||
#if HOST_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "HOST_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> RPMSG_TASK_PRIORITY
|
||||
// <i> used to define priority of rpmsg task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define RPMSG_TASK_PRIORITY 6
|
||||
#if RPMSG_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "RPMSG_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> MONITOR_TASK_STACK_SIZE
|
||||
// <i> used to define priority of monitor task
|
||||
#define MONITOR_TASK_STACK_SIZE 128
|
||||
|
||||
// <o> APP_TASK_STACK_SIZE
|
||||
// <i> used to define priority of APP task
|
||||
#define APP_TASK_STACK_SIZE 256
|
||||
|
||||
// <o> HOST_TASK_STACK_SIZE
|
||||
// <i> used to define priority of btdm-host task
|
||||
#define HOST_TASK_STACK_SIZE 2048
|
||||
|
||||
// <o> RPMSG_TASK_STACK_SIZE
|
||||
// <i> used to define priority of RPMSG task
|
||||
#define RPMSG_TASK_STACK_SIZE 2048
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= BTDM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> BTDM STACK Configuration
|
||||
|
||||
// <o> BTDM_STACK_ENABLE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE 1
|
||||
|
||||
// <o> BTDM_STACK_HCI_BAUDRATE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <1500000=> 1500000
|
||||
// <921600=> 921600
|
||||
// <460800=> 460800
|
||||
// <115200=> 115200
|
||||
#define BTDM_STACK_HCI_BAUDRATE 1500000
|
||||
|
||||
// </h>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // _APP_CONFIG_H
|
112
MCU/examples/application/bootloader/Inc/app_ota.h
Normal file
112
MCU/examples/application/bootloader/Inc/app_ota.h
Normal file
@ -0,0 +1,112 @@
|
||||
#ifndef APP_OTA_H
|
||||
#define APP_OTA_H
|
||||
#include <stdint.h>
|
||||
#include "fr30xx.h"
|
||||
/******************************************************************************
|
||||
* MACROS (ºê¶¨Òå)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (³£Á¿¶¨Òå)
|
||||
*/
|
||||
#define DOCUMENT_CHECK 1
|
||||
#define BOOT_A_INFO_ADDRESS 0
|
||||
#define BOOT_B_INFO_ADDRESS 0x1000
|
||||
|
||||
#define BOOTLOADER_IMG_RSV_SIZE (220*1024)
|
||||
#define OTA_B_STORAGE_ADDRESS ((4+4)*1024 + BOOTLOADER_IMG_RSV_SIZE)
|
||||
#define IMAGE_INFO_RSV_SIZE 0x2000 //8K
|
||||
#define APP_CODE_INFO_OFFSET 0x148
|
||||
#define IMGAE_INFO_SIZE 0x10
|
||||
#define OTA_BOOT_INFO_ADDRESS (OTA_B_STORAGE_ADDRESS + BOOTLOADER_IMG_RSV_SIZE)
|
||||
#define APP_CODE_STORAGE_ADDRESS (OTA_BOOT_INFO_ADDRESS+IMAGE_INFO_RSV_SIZE)
|
||||
#define RETARGET_APP_CODE_ADDRESS (FLASH_DAC_BASE+APP_CODE_STORAGE_ADDRESS) //APPµØÖ·
|
||||
#define FILE_CODE_ADDRESS_OFFSET IMGAE_INFO_SIZE
|
||||
|
||||
#define FLASH_SIZE 0x200000 // flash 2M
|
||||
#define DSP_CODE_MAX_SIZE (256*1024) // the maximun size of DSP code
|
||||
#define CONTROLLER_CODE_MAX_SIZE (80*1024) // the maximun size of CONTROLLER code
|
||||
#define BOOT_CODE_MAX_SIZE BOOTLOADER_IMG_RSV_SIZE // the maximun size of BOOT
|
||||
#define APP_CODE_MAX_SIZE (FLASH_SIZE-DSP_CODE_MAX_SIZE-CONTROLLER_CODE_MAX_SIZE) // the maximun size of APP
|
||||
|
||||
#define DSP_STORAGE_ADDRESS (FLASH_SIZE-DSP_CODE_MAX_SIZE)
|
||||
#define CONTROLLER_STORAGE_ADDRESS (DSP_STORAGE_ADDRESS-CONTROLLER_CODE_MAX_SIZE)
|
||||
|
||||
#define OTA_START_TIMOUT 5000
|
||||
#define OTA_ADV_TIMEOUT 1000*60*1
|
||||
|
||||
#define OTA_HDR_RESULT_LEN 1
|
||||
#define OTA_HDR_OPCODE_LEN 1
|
||||
#define OTA_HDR_LENGTH_LEN 2
|
||||
|
||||
/*file type*/
|
||||
#define FILE_TYPE_APP 0x01
|
||||
#define FILE_TYPE_CONTROLLER 0x02
|
||||
#define FILE_TYPE_DSP 0x04
|
||||
typedef enum
|
||||
{
|
||||
OTA_CMD_NVDS_TYPE,
|
||||
OTA_CMD_GET_STR_BASE,
|
||||
OTA_CMD_READ_FW_VER, //read firmware version
|
||||
OTA_CMD_PAGE_ERASE,
|
||||
OTA_CMD_CHIP_ERASE,
|
||||
OTA_CMD_WRITE_DATA,
|
||||
OTA_CMD_READ_DATA,
|
||||
OTA_CMD_WRITE_MEM,
|
||||
OTA_CMD_READ_MEM,
|
||||
OTA_CMD_REBOOT,
|
||||
OTA_CMD_START,
|
||||
OTA_CMD_NULL,
|
||||
} ota_cmd_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FILE_BOOT_LOADER =1,
|
||||
FILE_APP,
|
||||
FILE_CONTROLLER,
|
||||
FILE_DSP,
|
||||
}ota_file_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_RSP_SUCCESS,
|
||||
OTA_RSP_ERROR,
|
||||
OTA_RSP_UNKNOWN_CMD,
|
||||
}ota_rsp_t;
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (ÀàÐͶ¨Òå)
|
||||
*/
|
||||
struct app_otas_status_t
|
||||
{
|
||||
uint8_t read_opcode;
|
||||
uint8_t length;
|
||||
uint32_t base_addr;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t MSP;
|
||||
volatile uint32_t Reset_Handler;
|
||||
}str_CoreRemapStart_t;
|
||||
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (È«¾Ö±äÁ¿)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* FUNCTION DESCRIPTION
|
||||
*/
|
||||
uint16_t app_otas_read_data(uint8_t *p_data);
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len);
|
||||
void ota_init(void);
|
||||
void ota_deinit(void);
|
||||
void ota_set_imagesize(uint32_t imagesize);
|
||||
uint32_t ota_get_imagesize(void);
|
||||
void platform_reset(void);
|
||||
void ota_check(void);
|
||||
void jump_to_app(void);
|
||||
void check_file_integrity(void);
|
||||
void ota_info_init(void);
|
||||
void ota_boot_start(void);
|
||||
#endif
|
72
MCU/examples/application/bootloader/Inc/app_ota_service.h
Normal file
72
MCU/examples/application/bootloader/Inc/app_ota_service.h
Normal file
@ -0,0 +1,72 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 2023, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef APP_OTA_SERVICE
|
||||
#define APP_OTA_SERVICE
|
||||
|
||||
/*******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
#define OTA_SVC_UUID {0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTA_CHAR_UUID_TX {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_RX {0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_NOTI {0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_VERSION_INFO {0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTAS_MAX_DATA_SIZE 600
|
||||
#define OTAS_NOTIFY_DATA_SIZE 20
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OTA_ATT_IDX_SERVICE,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO,
|
||||
OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_NOTI,
|
||||
OTA_ATT_IDX_CHAR_VALUE_NOTI,
|
||||
OTA_ATT_IDX_CHAR_CFG_NOTI,
|
||||
OTA_IDX_CHAR_USER_DESCRIPTION_NOTI,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_TX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_TX,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_RX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_RX,
|
||||
|
||||
OTA_ATT_NB,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES (<28><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* PUBLIC FUNCTIONS (ȫ<>ֺ<EFBFBD><D6BA><EFBFBD>)
|
||||
*/
|
||||
void ota_gatt_add_service(void);
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len);
|
||||
void adv_timeout_TimerStop(void);
|
||||
#endif
|
27
MCU/examples/application/bootloader/Inc/app_task.h
Normal file
27
MCU/examples/application/bootloader/Inc/app_task.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _APP_TASK_H
|
||||
#define _APP_TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "co_list.h"
|
||||
|
||||
#define APP_TASK_EVENT_AT_CMD 0x00
|
||||
#define APP_TASK_EVENT_HOST_INITED 0x01
|
||||
|
||||
struct app_task_event {
|
||||
struct co_list_hdr hdr;
|
||||
|
||||
uint8_t event_type;
|
||||
|
||||
uint16_t param_len;
|
||||
uint8_t param[];
|
||||
};
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high);
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block);
|
||||
|
||||
void app_task_init(void);
|
||||
|
||||
#endif // _APP_TASK_H
|
38
MCU/examples/application/bootloader/Inc/fal_cfg.h
Normal file
38
MCU/examples/application/bootloader/Inc/fal_cfg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-05-17 armink the first version
|
||||
*/
|
||||
|
||||
#ifndef _FAL_CFG_H_
|
||||
#define _FAL_CFG_H_
|
||||
|
||||
#define FAL_DEBUG 1
|
||||
#define FAL_PART_HAS_TABLE_CFG
|
||||
#define FAL_USING_SFUD_PORT
|
||||
|
||||
#define NOR_FLASH_DEV_NAME "norflash0"
|
||||
|
||||
/* ===================== Flash device Configuration ========================= */
|
||||
extern const struct fal_flash_dev onchip_flash;
|
||||
//extern struct fal_flash_dev nor_flash0;
|
||||
|
||||
/* flash device table */
|
||||
#define FAL_FLASH_DEV_TABLE \
|
||||
{ \
|
||||
&onchip_flash, \
|
||||
}
|
||||
/* ====================== Partition Configuration ========================== */
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
/* partition table */
|
||||
#define FAL_PART_TABLE \
|
||||
{ \
|
||||
{FAL_PART_MAGIC_WORD, "FlashEnv", "flashdb_onchip", 0x001AC000 - 12*1024, 12*1024, 0}, \
|
||||
}
|
||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||
|
||||
#endif /* _FAL_CFG_H_ */
|
@ -0,0 +1,24 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'boot_load'
|
||||
* Target: 'Project'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
/*
|
||||
* Define the Device Header File:
|
||||
*/
|
||||
#define CMSIS_device_header "ARMCM33_DSP_FP.h"
|
||||
|
||||
/* Keil.ARM Compiler::Compiler:I/O:STDERR:Breakpoint:1.2.0 */
|
||||
#define RTE_Compiler_IO_STDERR /* Compiler I/O: STDERR */
|
||||
#define RTE_Compiler_IO_STDERR_BKPT /* Compiler I/O: STDERR Breakpoint */
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
1923
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvguix.LH
Normal file
1923
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvguix.LH
Normal file
File diff suppressed because one or more lines are too long
996
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvoptx
Normal file
996
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvoptx
Normal file
@ -0,0 +1,996 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc; *.md</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp; *.cc; *.cxx</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>0</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>0</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>13</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2V8M.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2V8M</Key>
|
||||
<Name>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\cmsis\core_cm33.h</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm33.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>appp</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_task.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_task.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_btdm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_btdm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_at.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_at.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_hw.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_hw.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>ota</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_ota_service.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_ota_service.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_ota.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_ota.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\btdm_mem.c</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_mem.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\SWD.c</PathWithFileName>
|
||||
<FilenameWithoutPath>SWD.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>host.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_code.s</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_code.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_bootloader.c</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_bootloader.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fal_flash_port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash_port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fdb_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_app.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_fr30xx.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_cali.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_frspim.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_qspi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu_iwdt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_spi_master.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_spi_master.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_i2c.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_dma.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>4</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\btdm\btdm_host.lib</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_host.lib</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_log.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_log.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_util.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_util.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\heap\heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_file.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_file.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_kvdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_utils.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_partition.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\croutine.c</PathWithFileName>
|
||||
<FilenameWithoutPath>croutine.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>45</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\event_groups.c</PathWithFileName>
|
||||
<FilenameWithoutPath>event_groups.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>46</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>47</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>48</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stream_buffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>49</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\tasks.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tasks.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>50</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\timers.c</PathWithFileName>
|
||||
<FilenameWithoutPath>timers.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>51</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>52</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>portasm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>53</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap_6.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>54</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</PathWithFileName>
|
||||
<FilenameWithoutPath>freertos_sleep.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>55</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</PathWithFileName>
|
||||
<FilenameWithoutPath>cpu_context.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/bsp</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>56</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\display\driver_display.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_display.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>57</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\touchpad\driver_touchpad.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_touchpad.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>58</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\spi_flash\IC_W25Qxx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>IC_W25Qxx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>59</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\spi_flash\ext_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ext_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>60</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\display\driver_sh8601z.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_sh8601z.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
778
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvprojx
Normal file
778
MCU/examples/application/bootloader/MDK-ARM/boot_load.uvprojx
Normal file
@ -0,0 +1,778 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6140000::V6.14::ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM33_DSP_FP</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM33_DSP_FP$Device\ARM\ARMCM33\Include\ARMCM33_DSP_FP.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>boot_load</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>"..\..\..\..\components\tools\keil\post_process.bat" "@L" "#L" "$J"</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName></SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll></SimDlgDll>
|
||||
<SimDlgDllArguments></SimDlgDllArguments>
|
||||
<TargetDllName>SARMV8M.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM33</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4101</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2V8M.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M33"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>1</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>1</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>4</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x200000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x60000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x1ffc0000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0xa0000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20200000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>3</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>3</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>6</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\components\btdm;..\..\..\..\components\btdm\include;..\..\..\..\components\drivers\cmsis;..\..\..\..\components\drivers\device;..\..\..\..\components\drivers\device\fr30xx;..\..\..\..\components\drivers\peripheral\Inc;..\..\..\..\components\modules\FlashDB\flashdb\inc;..\..\..\..\components\modules\FlashDB\port\fal\inc;..\..\..\..\components\modules\FreeRTOS\include;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ;..\..\..\common\flashdb;..\Inc;..\..\..\common\btdm;..\..\..\..\components\modules\common\include;..\..\..\..\components\modules\heap;..\..\..\..\components\drivers\bsp\display;..\..\..\..\components\drivers\bsp\touchpad;..\..\..\..\components\drivers\bsp\spi_flash</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>..\..\..\..\components\tools\keil\xip_flash_add_psram.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm33.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\cmsis\core_cm33.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>appp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_btdm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_btdm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_at.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_at.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_hw.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_hw.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>ota</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>app_ota_service.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_ota_service.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_ota.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_ota.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\btdm_mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>SWD.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\SWD.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_bootloader.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_bootloader.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal_flash_port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fal_flash_port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fdb_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>system_fr30xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_fr30xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_cali.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_frspim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_qspi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu_iwdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_spi_master.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_spi_master.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_dma.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_host.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\..\..\components\btdm\btdm_host.lib</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>co_list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_log.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_log.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_util.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_util.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\heap\heap.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_file.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_file.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_kvdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_partition.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>croutine.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\croutine.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>event_groups.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\event_groups.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stream_buffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tasks.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\tasks.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portasm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap_6.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>freertos_sleep.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpu_context.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/bsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_display.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\display\driver_display.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_touchpad.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\touchpad\driver_touchpad.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>IC_W25Qxx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\spi_flash\IC_W25Qxx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ext_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\spi_flash\ext_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_sh8601z.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\display\driver_sh8601z.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cbundle="ARM Compiler" Cclass="Compiler" Cgroup="I/O" Csub="STDERR" Cvariant="Breakpoint" Cvendor="Keil" Cversion="1.2.0" condition="ARMCC Cortex-M">
|
||||
<package name="ARM_Compiler" schemaVersion="1.4.9" url="http://www.keil.com/pack/" vendor="Keil" version="1.6.2"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Project"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName><Project Info></LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
BIN
MCU/examples/application/bootloader/OTA Boot使用说明.doc
Normal file
BIN
MCU/examples/application/bootloader/OTA Boot使用说明.doc
Normal file
Binary file not shown.
BIN
MCU/examples/application/bootloader/OTA Boot样例使用说明.doc
Normal file
BIN
MCU/examples/application/bootloader/OTA Boot样例使用说明.doc
Normal file
Binary file not shown.
356
MCU/examples/application/bootloader/customer_ota/ota.c
Normal file
356
MCU/examples/application/bootloader/customer_ota/ota.c
Normal file
@ -0,0 +1,356 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//#include <core_cm33.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
|
||||
#include "ota.h"
|
||||
#include "ota_service.h"
|
||||
|
||||
/******************************************************************************
|
||||
* MACROS (宏定义)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (常量定义)
|
||||
*/
|
||||
#define PMU_REG_FLASH_VDD_CTRL 0xFB
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
__PACKED_STRUCT ota_ongoing_t{
|
||||
uint8_t type;
|
||||
uint8_t start_flag;
|
||||
uint8_t erase_flag;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
__PACKED_STRUCT ota_file_version_t{
|
||||
uint32_t otaboot_version;
|
||||
uint32_t app_version;
|
||||
uint32_t controller_version;
|
||||
uint32_t dsp_version;
|
||||
};
|
||||
__PACKED_STRUCT file_info_t{
|
||||
uint32_t file_version;
|
||||
uint32_t file_storage_base;
|
||||
uint32_t file_length;
|
||||
uint32_t file_crc;
|
||||
};
|
||||
__PACKED_STRUCT ota_info_t{
|
||||
uint8_t first_check_flag[4];
|
||||
uint8_t file_type; //烧录文件中,所包含的文件类型
|
||||
struct file_info_t boot_file_info;
|
||||
struct file_info_t app_file_info;
|
||||
struct file_info_t controller_file_info;
|
||||
struct file_info_t dsp_file_info;
|
||||
uint8_t controller_flag;
|
||||
struct ota_ongoing_t ota_ongoing;
|
||||
uint32_t rsv[10];
|
||||
};
|
||||
|
||||
__PACKED_STRUCT firmware_version
|
||||
{
|
||||
uint32_t firmware_version;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT storage_baseaddr
|
||||
{
|
||||
uint32_t baseaddr;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT page_erase_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_mem_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_mem_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_data_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_data_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT ota_start_rsp
|
||||
{
|
||||
uint32_t ota_start;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT ota_finish_rsp
|
||||
{
|
||||
uint32_t ota_finsih_state;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT app_ota_rsp_hdr_t
|
||||
{
|
||||
uint8_t result;
|
||||
uint8_t org_opcode;
|
||||
uint16_t length;
|
||||
__PACKED union
|
||||
{
|
||||
uint8_t nvds_type;
|
||||
struct firmware_version version;
|
||||
struct storage_baseaddr baseaddr;
|
||||
struct page_erase_rsp page_erase;
|
||||
struct write_mem_rsp write_mem;
|
||||
struct read_mem_rsp read_mem;
|
||||
struct write_data_rsp write_data;
|
||||
struct read_data_rsp read_data;
|
||||
struct ota_finish_rsp finsih_rsp;
|
||||
struct ota_start_rsp ota_start;
|
||||
} __attribute__((packed)) rsp;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT page_erase_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_mem_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_mem_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_data_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_data_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT firmware_check
|
||||
{
|
||||
uint32_t firmware_length;
|
||||
uint32_t CRC32_data;
|
||||
} __attribute__((packed));
|
||||
__PACKED_STRUCT app_ota_cmd_hdr_t
|
||||
{
|
||||
uint8_t opcode;
|
||||
uint16_t length;
|
||||
__PACKED union
|
||||
{
|
||||
struct page_erase_cmd page_erase;
|
||||
struct write_mem_cmd write_mem;
|
||||
struct read_mem_cmd read_mem;
|
||||
struct write_data_cmd write_data;
|
||||
struct read_data_cmd read_data;
|
||||
struct firmware_check fir_crc_data;
|
||||
} __attribute__((packed)) cmd;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT otas_send_rsp
|
||||
{
|
||||
uint8_t conidx;
|
||||
uint16_t length;
|
||||
uint8_t *buffer;
|
||||
};
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (局部变量)
|
||||
*/
|
||||
static struct ota_info_t * ota_info;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (全局变量)
|
||||
*/
|
||||
extern uint8_t ble_static_addr[6];
|
||||
/******************************************************************************
|
||||
* LOCAL FUNCTIONS (本地函数)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* EXTERN FUNCTIONS (外部函数)
|
||||
*/
|
||||
extern void wdt_rst_start(void);
|
||||
|
||||
void show_reg(uint8_t *buffer,uint16_t length)
|
||||
{
|
||||
for(int i = 0; i < length; i++)
|
||||
{
|
||||
printf("%02x ",buffer[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
void ota_check_file_init(void)
|
||||
{
|
||||
ota_info = pvPortMalloc(sizeof(struct ota_info_t));
|
||||
flash_read(QSPI0,OTA_BOOT_INFO_ADDRESS,sizeof(struct ota_info_t),(uint8_t *)ota_info);
|
||||
}
|
||||
|
||||
void ota_deinit(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn app_otas_recv_data
|
||||
*
|
||||
* @brief Otas Data handler
|
||||
*
|
||||
*/
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len)
|
||||
{
|
||||
struct app_ota_cmd_hdr_t *cmd_hdr = (struct app_ota_cmd_hdr_t *)p_data;
|
||||
struct app_ota_rsp_hdr_t *rsp_hdr;
|
||||
uint16_t rsp_data_len = (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN+OTA_HDR_RESULT_LEN);
|
||||
switch(cmd_hdr->opcode)
|
||||
{
|
||||
case OTA_CMD_NVDS_TYPE:
|
||||
rsp_data_len += 1;
|
||||
break;
|
||||
case OTA_CMD_GET_STR_BASE:
|
||||
rsp_data_len += sizeof(struct storage_baseaddr);
|
||||
break;
|
||||
case OTA_CMD_READ_FW_VER:
|
||||
rsp_data_len += sizeof(struct firmware_version);
|
||||
break;
|
||||
case OTA_CMD_PAGE_ERASE:
|
||||
rsp_data_len += sizeof(struct page_erase_rsp);
|
||||
break;
|
||||
case OTA_CMD_WRITE_DATA:
|
||||
rsp_data_len += sizeof(struct write_data_rsp);
|
||||
break;
|
||||
case OTA_CMD_READ_DATA:
|
||||
rsp_data_len += sizeof(struct read_data_rsp);
|
||||
break;
|
||||
case OTA_CMD_WRITE_MEM:
|
||||
rsp_data_len += sizeof(struct write_mem_rsp);
|
||||
break;
|
||||
case OTA_CMD_READ_MEM:
|
||||
rsp_data_len += sizeof(struct read_mem_rsp);
|
||||
break;
|
||||
case OTA_CMD_START:
|
||||
rsp_data_len += sizeof(struct ota_start_rsp);
|
||||
break;
|
||||
case OTA_CMD_NULL:
|
||||
|
||||
return;
|
||||
}
|
||||
struct otas_send_rsp *req = pvPortMalloc(sizeof(struct otas_send_rsp));
|
||||
uint16_t base_length;
|
||||
req->conidx = conidx;
|
||||
req->length = rsp_data_len;
|
||||
req->buffer = pvPortMalloc(rsp_data_len);
|
||||
rsp_hdr = (struct app_ota_rsp_hdr_t *)&req->buffer[0];
|
||||
rsp_hdr->result = OTA_RSP_SUCCESS;
|
||||
rsp_hdr->org_opcode = cmd_hdr->opcode;
|
||||
rsp_hdr->length = rsp_data_len - (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN+OTA_HDR_RESULT_LEN);
|
||||
|
||||
switch(cmd_hdr->opcode)
|
||||
{
|
||||
case OTA_CMD_NVDS_TYPE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_GET_STR_BASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_FW_VER:
|
||||
{
|
||||
uint8_t type;
|
||||
type = *(p_data + (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN));
|
||||
switch(type)
|
||||
{
|
||||
case FILE_BOOT_LOADER:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->boot_file_info.file_version;
|
||||
break;
|
||||
|
||||
case FILE_APP:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->app_file_info.file_version;
|
||||
break;
|
||||
|
||||
case FILE_CONTROLLER:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->controller_file_info.file_version;
|
||||
break;
|
||||
case FILE_DSP:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->dsp_file_info.file_version;
|
||||
break;
|
||||
}
|
||||
printf("version:%x",rsp_hdr->rsp.version.firmware_version);
|
||||
}
|
||||
break;
|
||||
case OTA_CMD_PAGE_ERASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_CHIP_ERASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_WRITE_DATA:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_DATA:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_WRITE_MEM:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_MEM:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_REBOOT:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_START:
|
||||
{
|
||||
uint8_t ota_type;
|
||||
ota_type = *(p_data + (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN));
|
||||
printf("ota type:%d\r\n",ota_type);
|
||||
ota_info->ota_ongoing.type = ota_type;
|
||||
|
||||
ota_info->ota_ongoing.start_flag = 0x01;
|
||||
ota_info->ota_ongoing.erase_flag = 0;
|
||||
memcpy(ota_info->ota_ongoing.mac_addr,ble_static_addr,6);
|
||||
flash_erase(QSPI0,OTA_BOOT_INFO_ADDRESS,0x1000);
|
||||
flash_write(QSPI0,OTA_BOOT_INFO_ADDRESS,sizeof(struct ota_info_t),(uint8_t *)ota_info);
|
||||
wdt_rst_start();
|
||||
rsp_hdr->rsp.ota_start.ota_start = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
}
|
||||
ota_gatt_report_notify(conidx,req->buffer,req->length);
|
||||
vPortFree(req->buffer);
|
||||
vPortFree(req);
|
||||
}
|
||||
|
||||
|
||||
|
78
MCU/examples/application/bootloader/customer_ota/ota.h
Normal file
78
MCU/examples/application/bootloader/customer_ota/ota.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef OTA_H
|
||||
#define OTA_H
|
||||
#include <stdint.h>
|
||||
#include <cmsis_armclang.h>
|
||||
#define OTA_BOOT_INFO_ADDRESS 0x64000
|
||||
#define OTA_B_STORAGE_ADDRESS 0x32000
|
||||
#define APP_CODE_STORAGE_ADDRESS 0x66000
|
||||
#define RETARGET_APP_CODE_ADDRESS 0x08066000 //APP地址
|
||||
#define APP_CODE_INFO_OFFSET 0x148
|
||||
#define IMGAE_INFO_SIZE 0x10
|
||||
#define FILE_CODE_ADDRESS_OFFSET IMGAE_INFO_SIZE
|
||||
|
||||
|
||||
#define FLASH_SIZE 0x400000 // 2M
|
||||
#define DSP_SIZE (152*1024) // DSP SIZE 152k
|
||||
#define CONTROLLER_SIZE (64*1024)
|
||||
|
||||
#define DSP_STORAGE_ADDRESS (FLASH_SIZE-DSP_SIZE)
|
||||
#define CONTROLLER_STORAGE_ADDRESS (DSP_STORAGE_ADDRESS-CONTROLLER_SIZE)
|
||||
|
||||
|
||||
#define DSP_START_ADDRESS (DSP_STORAGE_ADDRESS+FILE_CODE_ADDRESS_OFFSET)
|
||||
#define CONTROLLER_START_ADDRESS (CONTROLLER_STORAGE_ADDRESS+FILE_CODE_ADDRESS_OFFSET)
|
||||
|
||||
#define OTA_HDR_RESULT_LEN 1
|
||||
#define OTA_HDR_OPCODE_LEN 1
|
||||
#define OTA_HDR_LENGTH_LEN 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_CMD_NVDS_TYPE,
|
||||
OTA_CMD_GET_STR_BASE,
|
||||
OTA_CMD_READ_FW_VER, //read firmware version
|
||||
OTA_CMD_PAGE_ERASE,
|
||||
OTA_CMD_CHIP_ERASE,
|
||||
OTA_CMD_WRITE_DATA,
|
||||
OTA_CMD_READ_DATA,
|
||||
OTA_CMD_WRITE_MEM,
|
||||
OTA_CMD_READ_MEM,
|
||||
OTA_CMD_REBOOT,
|
||||
OTA_CMD_START,
|
||||
OTA_CMD_NULL,
|
||||
} ota_cmd_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FILE_BOOT_LOADER =1,
|
||||
FILE_APP,
|
||||
FILE_CONTROLLER,
|
||||
FILE_DSP,
|
||||
}ota_file_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_RSP_SUCCESS,
|
||||
OTA_RSP_ERROR,
|
||||
OTA_RSP_UNKNOWN_CMD,
|
||||
}ota_rsp_t;
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
struct app_otas_status_t
|
||||
{
|
||||
uint8_t read_opcode;
|
||||
uint8_t length;
|
||||
uint32_t base_addr;
|
||||
};
|
||||
|
||||
__PACKED_STRUCT file_head_info_t{
|
||||
uint8_t check[4];
|
||||
uint32_t version;
|
||||
uint32_t code_length;
|
||||
uint32_t crc;
|
||||
};
|
||||
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len);
|
||||
void ota_check_file_init(void);
|
||||
#endif
|
218
MCU/examples/application/bootloader/customer_ota/ota_service.c
Normal file
218
MCU/examples/application/bootloader/customer_ota/ota_service.c
Normal file
@ -0,0 +1,218 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDES (包含头文件)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
#include "ota_service.h"
|
||||
#include "ota.h"
|
||||
/******************************************************************************
|
||||
* MACROS (宏定义)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (常量定义)
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (局部变量)
|
||||
*/
|
||||
static const uint8_t ota_svc_uuid[UUID_SIZE_16] = OTA_SVC_UUID;
|
||||
static bool ota_link_ntf_enable = false;
|
||||
static uint8_t ota_svc_id = 0;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (全局变量)
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Profile Attributes - Table
|
||||
* 每一项都是一个attribute的定义。
|
||||
* 第一个attribute为Service 的的定义。
|
||||
* 每一个特征值(characteristic)的定义,都至少包含三个attribute的定义;
|
||||
* 1. 特征值声明(Characteristic Declaration)
|
||||
* 2. 特征值的值(Characteristic value)
|
||||
* 3. 特征值描述符(Characteristic description)
|
||||
* 如果有notification 或者indication 的功能,则会包含四个attribute的定义,除了前面定义的三个,还会有一个特征值客户端配置(client characteristic configuration)。
|
||||
*
|
||||
*/
|
||||
const gatt_attribute_t ota_svc_att_table[OTA_ATT_NB] =
|
||||
{
|
||||
// Update Over The AIR Service Declaration
|
||||
[OTA_ATT_IDX_SERVICE] = { { UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) },
|
||||
GATT_PROP_READ,UUID_SIZE_16, (uint8_t *)ota_svc_uuid
|
||||
},
|
||||
|
||||
// OTA Information Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO]= { { UUID_SIZE_16, OTA_CHAR_UUID_VERSION_INFO },
|
||||
GATT_PROP_READ, sizeof(uint16_t), NULL
|
||||
},
|
||||
|
||||
// Notify Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ,0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_NOTI] = { { UUID_SIZE_16, OTA_CHAR_UUID_NOTI },
|
||||
GATT_PROP_READ | GATT_PROP_NOTI, OTAS_NOTIFY_DATA_SIZE, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_CFG_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) },
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, 0,0
|
||||
},
|
||||
[OTA_IDX_CHAR_USER_DESCRIPTION_NOTI]= { { UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) },
|
||||
GATT_PROP_READ, 12, NULL
|
||||
},
|
||||
|
||||
// Tx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_TX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_TX] = { { UUID_SIZE_16, OTA_CHAR_UUID_TX },
|
||||
GATT_PROP_READ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
|
||||
// Rx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_RX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_RX] = { { UUID_SIZE_16, OTA_CHAR_UUID_RX },
|
||||
GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
};
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_msg_handler
|
||||
*
|
||||
* @brief Ota Profile callback funtion for GATT messages. GATT read/write
|
||||
* operations are handeled here.
|
||||
*
|
||||
* @param gatt_msg -GATT messages from GATT layer.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static uint16_t ota_gatt_msg_handler(struct gatt_msg *p_msg)
|
||||
{
|
||||
switch(p_msg->msg_evt)
|
||||
{
|
||||
case GATTS_MSG_READ_REQ:
|
||||
if(p_msg->att_idx == OTA_IDX_CHAR_USER_DESCRIPTION_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "OTA Response", strlen("OTA Response"));
|
||||
return strlen("OTA Response");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "ntf_enable", strlen("ntf_enable"));
|
||||
return strlen("ntf_enable");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_TX)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "user_ota", strlen("user_ota"));
|
||||
return strlen("user_ota");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO) //get version
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "\x00\x01", strlen("\x00\x01"));
|
||||
return strlen("\x00\x01");
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
if(p_msg->att_idx == OTA_ATT_IDX_CHAR_CFG_NOTI)
|
||||
{
|
||||
|
||||
if(*(uint16_t *)p_msg->param.gatt_data.p_msg_data == 0x1)
|
||||
{
|
||||
printf("true\r\n");
|
||||
ota_link_ntf_enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("false\r\n");
|
||||
ota_link_ntf_enable = false;
|
||||
}
|
||||
}
|
||||
else if(p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_RX)
|
||||
{
|
||||
app_otas_recv_data(p_msg->conn_idx,p_msg->param.gatt_data.p_msg_data,p_msg->param.gatt_data.msg_len);
|
||||
}
|
||||
break;
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
break;
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
break;
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
ota_link_ntf_enable = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_report_notify
|
||||
*
|
||||
* @brief Send ota protocol response data.
|
||||
*
|
||||
*
|
||||
* @param conidx - report idx of the hid_rpt_info array.
|
||||
* p_data - data of the Ota information to be sent.
|
||||
* len - length of the HID information data.
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len)
|
||||
{
|
||||
if (ota_link_ntf_enable)
|
||||
{
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = conidx;
|
||||
ntf.svc_id = ota_svc_id;
|
||||
ntf.att_idx = OTA_ATT_IDX_CHAR_VALUE_NOTI;
|
||||
ntf.data_len = len;
|
||||
ntf.p_data = p_data;
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_add_service
|
||||
*
|
||||
* @brief Ota Profile add GATT service function.
|
||||
* 添加GATT service到ATT的数据库里面。
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void ota_gatt_add_service(void)
|
||||
{
|
||||
gatt_service_t ota_profie_svc;
|
||||
ota_profie_svc.p_att_tb = ota_svc_att_table;
|
||||
ota_profie_svc.att_nb = OTA_ATT_NB;
|
||||
ota_profie_svc.gatt_msg_handler = ota_gatt_msg_handler;
|
||||
|
||||
ota_svc_id = gatt_add_service(&ota_profie_svc);
|
||||
ota_check_file_init();
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
#ifndef OTA_SERVICE_H
|
||||
#define OTA_SERVICE_H
|
||||
/*******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
#define OTA_SVC_UUID {0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTA_CHAR_UUID_TX {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_RX {0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_NOTI {0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_VERSION_INFO {0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTAS_MAX_DATA_SIZE 600
|
||||
#define OTAS_NOTIFY_DATA_SIZE 20
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OTA_ATT_IDX_SERVICE,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO,
|
||||
OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_NOTI,
|
||||
OTA_ATT_IDX_CHAR_VALUE_NOTI,
|
||||
OTA_ATT_IDX_CHAR_CFG_NOTI,
|
||||
OTA_IDX_CHAR_USER_DESCRIPTION_NOTI,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_TX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_TX,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_RX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_RX,
|
||||
|
||||
OTA_ATT_NB,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES (<28><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* PUBLIC FUNCTIONS (ȫ<>ֺ<EFBFBD><D6BA><EFBFBD>)
|
||||
*/
|
||||
void ota_gatt_add_service(void);
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len);
|
||||
|
||||
#endif
|
320
MCU/examples/application/bootloader/src/app_at.c
Normal file
320
MCU/examples/application/bootloader/src/app_at.c
Normal file
@ -0,0 +1,320 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "co_util.h"
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "me_api.h"
|
||||
#include "hfg_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#define AT_RECV_MAX_LEN 32
|
||||
|
||||
static uint8_t app_at_recv_char;
|
||||
static uint8_t at_recv_buffer[AT_RECV_MAX_LEN];
|
||||
static uint8_t at_recv_index = 0;
|
||||
static uint8_t at_recv_state = 0;
|
||||
|
||||
void btdm_host_send_vendor_cmd(uint8_t type, uint8_t length, void *data);
|
||||
|
||||
void btdm_host_vendor_cmd_cmp_evt(uint8_t status, uint8_t len, uint8_t const *param)
|
||||
{
|
||||
printf("status: 0x%02x.\r\n", status);
|
||||
for (uint32_t i=0; i<len; i++) {
|
||||
printf("%02x ", param[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_A(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd)
|
||||
{
|
||||
// case 'A':
|
||||
// {
|
||||
// mac_addr_t addr;
|
||||
// addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
// addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
// addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
// addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
// addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
// addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
// gap_start_conn(&addr, ascii_strn2val((const char *)&data[12], 16, 2), 64, 64, 0, 500);
|
||||
// }
|
||||
// break;
|
||||
// case 'B':
|
||||
// {
|
||||
// gap_stop_conn();
|
||||
// }
|
||||
// break;
|
||||
case 'A':
|
||||
{
|
||||
uint8_t addr = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x00, 1, &addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'B':
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x01, 2, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
uint32_t addr = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x02, 4, (void *)&addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
uint32_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x03, 8, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'G':
|
||||
printf("hello world!\r\n");
|
||||
break;
|
||||
case 'H':
|
||||
printf("VAL: 0x%08x.\r\n", *(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8));
|
||||
break;
|
||||
case 'I':
|
||||
*(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8) = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'J':
|
||||
printf("OOL VAL: 0x%02x.\r\n", ool_read(ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
break;
|
||||
case 'K':
|
||||
ool_write(ascii_strn2val((const char *)&data[0], 16, 2), ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'L':
|
||||
printf("VAL: 0x%02x.\r\n", *(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)));
|
||||
break;
|
||||
case 'M':
|
||||
*(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)) = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
// case 'P':
|
||||
// co_printf("VAL: 0x%02x.\r\n", *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
// break;
|
||||
// case 'Q':
|
||||
// *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)) = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
// case 'S':
|
||||
// co_printf("VAL: 0x%02x.\r\n", frspim_rd(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1));
|
||||
// break;
|
||||
// case 'T':
|
||||
// frspim_wr(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1, ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
case 'U':
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *)(ascii_strn2val((const char *)&data[0], 16, 8) & (~3));
|
||||
uint8_t count = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
uint32_t *start = (uint32_t *)((uint32_t)ptr & (~0x0f));
|
||||
for(uint8_t i=0; i<count;) {
|
||||
if(((uint32_t)start & 0x0c) == 0) {
|
||||
printf("0x%08x: ", (uint32_t)start);
|
||||
}
|
||||
if(start < ptr) {
|
||||
printf(" ");
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
printf("%08x", *start);
|
||||
}
|
||||
if(((uint32_t)start & 0x0c) == 0x0c) {
|
||||
printf("\r\n");
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char *)&data[0], 16, 8), ascii_strn2val((const char *)&data[9], 16, 8));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_B(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
struct gap_ble_addr peer_addr;
|
||||
BD_ADDR addr;
|
||||
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
// AT#BA00
|
||||
//app_ble_advertising_start(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'B':
|
||||
// AT#BB01
|
||||
//app_ble_advertising_stop(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'C':
|
||||
//app_ble_scan_start();
|
||||
break;
|
||||
case 'D':
|
||||
//app_ble_scan_stop();
|
||||
break;
|
||||
case 'E':
|
||||
// AT#BE0123456789ab_01
|
||||
peer_addr.addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
peer_addr.addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
peer_addr.addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
peer_addr.addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
peer_addr.addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
peer_addr.addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
peer_addr.addr_type = ascii_strn2val((const char *)&data[13], 16, 2);
|
||||
//app_ble_conn_start(&peer_addr);
|
||||
break;
|
||||
case 'F':
|
||||
//app_ble_conn_stop();
|
||||
break;
|
||||
case 'H':
|
||||
ME_Inquiry(BT_IAC_GIAC, 5, 5);
|
||||
break;
|
||||
case 'I':
|
||||
ME_CancelInquiry();
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
BtStatus status;
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
|
||||
//status = HFG_CreateServiceLink(&hfg_channel[0], &addr);
|
||||
|
||||
if (status == BT_STATUS_PENDING) {
|
||||
printf("Opening Channel...\r\n");
|
||||
} else {
|
||||
printf("Could not open channel, status: %d\r\n", status);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
// {
|
||||
// uint8_t battery_level[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
// struct gatt_send_event ntf[6];
|
||||
// uint8_t i=0;
|
||||
// for(i=0;i<6;i++){
|
||||
// ntf[i].conidx = 0;
|
||||
// ntf[i].svc_id = svc_id;
|
||||
// ntf[i].att_idx = 2;
|
||||
// ntf[i].data_len = 15;
|
||||
// ntf[i].p_data = &battery_level[0];
|
||||
// gatt_notification(&ntf[i]);
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_D(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char*)&data[0],16,8), 0x1000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length)
|
||||
{
|
||||
switch(data[0])
|
||||
{
|
||||
case 'A':
|
||||
app_at_recv_cmd_A(data[1], &data[2]);
|
||||
break;
|
||||
case 'B':
|
||||
app_at_recv_cmd_B(data[1], &data[2]);
|
||||
break;
|
||||
case 'D':
|
||||
app_at_recv_cmd_D(data[1], &data[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_c(uint8_t c)
|
||||
{
|
||||
switch(at_recv_state)
|
||||
{
|
||||
case 0:
|
||||
if(c == 'A')
|
||||
{
|
||||
at_recv_state++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(c == 'T')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
if(c == '#')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 3:
|
||||
at_recv_buffer[at_recv_index++] = c;
|
||||
if((c == '\n')
|
||||
||(at_recv_index >= AT_RECV_MAX_LEN))
|
||||
{
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_AT_CMD, at_recv_index, false);
|
||||
if(event) {
|
||||
memcpy(event->param, at_recv_buffer, at_recv_index);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
at_recv_state = 0;
|
||||
at_recv_index = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
app_at_recv_c(app_at_recv_char);
|
||||
if (handle) {
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
434
MCU/examples/application/bootloader/src/app_ble.c
Normal file
434
MCU/examples/application/bootloader/src/app_ble.c
Normal file
@ -0,0 +1,434 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "co_log.h"
|
||||
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "fdb_app.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "portable.h"
|
||||
#include "btdm_mem.h"
|
||||
|
||||
#define SP_SVC_UUID 0xFFF0
|
||||
#define SP_CHAR1_UUID 0xFFF3
|
||||
#define SP_CHAR2_UUID {0xba, 0x5c, 0xFF, 0xF4, 0x04, 0xa3, 0x40, 0x71, 0xa0, 0xb5, 0x35, 0x85, 0x3e, 0xb0, 0x83, 0x07}
|
||||
|
||||
// Element index of gatt service table
|
||||
enum
|
||||
{
|
||||
SP_IDX_SERVICE,
|
||||
|
||||
SP_IDX_CHAR1_DECLARATION,
|
||||
SP_IDX_CHAR1_VALUE,
|
||||
SP_IDX_CHAR1_CFG,
|
||||
SP_IDX_CHAR1_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_CHAR2_DECLARATION,
|
||||
SP_IDX_CHAR2_VALUE,
|
||||
SP_IDX_CHAR2_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_NB,
|
||||
};
|
||||
|
||||
// Simple GATT Profile Service UUID: 0xFFF0
|
||||
static const uint8_t sp_svc_uuid[] = UUID16_ARR(SP_SVC_UUID);
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 UUID: 0xFFF3
|
||||
// Characteristic 1 data
|
||||
#define SP_CHAR1_VALUE_LEN 20
|
||||
static uint8_t sp_char1_value[SP_CHAR1_VALUE_LEN] = {0};
|
||||
|
||||
#define SP_CHAR1_USER_DESC_LEN 17
|
||||
static char sp_char1_user_desc_data[] = "Characteristic 1";
|
||||
|
||||
static uint8_t desc_data[2] = {0};
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 UUID: 0xBA5C-FFF4-04A3-4071-A0B5-3585-3EB0-8307
|
||||
// Characteristic 2 data
|
||||
#define SP_CHAR2_VALUE_LEN 5
|
||||
static uint8_t sp_char2_value[SP_CHAR2_VALUE_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55};
|
||||
|
||||
#define SP_CHAR2_USER_DESC_LEN 17
|
||||
static char sp_char2_user_desc_data[] = "Characteristic 2";
|
||||
|
||||
static const gatt_attribute_t simple_profile_att_table[] =
|
||||
{
|
||||
// Simple gatt Service Declaration
|
||||
[SP_IDX_SERVICE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
UUID_SIZE_2, /* Max size of the value */ /* Service UUID size in service declaration */
|
||||
(uint8_t*)sp_svc_uuid, /* Value of the attribute */ /* Service UUID value in service declaration */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 Declaration
|
||||
[SP_IDX_CHAR1_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
// Characteristic 1 Value
|
||||
[SP_IDX_CHAR1_VALUE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(SP_CHAR1_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_NOTI | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
SP_CHAR1_VALUE_LEN, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 1 client characteristic configuration
|
||||
[SP_IDX_CHAR1_CFG] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
2, /* Max size of the value */
|
||||
desc_data, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
},
|
||||
|
||||
// Characteristic 1 User Description
|
||||
[SP_IDX_CHAR1_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR1_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char1_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 Declaration
|
||||
[SP_IDX_CHAR2_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
|
||||
// Characteristic 2 Value
|
||||
[SP_IDX_CHAR2_VALUE] = {
|
||||
{ UUID_SIZE_16, SP_CHAR2_UUID }, /* UUID */
|
||||
GATT_PROP_READ , /* Permissions */
|
||||
SP_CHAR2_VALUE_LEN, /* Max size of the value */
|
||||
sp_char2_value, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 2 User Description
|
||||
[SP_IDX_CHAR2_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR2_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char2_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
};
|
||||
|
||||
static void app_ble_start_advertising(void);
|
||||
|
||||
static char local_device_name[] = "509x_Ble_Periphreal";
|
||||
static adv_handle adv;
|
||||
|
||||
/*
|
||||
* Advertising data, max size is 28 bytes
|
||||
*/
|
||||
static uint8_t adv_data[] = {
|
||||
/* gatt service information */
|
||||
0x03, //length of this AD
|
||||
GAP_ADVTYPE_16BIT_MORE, //16bit service uuid AD type
|
||||
0xff, 0xf0, //value.service uuid:0xFFF0
|
||||
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'5','0','9','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
/*
|
||||
* Advertising scan response data, max size is 31 bytes
|
||||
*/
|
||||
static uint8_t adv_scan_rsp_data[] = {
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'5','0','9','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
uint8_t service_id;
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
// printf("gap_callback: type = %d\r\n", event->type);
|
||||
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
//gap_get_link_version(event->param.connect.conidx);
|
||||
//gap_get_link_rssi(event->param.connect.conidx);
|
||||
//gap_get_link_features(event->param.connect.conidx);
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
gatt_mtu_exchange_req(service_id, event->param.connect.conidx, 247);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t gatt_callback(struct gatt_msg *p_msg)
|
||||
{
|
||||
uint8_t uuid_temp[16];
|
||||
uint16_t uuid_2 = 0;
|
||||
|
||||
switch(p_msg->msg_evt) {
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
{
|
||||
switch(p_msg->param.gatt_op_cmp.operation) {
|
||||
case GATT_OP_NOTIFY:
|
||||
/*opearation of notification is complete */
|
||||
printf("notify cmp, conidx:%d, status:0x%02X\r\n", p_msg->conn_idx, p_msg->param.gatt_op_cmp.status);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a read request from the peer device */
|
||||
case GATTS_MSG_READ_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_READ_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
/*
|
||||
* Because the buffer pointer of SP_IDX_CHAR1_VALUE is NULL,
|
||||
* read requests will be report to the application layer for user response
|
||||
*/
|
||||
uint8_t read_rsp_data[] = {0x00, 0x01, 0x02, 0x03, 0x04};
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, read_rsp_data, sizeof(read_rsp_data));
|
||||
|
||||
/* Return the length of response data */
|
||||
return (sizeof(read_rsp_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a write request from the peer device */
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_WRITE_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
printf("recv data: 0x");
|
||||
for(uint8_t i=0; i<p_msg->param.gatt_data.msg_len; i++)
|
||||
printf("%02X", p_msg->param.gatt_data.p_msg_data[i]);
|
||||
printf("\r\n");
|
||||
}
|
||||
else if(p_msg->att_idx == SP_IDX_CHAR1_CFG)
|
||||
{
|
||||
uint8_t data[2];
|
||||
memcpy(data, p_msg->param.gatt_data.p_msg_data, 2);
|
||||
if(data[0] & 0x01)
|
||||
{
|
||||
/* peer device enable notify */
|
||||
printf("ntf enable, att_idx:%d\r\n", p_msg->att_idx);
|
||||
uint8_t send_data[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = p_msg->conn_idx;
|
||||
ntf.att_idx = SP_IDX_CHAR1_VALUE;
|
||||
ntf.p_data = send_data;
|
||||
ntf.data_len = sizeof(send_data);
|
||||
ntf.svc_id = service_id;
|
||||
|
||||
/* Send a notification to the peer device */
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
printf("gatt linkk create, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
printf("gatt linkk lost, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void app_ble_add_service(void)
|
||||
{
|
||||
struct gatt_service service;
|
||||
|
||||
service.att_nb = SP_IDX_NB;
|
||||
service.p_att_tb = simple_profile_att_table;
|
||||
service.gatt_msg_handler = gatt_callback; //set GATT event callback
|
||||
|
||||
service_id = gatt_add_service(&service);
|
||||
}
|
||||
|
||||
static void app_ble_start_advertising(void)
|
||||
{
|
||||
/* creat a handle of advertising*/
|
||||
adv = gap_adv_create();
|
||||
|
||||
gap_adv_param_t adv_param = {
|
||||
.own_addr_type = GAP_ADDR_TYPE_STATIC, //own address type
|
||||
.adv_mode = GAP_ADV_MODE_UNDIRECT,
|
||||
.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC,
|
||||
.adv_chnl_map = GAP_ADV_CHAN_ALL,
|
||||
.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY, //Policy for filtering scanning or connection requests from peer devices
|
||||
.phy_mode = GAP_PHY_TYPE_LE_1M,
|
||||
.adv_intv_min = 160, //advertising min interval, in unit of 0.625ms
|
||||
.adv_intv_max = 160, //advertising max interval, in unit of 0.625ms
|
||||
};
|
||||
|
||||
/* set advertising param */
|
||||
gap_adv_set_param(adv, &adv_param);
|
||||
/* set advertising data */
|
||||
gap_adv_set_adv_data(adv, adv_data, sizeof(adv_data));
|
||||
/* set advertising scan response data */
|
||||
gap_adv_set_scan_rsp(adv, adv_scan_rsp_data, sizeof(adv_scan_rsp_data));
|
||||
/* start sadvertising */
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
printf("app_ble_init\r\n");
|
||||
|
||||
/* set GAP event callback*/
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
/* set security param */
|
||||
struct gap_security_param smp_param;
|
||||
smp_param.mitm = true;
|
||||
smp_param.secure_connection = false;
|
||||
smp_param.bond = true;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
gap_security_param_init(&smp_param);
|
||||
|
||||
/* add service profile, The GAP callback event is GATT_EVT_PROFILE_ADDED*/
|
||||
app_ble_add_service();
|
||||
}
|
||||
|
||||
|
118
MCU/examples/application/bootloader/src/app_btdm.c
Normal file
118
MCU/examples/application/bootloader/src/app_btdm.c
Normal file
@ -0,0 +1,118 @@
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#include "controller_bootloader.h"
|
||||
#include "host.h"
|
||||
#include "app_ota.h"
|
||||
|
||||
typedef int32_t app_btdm_ret_t;
|
||||
|
||||
static const uint8_t bt_addr[] = {0x12, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
static const uint8_t ble_public_addr[] = {0x13, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
uint8_t ble_static_addr[] = {0x13, 0x66, 0x12, 0x72, 0x12, 0xc2};
|
||||
|
||||
static void encoded_sco_frame_cb(void *arg, uint8_t *data, uint16_t length)
|
||||
{
|
||||
static uint16_t seq = 0;
|
||||
app_bt_send_sco_data(arg, seq++, data, length);
|
||||
}
|
||||
|
||||
static void btdm_callback(struct app_btdm_event_t *event)
|
||||
{
|
||||
switch(event->event) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_btdm_start(void)
|
||||
{
|
||||
app_ble_init();
|
||||
}
|
||||
|
||||
void host_ready_cb(void)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
/* notify application BTDM stack is ready. */
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_HOST_INITED, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
|
||||
void user_controller_init(void)
|
||||
{
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr);
|
||||
}
|
||||
void app_btdm_init(void)
|
||||
{
|
||||
/* prepare for BTDM stack */
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr);
|
||||
|
||||
host_ble_start(BTDM_STACK_HCI_BAUDRATE, HOST_TASK_STACK_SIZE, HOST_TASK_PRIORITY, ble_static_addr);
|
||||
|
||||
/*
|
||||
* init MCU->BT pin, configure PMU_PIN_8 output BBG_EN signal, this pin is used to
|
||||
* notice BT core that MCU is in working mode.
|
||||
*/
|
||||
ool_write(PMU_REG_DIAG_CTRL, 0x82);
|
||||
ool_write(PMU_REG_PIN_IOMUX_H, 0x03);
|
||||
/* disable PMU pin input as default setting */
|
||||
ool_write16(PMU_REG_PIN_INPUT_EN, 0x0002);
|
||||
|
||||
|
||||
/*
|
||||
* init BT->MCU pin, system should not enter sleep mode when this pin is low level.
|
||||
* This pin is used by BT core to notice MCU than BT core is in working mode.
|
||||
*/
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
pmu_gpio_int_init(PMU_PIN_9, PMU_GPIO_PULL_UP, 0);
|
||||
pmu_enable_isr(PMU_GPIO_PMU_INT_MSK_BIT);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_access_mode_set(uint8_t mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_connect(uint8_t *peer_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_profile_enable(uint16_t profiles)
|
||||
{
|
||||
return -1;
|
||||
}
|
828
MCU/examples/application/bootloader/src/app_hw.c
Normal file
828
MCU/examples/application/bootloader/src/app_hw.c
Normal file
@ -0,0 +1,828 @@
|
||||
/*
|
||||
* 1. AT command and log: UART3
|
||||
* 2. HCI interface: UART0, GPIO_PMU, handled by host.c.
|
||||
* 3. Display: DMA1, SPIx8_0, GPIO (for cs)
|
||||
* 4. Touchpad: I2C3
|
||||
* 5. external Flash: DMA0, SPIx8_1
|
||||
* 6. DSP: IPC, RPMSG
|
||||
* 7. Sensors: handled by 1010
|
||||
* 8. System clock, XIP Flash: handled by sleep procedure
|
||||
*/
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "driver_display.h"
|
||||
#include "driver_touchpad.h"
|
||||
#include "IC_W25Qxx.h"
|
||||
|
||||
#include "app_config.h"
|
||||
#include "app_hw.h"
|
||||
|
||||
struct hw_gpio_state_t {
|
||||
uint16_t PortA_PullEN;
|
||||
uint16_t PortB_PullEN;
|
||||
uint16_t PortC_PullEN;
|
||||
uint16_t PortD_PullEN;
|
||||
|
||||
uint16_t PortA_PullSelect;
|
||||
uint16_t PortB_PullSelect;
|
||||
uint16_t PortC_PullSelect;
|
||||
uint16_t PortD_PullSelect;
|
||||
|
||||
uint32_t PortA_PullResCfg;
|
||||
uint32_t PortB_PullResCfg;
|
||||
uint32_t PortC_PullResCfg;
|
||||
uint32_t PortD_PullResCfg;
|
||||
|
||||
uint32_t PortA_DriveCfg;
|
||||
uint32_t PortB_DriveCfg;
|
||||
uint32_t PortC_DriveCfg;
|
||||
uint32_t PortD_DriveCfg;
|
||||
|
||||
uint32_t PortA_L_FuncMux;
|
||||
uint32_t PortA_H_FuncMux;
|
||||
uint32_t PortB_L_FuncMux;
|
||||
uint32_t PortB_H_FuncMux;
|
||||
uint32_t PortC_L_FuncMux;
|
||||
uint32_t PortC_H_FuncMux;
|
||||
uint32_t PortD_L_FuncMux;
|
||||
uint32_t PortD_H_FuncMux;
|
||||
|
||||
uint32_t QSPI_PullSelect;
|
||||
uint32_t QSPI_PullEN;
|
||||
uint32_t OSPI_PullSelect;
|
||||
uint32_t OSPI_PullEN;
|
||||
|
||||
uint16_t GPIOA_OutputEN;
|
||||
uint16_t GPIOA_OUT_DATA;
|
||||
uint16_t GPIOA_EXTI_EN;
|
||||
uint16_t GPIOA_EXTI_INT_EN;
|
||||
uint32_t GPIOA_EXTI_TYPE;
|
||||
uint16_t GPIOB_OutputEN;
|
||||
uint16_t GPIOB_OUT_DATA;
|
||||
uint16_t GPIOB_EXTI_EN;
|
||||
uint16_t GPIOB_EXTI_INT_EN;
|
||||
uint32_t GPIOB_EXTI_TYPE;
|
||||
uint16_t GPIOC_OutputEN;
|
||||
uint16_t GPIOC_OUT_DATA;
|
||||
uint16_t GPIOC_EXTI_EN;
|
||||
uint16_t GPIOC_EXTI_INT_EN;
|
||||
uint32_t GPIOC_EXTI_TYPE;
|
||||
uint16_t GPIOD_OutputEN;
|
||||
uint16_t GPIOD_OUT_DATA;
|
||||
uint16_t GPIOD_EXTI_EN;
|
||||
uint16_t GPIOD_EXTI_INT_EN;
|
||||
uint32_t GPIOD_EXTI_TYPE;
|
||||
};
|
||||
|
||||
static struct hw_gpio_state_t gpio_state;
|
||||
|
||||
UART_HandleTypeDef uart_log_handle;
|
||||
DMA_HandleTypeDef dma_display_handle;
|
||||
SPI_HandleTypeDef spi_display_handle;
|
||||
I2C_HandleTypeDef i2c_touchpad_handle;
|
||||
SPI_HandleTypeDef spi_flash_handle;
|
||||
DMA_HandleTypeDef dma_flash_handle;
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void display_cs_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
printf("cs 0");
|
||||
}
|
||||
|
||||
void display_cs_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_5, GPIO_PIN_CLEAR);
|
||||
printf("cs 1");
|
||||
}
|
||||
|
||||
void spi_flash_cs_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void spi_flash_cs_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_9, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_6, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return gpio_read_pin(GPIOC, GPIO_PIN_7);
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return gpio_read_pin(GPIOB, GPIO_PIN_15);
|
||||
}
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
void display_delay_ms(uint32_t counter)
|
||||
{
|
||||
system_delay_us(counter * 1000);
|
||||
}
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
|
||||
#if 1 //DISPLAY_TYPE_ICNA3310
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#else
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_6, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
void touchpad_delay_ms(uint32_t counter)
|
||||
{
|
||||
system_delay_us(counter * 1000);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_log_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= Uart LOG configuration ========= */
|
||||
/* ========================================================== */
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
|
||||
/* UART3: used for Log and AT command */
|
||||
uart_log_handle.UARTx = UART3;
|
||||
uart_log_handle.Init.BaudRate = 921600;
|
||||
uart_log_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
uart_log_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
uart_log_handle.Init.Parity = UART_PARITY_NONE;
|
||||
uart_log_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
uart_log_handle.TxCpltCallback = NULL;
|
||||
uart_log_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&uart_log_handle);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
}
|
||||
else {
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
uart_init(&uart_log_handle);
|
||||
__UART_INT_RX_ENABLE(uart_log_handle.UARTx);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_display_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= Display interface configuration ========= */
|
||||
/* ========================================================== */
|
||||
/* config DMA1 for display */
|
||||
__SYSTEM_DMA1_CLK_ENABLE();
|
||||
dma_display_handle.DMAx = DMA1;
|
||||
dma_display_handle.Channel = DMA_Channel0;
|
||||
dma_display_handle.Init.Data_Flow = DMA_M2P_DMAC;
|
||||
dma_display_handle.Init.Request_ID = 2;
|
||||
system_dmac_request_id_config(SPIMX8_0_TX, DMA1_REQUEST_ID_2);
|
||||
dma_display_handle.Init.Source_Master_Sel = DMA_AHB_MASTER_3;
|
||||
dma_display_handle.Init.Desination_Master_Sel = DMA_AHB_MASTER_2;
|
||||
dma_display_handle.Init.Source_Inc = DMA_ADDR_INC_INC;
|
||||
dma_display_handle.Init.Desination_Inc = DMA_ADDR_INC_NO_CHANGE;
|
||||
dma_display_handle.Init.Source_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_display_handle.Init.Desination_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_display_handle.Init.Source_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_display_handle.Init.Desination_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_init(&dma_display_handle);
|
||||
NVIC_EnableIRQ(DMA1_IRQn);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
/* configure C0, C1, C2, C3, C4 to SPIx8_0 function */
|
||||
gpio_config.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_5;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure C5 to CS function */
|
||||
gpio_config.Pin = GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
/* configure B13, PB14 to VCCI function, RESET function */
|
||||
gpio_config.Pin = GPIO_PIN_13 | GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
/* configure PC15, PC6 to VCCI function, RESET function n*/
|
||||
gpio_config.Pin = GPIO_PIN_6 | GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC7 to TE functio(interrupt pin) */
|
||||
gpio_config.Pin = GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
/* configure B13, PB14 to VCCI function, RESET function */
|
||||
gpio_config.Pin = GPIO_PIN_13 | GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB15 to TE functio(interrupt pin) */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_ENABLE();
|
||||
spi_display_handle.SPIx = SPIMX8_0;
|
||||
spi_display_handle.Init.Work_Mode = SPI_WORK_MODE_0;
|
||||
spi_display_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 2;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 4;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 4;
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
spi_display_handle.Init.TxFIFOEmpty_Threshold = 20;
|
||||
spi_display_handle.Init.RxFIFOFull_Threshold = 0;
|
||||
spi_master_init(&spi_display_handle);
|
||||
|
||||
display_cs_set();
|
||||
display_init();
|
||||
printf("display_init!\n");
|
||||
}
|
||||
else {
|
||||
__SYSTEM_DMA1_CLK_ENABLE();
|
||||
system_dmac_request_id_config(SPIMX8_0_TX, DMA1_REQUEST_ID_2);
|
||||
dma_init(&dma_display_handle);
|
||||
NVIC_EnableIRQ(DMA1_IRQn);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_ENABLE();
|
||||
spi_display_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
spi_master_init(&spi_display_handle);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_touchpad_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= TP configuration ========= */
|
||||
/* ========================================================== */
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
/* configure GPIO_PC6 and GPIO_PC7 to I2C3 mode */
|
||||
gpio_config.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
|
||||
#if 1 //DISPLAY_TYPE_ICNA3310
|
||||
/* configure GPIO_PB12 and GPIO_PB13 to I2C2 mode */
|
||||
gpio_config.Pin = GPIO_PIN_12|GPIO_PIN_13;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
|
||||
exti_interrupt_enable(GPIOB,EXTI_LINE_14);
|
||||
exti_clear_LineStatus(GPIOB,EXTI_LINE_14);
|
||||
|
||||
NVIC_EnableIRQ(GPIOB_IRQn);
|
||||
|
||||
#else
|
||||
|
||||
/* configure GPIO_PA4 and GPIO_PA5 to I2C2 mode */
|
||||
gpio_config.Pin = GPIO_PIN_4|GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
/* configure GPIO_PA6 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_6;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
/* configure GPIO_PB14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
#endif
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
/* configure GPIO_PC6 and GPIO_PC7 to I2C3 mode */
|
||||
gpio_config.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
/* I2C Init */
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C3;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 220;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 230;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
__SYSTEM_I2C2_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C2;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 220;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 230;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C3;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 90;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 90;
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
i2c_init(&i2c_touchpad_handle);
|
||||
|
||||
__TOUCHPAD_RESET_SET();
|
||||
touchpad_init();
|
||||
}
|
||||
else {
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
#if BOARD_SEL == BOARD_EVB_FR3092E
|
||||
__SYSTEM_I2C2_CLK_ENABLE();
|
||||
#else
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
#endif
|
||||
i2c_init(&i2c_touchpad_handle);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_external_flash_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= External Flash interface configuration ======== */
|
||||
/* ========================================================== */
|
||||
/* config GPIO for external flash */
|
||||
gpio_config.Pin = GPIO_PIN_8 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_7;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* CS of external flash is controllerd by software */
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_9;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* config DMA0 for external flash */
|
||||
__SYSTEM_DMA0_CLK_ENABLE();
|
||||
dma_flash_handle.DMAx = DMA0;
|
||||
dma_flash_handle.Channel = DMA_Channel0;
|
||||
dma_flash_handle.Init.Data_Flow = DMA_P2M_DMAC;
|
||||
dma_flash_handle.Init.Request_ID = 2;
|
||||
system_dmac_request_id_config(SPIMX8_1_RX, DMA0_REQUEST_ID_2);
|
||||
dma_flash_handle.Init.Source_Master_Sel = DMA_AHB_MASTER_1;
|
||||
dma_flash_handle.Init.Desination_Master_Sel = DMA_AHB_MASTER_4;
|
||||
dma_flash_handle.Init.Source_Inc = DMA_ADDR_INC_NO_CHANGE;
|
||||
dma_flash_handle.Init.Desination_Inc = DMA_ADDR_INC_INC;
|
||||
dma_flash_handle.Init.Source_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_flash_handle.Init.Desination_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_flash_handle.Init.Source_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_flash_handle.Init.Desination_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_init(&dma_flash_handle);
|
||||
|
||||
/* Initial SPIx8_1 for extern flash */
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_ENABLE();
|
||||
spi_flash_handle.SPIx = SPIMX8_1;
|
||||
spi_flash_handle.Init.Work_Mode = SPI_WORK_MODE_3;
|
||||
spi_flash_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
spi_flash_handle.Init.BaudRate_Prescaler = 2;
|
||||
spi_flash_handle.Init.TxFIFOEmpty_Threshold = 20;
|
||||
spi_flash_handle.Init.RxFIFOFull_Threshold = 4;
|
||||
spi_master_init(&spi_flash_handle);
|
||||
__SPI_RX_SAMPLE_DLY(spi_flash_handle.SPIx, 2);
|
||||
__SPI_CS_Release();
|
||||
|
||||
IC_W25Qxx_QuadConfig(true);
|
||||
|
||||
NVIC_EnableIRQ(DMA0_IRQn);
|
||||
NVIC_EnableIRQ(SPIMX8_1_IRQn);
|
||||
}
|
||||
else {
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
__SYSTEM_DMA0_CLK_ENABLE();
|
||||
system_dmac_request_id_config(SPIMX8_1_RX, DMA0_REQUEST_ID_2);
|
||||
dma_init(&dma_flash_handle);
|
||||
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_ENABLE();
|
||||
spi_master_init(&spi_flash_handle);
|
||||
__SPI_RX_SAMPLE_DLY(spi_flash_handle.SPIx, 2);
|
||||
|
||||
NVIC_EnableIRQ(DMA0_IRQn);
|
||||
NVIC_EnableIRQ(SPIMX8_1_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_dsp_xip_flash_init(bool wake_up)
|
||||
{
|
||||
/* init QSPI1 for DSP XIP flash */
|
||||
__SYSTEM_QSPI1_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_QSPI1_CLK_ENABLE();
|
||||
/* configure OSPI pad to DSP XIP flash function */
|
||||
SYSTEM->OspiPadConfig.OSPI_FuncMux = 0x55555555;
|
||||
|
||||
/* power on DSP flash */
|
||||
ool_write(0xfc, ool_read(0xfc) | 0x01);
|
||||
|
||||
/* configure DSP XIP controller */
|
||||
flash_enable_quad(QSPI1);
|
||||
flash_init_controller(QSPI1, FLASH_RD_TYPE_QUAD_FAST, FLASH_WR_TYPE_SINGLE);
|
||||
flash_set_baudrate(QSPI1, QSPI_BAUDRATE_DIV_4);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_dsp_restore(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
__RAM_CODE __attribute__((noinline)) static void rise_qspi_clock(void)
|
||||
{
|
||||
__SYSTEM_QSPI0_CLK_SELECT_AUPLL();
|
||||
__QSPI_DELAY_CS_START_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_END_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_DESSERT_SET(QSPI0, 8);
|
||||
__QSPI_READ_CAPTURE_DELAY_SET(QSPI0, 0); // FLASH_ID_PUYA_P25Q32: 4 when div is 2
|
||||
// FLASH_ID_XMC_XM25LU32: 3 when div is 2
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 1 when div is 4
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 4 when div is 2
|
||||
system_delay_us(1000);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_xip_flash_init(bool wake_up)
|
||||
{
|
||||
// init internal flash
|
||||
__SYSTEM_PFC_CLK_ENABLE();
|
||||
__SYSTEM_QSPI0_CLK_ENABLE();
|
||||
__SYSTEM_APB_CLK_ENABLE();
|
||||
__SYSTEM_APB1_CLK_ENABLE();
|
||||
system_cache_enable(true);
|
||||
flash_enable_quad(QSPI0);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_QUAD, FLASH_WR_TYPE_SINGLE);
|
||||
if (wake_up == false) {
|
||||
flash_set_IO_DRV(QSPI0, 3);
|
||||
}
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
rise_qspi_clock();
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_gpio_save(void)
|
||||
{
|
||||
gpio_state.PortA_PullEN = SYSTEM->PortA_PullEN;
|
||||
gpio_state.PortB_PullEN = SYSTEM->PortB_PullEN;
|
||||
gpio_state.PortC_PullEN = SYSTEM->PortC_PullEN;
|
||||
gpio_state.PortD_PullEN = SYSTEM->PortD_PullEN;
|
||||
|
||||
gpio_state.PortA_PullSelect = SYSTEM->PortA_PullSelect;
|
||||
gpio_state.PortB_PullSelect = SYSTEM->PortB_PullSelect;
|
||||
gpio_state.PortC_PullSelect = SYSTEM->PortC_PullSelect;
|
||||
gpio_state.PortD_PullSelect = SYSTEM->PortD_PullSelect;
|
||||
|
||||
gpio_state.PortA_PullResCfg = SYSTEM->PortA_PullResCfg;
|
||||
gpio_state.PortB_PullResCfg = SYSTEM->PortB_PullResCfg;
|
||||
gpio_state.PortC_PullResCfg = SYSTEM->PortC_PullResCfg;
|
||||
gpio_state.PortD_PullResCfg = SYSTEM->PortD_PullResCfg;
|
||||
|
||||
gpio_state.PortA_DriveCfg = SYSTEM->PortA_DriveCfg;
|
||||
gpio_state.PortB_DriveCfg = SYSTEM->PortB_DriveCfg;
|
||||
gpio_state.PortC_DriveCfg = SYSTEM->PortC_DriveCfg;
|
||||
gpio_state.PortD_DriveCfg = SYSTEM->PortD_DriveCfg;
|
||||
|
||||
gpio_state.PortA_L_FuncMux = SYSTEM->PortA_L_FuncMux;
|
||||
gpio_state.PortA_H_FuncMux = SYSTEM->PortA_H_FuncMux;
|
||||
gpio_state.PortB_L_FuncMux = SYSTEM->PortB_L_FuncMux;
|
||||
gpio_state.PortB_H_FuncMux = SYSTEM->PortB_H_FuncMux;
|
||||
gpio_state.PortC_L_FuncMux = SYSTEM->PortC_L_FuncMux;
|
||||
gpio_state.PortC_H_FuncMux = SYSTEM->PortC_H_FuncMux;
|
||||
gpio_state.PortD_L_FuncMux = SYSTEM->PortD_L_FuncMux;
|
||||
gpio_state.PortD_H_FuncMux = SYSTEM->PortD_H_FuncMux;
|
||||
|
||||
gpio_state.QSPI_PullSelect = SYSTEM->QspiPadConfig.QSPI_PullSelect;
|
||||
gpio_state.QSPI_PullEN = SYSTEM->QspiPadConfig.QSPI_PullEN;
|
||||
gpio_state.OSPI_PullSelect = SYSTEM->OspiPadConfig.OSPI_PullSelect;
|
||||
gpio_state.OSPI_PullEN = SYSTEM->OspiPadConfig.OSPI_PullEN;
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_GPIOD_CLK_ENABLE();
|
||||
|
||||
gpio_state.GPIOA_OutputEN = GPIOA->GPIO_OutputEN;
|
||||
gpio_state.GPIOA_OUT_DATA = GPIOA->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOA_EXTI_EN = GPIOA->EXTI_EN;
|
||||
gpio_state.GPIOA_EXTI_INT_EN= GPIOA->EXTI_INT_EN;
|
||||
gpio_state.GPIOA_EXTI_TYPE = GPIOA->EXTI_TYPE;
|
||||
gpio_state.GPIOB_OutputEN = GPIOB->GPIO_OutputEN;
|
||||
gpio_state.GPIOB_OUT_DATA = GPIOB->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOB_EXTI_EN = GPIOB->EXTI_EN;
|
||||
gpio_state.GPIOB_EXTI_INT_EN= GPIOB->EXTI_INT_EN;
|
||||
gpio_state.GPIOB_EXTI_TYPE = GPIOB->EXTI_TYPE;
|
||||
gpio_state.GPIOC_OutputEN = GPIOC->GPIO_OutputEN;
|
||||
gpio_state.GPIOC_OUT_DATA = GPIOC->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOC_EXTI_EN = GPIOC->EXTI_EN;
|
||||
gpio_state.GPIOC_EXTI_INT_EN= GPIOC->EXTI_INT_EN;
|
||||
gpio_state.GPIOC_EXTI_TYPE = GPIOC->EXTI_TYPE;
|
||||
gpio_state.GPIOD_OutputEN = GPIOD->GPIO_OutputEN;
|
||||
gpio_state.GPIOD_OUT_DATA = GPIOD->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOD_EXTI_EN = GPIOD->EXTI_EN;
|
||||
gpio_state.GPIOD_EXTI_INT_EN= GPIOD->EXTI_INT_EN;
|
||||
gpio_state.GPIOD_EXTI_TYPE = GPIOD->EXTI_TYPE;
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_gpio_restore(void)
|
||||
{
|
||||
SYSTEM->PortA_PullEN = gpio_state.PortA_PullEN;
|
||||
SYSTEM->PortB_PullEN = gpio_state.PortB_PullEN;
|
||||
SYSTEM->PortC_PullEN = gpio_state.PortC_PullEN;
|
||||
SYSTEM->PortD_PullEN = gpio_state.PortD_PullEN;
|
||||
|
||||
SYSTEM->PortA_PullSelect = gpio_state.PortA_PullSelect;
|
||||
SYSTEM->PortB_PullSelect = gpio_state.PortB_PullSelect;
|
||||
SYSTEM->PortC_PullSelect = gpio_state.PortC_PullSelect;
|
||||
SYSTEM->PortD_PullSelect = gpio_state.PortD_PullSelect;
|
||||
|
||||
SYSTEM->PortA_PullResCfg = gpio_state.PortA_PullResCfg;
|
||||
SYSTEM->PortB_PullResCfg = gpio_state.PortB_PullResCfg;
|
||||
SYSTEM->PortC_PullResCfg = gpio_state.PortC_PullResCfg;
|
||||
SYSTEM->PortD_PullResCfg = gpio_state.PortD_PullResCfg;
|
||||
|
||||
SYSTEM->PortA_DriveCfg = gpio_state.PortA_DriveCfg;
|
||||
SYSTEM->PortB_DriveCfg = gpio_state.PortB_DriveCfg;
|
||||
SYSTEM->PortC_DriveCfg = gpio_state.PortC_DriveCfg;
|
||||
SYSTEM->PortD_DriveCfg = gpio_state.PortD_DriveCfg;
|
||||
|
||||
SYSTEM->PortA_L_FuncMux = gpio_state.PortA_L_FuncMux;
|
||||
SYSTEM->PortA_H_FuncMux = gpio_state.PortA_H_FuncMux;
|
||||
SYSTEM->PortB_L_FuncMux = gpio_state.PortB_L_FuncMux;
|
||||
SYSTEM->PortB_H_FuncMux = gpio_state.PortB_H_FuncMux;
|
||||
SYSTEM->PortC_L_FuncMux = gpio_state.PortC_L_FuncMux;
|
||||
SYSTEM->PortC_H_FuncMux = gpio_state.PortC_H_FuncMux;
|
||||
SYSTEM->PortD_L_FuncMux = gpio_state.PortD_L_FuncMux;
|
||||
SYSTEM->PortD_H_FuncMux = gpio_state.PortD_H_FuncMux;
|
||||
|
||||
SYSTEM->QspiPadConfig.QSPI_PullSelect = gpio_state.QSPI_PullSelect;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = gpio_state.QSPI_PullEN;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullSelect = gpio_state.OSPI_PullSelect;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullEN = gpio_state.OSPI_PullEN;
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_GPIOD_CLK_ENABLE();
|
||||
|
||||
GPIOA->GPIO_OutputEN = gpio_state.GPIOA_OutputEN;
|
||||
GPIOA->GPIO_OUT_DATA = gpio_state.GPIOA_OUT_DATA;
|
||||
GPIOA->EXTI_EN = gpio_state.GPIOA_EXTI_EN;
|
||||
GPIOA->EXTI_INT_EN = gpio_state.GPIOA_EXTI_INT_EN;
|
||||
GPIOA->EXTI_TYPE = gpio_state.GPIOA_EXTI_TYPE;
|
||||
GPIOB->GPIO_OutputEN = gpio_state.GPIOB_OutputEN;
|
||||
GPIOB->GPIO_OUT_DATA = gpio_state.GPIOB_OUT_DATA;
|
||||
GPIOB->EXTI_EN = gpio_state.GPIOB_EXTI_EN;
|
||||
GPIOB->EXTI_INT_EN = gpio_state.GPIOB_EXTI_INT_EN;
|
||||
GPIOB->EXTI_TYPE = gpio_state.GPIOB_EXTI_TYPE;
|
||||
GPIOC->GPIO_OutputEN = gpio_state.GPIOC_OutputEN;
|
||||
GPIOC->GPIO_OUT_DATA = gpio_state.GPIOC_OUT_DATA;
|
||||
GPIOC->EXTI_EN = gpio_state.GPIOC_EXTI_EN;
|
||||
GPIOC->EXTI_INT_EN = gpio_state.GPIOC_EXTI_INT_EN;
|
||||
GPIOC->EXTI_TYPE = gpio_state.GPIOC_EXTI_TYPE;
|
||||
GPIOD->GPIO_OutputEN = gpio_state.GPIOD_OutputEN;
|
||||
GPIOD->GPIO_OUT_DATA = gpio_state.GPIOD_OUT_DATA;
|
||||
GPIOD->EXTI_EN = gpio_state.GPIOD_EXTI_EN;
|
||||
GPIOD->EXTI_INT_EN = gpio_state.GPIOD_EXTI_INT_EN;
|
||||
GPIOD->EXTI_TYPE = gpio_state.GPIOD_EXTI_TYPE;
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_clock_init(void)
|
||||
{
|
||||
System_ClkConfig_t sys_clk_cfg;
|
||||
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_N = 8;
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_M = 0;
|
||||
sys_clk_cfg.AUPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_N = 10;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_M = 0;
|
||||
sys_clk_cfg.SPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.MCU_Clock_Source = MCU_CLK_SEL_SPLL_CLK;
|
||||
sys_clk_cfg.SOC_DIV = 1;
|
||||
sys_clk_cfg.MCU_DIV = 1;
|
||||
sys_clk_cfg.APB0_DIV = 1;
|
||||
sys_clk_cfg.APB1_DIV = 1;
|
||||
sys_clk_cfg.APB2_DIV = 1;
|
||||
sys_clk_cfg.APB3_DIV = 1;
|
||||
System_AUPLL_config(&sys_clk_cfg.AUPLL_CFG, 1000);
|
||||
System_SPLL_config(&sys_clk_cfg.SPLL_CFG, 1000);
|
||||
System_MCU_clock_Config(&sys_clk_cfg);
|
||||
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_I2C_CLK_SELECT_SPLL();
|
||||
__SYSTEM_BLEND_CLK_SELECT_SPLL();
|
||||
__SYSTEM_UART_CLK_SELECT_SPLL();
|
||||
}
|
27
MCU/examples/application/bootloader/src/app_hw.h
Normal file
27
MCU/examples/application/bootloader/src/app_hw.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __APP_HW_H__
|
||||
#define __APP_HW_H__
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
extern UART_HandleTypeDef uart_log_handle;
|
||||
extern DMA_HandleTypeDef dma_display_handle;
|
||||
extern SPI_HandleTypeDef spi_display_handle;
|
||||
extern I2C_HandleTypeDef i2c_touchpad_handle;
|
||||
extern SPI_HandleTypeDef spi_flash_handle;
|
||||
extern DMA_HandleTypeDef dma_flash_handle;
|
||||
|
||||
void hw_log_init(bool wake_up);
|
||||
void hw_display_init(bool wake_up);
|
||||
void hw_touchpad_init(bool wake_up);
|
||||
void hw_external_flash_init(bool wake_up);
|
||||
void hw_xip_flash_init(bool wake_up);
|
||||
void hw_dsp_xip_flash_init(bool wake_up);
|
||||
|
||||
void hw_clock_init(void);
|
||||
|
||||
void hw_gpio_save(void);
|
||||
void hw_gpio_restore(void);
|
||||
|
||||
void hw_dsp_restore(void);
|
||||
|
||||
#endif // __APP_HW_H__
|
1149
MCU/examples/application/bootloader/src/app_ota.c
Normal file
1149
MCU/examples/application/bootloader/src/app_ota.c
Normal file
File diff suppressed because it is too large
Load Diff
442
MCU/examples/application/bootloader/src/app_ota_service.c
Normal file
442
MCU/examples/application/bootloader/src/app_ota_service.c
Normal file
@ -0,0 +1,442 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
|
||||
#include "app_ota_service.h"
|
||||
#include "app_ota.h"
|
||||
|
||||
/******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (<28>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
static const uint8_t ota_svc_uuid[UUID_SIZE_16] = OTA_SVC_UUID;
|
||||
static uint8_t ota_svc_id = 0;
|
||||
static bool ota_link_ntf_enable = false;
|
||||
static TimerHandle_t xTimer_OtaAdvTimerOut = NULL;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
static void app_ble_start_advertising(void);
|
||||
|
||||
static char local_device_name[] = "Smart Watch";
|
||||
adv_handle ota_adv;
|
||||
extern uint8_t ble_static_addr[];
|
||||
|
||||
/*
|
||||
* Advertising data, max size is 28 bytes
|
||||
*/
|
||||
static uint8_t adv_data[] = {
|
||||
|
||||
/* local device name information */
|
||||
0x0C, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'S','m','a','r','t',' ','W','a','t','c','h', //value.local device name
|
||||
|
||||
0x09, // addr mac
|
||||
GAP_ADVTYPE_MANUFACTURER_SPECIFIC,
|
||||
LO_UINT16(0x1671),
|
||||
HI_UINT16(0x1671),
|
||||
0xc2,0x12,0x12,0x12,0x00,0x13,
|
||||
|
||||
0x03, // length of this data
|
||||
GAP_ADVTYPE_APPEARANCE,
|
||||
LO_UINT16(0x03c0),
|
||||
HI_UINT16(0x03c0),
|
||||
|
||||
|
||||
};
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
// printf("gap_callback: type = %d\r\n", event->type);
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
struct gap_link_param_update_req req;
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
gatt_mtu_exchange_req(ota_svc_id, event->param.connect.conidx, 247);
|
||||
req.conidx = event->param.connect.conidx;
|
||||
req.intv_max = 12;
|
||||
req.intv_min = 12;
|
||||
req.latency = 0;
|
||||
req.time_out = 500;
|
||||
gap_param_update_req(&req);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* @fn adv_timeout_callback
|
||||
*
|
||||
* @brief
|
||||
*/
|
||||
void adv_timeout_callback(TimerHandle_t timer)
|
||||
{
|
||||
check_file_integrity();
|
||||
}
|
||||
|
||||
void adv_timeout_TimerStop(void)
|
||||
{
|
||||
xTimerStop(xTimer_OtaAdvTimerOut,0);
|
||||
}
|
||||
static void app_ble_start_advertising(void)
|
||||
{
|
||||
/* creat a handle of advertising*/
|
||||
ota_adv = gap_adv_create();
|
||||
|
||||
gap_adv_param_t adv_param = {
|
||||
.own_addr_type = GAP_ADDR_TYPE_STATIC, //own address type
|
||||
.adv_mode = GAP_ADV_MODE_UNDIRECT,
|
||||
.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC,
|
||||
.adv_chnl_map = GAP_ADV_CHAN_ALL,
|
||||
.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY, //Policy for filtering scanning or connection requests from peer devices
|
||||
.phy_mode = GAP_PHY_TYPE_LE_1M,
|
||||
.adv_intv_min = 32, //advertising min interval, in unit of 0.625ms
|
||||
.adv_intv_max = 32, //advertising max interval, in unit of 0.625ms
|
||||
};
|
||||
|
||||
/* set advertising param */
|
||||
gap_adv_set_param(ota_adv, &adv_param);
|
||||
/* set advertising data */
|
||||
|
||||
adv_data[17] = ble_static_addr[5];
|
||||
adv_data[18] = ble_static_addr[4];
|
||||
adv_data[19] = ble_static_addr[3];
|
||||
adv_data[20] = ble_static_addr[2];
|
||||
adv_data[21] = ble_static_addr[1];
|
||||
adv_data[22] = ble_static_addr[0];
|
||||
|
||||
gap_adv_set_adv_data(ota_adv, adv_data, sizeof(adv_data));
|
||||
/* start sadvertising */
|
||||
gap_adv_start(ota_adv, 0, 0);
|
||||
}
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
printf("app_ble_init\r\n");
|
||||
|
||||
/* set GAP event callback*/
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
/* set security param */
|
||||
struct gap_security_param smp_param;
|
||||
smp_param.mitm = true;
|
||||
smp_param.secure_connection = false;
|
||||
smp_param.bond = true;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
gap_security_param_init(&smp_param);
|
||||
/*start ota adv 1 min*/
|
||||
ota_gatt_add_service();
|
||||
/*ota adv timeout*/
|
||||
xTimer_OtaAdvTimerOut = xTimerCreate("ota_adv",OTA_ADV_TIMEOUT/portTICK_PERIOD_MS,pdFALSE,NULL,adv_timeout_callback);
|
||||
xTimerStart(xTimer_OtaAdvTimerOut,0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Profile Attributes - Table
|
||||
* ÿһ<C3BF><EFBFBD><EEB6BC>һ<EFBFBD><D2BB>attribute<74>Ķ<EFBFBD><C4B6>塣
|
||||
* <20><>һ<EFBFBD><D2BB>attributeΪService <20>ĵĶ<C4B5><C4B6>塣
|
||||
* ÿһ<C3BF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ(characteristic)<29>Ķ<EFBFBD><C4B6>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD>ٰ<EFBFBD><D9B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>attribute<74>Ķ<EFBFBD><C4B6>壻
|
||||
* 1. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>(Characteristic Declaration)
|
||||
* 2. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ֵ(Characteristic value)
|
||||
* 3. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Characteristic description)
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>notification <20><><EFBFBD><EFBFBD>indication <20>Ĺ<EFBFBD><C4B9>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>attribute<74>Ķ<EFBFBD><C4B6>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD>ǰ<EFBFBD>涨<EFBFBD><E6B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(client characteristic configuration)<29><>
|
||||
*
|
||||
*/
|
||||
const gatt_attribute_t ota_svc_att_table[OTA_ATT_NB] =
|
||||
{
|
||||
// Update Over The AIR Service Declaration
|
||||
[OTA_ATT_IDX_SERVICE] = { { UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) },
|
||||
GATT_PROP_READ,UUID_SIZE_16, (uint8_t *)ota_svc_uuid
|
||||
},
|
||||
|
||||
// OTA Information Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO]= { { UUID_SIZE_16, OTA_CHAR_UUID_VERSION_INFO },
|
||||
GATT_PROP_READ, sizeof(uint16_t), NULL
|
||||
},
|
||||
|
||||
// Notify Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ,0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_NOTI] = { { UUID_SIZE_16, OTA_CHAR_UUID_NOTI },
|
||||
GATT_PROP_READ | GATT_PROP_NOTI, OTAS_NOTIFY_DATA_SIZE, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_CFG_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) },
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, 0,0
|
||||
},
|
||||
[OTA_IDX_CHAR_USER_DESCRIPTION_NOTI]= { { UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) },
|
||||
GATT_PROP_READ, 12, NULL
|
||||
},
|
||||
|
||||
// Tx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_TX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_TX] = { { UUID_SIZE_16, OTA_CHAR_UUID_TX },
|
||||
GATT_PROP_READ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
|
||||
// Rx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_RX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_RX] = { { UUID_SIZE_16, OTA_CHAR_UUID_RX },
|
||||
GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
};
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_msg_handler
|
||||
*
|
||||
* @brief Ota Profile callback funtion for GATT messages. GATT read/write
|
||||
* operations are handeled here.
|
||||
*
|
||||
* @param gatt_msg -GATT messages from GATT layer.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static uint16_t ota_gatt_msg_handler(struct gatt_msg *p_msg)
|
||||
{
|
||||
switch(p_msg->msg_evt)
|
||||
{
|
||||
case GATTS_MSG_READ_REQ:
|
||||
if(p_msg->att_idx == OTA_IDX_CHAR_USER_DESCRIPTION_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "OTA Response", strlen("OTA Response"));
|
||||
return strlen("OTA Response");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "ntf_enable", strlen("ntf_enable"));
|
||||
return strlen("ntf_enable");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_TX)
|
||||
{
|
||||
return app_otas_read_data(p_msg->param.gatt_data.p_msg_data);
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO) //get version
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "\x00\x01", strlen("\x00\x01"));
|
||||
return strlen("\x00\x01");
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
if(p_msg->att_idx == OTA_ATT_IDX_CHAR_CFG_NOTI)
|
||||
{
|
||||
|
||||
if(*(uint16_t *)p_msg->param.gatt_data.p_msg_data == 0x1)
|
||||
{
|
||||
printf("true\r\n");
|
||||
ota_link_ntf_enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("false\r\n");
|
||||
ota_link_ntf_enable = false;
|
||||
}
|
||||
}
|
||||
else if(p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_RX)
|
||||
{
|
||||
app_otas_recv_data(p_msg->conn_idx,p_msg->param.gatt_data.p_msg_data,p_msg->param.gatt_data.msg_len);
|
||||
}
|
||||
break;
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
|
||||
break;
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
ota_init();
|
||||
break;
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
ota_deinit();
|
||||
ota_link_ntf_enable = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_report_notify
|
||||
*
|
||||
* @brief Send ota protocol response data.
|
||||
*
|
||||
*
|
||||
* @param conidx - report idx of the hid_rpt_info array.
|
||||
* p_data - data of the Ota information to be sent.
|
||||
* len - length of the HID information data.
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len)
|
||||
{
|
||||
if (ota_link_ntf_enable)
|
||||
{
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = conidx;
|
||||
ntf.svc_id = ota_svc_id;
|
||||
ntf.att_idx = OTA_ATT_IDX_CHAR_VALUE_NOTI;
|
||||
ntf.data_len = len;
|
||||
ntf.p_data = p_data;
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_add_service
|
||||
*
|
||||
* @brief Ota Profile add GATT service function.
|
||||
* <20><><EFBFBD><EFBFBD>GATT service<63><65>ATT<54><54><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>档
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void ota_gatt_add_service(void)
|
||||
{
|
||||
gatt_service_t ota_profie_svc;
|
||||
ota_profie_svc.p_att_tb = ota_svc_att_table;
|
||||
ota_profie_svc.att_nb = OTA_ATT_NB;
|
||||
ota_profie_svc.gatt_msg_handler = ota_gatt_msg_handler;
|
||||
|
||||
ota_svc_id = gatt_add_service(&ota_profie_svc);
|
||||
}
|
||||
|
242
MCU/examples/application/bootloader/src/app_task.c
Normal file
242
MCU/examples/application/bootloader/src/app_task.c
Normal file
@ -0,0 +1,242 @@
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_config.h"
|
||||
#include "app_hw.h"
|
||||
#include "driver_display.h"
|
||||
#include "IC_W25Qxx.h"
|
||||
|
||||
static struct co_list event_list;
|
||||
|
||||
extern TaskHandle_t app_task_handle;
|
||||
|
||||
void hci_controller_read(void);
|
||||
void hci_host_read(void);
|
||||
static void iwdt_task(void *arg);
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
#define LCD_HOR_SIZE (466)
|
||||
#define LCD_VER_SIZE (466)
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
#if 0 //DISPLAY_TYPE_ICNA3310
|
||||
#define LCD_HOR_SIZE (466)
|
||||
#define LCD_VER_SIZE (466)
|
||||
#else
|
||||
#define LCD_HOR_SIZE (368)
|
||||
#define LCD_VER_SIZE (448)
|
||||
#endif
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
#define LCD_HOR_SIZE (368)
|
||||
#define LCD_VER_SIZE (448)
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
#define LV_COLOR_DEPTH 16
|
||||
|
||||
#define LV_HOR_RES_MAX (368)
|
||||
#define LV_VER_RES_MAX (448)
|
||||
#if (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) & 0x01)
|
||||
#define HOR_OFFSET (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) + 0x01)
|
||||
#else
|
||||
#define HOR_OFFSET (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) + 0x00)
|
||||
#endif
|
||||
#if (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) & 0x01)
|
||||
#define VER_OFFSET (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) + 0x01)
|
||||
#else
|
||||
#define VER_OFFSET (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) + 0x00)
|
||||
#endif
|
||||
|
||||
#define DISPLAY_BUFFER_SIZE LV_HOR_RES_MAX*LV_VER_RES_MAX*LV_COLOR_DEPTH/8/sizeof(uint32_t)
|
||||
|
||||
static uint32_t display_framebuffer[DISPLAY_BUFFER_SIZE];
|
||||
|
||||
typedef int16_t lv_coord_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t x1;
|
||||
lv_coord_t y1;
|
||||
lv_coord_t x2;
|
||||
lv_coord_t y2;
|
||||
} lv_area_t;
|
||||
|
||||
lv_area_t panel_win_area;
|
||||
|
||||
|
||||
void dma1_irq(void)
|
||||
{
|
||||
if (dma_get_tfr_Status(&dma_display_handle)) {
|
||||
display_update_dma_isr();
|
||||
|
||||
printf("dma end!");
|
||||
|
||||
//display_dma_ongoing = false;
|
||||
//my_disp_flush_done();
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_DISPLAY_ONGOING);
|
||||
}
|
||||
}
|
||||
|
||||
void dma0_irq(void)
|
||||
{
|
||||
IC_W25Qxx_DMA_Interrupt();
|
||||
}
|
||||
|
||||
void spimx8_1_irq(void)
|
||||
{
|
||||
IC_W25Qxx_Spi_Interrupt();
|
||||
}
|
||||
|
||||
const int color_table[] =
|
||||
{
|
||||
0xf800f800,
|
||||
0x07E007E0,
|
||||
0x001F001F,
|
||||
0x0,
|
||||
0xF81FF81F,
|
||||
0x07FF07FF,
|
||||
0xFFEFFFE0,
|
||||
0xFFFFFFFF,
|
||||
};
|
||||
|
||||
|
||||
static int color_id = 0;
|
||||
|
||||
void panel_disp_update(void)
|
||||
{
|
||||
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_DISPLAY_ONGOING);
|
||||
//memset(display_framebuffer,0xf800f800,sizeof(display_framebuffer));
|
||||
for(int i = 0; i < DISPLAY_BUFFER_SIZE; i++)
|
||||
{
|
||||
display_framebuffer[i] = color_table[color_id];
|
||||
}
|
||||
|
||||
color_id ++;
|
||||
color_id %= 8;
|
||||
|
||||
panel_win_area.x1 = 0;
|
||||
panel_win_area.x2 = LV_HOR_RES_MAX -1;
|
||||
panel_win_area.y1 = 0;
|
||||
panel_win_area.y2 = LV_VER_RES_MAX -1;
|
||||
|
||||
display_set_window(HOR_OFFSET+panel_win_area.x1,
|
||||
HOR_OFFSET+panel_win_area.x2,
|
||||
VER_OFFSET+panel_win_area.y1,
|
||||
VER_OFFSET+panel_win_area.y2);
|
||||
|
||||
display_update_dma((panel_win_area.x2+1-panel_win_area.x1)*(panel_win_area.y2+1-panel_win_area.y1), 16, (void *)display_framebuffer);
|
||||
}
|
||||
|
||||
|
||||
static void app_task_event_handler(void)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
vTaskSuspendAll();
|
||||
event = (struct app_task_event *)co_list_pop_front(&event_list);
|
||||
xTaskResumeAll();
|
||||
|
||||
if(event) {
|
||||
switch(event->event_type) {
|
||||
case APP_TASK_EVENT_AT_CMD:
|
||||
app_at_cmd_recv_handler(event->param, event->param_len);
|
||||
break;
|
||||
case APP_TASK_EVENT_HOST_INITED:
|
||||
app_btdm_start();
|
||||
xTaskCreate(iwdt_task, "idwt_task", 128, NULL, APP_TASK_PRIORITY-1, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
vPortFree((void *)event);
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high)
|
||||
{
|
||||
uint32_t old_basepri;
|
||||
|
||||
if(xPortIsInsideInterrupt()) {
|
||||
old_basepri = taskENTER_CRITICAL_FROM_ISR();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL_FROM_ISR(old_basepri);
|
||||
vTaskNotifyGiveFromISR(app_task_handle, NULL);
|
||||
}
|
||||
else {
|
||||
taskENTER_CRITICAL();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
xTaskNotifyGive(app_task_handle);
|
||||
}
|
||||
}
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
while(event == NULL) {
|
||||
event = pvPortMalloc(sizeof(struct app_task_event) + param_len);
|
||||
if (event == NULL) {
|
||||
if (block) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event->event_type = event_type;
|
||||
event->param_len = param_len;
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static void app_task(void *arg)
|
||||
{
|
||||
co_list_init(&event_list);
|
||||
|
||||
app_btdm_init();
|
||||
while(1) {
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
app_task_event_handler();
|
||||
}
|
||||
}
|
||||
|
||||
static void iwdt_task(void *arg)
|
||||
{
|
||||
printf("iwdt task!\n");
|
||||
|
||||
/* reinit external flash */
|
||||
hw_external_flash_init(false);
|
||||
|
||||
hw_display_init(false);
|
||||
hw_touchpad_init(false);
|
||||
|
||||
while(1) {
|
||||
vTaskDelay(2000);
|
||||
iwdt_Refresh();
|
||||
panel_disp_update();
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_init(void)
|
||||
{
|
||||
|
||||
xTaskCreate(app_task, "app", APP_TASK_STACK_SIZE, NULL, APP_TASK_PRIORITY, &app_task_handle);
|
||||
}
|
381
MCU/examples/application/bootloader/src/controller.c
Normal file
381
MCU/examples/application/bootloader/src/controller.c
Normal file
@ -0,0 +1,381 @@
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#include "SWD.h"
|
||||
#include "fdb_app.h"
|
||||
|
||||
#include "controller.h"
|
||||
|
||||
//#define CONTROLLER_CODE_SPLIT
|
||||
|
||||
#define HCI_UART UART0
|
||||
#define HCI_UART_IRQn UART0_IRQn
|
||||
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
#define CODE_EXEC_BASE_ADDR 0x1FFFA000
|
||||
|
||||
extern uint8_t CODE_BASE, CODE_END;
|
||||
#else
|
||||
#define CODE_EXEC_L_BASE_ADDR 0x1FFF8000
|
||||
#define CODE_EXEC_H_BASE_ADDR_P1 0x20008700
|
||||
//#define CODE_EXEC_H_BASE_ADDR_P2 0x20008700
|
||||
|
||||
extern uint8_t CODE_L_BASE, CODE_L_END;
|
||||
extern uint8_t CODE_H_BASE, CODE_H_END;
|
||||
#endif
|
||||
|
||||
#define CONTROLLER_PARAM_DUMMY 0x00
|
||||
#define CONTROLLER_PARAM_BAUDRATE 0x01
|
||||
#define CONTROLLER_PARAM_KEY 0x02
|
||||
#define CONTROLLER_PARAM_BT_ADDR 0x03
|
||||
#define CONTROLLER_PARAM_BLE_ADDR 0x04
|
||||
|
||||
const uint8_t app_boot_conn_req[] = {'f','r','e','q','c','h','i','p'};//from embedded to pc, request
|
||||
const uint8_t app_boot_conn_ack[] = {'F','R','1','0','1','0','O','K'};//from pc to embedded,ack
|
||||
const uint8_t app_boot_conn_success[] = {'o','k'};
|
||||
|
||||
const uint8_t controller_param_header[] = {'f', 'r', 'e', 'q'};
|
||||
const uint8_t controller_param_tail[] = {'c', 'h', 'i', 'p'};
|
||||
|
||||
///default feature
|
||||
//static uint8_t bt_feature_param[] = {
|
||||
// 0x41,0x08,
|
||||
// 0xaf,0x2a,0x4d,0xde,0xc3,0x2f,0x5b,0x87,
|
||||
//};
|
||||
static uint8_t btdm_internal_param[] = {
|
||||
///bt_feature:disable 3M(Byte3,bit3),0xde->0xda
|
||||
0x41,0x08,
|
||||
0xaf,0x2a,0x4d,0xda,0xc3,0x2f,0x5b,0x87,
|
||||
///to add
|
||||
|
||||
};
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef HCI_handle;
|
||||
|
||||
/************************************************************************************
|
||||
* @fn controller_start
|
||||
*
|
||||
* @brief Initializes bluetooth controller.
|
||||
*
|
||||
* @param baudrate: uart baudrate of HCI
|
||||
* ble_addr: ble public address
|
||||
* bt_addr: bt address
|
||||
*/
|
||||
bool controller_start(uint32_t baudrate, const uint8_t *ble_addr, const uint8_t *bt_addr)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
uint8_t buffer[8];
|
||||
uint32_t length;
|
||||
uint8_t *src, *dst;
|
||||
uint16_t tx_length;
|
||||
uint8_t opcode, param_type;
|
||||
|
||||
/* configure PA0, PA1, PA2, PA3 to UART0 function */
|
||||
gpio_config.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART0_CLK_ENABLE();
|
||||
HCI_handle.UARTx = HCI_UART;
|
||||
HCI_handle.Init.BaudRate = 115200;
|
||||
HCI_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
HCI_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
HCI_handle.Init.Parity = UART_PARITY_NONE;
|
||||
HCI_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
HCI_handle.TxCpltCallback = NULL;
|
||||
HCI_handle.RxCpltCallback = NULL;
|
||||
uart_init(&HCI_handle);
|
||||
/* keep RTS is inactive before HCI is ready */
|
||||
__UART_AUTO_FLOW_CONTROL_DISABLE(HCI_handle.UARTx);
|
||||
__UART_RTS_INACTIVE(HCI_handle.UARTx);
|
||||
|
||||
/* reset controller */
|
||||
/* configure PA15 GPIO function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_15, 0);
|
||||
system_delay_us(3000);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_15, 1);
|
||||
|
||||
/* change PA15 to input mode, used to avoid current leakage */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Pull = GPIO_NOPULL;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
/* hand shake with controller */
|
||||
uart_receive(&HCI_handle, buffer, 8);
|
||||
while (memcmp(buffer, app_boot_conn_req, 8)) {
|
||||
memcpy(&buffer[0], &buffer[1], 7);
|
||||
uart_receive(&HCI_handle, &buffer[7], 1);
|
||||
}
|
||||
|
||||
uart_transmit(&HCI_handle, (void *)app_boot_conn_ack, 8);
|
||||
uart_receive(&HCI_handle, buffer, 2);
|
||||
if (memcmp(buffer, app_boot_conn_success, 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* SWD Enable RAM */
|
||||
SWD_W_SystemReg();
|
||||
|
||||
/* change uart baudrate */
|
||||
opcode = 0x12;
|
||||
buffer[0] = 11; // 921600
|
||||
buffer[1] = 0;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
buffer[4] = 0;
|
||||
buffer[5] = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&buffer, 6);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x13) {
|
||||
return false;
|
||||
}
|
||||
HCI_handle.Init.BaudRate = 921600;
|
||||
uart_config_baudRate(&HCI_handle);
|
||||
system_delay_us(5000);
|
||||
|
||||
/* write code into RAM */
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_BASE;
|
||||
dst = (void *)CODE_EXEC_BASE_ADDR;
|
||||
length = (uint32_t)&CODE_END - (uint32_t)&CODE_BASE;
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
#else
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_L_BASE;
|
||||
dst = (void *)CODE_EXEC_L_BASE_ADDR;
|
||||
length = (uint32_t)&CODE_L_END - (uint32_t)&CODE_L_BASE;
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
|
||||
// opcode = 0x04;
|
||||
// src = (void *)&CODE_H_BASE;
|
||||
// dst = (void *)CODE_EXEC_H_BASE_ADDR_P2;
|
||||
// length = (uint32_t)&CODE_H_END - (uint32_t)&CODE_H_BASE;
|
||||
// if (length > (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1)) {
|
||||
// length -= (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// src += (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// }
|
||||
// else {
|
||||
// length = 0;
|
||||
// }
|
||||
// while (length) {
|
||||
// tx_length = length > 256 ? 256 : length;
|
||||
// uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
// uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
// uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
// uart_transmit(&HCI_handle, src, tx_length);
|
||||
//
|
||||
// uart_receive(&HCI_handle, buffer, 7);
|
||||
// if (buffer[0] != 0x05) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// length -= tx_length;
|
||||
// src += tx_length;
|
||||
// dst += tx_length;
|
||||
// }
|
||||
#endif
|
||||
|
||||
/* write parameters to exchange memory */
|
||||
opcode = 0x04;
|
||||
dst = (void *)0x40014000;
|
||||
/* write header to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(controller_param_header);
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&controller_param_header[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write baudrate to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(baudrate) + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BAUDRATE;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = sizeof(baudrate);
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&baudrate, length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write keys to remote device */
|
||||
length = flashdb_get_length(FDB_KEY_CONTROLLER_INFO) + sizeof(btdm_internal_param);
|
||||
if (length) {
|
||||
uint8_t *tmp = pvPortMalloc(length);
|
||||
uint16_t sub_length = length;
|
||||
uint16_t key_len = length - sizeof(btdm_internal_param);
|
||||
if(key_len){
|
||||
flashdb_get(FDB_KEY_CONTROLLER_INFO, tmp, key_len);
|
||||
memcpy(&tmp[key_len],btdm_internal_param,sizeof(btdm_internal_param));
|
||||
}
|
||||
else{
|
||||
memcpy(&tmp[0],btdm_internal_param,sizeof(btdm_internal_param));
|
||||
}
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
|
||||
length = sub_length + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_KEY;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = sub_length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&tmp[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
vPortFree(tmp);
|
||||
return false;
|
||||
}
|
||||
vPortFree(tmp);
|
||||
}
|
||||
/* write bt address to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = 6 + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BT_ADDR;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = 6;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&bt_addr[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write parameter to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = 6 + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BLE_ADDR;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = 6;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&ble_addr[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write tail to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(controller_param_tail);
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&controller_param_tail[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* boot from RAM */
|
||||
opcode = 0x2b;
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
dst = (void *)CODE_EXEC_BASE_ADDR;
|
||||
#else
|
||||
dst = (void *)CODE_EXEC_L_BASE_ADDR;
|
||||
#endif
|
||||
tx_length = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x2c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONTROLLER_CODE_SPLIT
|
||||
system_delay_us(50000);
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_H_BASE;
|
||||
dst = (void *)CODE_EXEC_H_BASE_ADDR_P1;
|
||||
length = (uint32_t)&CODE_H_END - (uint32_t)&CODE_H_BASE;
|
||||
// if (length > (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1)) {
|
||||
// length = (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// }
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
|
||||
/* disconnect */
|
||||
opcode = 0x10;
|
||||
dst = (void *)1; /* normal disconnect */
|
||||
tx_length = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x11) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
363
MCU/examples/application/bootloader/src/main.c
Normal file
363
MCU/examples/application/bootloader/src/main.c
Normal file
@ -0,0 +1,363 @@
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
#include "driver_pmu_iwdt.h"
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "fdb_app.h"
|
||||
#include "host.h"
|
||||
|
||||
#include "app_task.h"
|
||||
#include "app_at.h"
|
||||
#include "app_ota.h"
|
||||
#include "driver_timer.h"
|
||||
#include "app_hw.h"
|
||||
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef Uart3_handle;
|
||||
static CALI_HandleTypeDef cali_handle;
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* FreeRTOS running status monitor task */
|
||||
static TaskHandle_t monitor_task_handle;
|
||||
volatile unsigned int CPU_RunTime;
|
||||
static uint8_t CPU_RunInfo[2048];
|
||||
#endif
|
||||
|
||||
/* APP task */
|
||||
TaskHandle_t app_task_handle;
|
||||
|
||||
void controller_start(void);
|
||||
void host_start(void);
|
||||
|
||||
int fputc(int c, FILE *fp)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
static void monitor_task(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
vTaskDelay(2000000);
|
||||
|
||||
memset(CPU_RunInfo,0,2048);
|
||||
vTaskList((char *)&CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
printf("name state priority stack seq\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
|
||||
memset(CPU_RunInfo,0,400);
|
||||
vTaskGetRunTimeStats((char *)&CPU_RunInfo);
|
||||
printf("name counter usage\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
void vApplicationTickHook(void)
|
||||
{
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
CPU_RunTime++;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cali_done_handle(CALI_HandleTypeDef *hcali, uint32_t result)
|
||||
{
|
||||
system_set_LPRCCLK(cali_calc_rc_freq(hcali, result));
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
}
|
||||
|
||||
__RAM_CODE bool user_deep_sleep_check(void)
|
||||
{
|
||||
return host_before_sleep_check();
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_before_sleep(void)
|
||||
{
|
||||
ool_write16(PMU_REG_PIN_PULL_EN, 0x3fff);
|
||||
ool_write16(PMU_REG_PIN_PULL_SEL, 0x3fff);
|
||||
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) | 0x40);
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_after_sleep(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
|
||||
host_hci_reinit();
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) & (~0x40));
|
||||
NVIC_SetPriority(UART0_IRQn, 2);
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
|
||||
/* configure PA0 and PA1 to UART0 function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 115200;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
/* restart calibration */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 60;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 2);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
}
|
||||
void wdt_rst_start(void)
|
||||
{
|
||||
iwdt_Init_t iwdt_handle;
|
||||
iwdt_handle.iwdt_int_Enable = WDT_INT_DISABLE;
|
||||
iwdt_handle.iwdt_Timeout = 0xFFF;
|
||||
iwdt_handle.iwdt_Count = 32000 * 3; // 32K, timeout 3s
|
||||
iwdt_init(iwdt_handle);
|
||||
|
||||
iwdt_Enable();
|
||||
}
|
||||
|
||||
void sys_iwdt_start(void)
|
||||
{
|
||||
iwdt_Init_t iwdt_handle;
|
||||
iwdt_handle.iwdt_int_Enable = WDT_INT_DISABLE;
|
||||
iwdt_handle.iwdt_Timeout = 0xFFF;
|
||||
iwdt_handle.iwdt_Count = 32000 * 6; // 32K, timeout 5s
|
||||
iwdt_init(iwdt_handle);
|
||||
|
||||
iwdt_Enable();
|
||||
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
system_delay_us(1000000);
|
||||
|
||||
/* configure all interrupt priority to 2 */
|
||||
*(volatile uint32_t *)0xE000E400 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E404 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E408 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E40C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E410 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E414 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E418 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E41C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E420 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E424 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E428 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E42C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E430 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E434 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E438 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E43C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E440 = 0x40404040;
|
||||
|
||||
pmu_init();
|
||||
// /* Power Keep: 32KB PRAM, 128KB SRAM */
|
||||
// ool_write16(PMU_REG_PKSRAM_GATE, ~0x0063);
|
||||
|
||||
/* reinit flash controller */
|
||||
system_cache_enable(true);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_enable_quad(QSPI0);
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_DUAL, FLASH_WR_TYPE_SINGLE);
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART2: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 921600;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
/*ota check*/
|
||||
ota_boot_start();
|
||||
|
||||
#if 1
|
||||
/* set SYSTEM BUCK to 1.35v, set DSP LDO and APP LDO to bypass mode */
|
||||
ool_write(PMU_REG_SYSBUCK_CTRL_0, 0x04);
|
||||
ool_write(PMU_REG_DSP_DLDO_CTRL, ool_read(PMU_REG_DSP_DLDO_CTRL)| 0x80);
|
||||
ool_write(PMU_REG_APP_DLDO_CTRL, ool_read(PMU_REG_APP_DLDO_CTRL)| 0x40);
|
||||
|
||||
/* initial system clock and XIP flash */
|
||||
hw_clock_init();
|
||||
hw_xip_flash_init(false);
|
||||
uart_init(&Uart3_handle);
|
||||
#endif
|
||||
|
||||
/*enable uart irq*/
|
||||
NVIC_SetPriority(UART3_IRQn, 4);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
|
||||
/* do calibration, get current RC frequency */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 200;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 4);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
|
||||
/* init flashdb to store user data */
|
||||
flashdb_init();
|
||||
printf("start running\r\n");
|
||||
|
||||
sys_iwdt_start();
|
||||
|
||||
/* Create tasks */
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
xTaskCreate(monitor_task, "monitor", MONITOR_TASK_STACK_SIZE, NULL, MONITOR_TASK_PRIORITY, &monitor_task_handle);
|
||||
#endif
|
||||
/* create application task */
|
||||
app_task_init();
|
||||
|
||||
/* initialize AT command */
|
||||
app_at_init(&Uart3_handle);
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
#if 1
|
||||
SYSTEM->PortA_PullSelect = 0x0000ff9f;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000fff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullSelect = 0x00000000;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0xffffffff;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullSelect = 0x00000000;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullEN = 0xffffffff;
|
||||
|
||||
/* IO33 always on, IO18 off in sleep mode */
|
||||
ool_write(0x63, 0x08);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_12;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_12, GPIO_PIN_CLEAR); // motor en: default output low
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); // HR sensor power en: default output high
|
||||
#else
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
#endif
|
||||
/* enable sleep */
|
||||
//system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
printf("FR5090: BTDM test: 0x%04x.\r\n", ool_read16(PMU_REG_PIN_INPUT_EN));
|
||||
/* Start the scheduler itself. */
|
||||
vTaskStartScheduler();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uart3_irq(void)
|
||||
{
|
||||
uart_IRQHandler(&Uart3_handle);
|
||||
}
|
||||
|
||||
void PMU_GPIO_PMU_IRQHandler(void)
|
||||
{
|
||||
uint16_t data = ool_read16(PMU_REG_PIN_DATA);
|
||||
uint16_t result = ool_read16(PMU_REG_PIN_XOR_RESULT);
|
||||
|
||||
/* update last value with latest data */
|
||||
ool_write16(PMU_REG_PIN_LAST_V, data);
|
||||
/* clear last XOR result */
|
||||
ool_write16(PMU_REG_PIN_XOR_CLR, result);
|
||||
|
||||
if (data & PMU_PIN_9) {
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
else {
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
}
|
||||
|
||||
void cali_irq(void)
|
||||
{
|
||||
cali_IRQHandler(&cali_handle);
|
||||
}
|
||||
|
177
MCU/examples/application/btdm_audio/Inc/FreeRTOSConfig.h
Normal file
177
MCU/examples/application/btdm_audio/Inc/FreeRTOSConfig.h
Normal file
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* FreeRTOS V202112.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include "app_config.h"
|
||||
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__ICCARM__) || defined(__GNUC__)
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
/* Cortex M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( FREERTOS_MAX_PRIORITY )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 256 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 12
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__ICCARM__) || defined(__GNUC__)
|
||||
extern volatile unsigned int CPU_RunTime;
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() CPU_RunTime
|
||||
#endif
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
248
MCU/examples/application/btdm_audio/Inc/app_config.h
Normal file
248
MCU/examples/application/btdm_audio/Inc/app_config.h
Normal file
@ -0,0 +1,248 @@
|
||||
#ifndef _APP_CONFIG_H
|
||||
#define _APP_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= SYSTEM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> SYSTEM Configuration
|
||||
|
||||
// <o> SYSTEM_CLOCK_SEL
|
||||
// <i> used to define system working clock
|
||||
// <24000000=> 24MHz
|
||||
// <48000000=> 48MHz
|
||||
// <96000000=> 96MHz
|
||||
// <144000000=> 144MHz
|
||||
// <192000000=> 192MHz
|
||||
// <240000000=> 240MHz
|
||||
#define SYSTEM_CLOCK_SEL 24000000
|
||||
|
||||
// <o> DSP_ROM_CODE_XIP
|
||||
// <i> check to choose DSP rom code running in iROM or XIP-Flash, default: iROM
|
||||
// <0=> NO
|
||||
// <1=> YES
|
||||
#define DSP_ROM_CODE_XIP 0
|
||||
|
||||
#define DSP_CODE_LOAD_MODE_SDCARD 1
|
||||
#define DSP_CODE_LOAD_MODE_XIP_RO 2
|
||||
#define DSP_CODE_LOAD_MODE_FIX_ADDRESS 3
|
||||
// <o> DSP_CODE_LOAD_MODE
|
||||
// <i> choose dsp code load mode: 1. from sd card; 2. compiled into XIP bin file; 3. from fixed address in XIP flash
|
||||
// <1=> DSP_CODE_LOAD_MODE_SDCARD
|
||||
// <2=> DSP_CODE_LOAD_MODE_XIP_RO
|
||||
// <3=> DSP_CODE_LOAD_MODE_FIX_ADDRESS
|
||||
#define DSP_CODE_LOAD_MODE 2
|
||||
|
||||
// <o> DSP_CODE_FIX_ADDRESS
|
||||
// <i> used to define where to fetch dsp code, this defination is valid when DSP_CODE_LOAD_MODE is DSP_CODE_LOAD_MODE_FIX_ADDRESS
|
||||
#define DSP_CODE_FIX_ADDRESS 0x001C0000
|
||||
|
||||
#define CONTROLLER_CODE_LOAD_MODE_SDCARD 1
|
||||
#define CONTROLLER_CODE_LOAD_MODE_XIP_RO 2
|
||||
#define CONTROLLER_CODE_LOAD_MODE_FIX_ADDRESS 3
|
||||
// <o> CONTROLLER_CODE_LOAD_MODE
|
||||
// <i> choose dsp code load mode: 1. from sd card; 2. compiled into XIP bin file; 3. from fixed address in XIP flash
|
||||
// <1=> CONTROLLER_CODE_LOAD_MODE_SDCARD
|
||||
// <2=> CONTROLLER_CODE_LOAD_MODE_XIP_RO
|
||||
// <3=> CONTROLLER_CODE_LOAD_MODE_FIX_ADDRESS
|
||||
#define CONTROLLER_CODE_LOAD_MODE 2
|
||||
|
||||
// <o> CONTROLLER_CODE_INC_SENSOR_HUB
|
||||
// <i> when CONTROLLER_CODE_LOAD_MODE is CONTROLLER_CODE_LOAD_MODE_XIP_RO, choose which firmware is commpiled into XIP bin file.
|
||||
// <0=> NO
|
||||
// <1=> YES
|
||||
#define CONTROLLER_CODE_INC_SENSOR_HUB 0
|
||||
|
||||
// <o> CONTROLLER_CODE_FIX_ADDRESS
|
||||
// <i> used to define where to fetch controller code, this defination is valid when CONTROLLER_CODE_LOAD_MODE is CONTROLLER_CODE_LOAD_MODE_FIX_ADDRESS
|
||||
#define CONTROLLER_CODE_FIX_ADDRESS 0x001AC000
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= FreeRTOS configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> FreeRTOS Configuration
|
||||
|
||||
// <o> ENABLE_RTOS_MONITOR
|
||||
// <i> check to enable or disable RTOS monitor, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define ENABLE_RTOS_MONITOR 0
|
||||
|
||||
// <o> FREERTOS_MAX_PRIORITY
|
||||
// <i> used to define priority of monitor task
|
||||
// <1-10:1>
|
||||
#define FREERTOS_MAX_PRIORITY 10
|
||||
|
||||
// <o> MONITOR_TASK_PRIORITY
|
||||
// <i> used to define priority of monitor task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define MONITOR_TASK_PRIORITY 1
|
||||
#if MONITOR_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "MONITOR_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> APP_TASK_PRIORITY
|
||||
// <i> used to define priority of app task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define APP_TASK_PRIORITY 3
|
||||
#if APP_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "APP_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> HOST_TASK_PRIORITY
|
||||
// <i> used to define priority of host task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define HOST_TASK_PRIORITY 2
|
||||
#if HOST_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "HOST_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> RPMSG_TASK_PRIORITY
|
||||
// <i> used to define priority of rpmsg task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define RPMSG_TASK_PRIORITY 6
|
||||
#if RPMSG_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "RPMSG_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> AUDIO_SCENE_TASK_PRIORITY
|
||||
// <i> used to define priority of rpmsg task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define AUDIO_SCENE_TASK_PRIORITY 6
|
||||
#if AUDIO_SCENE_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "AUDIO_SCENE_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> MONITOR_TASK_STACK_SIZE
|
||||
// <i> used to define priority of monitor task
|
||||
#define MONITOR_TASK_STACK_SIZE 128
|
||||
|
||||
// <o> APP_TASK_STACK_SIZE
|
||||
// <i> used to define priority of APP task
|
||||
#define APP_TASK_STACK_SIZE 1024 //256
|
||||
|
||||
// <o> HOST_TASK_STACK_SIZE
|
||||
// <i> used to define priority of btdm-host task
|
||||
#define HOST_TASK_STACK_SIZE 2048
|
||||
|
||||
// <o> RPMSG_TASK_STACK_SIZE
|
||||
// <i> used to define priority of RPMSG task
|
||||
#define RPMSG_TASK_STACK_SIZE 2048
|
||||
|
||||
// <o> AUDIO_SCENE_TASK_STACK_SIZE
|
||||
// <i> used to define priority of audio scene task
|
||||
#define AUDIO_SCENE_TASK_STACK_SIZE 1024
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= DSP configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> DSP Configuration
|
||||
|
||||
// <o> ENABLE_DSP
|
||||
// <i> check to enable or disable DSP, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define ENABLE_DSP 1
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= BTDM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> BTDM STACK Configuration
|
||||
|
||||
// <o> BTDM_STACK_ENABLE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE 1
|
||||
|
||||
// <o> BTDM_STACK_HCI_BAUDRATE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <1500000=> 1500000
|
||||
// <921600=> 921600
|
||||
// <460800=> 460800
|
||||
// <115200=> 115200
|
||||
#define BTDM_STACK_HCI_BAUDRATE 1500000
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_BT
|
||||
// <i> check to enable or disable classic bluetooth, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_BT 1
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_HF
|
||||
// <i> check to enable or disable hand free, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_HF 1
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_AG
|
||||
// <i> check to enable or disable audio-gate, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_AG 0
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_A2DP_SRC
|
||||
// <i> check to enable or disable a2dp srouce, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_A2DP_SRC 0
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_A2DP_SNK
|
||||
// <i> check to enable or disable a2dp sink, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_A2DP_SNK 1
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_AVRCP
|
||||
// <i> check to enable or disable avrcp, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_AVRCP 1
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_AAC
|
||||
// <i> check to enable or disable aac codec, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_AAC 0
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_PBAP
|
||||
// <i> check to enable or disable pbap, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_PBAP 1
|
||||
|
||||
// <o> BTDM_STACK_ENABLE_SPP
|
||||
// <i> check to enable or disable spp, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE_SPP 0
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= BTDM Address configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> BTDM Address configuration
|
||||
|
||||
// <o> BT_ADDR_RANDOM_ENABLE
|
||||
// <i> check to enable or disable random bt addr, default: ENABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BT_ADDR_RANDOM_ENABLE 1
|
||||
|
||||
// <o> BLE_ADDR_RANDOM_ENABLE
|
||||
// <i> check to enable or disable random ble static addr, default: ENABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BLE_ADDR_RANDOM_ENABLE 1
|
||||
|
||||
// </h>
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // _APP_CONFIG_H
|
38
MCU/examples/application/btdm_audio/Inc/fal_cfg.h
Normal file
38
MCU/examples/application/btdm_audio/Inc/fal_cfg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-05-17 armink the first version
|
||||
*/
|
||||
|
||||
#ifndef _FAL_CFG_H_
|
||||
#define _FAL_CFG_H_
|
||||
|
||||
#define FAL_DEBUG 1
|
||||
#define FAL_PART_HAS_TABLE_CFG
|
||||
#define FAL_USING_SFUD_PORT
|
||||
|
||||
#define NOR_FLASH_DEV_NAME "norflash0"
|
||||
|
||||
/* ===================== Flash device Configuration ========================= */
|
||||
extern const struct fal_flash_dev onchip_flash;
|
||||
//extern struct fal_flash_dev nor_flash0;
|
||||
|
||||
/* flash device table */
|
||||
#define FAL_FLASH_DEV_TABLE \
|
||||
{ \
|
||||
&onchip_flash, \
|
||||
}
|
||||
/* ====================== Partition Configuration ========================== */
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
/* partition table */
|
||||
#define FAL_PART_TABLE \
|
||||
{ \
|
||||
{FAL_PART_MAGIC_WORD, "FlashEnv", "flashdb_onchip", 800*1024, 12*1024, 0}, \
|
||||
}
|
||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||
|
||||
#endif /* _FAL_CFG_H_ */
|
86
MCU/examples/application/btdm_audio/Inc/rpmsg_config.h
Normal file
86
MCU/examples/application/btdm_audio/Inc/rpmsg_config.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Mentor Graphics Corporation
|
||||
* Copyright (c) 2015 Xilinx, Inc.
|
||||
* Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef RPMSG_CONFIG_H_
|
||||
#define RPMSG_CONFIG_H_
|
||||
|
||||
/*!
|
||||
* @addtogroup config
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
//! @name Configuration options
|
||||
//@{
|
||||
|
||||
//! @def RL_MS_PER_INTERVAL
|
||||
//!
|
||||
//! Delay in milliseconds used in non-blocking API functions for polling.
|
||||
//! The default value is 1.
|
||||
#define RL_MS_PER_INTERVAL (1)
|
||||
|
||||
//! @def RL_BUFFER_PAYLOAD_SIZE
|
||||
//!
|
||||
//! Size of the buffer payload, it must be equal to (240, 496, 1008, ...)
|
||||
//! [2^n - 16]. Ensure the same value is defined on both sides of rpmsg
|
||||
//! communication. The default value is 496U.
|
||||
#define RL_BUFFER_PAYLOAD_SIZE (240U)
|
||||
|
||||
//! @def RL_BUFFER_COUNT
|
||||
//!
|
||||
//! Number of the buffers, it must be power of two (2, 4, ...).
|
||||
//! The default value is 2U.
|
||||
//! Note this value defines the buffer count for one direction of the rpmsg
|
||||
//! communication only, i.e. if the default value of 2 is used
|
||||
//! in rpmsg_config.h files for the master and the remote side, 4 buffers
|
||||
//! in total are created in the shared memory.
|
||||
#define RL_BUFFER_COUNT (2U)
|
||||
|
||||
//! @def RL_API_HAS_ZEROCOPY
|
||||
//!
|
||||
//! Zero-copy API functions enabled/disabled.
|
||||
//! The default value is 1 (enabled).
|
||||
#define RL_API_HAS_ZEROCOPY (1)
|
||||
|
||||
//! @def RL_USE_STATIC_API
|
||||
//!
|
||||
//! Static API functions (no dynamic allocation) enabled/disabled.
|
||||
//! The default value is 0 (static API disabled).
|
||||
#define RL_USE_STATIC_API (0)
|
||||
|
||||
//! @def RL_CLEAR_USED_BUFFERS
|
||||
//!
|
||||
//! Clearing used buffers before returning back to the pool of free buffers
|
||||
//! enabled/disabled.
|
||||
//! The default value is 0 (disabled).
|
||||
#define RL_CLEAR_USED_BUFFERS (0)
|
||||
|
||||
//! @def RL_USE_MCMGR_IPC_ISR_HANDLER
|
||||
//!
|
||||
//! When enabled IPC interrupts are managed by the Multicore Manager (IPC
|
||||
//! interrupts router), when disabled RPMsg-Lite manages IPC interrupts
|
||||
//! by itself.
|
||||
//! The default value is 0 (no MCMGR IPC ISR handler used).
|
||||
#define RL_USE_MCMGR_IPC_ISR_HANDLER (0)
|
||||
|
||||
//! @def RL_USE_ENVIRONMENT_CONTEXT
|
||||
//!
|
||||
//! When enabled the environment layer uses its own context.
|
||||
//! Added for QNX port mainly, but can be used if required.
|
||||
//! The default value is 0 (no context, saves some RAM).
|
||||
#define RL_USE_ENVIRONMENT_CONTEXT (0)
|
||||
|
||||
//! @def RL_DEBUG_CHECK_BUFFERS
|
||||
//!
|
||||
//! Do not use in RPMsg-Lite to Linux configuration
|
||||
#define RL_DEBUG_CHECK_BUFFERS (0)
|
||||
//@}
|
||||
|
||||
#endif /* RPMSG_CONFIG_H_ */
|
938
MCU/examples/application/btdm_audio/MDK-ARM/Project.uvprojx
Normal file
938
MCU/examples/application/btdm_audio/MDK-ARM/Project.uvprojx
Normal file
@ -0,0 +1,938 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6140000::V6.14::ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM33_DSP_FP</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM33_DSP_FP$Device\ARM\ARMCM33\Include\ARMCM33_DSP_FP.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>Project</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>"..\..\..\..\components\tools\keil\post_process.bat" "@L" "#L" "$J"</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName></SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll></SimDlgDll>
|
||||
<SimDlgDllArguments></SimDlgDllArguments>
|
||||
<TargetDllName>SARMV8M.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM33</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4102</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2V8M.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M33"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>1</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>1</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>4</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x200000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x60000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x1ffc0000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0xa0000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20200000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>3</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>6</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>LV_CONF_INCLUDE_SIMPLE,LV_LVGL_H_INCLUDE_SIMPLE</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\components\btdm\include;..\..\..\..\components\drivers\cmsis;..\..\..\..\components\drivers\device\fr30xx;..\..\..\..\components\drivers\peripheral\Inc;..\..\..\..\components\modules\audio;..\..\..\..\components\modules\audio\algorithm;..\..\..\..\components\modules\audio\codec;..\..\..\..\components\modules\audio\resample;..\..\..\..\components\modules\common\include;..\..\..\..\components\modules\dsp;..\..\..\..\components\modules\fatfs\source;..\..\..\..\components\modules\FlashDB\flashdb\inc;..\..\..\..\components\modules\FlashDB\port\fal\inc;..\..\..\..\components\modules\FreeRTOS\include;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ;..\..\..\..\components\modules\heap;..\..\..\..\components\modules\rpmsg-lite\lib\include;..\..\..\..\components\modules\rpmsg-lite\lib\include\platform\fr30xx_m33;..\..\..\common\btdm;..\..\..\common\flashdb;..\Inc;..\Src;..\..\..\common\btdm\profile\ble_ANCS_AMCS;..\..\..\common\btdm\profile\ble_hid;..\..\..\common\btdm\profile\ble_simple_gatt</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>..\..\..\..\components\tools\keil\xip_flash_add_psram.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm33.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\cmsis\core_cm33.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_audio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_audio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_ble.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_ble.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_bt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_bt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_btdm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_btdm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_at.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_at.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_rpmsg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_rpmsg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\app_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>diskio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\diskio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Inc\app_config.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_bt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\user_bt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\btdm_mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code_single_ota.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code_single_ota.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code_split_ota.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code_split_ota.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>SWD.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\SWD.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/dsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>dsp_code_flash.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\dsp\dsp_code_flash.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dsp_code_rom.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\dsp\dsp_code_rom.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal_flash_port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fal_flash_port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fdb_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_fr30xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_codec.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_codec.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_frspim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_i2s.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_i2s.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_ipc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_ipc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pdm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pdm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu_iwdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_qspi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_sd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_sd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_sd_card.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_sd_card.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_trng.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_trng.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/audio</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>algorithm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\algorithm\algorithm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>codec.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\codec\codec.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>resample.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\resample\resample.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>audio_decoder.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\audio_decoder.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>audio_encoder.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\audio_encoder.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>audio_hw.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\audio_hw.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>audio_rpmsg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\audio_rpmsg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>audio_scene.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\audio\audio_scene.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_host.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\..\..\components\btdm\btdm_host.lib</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>co_log.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_log.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_util.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_util.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/dsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>dsp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\dsp\dsp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dsp_mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\dsp\dsp_mem.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>moudle/fatfs</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ff.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\fatfs\source\ff.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ffsystem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\fatfs\source\ffsystem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ffunicode.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\fatfs\source\ffunicode.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_partition.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_kvdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>croutine.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\croutine.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>event_groups.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\event_groups.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stream_buffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tasks.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\tasks.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portasm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>freertos_sleep.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap_6.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpu_context.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/heap</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\heap\heap.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/rpmsg</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rpmsg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\rpmsg_lite\rpmsg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rpmsg_lite.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\rpmsg_lite\rpmsg_lite.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rpmsg_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\rpmsg_lite\rpmsg_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rpmsg_env_freertos.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\rpmsg_lite\porting\environment\rpmsg_env_freertos.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rpmsg_platform.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\rpmsg_lite\porting\platform\fr30xx_cm33\rpmsg_platform.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>llist.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\common\llist.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>virtqueue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\rpmsg-lite\lib\virtio\virtqueue.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>ble/profile</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ANCS_AMS_client.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\profile\ble_ANCS_AMCS\ANCS_AMS_client.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>simple_gatt_service.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\profile\ble_simple_gatt\simple_gatt_service.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>hid_service.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\profile\ble_hid\hid_service.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>AMS_client.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\profile\ble_ANCS_AMCS\AMS_client.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cbundle="ARM Compiler" Cclass="Compiler" Cgroup="I/O" Csub="STDERR" Cvariant="Breakpoint" Cvendor="Keil" Cversion="1.2.0" condition="ARMCC Cortex-M">
|
||||
<package name="ARM_Compiler" schemaVersion="1.6.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.6.3"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Project"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName><Project Info></LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
701
MCU/examples/application/btdm_audio/Src/app_at.c
Normal file
701
MCU/examples/application/btdm_audio/Src/app_at.c
Normal file
@ -0,0 +1,701 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "co_util.h"
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "me_api.h"
|
||||
#include "hfg_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_bt.h"
|
||||
#include "app_audio.h"
|
||||
#include "btdm_mem.h"
|
||||
#include "fdb_app.h"
|
||||
#include "user_bt.h"
|
||||
#include "dsp_mem.h"
|
||||
#include "heap.h"
|
||||
|
||||
#define AT_RECV_MAX_LEN 32
|
||||
|
||||
static uint8_t app_at_recv_char;
|
||||
static uint8_t at_recv_buffer[AT_RECV_MAX_LEN];
|
||||
static uint8_t at_recv_index = 0;
|
||||
static uint8_t at_recv_state = 0;
|
||||
|
||||
void btdm_host_send_vendor_cmd(uint8_t type, uint8_t length, void *data);
|
||||
|
||||
void btdm_host_vendor_cmd_cmp_evt(uint8_t status, uint8_t len, uint8_t const *param)
|
||||
{
|
||||
printf("status: 0x%02x.\r\n", status);
|
||||
for (uint32_t i=0; i<len; i++) {
|
||||
printf("%02x ", param[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_A(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd)
|
||||
{
|
||||
// case 'A':
|
||||
// {
|
||||
// mac_addr_t addr;
|
||||
// addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
// addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
// addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
// addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
// addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
// addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
// gap_start_conn(&addr, ascii_strn2val((const char *)&data[12], 16, 2), 64, 64, 0, 500);
|
||||
// }
|
||||
// break;
|
||||
// case 'B':
|
||||
// {
|
||||
// gap_stop_conn();
|
||||
// }
|
||||
// break;
|
||||
case 'A':
|
||||
{
|
||||
uint8_t addr = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x00, 1, &addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'B':
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x01, 2, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
uint32_t addr = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x02, 4, (void *)&addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
uint32_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x03, 8, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'G':
|
||||
printf("hello world!\r\n");
|
||||
break;
|
||||
case 'H':
|
||||
printf("VAL: 0x%08x.\r\n", *(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8));
|
||||
break;
|
||||
case 'I':
|
||||
*(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8) = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'J':
|
||||
printf("OOL VAL: 0x%02x.\r\n", ool_read(ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
break;
|
||||
case 'K':
|
||||
ool_write(ascii_strn2val((const char *)&data[0], 16, 2), ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'L':
|
||||
printf("VAL: 0x%02x.\r\n", *(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)));
|
||||
break;
|
||||
case 'M':
|
||||
*(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)) = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
// case 'P':
|
||||
// co_printf("VAL: 0x%02x.\r\n", *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
// break;
|
||||
// case 'Q':
|
||||
// *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)) = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
// case 'S':
|
||||
// co_printf("VAL: 0x%02x.\r\n", frspim_rd(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1));
|
||||
// break;
|
||||
// case 'T':
|
||||
// frspim_wr(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1, ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
case 'U':
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *)(ascii_strn2val((const char *)&data[0], 16, 8) & (~3));
|
||||
uint8_t count = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
uint32_t *start = (uint32_t *)((uint32_t)ptr & (~0x0f));
|
||||
for(uint8_t i=0; i<count;) {
|
||||
if(((uint32_t)start & 0x0c) == 0) {
|
||||
printf("0x%08x: ", (uint32_t)start);
|
||||
}
|
||||
if(start < ptr) {
|
||||
printf(" ");
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
printf("%08x", *start);
|
||||
}
|
||||
if(((uint32_t)start & 0x0c) == 0x0c) {
|
||||
printf("\r\n");
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char *)&data[0], 16, 8), ascii_strn2val((const char *)&data[9], 16, 8));
|
||||
break;
|
||||
case 'W':
|
||||
{
|
||||
uint32_t curr_free, min_free;
|
||||
dsp_mem_get_usage(&curr_free, &min_free);
|
||||
printf("DSP MEM: %d, %d\r\n", curr_free, min_free);
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
{
|
||||
void system_reset(void);
|
||||
system_reset();
|
||||
}
|
||||
break;
|
||||
case 'Y':
|
||||
heap_dump_used_mem(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'Z':
|
||||
printf("MEM usage\r\n \
|
||||
\tHEAP_TYPE_SRAM_BLOCK: %d, %d\r\n \
|
||||
\tHEAP_TYPE_DRAM_BLOCK: %d, %d\r\n \
|
||||
\tHEAP_TYPE_BTDM_BLOCK: %d, %d\r\n \
|
||||
\tTOTAL USAGE: %d\r\n", \
|
||||
heap_get_mem_usage(HEAP_TYPE_SRAM_BLOCK), heap_get_mem_usage_single(HEAP_TYPE_SRAM_BLOCK), \
|
||||
heap_get_mem_usage(HEAP_TYPE_DRAM_BLOCK), heap_get_mem_usage_single(HEAP_TYPE_DRAM_BLOCK), \
|
||||
heap_get_mem_usage(HEAP_TYPE_BTDM_BLOCK), heap_get_mem_usage_single(HEAP_TYPE_BTDM_BLOCK), \
|
||||
heap_get_max_mem_usage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void user_hci_callback(const BtEvent *event)
|
||||
{
|
||||
printf("event type = %d\r\n",event->eType);
|
||||
if(event->eType == BTEVENT_COMMAND_COMPLETE){
|
||||
btdm_free(event->p.meToken);
|
||||
}
|
||||
}
|
||||
static void app_at_recv_cmd_B(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
struct gap_ble_addr peer_addr;
|
||||
BD_ADDR addr;
|
||||
HfgResponse *rsp;
|
||||
BtStatus status;
|
||||
MeCommandToken *token;
|
||||
uint16_t page_timeout = 0x400;
|
||||
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
// AT#BA00
|
||||
//app_ble_start_advertising(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'B':
|
||||
// AT#BB01
|
||||
//app_ble_stop_advertising(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'C':
|
||||
app_ble_scan_start();
|
||||
break;
|
||||
case 'D':
|
||||
app_ble_scan_stop();
|
||||
break;
|
||||
case 'E':
|
||||
// AT#BE0123456789ab_01
|
||||
peer_addr.addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
peer_addr.addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
peer_addr.addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
peer_addr.addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
peer_addr.addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
peer_addr.addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
peer_addr.addr_type = ascii_strn2val((const char *)&data[13], 16, 2);
|
||||
app_ble_conn_start(&peer_addr);
|
||||
break;
|
||||
case 'F':
|
||||
app_ble_conn_stop();
|
||||
break;
|
||||
#if BTDM_STACK_ENABLE_BT == 1
|
||||
case 'H':
|
||||
ME_Inquiry(BT_IAC_GIAC, 5, 5);
|
||||
break;
|
||||
case 'I':
|
||||
ME_CancelInquiry();
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
BtStatus status;
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
|
||||
status = HFG_CreateServiceLink(&hfg_channel[0], &addr);
|
||||
|
||||
if (status == BT_STATUS_PENDING) {
|
||||
printf("Opening Channel...\r\n");
|
||||
} else {
|
||||
printf("Could not open channel, status: %d\r\n", status);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'K':
|
||||
status = BT_STATUS_NO_RESOURCES;
|
||||
rsp = (HfgResponse *)btdm_malloc(sizeof(HfgResponse));
|
||||
if(rsp != NULL){
|
||||
status = HFG_CreateCodecConnection(&hfg_channel[0], 1, rsp);
|
||||
}
|
||||
if(status != BT_STATUS_PENDING){
|
||||
btdm_free((void *)rsp);
|
||||
}
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'L':
|
||||
flashdb_del(FDB_KEY_BT_LINKKEY);
|
||||
|
||||
break;
|
||||
case 'M':
|
||||
token = btdm_malloc(sizeof(MeCommandToken));
|
||||
token->p.general.in.hciCommand = 0x0c18;//HCC_WRITE_PAGE_TIMEOUT;
|
||||
token->p.general.in.parmLen = 2;
|
||||
token->p.general.in.parms = (uint8_t *)&page_timeout;
|
||||
token->callback = user_hci_callback; //token is freed at this callback
|
||||
status = ME_SendHciCommandAsync(token);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'N':
|
||||
{
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
user_bt_env.connect_times = 3;
|
||||
status = bt_connect(&addr);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 'O':
|
||||
// {
|
||||
// uint8_t battery_level[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
// struct gatt_send_event ntf[6];
|
||||
// uint8_t i=0;
|
||||
// for(i=0;i<6;i++){
|
||||
// ntf[i].conidx = 0;
|
||||
// ntf[i].svc_id = svc_id;
|
||||
// ntf[i].att_idx = 2;
|
||||
// ntf[i].data_len = 15;
|
||||
// ntf[i].p_data = &battery_level[0];
|
||||
// gatt_notification(&ntf[i]);
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
case 'P':
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
bt_disconnect(&addr,false);
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
bt_disconnect(&addr,true);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
// ME_SetLocalDeviceName((const uint8_t *)"FR30xx_m", sizeof("FR30xx_m"));
|
||||
//app_btdm_init();
|
||||
|
||||
break;
|
||||
case 'S':
|
||||
{
|
||||
BtAccessModeInfo access_mode_nc = {
|
||||
.inqInterval = 0x800,
|
||||
.inqWindow = 0x12,
|
||||
.pageInterval = 0x800,
|
||||
.pageWindow = 0x12,
|
||||
};
|
||||
status = bt_enter_pairing(BAM_GENERAL_ACCESSIBLE, &access_mode_nc);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
{
|
||||
status = bt_exit_pairing();
|
||||
printf("status = %d\r\n",status);
|
||||
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
{
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
bt_exit_pairing();
|
||||
bt_connect(&addr);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
uint8_t voltage_str[] = "AT+IPHONEACCEV=1,1,6";
|
||||
uint8_t cmps_str[] = "AT+CPMS=?";
|
||||
uint8_t clk_str[] = "AT+CCLK=?";
|
||||
//bt hf&pbap related cmd
|
||||
static void app_at_recv_cmd_C(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
BtStatus status;
|
||||
BD_ADDR addr;
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
status = bt_answer_call(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'B':
|
||||
status = bt_hang_up(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'C':
|
||||
status = bt_redial(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
uint8_t number[] = "10086";
|
||||
status = bt_dial_number(user_bt_env.last_active_index,number,sizeof(number));
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
status = bt_list_current_calls(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'F':
|
||||
status = bt_transfer_sco(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'G':
|
||||
{
|
||||
uint8_t dtmf = data[0];
|
||||
status = bt_send_dtmf(user_bt_env.last_active_index,dtmf);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
{
|
||||
//vol---[0x00,0x0f]
|
||||
uint8_t vol = ascii_strn2val((const char*)&data[0],16,2);
|
||||
status = bt_report_spk_volume(user_bt_env.last_active_index,vol);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
{
|
||||
status = bt_send_hf_cmd(user_bt_env.last_active_index,voltage_str);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
uint8_t enabled = ascii_strn2val((const char*)&data[0],16,2);
|
||||
status = bt_enable_voice_recognition(user_bt_env.last_active_index, enabled);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'K':
|
||||
printf("voice recog enabled : %d\r\n",bt_is_voice_rec_active(user_bt_env.last_active_index));
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
// addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
// addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
// addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
// addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
// addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
// addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
if(user_bt_get_state(user_bt_env.last_active_index) >= BT_STATE_CONNECTED){
|
||||
printf("pbap client %d\r\n",pbap_client[user_bt_env.last_active_index].cApp.connState);
|
||||
status = PBAP_ClientConnect(&pbap_client[user_bt_env.last_active_index],&user_bt_env.dev[user_bt_env.last_active_index].remote_bd);
|
||||
if(status == BT_STATUS_PENDING){
|
||||
user_bt_env.dev[user_bt_env.last_active_index].pbap_client = &pbap_client[user_bt_env.last_active_index];
|
||||
}
|
||||
}
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'M':
|
||||
status = PBAP_ClientDisconnect(&pbap_client[user_bt_env.last_active_index]);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'N':
|
||||
{
|
||||
uint8_t pbName[64];
|
||||
PbapPullPbParms parms;
|
||||
|
||||
memcpy(pbName,PB_LOCAL_MCH_NAME,sizeof(PB_LOCAL_MCH_NAME));
|
||||
parms.pbName = pbName;
|
||||
memset(parms.filter.byte,0,PBAP_FILTER_SIZE);
|
||||
parms.filter.byte[0] = 0x84;
|
||||
parms.listStartOffset = 0;
|
||||
parms.maxListCount = 4; //0---search missed call and total pb size
|
||||
parms.format= VCARD_FORMAT_30;
|
||||
status = PBAP_PullPhonebook(&pbap_client[0], &parms);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
{
|
||||
PbapPullVcardListingParms parms;
|
||||
uint8_t search_val[12]; //= "13262651013";
|
||||
memcpy(search_val,&data[0],11);
|
||||
uint8_t folder[] = "telecom/pb";
|
||||
parms.folderName = folder;
|
||||
parms.order = VCARD_SORT_ORDER_INDEXED;
|
||||
parms.listStartOffset = 0x00;
|
||||
parms.maxListCount = 4;
|
||||
parms.searchAttribute = VCARD_SEARCH_ATTRIB_NUMBER;
|
||||
parms.searchValue = search_val;
|
||||
status = PBAP_PullVcardListing(&pbap_client[0], &parms);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
{
|
||||
uint8_t pbName[64];
|
||||
PbapPullPbParms parms;
|
||||
|
||||
memcpy(pbName,PB_LOCAL_STORE_NAME,sizeof(PB_LOCAL_STORE_NAME));
|
||||
parms.pbName = pbName;
|
||||
memset(parms.filter.byte,0,PBAP_FILTER_SIZE);
|
||||
parms.filter.byte[0] = 0x07;//0x84;
|
||||
parms.listStartOffset = 0;
|
||||
parms.maxListCount = 20; //0---search missed call and total pb size
|
||||
parms.format= VCARD_FORMAT_30;
|
||||
status = PBAP_PullPhonebook(&pbap_client[0], &parms);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
{
|
||||
uint8_t mute_str[] = "AT+CMUT=1";
|
||||
status = bt_send_hf_cmd(user_bt_env.last_active_index,mute_str);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'Y':
|
||||
{
|
||||
|
||||
status = bt_send_hf_cmd(user_bt_env.last_active_index,clk_str);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
case 'Z':
|
||||
{
|
||||
uint8_t mute_str[] = "AT+CCLK?";
|
||||
status = bt_send_hf_cmd(user_bt_env.last_active_index,mute_str);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
///bt media related cmd
|
||||
static void app_at_recv_cmd_E(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
BD_ADDR addr;
|
||||
BtStatus status;
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_PLAY, TRUE);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'B':
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_PAUSE, TRUE);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'C':
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_FORWARD, TRUE);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_BACKWARD, TRUE);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
{
|
||||
uint8_t vol = ascii_strn2val((const char*)&data[0],16,2);
|
||||
status = bt_set_media_volume(user_bt_env.last_active_index,vol);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
{
|
||||
status = bt_get_media_info(user_bt_env.last_active_index,0x41);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'G':
|
||||
{
|
||||
status = bt_get_playstatus(user_bt_env.last_active_index);
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
status = spp_connect(&spp_dev[0],&addr);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'I':
|
||||
status = spp_disconnect(&spp_dev[0]);
|
||||
printf("status = %d\r\n",status);
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
uint8_t test_data[] = {'1','2','3','4'};
|
||||
status = spp_send(&spp_dev[0],test_data,sizeof(test_data));
|
||||
printf("status = %d\r\n",status);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_D(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char*)&data[0],16,8), 0x1000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length)
|
||||
{
|
||||
switch(data[0])
|
||||
{
|
||||
case 'A':
|
||||
app_at_recv_cmd_A(data[1], &data[2]);
|
||||
break;
|
||||
case 'B':
|
||||
app_at_recv_cmd_B(data[1], &data[2]);
|
||||
break;
|
||||
case 'C':
|
||||
app_at_recv_cmd_C(data[1], &data[2]);
|
||||
break;
|
||||
case 'D':
|
||||
app_at_recv_cmd_D(data[1], &data[2]);
|
||||
break;
|
||||
case 'E':
|
||||
app_at_recv_cmd_E(data[1], &data[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_c(uint8_t c)
|
||||
{
|
||||
switch(at_recv_state)
|
||||
{
|
||||
case 0:
|
||||
if(c == 'A')
|
||||
{
|
||||
at_recv_state++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(c == 'T')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
if(c == '#')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 3:
|
||||
at_recv_buffer[at_recv_index++] = c;
|
||||
if((c == '\n')
|
||||
||(at_recv_index >= AT_RECV_MAX_LEN))
|
||||
{
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_AT_CMD, at_recv_index, false);
|
||||
if(event) {
|
||||
memcpy(event->param, at_recv_buffer, at_recv_index);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
at_recv_state = 0;
|
||||
at_recv_index = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
app_at_recv_c(app_at_recv_char);
|
||||
if (handle) {
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
14
MCU/examples/application/btdm_audio/Src/app_at.h
Normal file
14
MCU/examples/application/btdm_audio/Src/app_at.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _APP_AT_H
|
||||
#define _APP_AT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver_uart.h"
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length);
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
#endif // _APP_AT_H
|
148
MCU/examples/application/btdm_audio/Src/app_audio.c
Normal file
148
MCU/examples/application/btdm_audio/Src/app_audio.c
Normal file
@ -0,0 +1,148 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "app_config.h"
|
||||
#include "app_audio.h"
|
||||
|
||||
#include "audio_scene.h"
|
||||
#include "co_list.h"
|
||||
|
||||
#define APP_AUDIO_DATA_READY_THD 6
|
||||
#define APP_AUDIO_DATA_BUFFER_MAX 12
|
||||
|
||||
enum app_audio_mode_t {
|
||||
APP_AUDIO_MODE_IDLE,
|
||||
APP_AUDIO_MODE_A2DP_SINK,
|
||||
APP_AUDIO_MODE_A2DP_SOURCE,
|
||||
APP_AUDIO_MODE_SCO,
|
||||
APP_AUDIO_MODE_TONE,
|
||||
APP_AUDIO_MODE_VOICE_RECOGNIZE,
|
||||
};
|
||||
|
||||
static enum app_audio_mode_t audio_mode = APP_AUDIO_MODE_IDLE;
|
||||
static uint32_t audio_data_counter = 0;
|
||||
static audio_scene_t *audio_scene;
|
||||
|
||||
static void audio_pa_disable(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void audio_pa_enable(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void app_audio_stop(void)
|
||||
{
|
||||
switch(audio_mode) {
|
||||
case APP_AUDIO_MODE_A2DP_SINK:
|
||||
app_audio_a2dp_sink_stop();
|
||||
break;
|
||||
case APP_AUDIO_MODE_SCO:
|
||||
app_audio_sco_stop();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_audio_a2dp_sink_start(audio_type_t audio_type, uint32_t sample_rate)
|
||||
{
|
||||
audio_scene_param_a2dp_sink_t param;
|
||||
|
||||
if (audio_mode == APP_AUDIO_MODE_A2DP_SINK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (audio_mode != APP_AUDIO_MODE_IDLE) {
|
||||
app_audio_stop();
|
||||
}
|
||||
|
||||
param.sample_rate = sample_rate;
|
||||
param.channels = 2;
|
||||
param.audio_type = audio_type;
|
||||
param.hw_type = AUDIO_HW_TYPE_CODEC;
|
||||
param.hw_base_addr = I2S0_BASE;
|
||||
|
||||
assert(audio_mode == APP_AUDIO_MODE_IDLE);
|
||||
|
||||
audio_scene = audio_scene_create(AUDIO_SCENE_TYPE_A2DP_SINK, ¶m);
|
||||
assert(audio_scene != NULL);
|
||||
audio_mode = APP_AUDIO_MODE_A2DP_SINK;
|
||||
}
|
||||
|
||||
void app_audio_a2dp_sink_stop(void)
|
||||
{
|
||||
if (audio_mode == APP_AUDIO_MODE_A2DP_SINK) {
|
||||
audio_scene_destroy(audio_scene);
|
||||
audio_mode = APP_AUDIO_MODE_IDLE;
|
||||
audio_pa_disable();
|
||||
}
|
||||
}
|
||||
|
||||
void app_audio_a2dp_sink_play(uint8_t *buffer, uint32_t length)
|
||||
{
|
||||
if (audio_mode == APP_AUDIO_MODE_A2DP_SINK) {
|
||||
if (audio_scene_dac_is_ready(audio_scene)) {
|
||||
audio_pa_enable();
|
||||
}
|
||||
audio_scene_recv_raw_data(audio_scene, true, buffer, length);
|
||||
}
|
||||
}
|
||||
|
||||
void app_audio_sco_start(audio_type_t audio_type,audio_sence_report_encoded_frame report_enc_cb, void *report_enc_arg)
|
||||
{
|
||||
audio_scene_param_sco_t param;
|
||||
|
||||
if (audio_mode == APP_AUDIO_MODE_SCO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (audio_mode != APP_AUDIO_MODE_IDLE) {
|
||||
app_audio_stop();
|
||||
}
|
||||
|
||||
if (audio_type == AUDIO_TYPE_MSBC) {
|
||||
printf("SCO: msbc.\r\n");
|
||||
param.sample_rate = 16000;
|
||||
}
|
||||
else {
|
||||
printf("SCO: cvsd.\r\n");
|
||||
param.sample_rate = 8000;
|
||||
}
|
||||
param.audio_type = audio_type;
|
||||
param.hw_type = AUDIO_HW_TYPE_CODEC;
|
||||
param.hw_base_addr = I2S0_BASE;
|
||||
param.report_enc_cb = report_enc_cb;
|
||||
param.report_enc_arg = report_enc_arg;
|
||||
|
||||
assert(audio_mode == APP_AUDIO_MODE_IDLE);
|
||||
|
||||
audio_scene = audio_scene_create(AUDIO_SCENE_TYPE_SCO, ¶m);
|
||||
audio_mode = APP_AUDIO_MODE_SCO;
|
||||
assert(audio_scene != NULL);
|
||||
}
|
||||
|
||||
void app_audio_sco_stop(void)
|
||||
{
|
||||
if (audio_mode == APP_AUDIO_MODE_SCO) {
|
||||
audio_scene_destroy(audio_scene);
|
||||
audio_mode = APP_AUDIO_MODE_IDLE;
|
||||
audio_pa_disable();
|
||||
}
|
||||
}
|
||||
|
||||
void app_audio_sco_recv(bool valid, uint8_t audio_type, uint8_t *buffer, uint32_t length)
|
||||
{
|
||||
if (audio_mode == APP_AUDIO_MODE_SCO) {
|
||||
if (audio_scene_dac_is_ready(audio_scene)) {
|
||||
audio_pa_enable();
|
||||
}
|
||||
if (audio_type == AUDIO_TYPE_MSBC) {
|
||||
audio_scene_recv_raw_data(audio_scene, valid, buffer+2, length-3);
|
||||
}
|
||||
else {
|
||||
audio_scene_recv_raw_data(audio_scene, valid, buffer, length);
|
||||
}
|
||||
}
|
||||
}
|
21
MCU/examples/application/btdm_audio/Src/app_audio.h
Normal file
21
MCU/examples/application/btdm_audio/Src/app_audio.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef _APP_AUDIO_H
|
||||
#define _APP_AUDIO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "audio_common.h"
|
||||
#include "audio_scene.h"
|
||||
|
||||
void app_audio_a2dp_sink_start(audio_type_t audio_type, uint32_t sample_rate);
|
||||
void app_audio_a2dp_sink_stop(void);
|
||||
void app_audio_a2dp_sink_play(uint8_t *buffer, uint32_t length);
|
||||
|
||||
void app_audio_sco_start(audio_type_t audio_type, audio_sence_report_encoded_frame report_enc_cb, void *report_enc_arg);
|
||||
void app_audio_sco_stop(void);
|
||||
void app_audio_sco_recv(bool valid, uint8_t audio_type, uint8_t *buffer, uint32_t length);
|
||||
|
||||
void app_audio_voice_recognize_start(void);
|
||||
void app_audio_voice_recognize_stop(void);
|
||||
|
||||
#endif // _APP_AUDIO_H
|
390
MCU/examples/application/btdm_audio/Src/app_ble.c
Normal file
390
MCU/examples/application/btdm_audio/Src/app_ble.c
Normal file
@ -0,0 +1,390 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "co_log.h"
|
||||
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "gaf_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
//#include "user_bt.h"
|
||||
#include "hid_service.h"
|
||||
#include "simple_gatt_service.h"
|
||||
#include "ANCS_AMS_client.h"
|
||||
#include "AMS_client.h"
|
||||
|
||||
#define APP_BLE_ADV_CHN_MAX 2
|
||||
|
||||
|
||||
static TimerHandle_t ble_sec_req_timer = NULL;
|
||||
static void app_ble_start_advertising(uint8_t adv_chn);
|
||||
|
||||
char local_device_name[] = "30xx_ble";
|
||||
static adv_handle adv[APP_BLE_ADV_CHN_MAX];
|
||||
static uint16_t mtu_connected[8];
|
||||
|
||||
extern const uint8_t ble_static_addr[];
|
||||
|
||||
uint8_t slave_link_conidx;
|
||||
static uint8_t adv_data[] = {
|
||||
|
||||
#if 0
|
||||
/* gatt service information */
|
||||
0x03, //length of this AD
|
||||
GAP_ADVTYPE_16BIT_MORE, //16bit service uuid AD type
|
||||
//0xff, 0xf0, //value.service uuid:0xFFF0
|
||||
LO_UINT16(0XFF72),
|
||||
HI_UINT16(0XFF72),
|
||||
#endif
|
||||
|
||||
/* local device name information */
|
||||
0x0A, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'3','0','x','x','_',' ','b','l','e', //value.local device name
|
||||
|
||||
// 0x09, // addr mac
|
||||
// GAP_ADVTYPE_MANUFACTURER_SPECIFIC,
|
||||
// LO_UINT16(0x1671),
|
||||
// HI_UINT16(0x1671),
|
||||
// 0xc2,0x12,0x12,0x12,0x00,0x13,
|
||||
|
||||
// 0x03, // length of this data
|
||||
// GAP_ADVTYPE_APPEARANCE,
|
||||
// LO_UINT16(0x03c0),
|
||||
// HI_UINT16(0x03c0),
|
||||
|
||||
|
||||
#if 0
|
||||
// appearance
|
||||
0x03, // length of this data
|
||||
GAP_ADVTYPE_APPEARANCE,
|
||||
LO_UINT16(GAP_APPEARE_HID_KEYBOARD),
|
||||
HI_UINT16(GAP_APPEARE_HID_KEYBOARD),
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Advertising scan response data, max size is 31 bytes
|
||||
*/
|
||||
static uint8_t adv_scan_rsp_data[] = {
|
||||
|
||||
#if 1
|
||||
0x03, // length of this data
|
||||
GAP_ADVTYPE_16BIT_COMPLETE,
|
||||
LO_UINT16(HID_SERV_UUID),
|
||||
HI_UINT16(HID_SERV_UUID),
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Tx power level <20><><EFBFBD>书<EFBFBD><E4B9A6>
|
||||
0x02, // length of this data
|
||||
GAP_ADVTYPE_POWER_LEVEL,
|
||||
0, // 0dBm
|
||||
#endif
|
||||
};
|
||||
|
||||
static uint8_t client_id;
|
||||
|
||||
uint16_t app_ble_get_mtu(uint8_t conidx)
|
||||
{
|
||||
return mtu_connected[conidx];
|
||||
}
|
||||
|
||||
void app_ble_set_mtu(uint8_t conidx, uint16_t mtu)
|
||||
{
|
||||
mtu_connected[conidx] = mtu;
|
||||
}
|
||||
|
||||
static void ble_sec_req_timer_cb(TimerHandle_t pxTimer)
|
||||
{
|
||||
gap_security_req(0);
|
||||
}
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
printf("gap_callback: type = %d\r\n", event->type);
|
||||
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
//gap_get_link_version(event->param.connect.conidx);
|
||||
//gap_get_link_rssi(event->param.connect.conidx);
|
||||
//gap_get_link_features(event->param.connect.conidx);
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
// gatt_mtu_exchange_req(service_id, event->param.connect.conidx, 247);
|
||||
if(ble_sec_req_timer == NULL){
|
||||
ble_sec_req_timer = xTimerCreate("ble_sec_req_timer", 1000, pdFALSE, 0, ble_sec_req_timer_cb );
|
||||
}
|
||||
xTimerStart(ble_sec_req_timer,portMAX_DELAY);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
app_ble_start_advertising(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
app_ble_set_mtu(event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
//gap_security_req(event->param.connect.conidx);
|
||||
break;
|
||||
case GAP_EVT_SMP_ENCRYPT_SUCCESS:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_SMP_ENCRYPT_SUCCESS\r\n", event->param.mtu_ind.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SMP_BOND_SUCCESS:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_SMP_BOND_SUCCESS\r\n", event->param.mtu_ind.conidx);
|
||||
#if BLE_PROFILE_ENABLE_ANCS
|
||||
gatt_discovery_all_peer_svc(ANCS_AMS_client_id,event->param.connect.conidx);
|
||||
#endif
|
||||
|
||||
#if (BLE_PROFILE_ENABLE_HID)
|
||||
hid_service_enable(event->param.connect.conidx);
|
||||
#endif
|
||||
|
||||
// user_bt_env.connect_times = 3;
|
||||
// bt_connect(&event->param.bond.peer_id_addr.addr.addr);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_HID_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
//gap_security_req(event->param.connect.conidx);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t gatt_callback(struct gatt_msg *p_msg)
|
||||
{
|
||||
switch(p_msg->msg_evt) {
|
||||
case GATT_OP_PEER_SVC_DISC_END:
|
||||
switch(p_msg->param.gatt_op_cmp.operation) {
|
||||
case GATT_OP_PEER_SVC_DISC_END:
|
||||
// LOG_INFO(NULL, "GATT_OP_PEER_SVC_DISC_END: ");
|
||||
// uint16_t length = p_msg->param.gatt_op_cmp.arg_len;
|
||||
// uint8_t *buffer = p_msg->param.gatt_op_cmp.arg;
|
||||
// for(uint8_t i=0; i<length; i++) {
|
||||
// LOG_INFO(NULL, "%02x ", buffer[i]);
|
||||
// }
|
||||
// LOG_INFO(NULL, "\r\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
struct gap_security_param smp_param;
|
||||
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
smp_param.mitm = false;
|
||||
smp_param.secure_connection = true;
|
||||
smp_param.bond = true;
|
||||
smp_param.rsp_mode = ENABLE_AUTO_RSP;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
smp_param.rsp_mode = ENABLE_AUTO_RSP;
|
||||
gap_security_param_init(&smp_param);
|
||||
|
||||
sp_gatt_add_service();
|
||||
|
||||
#if BLE_PROFILE_ENABLE_ANCS
|
||||
ANCS_AMS_gatt_add_client();
|
||||
#endif
|
||||
|
||||
#if BLE_PROFILE_ENABLE_HID
|
||||
hid_gatt_add_service();
|
||||
#endif
|
||||
|
||||
// gaf_cfg();
|
||||
}
|
||||
|
||||
void app_ble_start_advertising(uint8_t adv_chn)
|
||||
{
|
||||
if (adv_chn < APP_BLE_ADV_CHN_MAX) {
|
||||
if (adv[adv_chn] == NULL) {
|
||||
struct gap_adv_param adv_param;
|
||||
|
||||
adv_param.adv_mode = GAP_ADV_MODE_UNDIRECT;
|
||||
adv_param.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC;
|
||||
adv_param.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY;
|
||||
adv_param.adv_chnl_map = GAP_ADV_CHAN_ALL;
|
||||
adv_param.phy_mode = GAP_PHY_TYPE_LE_1M;
|
||||
adv_param.own_addr_type = GAP_ADDR_TYPE_STATIC; // GAPM_GEN_RSLV_ADDR GAPM_STATIC_ADDR
|
||||
|
||||
adv_param.adv_intv_min = 1600;
|
||||
adv_param.adv_intv_max = 1600;
|
||||
adv[adv_chn] = gap_adv_create();
|
||||
gap_adv_set_param(adv[adv_chn], &adv_param);
|
||||
|
||||
adv_data[17] = ble_static_addr[5];
|
||||
adv_data[18] = ble_static_addr[4];
|
||||
adv_data[19] = ble_static_addr[3];
|
||||
adv_data[20] = ble_static_addr[2];
|
||||
adv_data[21] = ble_static_addr[1];
|
||||
adv_data[22] = ble_static_addr[0];
|
||||
|
||||
gap_adv_set_adv_data(adv[adv_chn], adv_data, sizeof(adv_data));
|
||||
gap_adv_set_scan_rsp(adv[adv_chn], adv_scan_rsp_data, sizeof(adv_scan_rsp_data));
|
||||
}
|
||||
gap_adv_start(adv[adv_chn], 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void app_ble_stop_advertising(uint8_t adv_chn)
|
||||
{
|
||||
if ((adv_chn < APP_BLE_ADV_CHN_MAX)
|
||||
&& (adv[adv_chn] != NULL)) {
|
||||
gap_adv_stop(adv[adv_chn]);
|
||||
}
|
||||
}
|
||||
|
||||
void app_ble_scan_start(void)
|
||||
{
|
||||
struct gap_scan_param param;
|
||||
|
||||
param.scan_type = GAP_SCAN_TYPE_GEN_DISC;
|
||||
param.own_addr_type = GAP_ADDR_TYPE_STATIC;
|
||||
param.phy_mode = GAP_PHY_TYPE_LE_1M;
|
||||
|
||||
param.dup_filt_pol = true;
|
||||
param.scan_intv = 32;
|
||||
param.scan_window = 20;
|
||||
param.duration = 0;
|
||||
|
||||
gap_scan_start(¶m);
|
||||
}
|
||||
|
||||
void app_ble_scan_stop(void)
|
||||
{
|
||||
gap_scan_stop();
|
||||
}
|
||||
|
||||
void app_ble_conn_start(struct gap_ble_addr *addr)
|
||||
{
|
||||
struct gap_conn_param conn_param;
|
||||
conn_param.peer_addr.addr_type = addr->addr_type;
|
||||
conn_param.peer_addr.addr.addr[0] = addr->addr.addr[0];
|
||||
conn_param.peer_addr.addr.addr[1] = addr->addr.addr[1];
|
||||
conn_param.peer_addr.addr.addr[2] = addr->addr.addr[2];
|
||||
conn_param.peer_addr.addr.addr[3] = addr->addr.addr[3];
|
||||
conn_param.peer_addr.addr.addr[4] = addr->addr.addr[4];
|
||||
conn_param.peer_addr.addr.addr[5] = addr->addr.addr[5];
|
||||
conn_param.own_addr_type = GAP_ADDR_TYPE_STATIC;
|
||||
conn_param.phy_mode = GAP_PHY_TYPE_LE_1M;
|
||||
conn_param.scan_intv = 32;
|
||||
conn_param.scan_window = 32;
|
||||
conn_param.conn_intv_min = 24;
|
||||
conn_param.conn_intv_max = 24;
|
||||
conn_param.supervision_to = 500;
|
||||
conn_param.slave_latency = 0;
|
||||
conn_param.ce_len_max = 2;
|
||||
conn_param.ce_len_min = 2;
|
||||
gap_conn_start(&conn_param);
|
||||
}
|
||||
|
||||
void app_ble_conn_stop(void)
|
||||
{
|
||||
gap_conn_stop();
|
||||
}
|
19
MCU/examples/application/btdm_audio/Src/app_ble.h
Normal file
19
MCU/examples/application/btdm_audio/Src/app_ble.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _APP_BLE_H
|
||||
#define _APP_BLE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "gap_api.h"
|
||||
|
||||
void app_ble_init(void);
|
||||
|
||||
void app_ble_advertising_start(uint8_t adv_chn);
|
||||
void app_ble_advertising_stop(uint8_t adv_chn);
|
||||
|
||||
void app_ble_scan_start(void);
|
||||
void app_ble_scan_stop(void);
|
||||
|
||||
void app_ble_conn_start(struct gap_ble_addr *addr);
|
||||
void app_ble_conn_stop(void);
|
||||
|
||||
#endif // _APP_BLE_H
|
1284
MCU/examples/application/btdm_audio/Src/app_bt.c
Normal file
1284
MCU/examples/application/btdm_audio/Src/app_bt.c
Normal file
File diff suppressed because it is too large
Load Diff
32
MCU/examples/application/btdm_audio/Src/app_bt.h
Normal file
32
MCU/examples/application/btdm_audio/Src/app_bt.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _APP_BT_H
|
||||
#define _APP_BT_H
|
||||
|
||||
#include "app_btdm.h"
|
||||
|
||||
#include "hf_api.h"
|
||||
#include "me_api.h"
|
||||
#include "a2dp_api.h"
|
||||
#include "hfg_api.h"
|
||||
#include "avrcp_api.h"
|
||||
#include "hid_api.h"
|
||||
#include "spp_api.h"
|
||||
#include "pbap_api.h"
|
||||
|
||||
extern HfChannel *hf_channel;
|
||||
extern HfgChannel *hfg_channel;
|
||||
extern A2dpStream *Stream;
|
||||
extern AvrcpChannel *rcpCtChannel;
|
||||
extern AvrcpChannel *rcpTgChannel;
|
||||
extern PbapClientSession *pbap_client;
|
||||
extern SppDev *spp_dev;
|
||||
|
||||
uint8_t bt_get_free_hf_channel(void);
|
||||
uint8_t bt_get_free_hfg_channel(void);
|
||||
uint8_t bt_get_free_a2dp_stream(void);
|
||||
uint8_t bt_get_free_avrcp_channel(void);
|
||||
|
||||
void app_bt_send_sco_data(void *channel, uint8_t seq, uint8_t *data, uint16_t length);
|
||||
|
||||
void app_bt_init(app_btdm_callback_t cb);
|
||||
|
||||
#endif // _APP_BT_H
|
233
MCU/examples/application/btdm_audio/Src/app_btdm.c
Normal file
233
MCU/examples/application/btdm_audio/Src/app_btdm.c
Normal file
@ -0,0 +1,233 @@
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_audio.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_bt.h"
|
||||
#include "user_bt.h"
|
||||
#include "co_list.h"
|
||||
#include "controller.h"
|
||||
#include "host.h"
|
||||
#include "btdm_mem.h"
|
||||
#include "fdb_app.h"
|
||||
|
||||
#define SCO_DATA_BUFFER_COUNT 4
|
||||
|
||||
typedef int32_t app_btdm_ret_t;
|
||||
|
||||
struct sco_data_t {
|
||||
struct co_list_hdr hdr;
|
||||
void *arg;
|
||||
uint16_t length;
|
||||
uint8_t data[];
|
||||
};
|
||||
uint8_t bt_addr[] = {0x12, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
uint8_t ble_public_addr[] = {0x13, 0x00, 0x88, 0x12, 0x12, 0x12};
|
||||
uint8_t ble_static_addr[] = {0x13, 0x66, 0x88, 0x12, 0x12, 0xc2};
|
||||
|
||||
static uint8_t sco_data_buffering = 0;
|
||||
static struct co_list sco_data_list;
|
||||
|
||||
static void encoded_sco_frame_cb(void *arg, uint8_t *data, uint16_t length)
|
||||
{
|
||||
static uint16_t seq = 0;
|
||||
if (sco_data_buffering) {
|
||||
struct sco_data_t *sco_data;
|
||||
|
||||
sco_data = (void *)btdm_malloc(sizeof(struct sco_data_t) + length);
|
||||
sco_data->arg = arg;
|
||||
sco_data->length = length;
|
||||
memcpy((void *)&sco_data->data[0], data, length);
|
||||
co_list_push_back(&sco_data_list, &sco_data->hdr);
|
||||
|
||||
sco_data_buffering--;
|
||||
if (sco_data_buffering == 0) {
|
||||
sco_data = (void *)co_list_pop_front(&sco_data_list);
|
||||
while (sco_data) {
|
||||
//fputc('D', NULL);
|
||||
app_bt_send_sco_data(sco_data->arg, seq++, sco_data->data, sco_data->length);
|
||||
btdm_free((void *)sco_data);
|
||||
sco_data = (void *)co_list_pop_front(&sco_data_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//fputc('D', NULL);
|
||||
app_bt_send_sco_data(arg, seq++, data, length);
|
||||
}
|
||||
}
|
||||
|
||||
static void btdm_callback(struct app_btdm_event_t *event)
|
||||
{
|
||||
switch(event->event) {
|
||||
case APP_BTDM_EVT_A2DP_STREAM_STARTED:
|
||||
if (event->param.a2dp_codec.codec_type == APP_BTDM_CODEC_SBC) {
|
||||
app_audio_a2dp_sink_start(AUDIO_TYPE_SBC, event->param.a2dp_codec.sample_rate);
|
||||
}
|
||||
else if (event->param.a2dp_codec.codec_type == APP_BTDM_CODEC_AAC) {
|
||||
app_audio_a2dp_sink_start(AUDIO_TYPE_AAC, event->param.a2dp_codec.sample_rate);
|
||||
}
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_A2DP_ONGOING);
|
||||
break;
|
||||
case APP_BTDM_EVT_A2DP_STREAM_STOPPED:
|
||||
app_audio_a2dp_sink_stop();
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_A2DP_ONGOING);
|
||||
break;
|
||||
case APP_BTDM_EVT_A2DP_STREAM_DATA:
|
||||
app_audio_a2dp_sink_play(event->param.a2dp_data.buffer, event->param.a2dp_data.length);
|
||||
break;
|
||||
case APP_BTDM_EVT_SCO_CREATED:
|
||||
sco_data_buffering = SCO_DATA_BUFFER_COUNT;
|
||||
{
|
||||
struct sco_data_t *sco_data;
|
||||
sco_data = (void *)co_list_pop_front(&sco_data_list);
|
||||
while (sco_data) {
|
||||
btdm_free((void *)sco_data);
|
||||
sco_data = (void *)co_list_pop_front(&sco_data_list);
|
||||
}
|
||||
}
|
||||
if (event->param.sco_codec.codec_type == APP_BTDM_CODEC_mSBC) {
|
||||
app_audio_sco_start(AUDIO_TYPE_MSBC, encoded_sco_frame_cb, event->param.sco_codec.hf_channel);
|
||||
}
|
||||
else {
|
||||
app_audio_sco_start(AUDIO_TYPE_PCM, encoded_sco_frame_cb, event->param.sco_codec.hf_channel);
|
||||
}
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_SCO_ONGOING);
|
||||
break;
|
||||
case APP_BTDM_EVT_SCO_REMOVED:
|
||||
app_audio_sco_stop();
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_SCO_ONGOING);
|
||||
break;
|
||||
case APP_BTDM_EVT_SCO_DATA:
|
||||
{
|
||||
uint8_t audio_codec_type;
|
||||
if (event->param.sco_data.codec_type == APP_BTDM_CODEC_mSBC) {
|
||||
audio_codec_type = AUDIO_TYPE_MSBC;
|
||||
}
|
||||
else {
|
||||
audio_codec_type = AUDIO_TYPE_PCM;
|
||||
}
|
||||
app_audio_sco_recv(event->param.sco_data.valid, audio_codec_type, event->param.sco_data.buffer, event->param.sco_data.length);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_btdm_start(void)
|
||||
{
|
||||
app_ble_init();
|
||||
#if BTDM_STACK_ENABLE_BT == 1
|
||||
app_bt_init(btdm_callback);
|
||||
user_bt_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void host_ready_cb(void)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
/* notify application BTDM stack is ready. */
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_HOST_INITED, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
|
||||
void app_btdm_init(void)
|
||||
{
|
||||
/*get bt addr*/
|
||||
#if BT_ADDR_RANDOM_ENABLE | BLE_ADDR_RANDOM_ENABLE
|
||||
uint8_t rand_num[4];
|
||||
if(flashdb_get(FDB_KEY_USER_RANDOM_SEED, (void *)&rand_num[0], 4) != 0){
|
||||
#if BT_ADDR_RANDOM_ENABLE
|
||||
memcpy((void *)&bt_addr[0],rand_num,4);
|
||||
#endif
|
||||
#if BLE_ADDR_RANDOM_ENABLE
|
||||
memcpy((void *)&ble_static_addr[0],rand_num,4);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* prepare for BTDM stack */
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
|
||||
extern uint8_t CONTROLLER_CODE_OTA_BASE;
|
||||
uint32_t controller_code_base_addr = (uint32_t)&CONTROLLER_CODE_OTA_BASE;
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr, controller_code_base_addr);
|
||||
#elif defined(__GNUC__) || defined(__ICCARM__)
|
||||
extern const uint8_t controller_code_buffer[];
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr, (uint32_t)&controller_code_buffer[0]);
|
||||
#else
|
||||
#error "not supported platform"
|
||||
#endif
|
||||
|
||||
#if BTDM_STACK_ENABLE_BT == 1
|
||||
host_btdm_start(BTDM_STACK_HCI_BAUDRATE, HOST_TASK_STACK_SIZE, HOST_TASK_PRIORITY, ble_static_addr);
|
||||
#else
|
||||
host_ble_start(BTDM_STACK_HCI_BAUDRATE, HOST_TASK_STACK_SIZE, HOST_TASK_PRIORITY, ble_static_addr);
|
||||
#endif
|
||||
|
||||
/* init MCU->BT pin, configure PMU_PIN_8 output BBG_EN signal */
|
||||
ool_write(PMU_REG_DIAG_CTRL, 0x82);
|
||||
ool_write(PMU_REG_PIN_IOMUX_H, 0x03);
|
||||
/* disable PMU pin input as default setting */
|
||||
ool_write16(PMU_REG_PIN_INPUT_EN, 0x0002);
|
||||
|
||||
/* PP1 is connected to ARST of 1010, this pin is low in sleep mode */
|
||||
ool_write16(PMU_REG_PIN_PULL_EN, 0x3ffd);
|
||||
ool_write16(PMU_REG_PIN_PULL_SEL, 0x3fff);
|
||||
|
||||
/* init BT->MCU pin, system should not enter sleep mode when this pin is low level */
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
pmu_gpio_int_init(PMU_PIN_9, PMU_GPIO_PULL_UP, 0);
|
||||
pmu_enable_isr(PMU_GPIO_PMU_INT_MSK_BIT);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_access_mode_set(uint8_t mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_connect(uint8_t *peer_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_profile_enable(uint16_t profiles)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const uint8_t *app_get_bt_addr(void)
|
||||
{
|
||||
return bt_addr;
|
||||
}
|
67
MCU/examples/application/btdm_audio/Src/app_btdm.h
Normal file
67
MCU/examples/application/btdm_audio/Src/app_btdm.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef _APP_BTDM_H
|
||||
#define _APP_BTDM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum {
|
||||
APP_BTDM_EVT_BLE_CONNECTED,
|
||||
APP_BTDM_EVT_BLE_DISCONNECTED,
|
||||
|
||||
APP_BTDM_EVT_BT_CONNECTED,
|
||||
APP_BTDM_EVT_BT_DISCONNECTED,
|
||||
APP_BTDM_EVT_HF_INCOMING,
|
||||
APP_BTDM_EVT_HF_CALL_ACTIVE,
|
||||
APP_BTDM_EVT_HF_CALL_REMOVE,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STARTED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STOPPED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_DATA,
|
||||
APP_BTDM_EVT_AVRCP_VOL_CHANGE,
|
||||
APP_BTDM_EVT_AVRCP_NEXT,
|
||||
APP_BTDM_EVT_AVRCP_PREV,
|
||||
APP_BTDM_EVT_AVRCP_PAUSE,
|
||||
APP_BTDM_EVT_AVRCP_FAST_FORWARD,
|
||||
APP_BTDM_EVT_AVRCP_FAST_BACKWARD,
|
||||
APP_BTDM_EVT_SCO_CREATED,
|
||||
APP_BTDM_EVT_SCO_REMOVED,
|
||||
APP_BTDM_EVT_SCO_DATA,
|
||||
};
|
||||
|
||||
enum {
|
||||
APP_BTDM_CODEC_SBC,
|
||||
APP_BTDM_CODEC_AAC,
|
||||
APP_BTDM_CODEC_mSBC,
|
||||
APP_BTDM_CODEC_PCM,
|
||||
APP_BTDM_CODEC_UNKNOWN,
|
||||
};
|
||||
|
||||
struct app_btdm_event_t {
|
||||
uint8_t event;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} a2dp_data;
|
||||
struct {
|
||||
uint8_t codec_type;
|
||||
uint32_t sample_rate;
|
||||
} a2dp_codec;
|
||||
struct {
|
||||
bool valid;
|
||||
uint8_t codec_type;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} sco_data;
|
||||
struct {
|
||||
void *hf_channel;
|
||||
uint8_t codec_type;
|
||||
} sco_codec;
|
||||
} param;
|
||||
};
|
||||
|
||||
typedef void (*app_btdm_callback_t)(struct app_btdm_event_t *e);
|
||||
|
||||
void app_btdm_start(void);
|
||||
void app_btdm_init(void);
|
||||
const uint8_t *app_get_bt_addr(void);
|
||||
#endif // _APP_BTDM_H
|
133
MCU/examples/application/btdm_audio/Src/app_rpmsg.c
Normal file
133
MCU/examples/application/btdm_audio/Src/app_rpmsg.c
Normal file
@ -0,0 +1,133 @@
|
||||
#include "fr30xx.h"
|
||||
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "rpmsg.h"
|
||||
#include "rpmsg_lite.h"
|
||||
#include "rpmsg_queue.h"
|
||||
#include "rpmsg_ns.h"
|
||||
|
||||
#include "dsp.h"
|
||||
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_rpmsg.h"
|
||||
|
||||
#define DSP_BOOT_FROM_EXT_FLASH 1 // 1: flash, 0: sd card
|
||||
|
||||
/* Remote rpmsg instance */
|
||||
static struct rpmsg_lite_instance *remote_rpmsg;
|
||||
static TaskHandle_t rpmsg_task_handle;
|
||||
|
||||
static void rpmsg_recv(struct rpmsg_lite_instance *rpmsg, struct rpmsg_msg_t *msg)
|
||||
{
|
||||
// printf("rpmsg_recv: msg_type = %d.\r\n", msg->msg_type);
|
||||
|
||||
switch (msg->msg_type) {
|
||||
case RPMSG_MSG_TYPE_SYNC_INVOKE:
|
||||
if (msg->p.sync_func.func_id == RPMSG_SYNC_FUNC_SUM) {
|
||||
uint32_t address = (uint32_t)msg->p.sync_func.param;
|
||||
struct rpmsg_sync_msg_sum_t *param = msg->p.sync_func.param;
|
||||
if (address >= DSP_DRAM_BASE_ADDR) {
|
||||
address = DSP_DRAM_2_MCU_SRAM(address);
|
||||
}
|
||||
param = (void *)address;
|
||||
rpmsg_send_sync_ret(rpmsg, 0, param->x + param->y);
|
||||
}
|
||||
else {
|
||||
rpmsg_send_sync_ret(rpmsg, 0xffffffff, 0);
|
||||
}
|
||||
break;
|
||||
case RPMSG_MSG_TYPE_ASYNC_MSG:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void rpmsg_task(void *arg)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
struct rpmsg_msg_t *msg;
|
||||
uint32_t msg_len;
|
||||
uint32_t src_addr;
|
||||
uint32_t length;
|
||||
|
||||
dsp_prepare();
|
||||
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
|
||||
extern uint8_t DSP_CODE_ROM_BASE, DSP_CODE_ROM_END;
|
||||
src_addr = (uint32_t)&DSP_CODE_ROM_BASE;
|
||||
length = (uint32_t)&DSP_CODE_ROM_END - (uint32_t)&DSP_CODE_ROM_BASE;
|
||||
#elif defined(__GNUC__) || defined(__ICCARM__)
|
||||
extern const uint8_t dsp_code_rom_buffer[];
|
||||
src_addr = (uint32_t)&dsp_code_rom_buffer[0];
|
||||
length = 0;
|
||||
#endif
|
||||
if (dsp_load_code_from_internal_flash(src_addr, length) == false) {
|
||||
|
||||
printf("DSP image load failed.\r\n");
|
||||
while(1);
|
||||
}
|
||||
|
||||
printf("DSP is released.\r\n");
|
||||
__SYSTEM_LIBRARY_ROM_CLK_ENABLE();
|
||||
remote_rpmsg = rpmsg_remote_init(rpmsg_recv);
|
||||
dsp_run(0x78400660);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_DSP);
|
||||
rpmsg_wait_master_ready(remote_rpmsg);
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_DSP);
|
||||
|
||||
printf("DSP is ready.\r\n");
|
||||
|
||||
/* notice APP that rpmsg is ready. */
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_RPMSG_INITED, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
|
||||
while (1) {
|
||||
src_addr = rpmsg_recv_msg(remote_rpmsg, &msg, &msg_len);
|
||||
rpmsg_recv(remote_rpmsg, msg);
|
||||
rpmsg_lite_release_rx_buffer(remote_rpmsg, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void app_rpmsg_init(void)
|
||||
{
|
||||
/* create rpmsg task. */
|
||||
xTaskCreate(rpmsg_task, "RPMSG_TASK", RPMSG_TASK_STACK_SIZE, NULL, RPMSG_TASK_PRIORITY, &rpmsg_task_handle);
|
||||
}
|
||||
|
||||
void app_rpmsg_recover(void)
|
||||
{
|
||||
dsp_prepare();
|
||||
|
||||
uint32_t src_addr;
|
||||
uint32_t length;
|
||||
#if DSP_CODE_LOAD_MODE == DSP_CODE_LOAD_MODE_XIP_RO
|
||||
#if DSP_ROM_CODE_XIP == 1
|
||||
extern uint8_t DSP_CODE_FLASH_BASE, DSP_CODE_FLASH_END;
|
||||
src_addr = (uint32_t)&DSP_CODE_FLASH_BASE;
|
||||
length = (uint32_t)&DSP_CODE_FLASH_END - (uint32_t)&DSP_CODE_FLASH_BASE;
|
||||
#else
|
||||
extern uint8_t DSP_CODE_ROM_BASE, DSP_CODE_ROM_END;
|
||||
src_addr = (uint32_t)&DSP_CODE_ROM_BASE;
|
||||
length = (uint32_t)&DSP_CODE_ROM_END - (uint32_t)&DSP_CODE_ROM_BASE;
|
||||
#endif
|
||||
dsp_load_rw_from_internal_flash(src_addr, length);
|
||||
#elif DSP_CODE_LOAD_MODE == DSP_CODE_LOAD_MODE_FIX_ADDRESS
|
||||
src_addr = (uint32_t)((DSP_CODE_FIX_ADDRESS + 0x10) | FLASH_DAC_BASE);
|
||||
length = *(volatile uint32_t *)((DSP_CODE_FIX_ADDRESS + 0x08) | FLASH_DAC_BASE);
|
||||
dsp_load_rw_from_internal_flash(src_addr, length);
|
||||
#else
|
||||
#error "choose correct DSP code load mode"
|
||||
#endif
|
||||
|
||||
#if DSP_ROM_CODE_XIP == 0
|
||||
__SYSTEM_LIBRARY_ROM_CLK_ENABLE();
|
||||
#endif
|
||||
dsp_run(0x78400660);
|
||||
|
||||
rpmsg_remote_recover();
|
||||
}
|
7
MCU/examples/application/btdm_audio/Src/app_rpmsg.h
Normal file
7
MCU/examples/application/btdm_audio/Src/app_rpmsg.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef _APP_RPMSG_H
|
||||
#define _APP_RPMSG_H
|
||||
|
||||
void app_rpmsg_init(void);
|
||||
void app_rpmsg_recover(void);
|
||||
|
||||
#endif // _APP_RPMSG_H
|
110
MCU/examples/application/btdm_audio/Src/app_task.c
Normal file
110
MCU/examples/application/btdm_audio/Src/app_task.c
Normal file
@ -0,0 +1,110 @@
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_bt.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_rpmsg.h"
|
||||
#include "app_config.h"
|
||||
|
||||
static struct co_list event_list;
|
||||
|
||||
extern TaskHandle_t app_task_handle;
|
||||
|
||||
void hci_controller_read(void);
|
||||
void hci_host_read(void);
|
||||
|
||||
static void app_task_event_handler(void)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
vTaskSuspendAll();
|
||||
event = (struct app_task_event *)co_list_pop_front(&event_list);
|
||||
xTaskResumeAll();
|
||||
|
||||
if(event) {
|
||||
switch(event->event_type) {
|
||||
case APP_TASK_EVENT_AT_CMD:
|
||||
app_at_cmd_recv_handler(event->param, event->param_len);
|
||||
break;
|
||||
case APP_TASK_EVENT_RPMSG_INITED:
|
||||
app_btdm_init();
|
||||
break;
|
||||
case APP_TASK_EVENT_HOST_INITED:
|
||||
app_btdm_start();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
vPortFree((void *)event);
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high)
|
||||
{
|
||||
uint32_t old_basepri;
|
||||
|
||||
if(xPortIsInsideInterrupt()) {
|
||||
old_basepri = taskENTER_CRITICAL_FROM_ISR();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL_FROM_ISR(old_basepri);
|
||||
vTaskNotifyGiveFromISR(app_task_handle, NULL);
|
||||
}
|
||||
else {
|
||||
taskENTER_CRITICAL();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
xTaskNotifyGive(app_task_handle);
|
||||
}
|
||||
}
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
while(event == NULL) {
|
||||
event = pvPortMalloc(sizeof(struct app_task_event) + param_len);
|
||||
if (event == NULL) {
|
||||
if (block) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event->event_type = event_type;
|
||||
event->param_len = param_len;
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static void app_task(void *arg)
|
||||
{
|
||||
co_list_init(&event_list);
|
||||
|
||||
app_rpmsg_init();
|
||||
|
||||
while(1) {
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
app_task_event_handler();
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_init(void)
|
||||
{
|
||||
xTaskCreate(app_task, "app", APP_TASK_STACK_SIZE, NULL, APP_TASK_PRIORITY, &app_task_handle);
|
||||
}
|
30
MCU/examples/application/btdm_audio/Src/app_task.h
Normal file
30
MCU/examples/application/btdm_audio/Src/app_task.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef _APP_TASK_H
|
||||
#define _APP_TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "co_list.h"
|
||||
|
||||
#define APP_TASK_EVENT_AT_CMD 0x00
|
||||
#define APP_TASK_EVENT_RPMSG_INITED 0x01
|
||||
#define APP_TASK_EVENT_HOST_INITED 0x02
|
||||
#define APP_TASK_EVENT_LVGL_INITED 0x03
|
||||
#define APP_TASK_EVENT_DELAY_CONNECT 0x04
|
||||
|
||||
struct app_task_event {
|
||||
struct co_list_hdr hdr;
|
||||
|
||||
uint8_t event_type;
|
||||
|
||||
uint16_t param_len;
|
||||
uint8_t param[];
|
||||
};
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high);
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block);
|
||||
|
||||
void app_task_init(void);
|
||||
|
||||
#endif // _APP_TASK_H
|
451
MCU/examples/application/btdm_audio/Src/diskio.c
Normal file
451
MCU/examples/application/btdm_audio/Src/diskio.c
Normal file
@ -0,0 +1,451 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Low level disk I/O module SKELETON for FatFs (C)ChaN, 2019 */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* If a working storage control module is available, it should be */
|
||||
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||
/* This is an example of glue functions to attach various exsisting */
|
||||
/* storage control modules to the FatFs module with a defined API. */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "ff.h" /* Obtains integer types */
|
||||
#include "diskio.h" /* Declarations of disk functions */
|
||||
|
||||
/* Definitions of physical drive number for each drive */
|
||||
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
|
||||
#define DEV_MMC 1 /* Example: Map MMC to physical drive 1 */
|
||||
#define DEV_SPI_FLASH 2 /* Example: Map SPI Flash to physical drive 2 */
|
||||
#define DEV_NAND_FLASH 3 /* Example: Map Nand Flash to physical drive 3 */
|
||||
#define DEV_SD_CARD 4 /* Example: Map SD Card to physical drive 4 */
|
||||
|
||||
#define RAM_SECTOR_SIZE 512
|
||||
#define RAM_SECTOR_COUNT (16*48)
|
||||
#define RAM_BLOCK_SIZE 4096
|
||||
#define RAM_DISK_SIZE (RAM_SECTOR_SIZE * RAM_SECTOR_COUNT)
|
||||
|
||||
#define SD_CARD_SECTOR_SIZE 512
|
||||
#define SD_CARD_BLOCK_SIZE 4096
|
||||
|
||||
#define SPI_FLASH_SECTOR_SIZE 512
|
||||
#define SPI_FLASH_BLOCK_SIZE 4096
|
||||
#define SPI_FLASH_SECTOR_COUNT (2*1024*4)
|
||||
|
||||
__ALIGNED(4) static uint8_t ram_disk_space[RAM_DISK_SIZE];
|
||||
static uint8_t spi_flash_poll[4096];
|
||||
extern SD_HandleTypeDef sdio_handle;
|
||||
|
||||
static DSTATUS RAM_disk_status(void)
|
||||
{
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS MMC_disk_status(void)
|
||||
{
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS SPI_flash_status(void)
|
||||
{
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS SD_Card_status(void)
|
||||
{
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS RAM_disk_initialize(void)
|
||||
{
|
||||
// memset(ram_disk_space, 0, RAM_DISK_SIZE);
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS MMC_disk_initialize(void)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS SPI_flash_initialize(void)
|
||||
{
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS SD_Card_initialize(void)
|
||||
{
|
||||
// uint32_t EER;
|
||||
//
|
||||
// EER = SDCard_Init(&SDIO);
|
||||
// if (EER != INT_NO_ERR) {
|
||||
// return RES_ERROR;
|
||||
// }
|
||||
// EER = SDCard_BusWidth_Select(&SDIO, SDIO_BUS_WIDTH_4BIT);
|
||||
// if (EER != INT_NO_ERR) {
|
||||
// return RES_ERROR;
|
||||
// }
|
||||
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS RAM_disk_read(BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS SPI_flash_read(BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS MMC_disk_read(BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS SD_Card_read(BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
SDCard_ReadBolcks(&sdio_handle, (uint32_t *)buff, sector, count);
|
||||
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
static DSTATUS RAM_disk_write(const BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS MMC_disk_write(const BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS SPI_flash_write(const BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
static DSTATUS SD_Card_write(const BYTE *buff, LBA_t sector, UINT count)
|
||||
{
|
||||
SDCard_WriteBolcks(&sdio_handle, (uint32_t *)buff, sector, count);
|
||||
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_status (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
DSTATUS stat;
|
||||
|
||||
switch (pdrv) {
|
||||
case DEV_RAM :
|
||||
stat = RAM_disk_status();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_MMC :
|
||||
stat = MMC_disk_status();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_SPI_FLASH :
|
||||
stat = SPI_flash_status();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_SD_CARD :
|
||||
stat = SD_Card_status();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
}
|
||||
return STA_NOINIT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Inidialize a Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_initialize (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
DSTATUS stat;
|
||||
|
||||
switch (pdrv) {
|
||||
case DEV_RAM :
|
||||
stat = RAM_disk_initialize();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_MMC :
|
||||
stat = MMC_disk_initialize();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_SPI_FLASH :
|
||||
stat = SPI_flash_initialize();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
|
||||
case DEV_SD_CARD :
|
||||
stat = SD_Card_initialize();
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return stat;
|
||||
}
|
||||
return STA_NOINIT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Read Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_read (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
BYTE *buff, /* Data buffer to store read data */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
|
||||
switch (pdrv) {
|
||||
case DEV_RAM :
|
||||
// translate the arguments here
|
||||
|
||||
res = RAM_disk_read(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_MMC :
|
||||
// translate the arguments here
|
||||
|
||||
res = MMC_disk_read(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SPI_FLASH :
|
||||
// translate the arguments here
|
||||
|
||||
res = SPI_flash_read(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SD_CARD :
|
||||
// translate the arguments here
|
||||
|
||||
res = SD_Card_read(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Write Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if FF_FS_READONLY == 0
|
||||
|
||||
DRESULT disk_write (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
const BYTE *buff, /* Data to be written */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
|
||||
switch (pdrv) {
|
||||
case DEV_RAM :
|
||||
// translate the arguments here
|
||||
|
||||
res = RAM_disk_write(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_MMC :
|
||||
// translate the arguments here
|
||||
|
||||
res = MMC_disk_write(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SPI_FLASH :
|
||||
// translate the arguments here
|
||||
|
||||
res = SPI_flash_write(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SD_CARD :
|
||||
// translate the arguments here
|
||||
|
||||
res = SD_Card_write(buff, sector, count);
|
||||
|
||||
// translate the reslut code here
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Miscellaneous Functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_ioctl (
|
||||
BYTE pdrv, /* Physical drive nmuber (0..) */
|
||||
BYTE cmd, /* Control code */
|
||||
void *buff /* Buffer to send/receive control data */
|
||||
)
|
||||
{
|
||||
DRESULT res = RES_PARERR;
|
||||
|
||||
switch (pdrv) {
|
||||
case DEV_RAM :
|
||||
|
||||
// Process of the command for the RAM drive
|
||||
switch(cmd)
|
||||
{
|
||||
case CTRL_SYNC:
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_SIZE:
|
||||
*(WORD*)buff = RAM_SECTOR_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*(WORD*)buff = RAM_BLOCK_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_COUNT:
|
||||
*(DWORD*)buff = RAM_SECTOR_COUNT;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case CTRL_TRIM:
|
||||
res = RES_OK;
|
||||
break;
|
||||
default:
|
||||
res = RES_PARERR;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_MMC :
|
||||
|
||||
// Process of the command for the MMC/SD card
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SPI_FLASH :
|
||||
|
||||
// Process of the command for the MMC/SD card
|
||||
switch(cmd)
|
||||
{
|
||||
case CTRL_SYNC:
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_SIZE:
|
||||
*(WORD*)buff = SPI_FLASH_SECTOR_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*(WORD*)buff = SPI_FLASH_BLOCK_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_COUNT:
|
||||
*(DWORD*)buff = SPI_FLASH_SECTOR_COUNT;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case CTRL_TRIM:
|
||||
res = RES_OK;
|
||||
break;
|
||||
default:
|
||||
res = RES_PARERR;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
case DEV_SD_CARD :
|
||||
|
||||
// Process of the command for the RAM drive
|
||||
switch(cmd)
|
||||
{
|
||||
case CTRL_SYNC:
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_SIZE:
|
||||
*(WORD*)buff = SD_CARD_SECTOR_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*(WORD*)buff = SD_CARD_BLOCK_SIZE;
|
||||
res = RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_COUNT:
|
||||
*(DWORD*)buff = SDCard_Get_Block_count(&sdio_handle);
|
||||
res = RES_OK;
|
||||
break;
|
||||
case CTRL_TRIM:
|
||||
res = RES_OK;
|
||||
break;
|
||||
default:
|
||||
res = RES_PARERR;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
374
MCU/examples/application/btdm_audio/Src/main.c
Normal file
374
MCU/examples/application/btdm_audio/Src/main.c
Normal file
@ -0,0 +1,374 @@
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "fdb_app.h"
|
||||
#include "host.h"
|
||||
#include "ff.h"
|
||||
|
||||
#include "app_task.h"
|
||||
#include "app_at.h"
|
||||
#include "audio_scene.h"
|
||||
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef Uart3_handle;
|
||||
SD_HandleTypeDef sdio_handle;
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* FreeRTOS running status monitor task */
|
||||
static TaskHandle_t monitor_task_handle;
|
||||
volatile unsigned int CPU_RunTime;
|
||||
static uint8_t CPU_RunInfo[2048];
|
||||
#endif
|
||||
|
||||
/* file system */
|
||||
static FATFS fs;
|
||||
|
||||
/* APP task */
|
||||
TaskHandle_t app_task_handle;
|
||||
|
||||
void controller_start(void);
|
||||
void host_start(void);
|
||||
|
||||
#if defined(__ARMCC_VERSION) || defined(__CC_ARM)
|
||||
int fputc(int c, FILE *fp)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __ICCARM__
|
||||
int putchar(int c)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
static void monitor_task(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
vTaskDelay(10000);
|
||||
|
||||
memset(CPU_RunInfo,0,2048);
|
||||
vTaskList((char *)&CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
printf("name state priority stack seq\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
|
||||
memset(CPU_RunInfo,0,400);
|
||||
vTaskGetRunTimeStats((char *)&CPU_RunInfo);
|
||||
printf("name counter usage\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
void vApplicationTickHook(void)
|
||||
{
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
CPU_RunTime++;
|
||||
#endif
|
||||
}
|
||||
|
||||
__RAM_CODE bool user_deep_sleep_check(void)
|
||||
{
|
||||
return host_before_sleep_check();
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_before_sleep(void)
|
||||
{
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) | 0x40);
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_after_sleep(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* configure all interrupt priority to 2 */
|
||||
*(volatile uint32_t *)0xE000E400 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E404 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E408 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E40C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E410 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E414 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E418 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E41C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E420 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E424 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E428 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E42C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E430 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E434 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E438 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E43C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E440 = 0x40404040;
|
||||
|
||||
host_hci_reinit();
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) & (~0x40));
|
||||
NVIC_SetPriority(UART0_IRQn, 2);
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
|
||||
/* configure PA0 and PA1 to UART0 function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART2_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 921600;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
app_rpmsg_recover();
|
||||
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_clock_init(void)
|
||||
{
|
||||
System_ClkConfig_t sys_clk_cfg;
|
||||
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_N = 8;
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_M = 15204;
|
||||
sys_clk_cfg.AUPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_N = 8;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_M = 0;
|
||||
sys_clk_cfg.SPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.MCU_Clock_Source = MCU_CLK_SEL_SPLL_CLK;
|
||||
sys_clk_cfg.SOC_DIV = 1;
|
||||
sys_clk_cfg.MCU_DIV = 1;
|
||||
sys_clk_cfg.APB0_DIV = 1;
|
||||
sys_clk_cfg.APB1_DIV = 1;
|
||||
sys_clk_cfg.APB2_DIV = 1;
|
||||
sys_clk_cfg.APB3_DIV = 1;
|
||||
System_AUPLL_config(&sys_clk_cfg.AUPLL_CFG, 1000);
|
||||
System_SPLL_config(&sys_clk_cfg.SPLL_CFG, 1000);
|
||||
System_MCU_clock_Config(&sys_clk_cfg);
|
||||
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_I2C_CLK_SELECT_SPLL();
|
||||
__SYSTEM_BLEND_CLK_SELECT_SPLL();
|
||||
__SYSTEM_UART_CLK_SELECT_SPLL();
|
||||
}
|
||||
|
||||
__RAM_CODE __attribute__((noinline)) static void rise_qspi_clock(void)
|
||||
{
|
||||
__SYSTEM_QSPI0_CLK_SELECT_AUPLL();
|
||||
__QSPI_DELAY_CS_START_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_END_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_DESSERT_SET(QSPI0, 8);
|
||||
__QSPI_READ_CAPTURE_DELAY_SET(QSPI0, 0); // FLASH_ID_PUYA_P25Q32: 4 when div is 2
|
||||
// FLASH_ID_XMC_XM25LU32: 3 when div is 2
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 1 when div is 4
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 4 when div is 2
|
||||
system_delay_us(1000);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_xip_flash_init(bool wake_up)
|
||||
{
|
||||
// init internal flash
|
||||
__SYSTEM_PFC_CLK_ENABLE();
|
||||
__SYSTEM_QSPI0_CLK_ENABLE();
|
||||
__SYSTEM_APB_CLK_ENABLE();
|
||||
__SYSTEM_APB1_CLK_ENABLE();
|
||||
system_cache_enable(true);
|
||||
flash_enable_quad(QSPI0);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_QUAD, FLASH_WR_TYPE_SINGLE);
|
||||
if (wake_up == false) {
|
||||
flash_set_IO_DRV(QSPI0, 3);
|
||||
}
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
rise_qspi_clock();
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
UART_HandleTypeDef dsp_uart_handle;
|
||||
uint32_t error;
|
||||
uint32_t rand_num;
|
||||
size_t size;
|
||||
|
||||
system_delay_us(1000000);
|
||||
|
||||
/* configure all interrupt priority to 2 */
|
||||
*(volatile uint32_t *)0xE000E400 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E404 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E408 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E40C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E410 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E414 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E418 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E41C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E420 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E424 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E428 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E42C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E430 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E434 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E438 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E43C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E440 = 0x40404040;
|
||||
|
||||
pmu_init();
|
||||
ool_write(0xc3, 0x27);
|
||||
|
||||
// system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
|
||||
/* initial system clock and XIP flash */
|
||||
hw_clock_init();
|
||||
hw_xip_flash_init(false);
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
/* configure PA6 to PA_EN function */
|
||||
gpio_config.Pin = GPIO_PIN_6;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
|
||||
/* initialize uart for DSP UART */
|
||||
/* ========================================================== */
|
||||
/* ========= Uart LOG configuration ========= */
|
||||
/* ========================================================== */
|
||||
/* configure PA4 and PA5 to UART1 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
/* UART1: used for Log and AT command */
|
||||
__SYSTEM_UART1_CLK_ENABLE();
|
||||
dsp_uart_handle.UARTx = UART1;
|
||||
dsp_uart_handle.Init.BaudRate = 3000000;
|
||||
dsp_uart_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
dsp_uart_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
dsp_uart_handle.Init.Parity = UART_PARITY_NONE;
|
||||
dsp_uart_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
dsp_uart_handle.Init.AUTO_FLOW = false;
|
||||
dsp_uart_handle.TxCpltCallback = NULL;
|
||||
dsp_uart_handle.RxCpltCallback = NULL;
|
||||
uart_init(&dsp_uart_handle);
|
||||
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART3: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 921600;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
NVIC_SetPriority(UART3_IRQn, 4);
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= I2S interface configuration ======== */
|
||||
/* ========================================================== */
|
||||
/* configure PB0~PB3 to I2S0 function */
|
||||
gpio_config.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_B;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* init flashdb to store user data */
|
||||
flashdb_init();
|
||||
|
||||
/* get random seed*/
|
||||
size = flashdb_get(FDB_KEY_USER_RANDOM_SEED, (void *)&rand_num, 4);
|
||||
printf("flashdb get random seed :%d\r\n",size);
|
||||
if(size == 0){
|
||||
__SYSTEM_TRNG_CLK_ENABLE();
|
||||
trng_init();
|
||||
trng_read_rand_num((uint8_t *)&rand_num,4);
|
||||
flashdb_set(FDB_KEY_USER_RANDOM_SEED,(uint8_t *)&rand_num,4);
|
||||
__SYSTEM_TRNG_CLK_DISABLE();
|
||||
}
|
||||
printf("flash db get rand num: %x\r\n",rand_num);
|
||||
/* Create tasks */
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
xTaskCreate(monitor_task, "monitor", MONITOR_TASK_STACK_SIZE, NULL, MONITOR_TASK_PRIORITY, &monitor_task_handle);
|
||||
#endif
|
||||
|
||||
app_task_init();
|
||||
audio_scene_init(AUDIO_SCENE_TASK_STACK_SIZE, AUDIO_SCENE_TASK_PRIORITY);
|
||||
|
||||
/* initialize AT command */
|
||||
app_at_init(&Uart3_handle);
|
||||
|
||||
printf("FR5090: BTDM test.\r\n");
|
||||
|
||||
/* Start the scheduler itself. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uart3_irq(void)
|
||||
{
|
||||
uart_IRQHandler(&Uart3_handle);
|
||||
}
|
||||
|
||||
void PMU_GPIO_PMU_IRQHandler(void)
|
||||
{
|
||||
uint16_t data = ool_read16(PMU_REG_PIN_DATA);
|
||||
uint16_t result = ool_read16(PMU_REG_PIN_XOR_RESULT);
|
||||
|
||||
/* update last value with latest data */
|
||||
ool_write16(PMU_REG_PIN_LAST_V, data);
|
||||
/* clear last XOR result */
|
||||
ool_write16(PMU_REG_PIN_XOR_CLR, result);
|
||||
|
||||
if (data & PMU_PIN_9) {
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
else {
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
}
|
1167
MCU/examples/application/btdm_audio/Src/user_bt.c
Normal file
1167
MCU/examples/application/btdm_audio/Src/user_bt.c
Normal file
File diff suppressed because it is too large
Load Diff
223
MCU/examples/application/btdm_audio/Src/user_bt.h
Normal file
223
MCU/examples/application/btdm_audio/Src/user_bt.h
Normal file
@ -0,0 +1,223 @@
|
||||
#ifndef __USER_BT_H
|
||||
#define __USER_BT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "app_bt.h"
|
||||
#include "bt_types.h"
|
||||
#include "btconfig.h"
|
||||
#include "co_list.h"
|
||||
|
||||
///enable_profiles
|
||||
#define ENABLE_PROFILE_HF BIT0
|
||||
#define ENABLE_PROFILE_A2DP BIT1 //if a2dp is enabled, avrcp is enabled automatically
|
||||
#define ENABLE_PROFILE_HID BIT2
|
||||
#define ENABLE_PROFILE_PBAP BIT3
|
||||
#define ENABLE_PROFILE_SPP BIT4
|
||||
#define ENABLE_PROFILE_HFG BIT5
|
||||
#define ENABLE_PROFILE_MAP BIT6
|
||||
#define ENABLE_PROFILE_ALL 0xff
|
||||
|
||||
//conn flags
|
||||
#define LINK_STATUS_HF_CONNECTED (1<<0)
|
||||
#define LINK_STATUS_AV_CONNECTED (1<<1)
|
||||
#define LINK_STATUS_AVC_CONNECTED (1<<2)
|
||||
#define LINK_STATUS_MEDIA_PLAYING (1<<3)
|
||||
#define LINK_STATUS_SCO_CONNECTED (1<<4)
|
||||
#define LINK_STATUS_HID_CONNECTED (1<<5)
|
||||
#define LINK_STATUS_PBAP_CONNECTED (1<<6)
|
||||
#define LINK_STATUS_SPP_CONNECTED (1<<7)
|
||||
#define LINK_STATUS_HFG_CONNECTED (1<<8)
|
||||
|
||||
|
||||
enum bt_state_t{
|
||||
BT_STATE_IDLE, //IDLE
|
||||
BT_STATE_CONNECTING, //CONNECTING, connect is ongoing
|
||||
BT_STATE_DISCONNECTING, //disconnecting
|
||||
BT_STATE_CONNECTED, //CONNECTED, connected,no call and music
|
||||
BT_STATE_HFP_INCOMMING, //INCOMMING CALL
|
||||
BT_STATE_HFP_OUTGOING, //OUTGOING CALL
|
||||
BT_STATE_HFP_CALLACTIVE, //CALL IS ACTIVE
|
||||
BT_STATE_MEDIA_PLAYING, //MUSIC PLAYING
|
||||
BT_STATE_MAX,
|
||||
};
|
||||
|
||||
//enum bt_state_t{
|
||||
// BT_STATE_IDLE, //IDLE
|
||||
// BT_STATE_PAIRING, //PAIRING
|
||||
// BT_STATE_CONNECTED, //CONNECTED, connected,no call and music
|
||||
// BT_STATE_BOTH_CONNECTED, //used in connecting with two device
|
||||
// BT_STATE_MAX,
|
||||
//};
|
||||
|
||||
enum bt_link_state_t{
|
||||
BT_LINK_STATE_IDLE,
|
||||
BT_LINK_STATE_CONNECTING,
|
||||
BT_LINK_STATE_DISCONNECTING,
|
||||
BT_LINK_STATE_ACL_CONNECTED,
|
||||
BT_LINK_STATE_PROFILE_CONNECTED,
|
||||
};
|
||||
|
||||
enum app_bt_access_state_t{
|
||||
ACCESS_IDLE = 0x00,
|
||||
ACCESS_PAIRING,
|
||||
};
|
||||
|
||||
enum bt_connect_action_t{
|
||||
BT_ACTION_NULL,
|
||||
BT_ACTION_CONNECT,
|
||||
BT_ACTION_DISCONNECT,
|
||||
BT_ACTION_ACCESS,
|
||||
};
|
||||
|
||||
enum bt_connect_event_t{
|
||||
BT_EVENT_CON_IND,
|
||||
BT_EVENT_CON_CNF,
|
||||
BT_EVENT_PROFILE_CONNECT,
|
||||
BT_EVENT_DISCONNECT,
|
||||
BT_EVENT_ACC_CHG,
|
||||
};
|
||||
|
||||
enum bt_profile_event_t{
|
||||
BT_PROFILE_HF_CONN_REQ,
|
||||
BT_PROFILE_HF_CONN,
|
||||
BT_PROFILE_HF_DISCONN,
|
||||
BT_PROFILE_HF_AUDIO_CONN,
|
||||
BT_PROFILE_HF_AUDIO_DISCONN,
|
||||
|
||||
BT_PROFILE_HF_CALL, //5
|
||||
BT_PROFILE_HF_CALLSETUP,
|
||||
BT_PROFILE_HF_SPK_VOL,
|
||||
BT_PROFILE_HF_CURRENT_CALL,
|
||||
BT_PROFILE_HF_AT_RESULT,
|
||||
BT_PROFILE_HF_MAX, //10
|
||||
|
||||
BT_PROFILE_A2DP_CONN,
|
||||
BT_PROFILE_A2DP_DISCONN,
|
||||
BT_PROFILE_A2DP_PLAYING,
|
||||
BT_PROFILE_A2DP_SUSPEND,
|
||||
BT_PROFILE_A2DP_OPEN_IND,
|
||||
BT_PROFILE_A2DP_MAX,
|
||||
|
||||
BT_PROFILE_AVRCP_CONN,
|
||||
BT_PROFILE_AVRCP_DISCONN,
|
||||
BT_PROFILE_AVRCP_MEDIA_STATUS,
|
||||
BT_PROFILE_AVRCP_MEDIA_INFO,
|
||||
BT_PROFILE_AVRCP_MEDIA_POS,
|
||||
BT_PROFILE_AVRCP_MAX,
|
||||
|
||||
BT_PROFILE_PBAP_CONN,
|
||||
BT_PROFILE_PBAP_DISCONN,
|
||||
BT_PROFILE_PBAP_DATA_IND,
|
||||
BT_PROFILE_PBAP_COMP,
|
||||
BT_PROFILE_PBAP_MAX,
|
||||
};
|
||||
|
||||
struct bt_connect_param_t{
|
||||
uint16_t page_timeout; //unit: 625us
|
||||
uint8_t connect_times;
|
||||
// uint8_t connect_interval; //unit: 1s , interval shall larger than page_timeout
|
||||
};
|
||||
|
||||
struct bt_connect_elt_t{
|
||||
struct co_list_hdr hdr;
|
||||
BD_ADDR addr;
|
||||
uint8_t action;
|
||||
// struct bt_connect_param_t param;
|
||||
};
|
||||
|
||||
/* Device context */
|
||||
typedef struct app_device_t {
|
||||
BD_ADDR remote_bd;
|
||||
uint16_t conFlags;//avrcp,a2dp,hfp conn status
|
||||
uint8_t prf_all_connected;
|
||||
uint8_t responder;
|
||||
uint8_t state;
|
||||
|
||||
uint8_t mode;//active or sniff
|
||||
|
||||
HfCallSetupState setup_state;
|
||||
HfCallActiveState active;
|
||||
HfCallHeldState call_held;
|
||||
|
||||
BtRemoteDevice *remDev;
|
||||
HfChannel *hf_chan;
|
||||
HfgChannel *hfg_chan;
|
||||
AvrcpChannel *rcp_chan;
|
||||
A2dpStream *pstream;
|
||||
HidChannel *hid_chan;
|
||||
PbapClientSession *pbap_client;
|
||||
} APP_DEVICE;
|
||||
|
||||
struct user_bt_env_t {
|
||||
uint8_t enable_profiles;
|
||||
uint8_t last_active_index;
|
||||
uint8_t access_state;
|
||||
uint16_t page_timeout; //unit: 625us
|
||||
uint8_t connect_times;
|
||||
BD_ADDR last_dev_addr;
|
||||
uint8_t cur_action;
|
||||
uint8_t action_cnt;
|
||||
struct co_list op_list;
|
||||
// struct bt_connect_param_t connect_param;
|
||||
void (*bt_disconnect_cb)(BD_ADDR *addr, uint8_t errcode);
|
||||
void (*bt_connect_cb)(uint8_t type, BD_ADDR *addr, uint8_t errcode);
|
||||
void (*bt_access_change_cb)(uint8_t mode);
|
||||
APP_DEVICE dev[NUM_BT_DEVICES];
|
||||
};
|
||||
|
||||
extern struct user_bt_env_t user_bt_env;
|
||||
|
||||
|
||||
BtStatus bt_connect(BD_ADDR *addr);
|
||||
|
||||
BtStatus bt_disconnect(BD_ADDR *addr, uint8_t force_disconnect);
|
||||
|
||||
BtStatus bt_poweroff(void);
|
||||
|
||||
void bt_connect_act_cmp(uint8_t evt,uint8_t error,BtRemoteDevice *rem_dev);
|
||||
|
||||
void bt_update_conn_status(uint8_t event, void *chan, const void *param);
|
||||
|
||||
uint8_t user_bt_get_state(uint8_t dev_index);
|
||||
|
||||
void user_bt_init(void);
|
||||
|
||||
|
||||
BtStatus bt_answer_call(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_dial_number(uint8_t dev_index, uint8_t *number, uint16_t len);
|
||||
|
||||
BtStatus bt_redial(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_call_hold(uint8_t dev_index, HfHoldAction action, uint8_t index);
|
||||
|
||||
BtStatus bt_hang_up(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_list_current_calls(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_transfer_sco(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_send_dtmf(uint8_t dev_index, uint8_t dtmf);
|
||||
|
||||
BtStatus bt_report_mic_volume(uint8_t dev_index, uint8_t vol);
|
||||
|
||||
BtStatus bt_report_spk_volume(uint8_t dev_index, uint8_t vol);
|
||||
|
||||
BtStatus bt_send_hf_cmd(uint8_t dev_index, const uint8_t *at_str);
|
||||
|
||||
BtStatus bt_enable_voice_recognition(uint8_t dev_index, uint8_t enabled);
|
||||
|
||||
uint8_t bt_is_voice_rec_active(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_get_media_info(uint8_t dev_index,AvrcpMediaAttrIdMask mediaMask);
|
||||
|
||||
BtStatus bt_get_playstatus(uint8_t dev_index);
|
||||
|
||||
BtStatus bt_set_media_volume(uint8_t dev_index, uint8_t volume);
|
||||
|
||||
BtStatus bt_enter_pairing(uint8_t access, BtAccessModeInfo *info);
|
||||
|
||||
BtStatus bt_exit_pairing(void);
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user