hpw422移植新的sdk
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
/*!
|
||||
* \file system_it_xinc.c
|
||||
*
|
||||
* \brief Target system interruption implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "system_it_xinc.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles NMI exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END NonMaskableInt_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Hard Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END HardFault_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Memory Manage exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Bus Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Usage Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles SVCall exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END SVCall_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles PendSVC exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END PendSV_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/****************************** Hard Fault Handler Functions *******************************/
|
||||
/*------------------------------------------------------------------------------------
|
||||
Private Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args)
|
||||
{
|
||||
/*栈帧里面内容:*/
|
||||
unsigned int stack_r0; //压栈的 R0
|
||||
unsigned int stack_r1; //压栈的 R1
|
||||
unsigned int stack_r2; //压栈的 R2
|
||||
unsigned int stack_r3; //压栈的 R3
|
||||
unsigned int stack_r12; //压栈的 R12
|
||||
unsigned int stack_lr; //压栈的 lr
|
||||
unsigned int stack_pc; //压栈的 pc
|
||||
unsigned int stack_psr; //压栈的 psr
|
||||
|
||||
stack_r0 = ((unsigned int)HardFault_args[0]);
|
||||
stack_r1 = ((unsigned int)HardFault_args[1]);
|
||||
stack_r2 = ((unsigned int)HardFault_args[2]);
|
||||
stack_r3 = ((unsigned int)HardFault_args[3]);
|
||||
stack_r12 = ((unsigned int)HardFault_args[4]);
|
||||
stack_lr = ((unsigned int)HardFault_args[5]);
|
||||
stack_pc = ((unsigned int)HardFault_args[6]);
|
||||
stack_psr = ((unsigned int)HardFault_args[7]);
|
||||
|
||||
DEBUG("----%s----\n", __func__);
|
||||
DEBUG("R0=%x\n",stack_r0);
|
||||
DEBUG("R1=%x\n",stack_r1);
|
||||
DEBUG("R2=%x\n",stack_r2);
|
||||
DEBUG("R3=%x\n",stack_r3);
|
||||
DEBUG("R12=%x\n",stack_r12);
|
||||
DEBUG("LR[R14]=%x\n",stack_lr);
|
||||
DEBUG("PC[R15]=%x\n",stack_pc);
|
||||
DEBUG("PSR=%x\n",stack_psr);
|
||||
DEBUG("SCB_SHCSR=%x\n",SCB->SHCSR);
|
||||
DEBUG("---------------------------\n");
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file system_it_xinc.h
|
||||
*
|
||||
* \brief The header of system_it_xinc.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SYSTEM_IT_XINC_H__
|
||||
#define __SYSTEM_IT_XINC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void NMI_Handler( void );
|
||||
void HardFault_Handler( void );
|
||||
void MemManage_Handler( void );
|
||||
void BusFault_Handler( void );
|
||||
void UsageFault_Handler( void );
|
||||
void SVC_Handler( void );
|
||||
void DebugMon_Handler( void );
|
||||
void PendSV_Handler( void );
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_IT_XINC_H__ */
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define __DEBUG_OUT_PORT 0
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void debug_uart_init(void)
|
||||
{
|
||||
#if (__DEBUG_OUT_PORT == 0)
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
#else
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART1_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_14;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART1_RX;
|
||||
gpio_cfg.Pin = GPIO_15;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART1_IDX, &uart_cfg);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#define VECTOR_NUM 48
|
||||
|
||||
void set_vector(void)
|
||||
{
|
||||
#if (USE_XIP == 1)
|
||||
GLOBAL_INT_DISABLE();
|
||||
for (uint32_t i = 0, *Pvector = (uint32_t *)(0x11001000 + 0),
|
||||
*_vector_table = (uint32_t *)(0x10000000);
|
||||
i < VECTOR_NUM; i++) // copy vertor table
|
||||
{
|
||||
_vector_table[i] = *Pvector++;
|
||||
}
|
||||
|
||||
*((volatile unsigned int *)(0x4000013C)) =
|
||||
0x10000001; // inter vertor table remap
|
||||
GLOBAL_INT_RESTORE();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WDT_ResetInit(void)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
|
||||
cpr_lp_ctl__ctl_wdt_tclk_en__setf(ENABLE);
|
||||
wdt_cr__wdt_en__setf(DISABLE);
|
||||
}
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
|
||||
WDT_ResetInit();
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
set_vector();
|
||||
#endif
|
||||
|
||||
debug_uart_init();
|
||||
}
|
||||
|
||||
__RAM_CODE int sendchar(int c)
|
||||
{
|
||||
unsigned int status;
|
||||
#if (__DEBUG_OUT_PORT == 1)
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40011000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40011000 + 0x00))) = c;
|
||||
return (1);
|
||||
#else
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40010000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40010000 + 0x00))) = c;
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle; /* Add whatever you need here */
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
__RAM_CODE int fputc(int ch, FILE *f) { return (sendchar(ch)); }
|
||||
|
||||
int ferror(FILE *f)
|
||||
{
|
||||
/* Your implementation of ferror */
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void _ttywrch(int ch) { sendchar(ch); }
|
||||
|
||||
void _sys_exit(int return_code)
|
||||
{
|
||||
label:
|
||||
goto label; /* endless loop */
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_xinc.s
|
||||
; * @purpose: CMSIS Cortex-M0 Core Device Startup File for the
|
||||
; * Device xinc.
|
||||
; *****************************************************************************/
|
||||
|
||||
Stack_Size EQU 0x00001000
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
Heap_Size EQU 0x00000100
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
; ToDo: Add here the vectors for the device specific external interrupts handler
|
||||
DCD BLE_Handler ; 0
|
||||
DCD DMA_Handler ; 1
|
||||
DCD CPR_Handler ; 2
|
||||
DCD GPIO_Handler ; 3
|
||||
DCD RTC_Handler ; 4
|
||||
DCD TIMER0_Handler ; 5
|
||||
DCD TIMER1_Handler ; 6
|
||||
DCD TIMER2_Handler ; 7
|
||||
DCD TIMER3_Handler ; 8
|
||||
DCD WDT_Handler ; 9
|
||||
DCD I2C_Handler ; 10
|
||||
DCD UART0_Handler ; 11
|
||||
DCD UART1_Handler ; 12
|
||||
DCD SPI0_Handler ; 13
|
||||
DCD SPI1_Handler ; 14
|
||||
DCD 0 ; 15
|
||||
DCD 0 ; 16
|
||||
DCD GADC_Handler ; 17
|
||||
DCD PWM_Handler ; 18
|
||||
DCD AES_Handler ; 19
|
||||
DCD USB_Handler ; 20
|
||||
DCD AUDIO_Handler ; 21
|
||||
DCD RF24G_Handler ; 22
|
||||
DCD SPI2_Handler ; 23
|
||||
DCD MPU_Handler ; 24
|
||||
DCD UART2_Handler ; 25
|
||||
DCD I2S_Handler ; 26
|
||||
DCD AOTIMER0_Handler ; 27
|
||||
DCD AOTIMER1_Handler ; 28
|
||||
DCD CMP_Handler ; 29
|
||||
DCD FMC_Handler ; 30
|
||||
DCD CAN_Handler ; 31
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
|
||||
LDR r0, =0x4000013C ; remap
|
||||
LDR r1, =0x10000001
|
||||
STR r1, [r0]
|
||||
|
||||
|
||||
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
IMPORT HardFault_Handler_c ;函数声明
|
||||
movs r0, #4 ;判断主栈指针还是进程栈指针
|
||||
mov r1, lr
|
||||
tst r0, r1
|
||||
beq hf_used_msp ;如果是主栈指针
|
||||
mrs r0, psp ;否则是进程栈指针,把进程栈指针地址付给 R0
|
||||
ldr r1, =HardFault_Handler_c ;跳转到 HardFault 中断程序
|
||||
bx r1
|
||||
hf_used_msp
|
||||
mrs r0, msp ;把主栈指针地址赋给 R0
|
||||
ldr r1, =HardFault_Handler_c
|
||||
bx r1
|
||||
;EXPORT HardFault_Handler [WEAK]
|
||||
;B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT BLE_Handler [WEAK]
|
||||
EXPORT DMA_Handler [WEAK]
|
||||
EXPORT CPR_Handler [WEAK]
|
||||
EXPORT GPIO_Handler [WEAK]
|
||||
EXPORT RTC_Handler [WEAK]
|
||||
EXPORT TIMER0_Handler [WEAK]
|
||||
EXPORT TIMER1_Handler [WEAK]
|
||||
EXPORT TIMER2_Handler [WEAK]
|
||||
EXPORT TIMER3_Handler [WEAK]
|
||||
EXPORT WDT_Handler [WEAK]
|
||||
EXPORT I2C_Handler [WEAK]
|
||||
EXPORT UART0_Handler [WEAK]
|
||||
EXPORT UART1_Handler [WEAK]
|
||||
EXPORT SPI0_Handler [WEAK]
|
||||
EXPORT SPI1_Handler [WEAK]
|
||||
;EXPORT KBS_Handler [WEAK]
|
||||
;EXPORT QDEC_Handler [WEAK]
|
||||
EXPORT GADC_Handler [WEAK]
|
||||
EXPORT PWM_Handler [WEAK]
|
||||
EXPORT AES_Handler [WEAK]
|
||||
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
|
||||
EXPORT USB_Handler [WEAK];20
|
||||
EXPORT AUDIO_Handler [WEAK];21
|
||||
EXPORT RF24G_Handler [WEAK];22
|
||||
EXPORT SPI2_Handler [WEAK];23
|
||||
EXPORT MPU_Handler [WEAK];24
|
||||
EXPORT UART2_Handler [WEAK];25
|
||||
EXPORT I2S_Handler [WEAK];26
|
||||
EXPORT AOTIMER0_Handler [WEAK];27
|
||||
EXPORT AOTIMER1_Handler [WEAK];28
|
||||
EXPORT CMP_Handler [WEAK];29
|
||||
EXPORT FMC_Handler [WEAK];30
|
||||
EXPORT CAN_Handler [WEAK];31
|
||||
|
||||
PendSV_Handler
|
||||
SysTick_Handler
|
||||
BLE_Handler
|
||||
RF24G_Handler
|
||||
DMA_Handler
|
||||
CPR_Handler
|
||||
GPIO_Handler
|
||||
RTC_Handler
|
||||
TIMER0_Handler
|
||||
TIMER1_Handler
|
||||
TIMER2_Handler
|
||||
TIMER3_Handler
|
||||
WDT_Handler
|
||||
I2C_Handler
|
||||
I2S_Handler
|
||||
UART0_Handler
|
||||
UART1_Handler
|
||||
UART2_Handler
|
||||
SPI0_Handler
|
||||
SPI1_Handler
|
||||
SPI2_Handler
|
||||
MPU_Handler
|
||||
;KBS_Handler
|
||||
;QDEC_Handler
|
||||
GADC_Handler
|
||||
PWM_Handler
|
||||
AUDIO_Handler
|
||||
;SIM_Handler
|
||||
AES_Handler
|
||||
AOTIMER0_Handler
|
||||
AOTIMER1_Handler
|
||||
CMP_Handler
|
||||
FMC_Handler
|
||||
CAN_Handler
|
||||
USB_Handler
|
||||
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, = (Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
END
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
#ifndef SDK_DRIVER_CONFIG_H
|
||||
#define SDK_DRIVER_CONFIG_H
|
||||
// <<< Use Configuration Wizard in Context Menu >>>\n
|
||||
#ifdef USE_APP_CONFIG
|
||||
#include "app_config.h"
|
||||
#endif
|
||||
// <h> XC_Drivers
|
||||
|
||||
// <e> XC_CLOCK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CLOCK_ENABLED
|
||||
#define XC_CLOCK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWR_ENABLED
|
||||
#define XC_PWR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_WDT_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_WDT_ENABLED
|
||||
#define XC_WDT_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_BOR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_BOR_ENABLED
|
||||
#define XC_BOR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SYSTICK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SYSTICK_ENABLED
|
||||
#define XC_SYSTICK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_TIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_TIMER_ENABLED
|
||||
#define XC_TIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_AOTIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_AOTIMER_ENABLED
|
||||
#define XC_AOTIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_GPIO_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_GPIO_ENABLED
|
||||
#define XC_GPIO_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_ADC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_ADC_ENABLED
|
||||
#define XC_ADC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_UART_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_UART_ENABLED
|
||||
#define XC_UART_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWM_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWM_ENABLED
|
||||
#define XC_PWM_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_FMC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_FMC_SPI_ENABLED
|
||||
#define XC_FMC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SPI_ENABLED
|
||||
#define XC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_IIC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_IIC_ENABLED
|
||||
#define XC_IIC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_RTC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_RTC_ENABLED
|
||||
#define XC_RTC_ENABLED 1
|
||||
#endif
|
||||
|
||||
//==========================================================
|
||||
// <q> XC_RTC_DATE_INT_ENABLED
|
||||
|
||||
#ifndef XC_RTC_DATE_INT_ENABLED
|
||||
#define XC_RTC_DATE_INT_ENABLED 0
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_DMA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_DMA_ENABLED
|
||||
#define XC_DMA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PGA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PGA_ENABLED
|
||||
#define XC_PGA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_QDEC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_QDEC_ENABLED
|
||||
#define XC_QDEC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_CALIB_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CALIB_ENABLED
|
||||
#define XC_CALIB_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
#endif //SDK_DRIVER_CONFIG_H
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
#include "usbd_core.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_cdc_if.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void SysTick_Callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void clock_init(void)
|
||||
{
|
||||
CLOCK_InitCfg_t clock_cfg;
|
||||
|
||||
clock_cfg.hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
clock_cfg.hfclk_in = CLOCK_HFCLK_IN_48M;
|
||||
clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
|
||||
if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_XTAL) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32768;
|
||||
} else if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_RC) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
}
|
||||
|
||||
xc_clock_init_cfg(&clock_cfg);
|
||||
|
||||
SysTick_Config(xc_clock_hfclk_in_get() / 100);
|
||||
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
void app_uart_init(void)
|
||||
{
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clock_init( );
|
||||
|
||||
app_uart_init( );
|
||||
|
||||
DEBUG("__USB_CDC_DEMO__\n");
|
||||
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
SP = _RDWORD(0x10000000);
|
||||
PC = _RDWORD(0x10000004);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
FUNC void InitGpio(void)
|
||||
{
|
||||
// Config IOMUX
|
||||
/*
|
||||
gpio_mux_ctl_u(33,1);//d2
|
||||
gpio_mux_ctl_u(34,1);//d3
|
||||
gpio_mux_ctl_u(35,2);//clk
|
||||
gpio_mux_ctl_u(36,2);//cs
|
||||
gpio_mux_ctl_u(37,2);//d0 rx
|
||||
gpio_mux_ctl_u(38,2);//d1 tx
|
||||
*/
|
||||
_WDWORD(0x4000019c, 0x00002A94);
|
||||
}
|
||||
FUNC void InitFlash(void)
|
||||
{
|
||||
|
||||
}
|
||||
FUNC void InitXIP(void)
|
||||
{
|
||||
|
||||
_WDWORD(0x40000104,0x040000);//reset ssi0
|
||||
_WDWORD(0x40000104,0x040004);//reset ssi0
|
||||
_WDWORD(0x40000050,0x110000);//close spi0 mclk
|
||||
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
|
||||
|
||||
|
||||
//config fmc
|
||||
_WDWORD(0x40000270, 0x0503);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x40000270, 0x3503);
|
||||
//config cache
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x0);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x21);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
|
||||
|
||||
//config xip spi
|
||||
_WDWORD(0x51000008, 0); //disable spi
|
||||
|
||||
_WDWORD(0x5100002c,0); //close IE
|
||||
_WDWORD(0x51000000,0x1F); //32bit SPI data
|
||||
_WDWORD(0x51000010,0x01); //enable select slave -- SE
|
||||
_WDWORD(0x51000018,0x0); //TXFTL be set 0
|
||||
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
|
||||
|
||||
_WDWORD(0x5100010c, 0x01);//enable select slave
|
||||
_WDWORD(0x51000114, 0xFF);//XIP time out
|
||||
|
||||
_WDWORD(0x51000014, 0x2);//div 2
|
||||
|
||||
//quad
|
||||
_WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
|
||||
_WDWORD(0x51000100, 0x6b);//quad read cmd
|
||||
_WDWORD(0x51000104, 0x6b);//quad read cmd
|
||||
|
||||
|
||||
// //dual
|
||||
// _WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
|
||||
// _WDWORD(0x51000100, 0x3b);//dual read cmd
|
||||
// _WDWORD(0x51000104, 0x3b);//dual read cmd
|
||||
|
||||
|
||||
_WDWORD(0x51000008, 1); //enable spi
|
||||
}
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
InitGpio();
|
||||
InitFlash();
|
||||
InitXIP();
|
||||
SP = _RDWORD(0x11001000);
|
||||
PC = _RDWORD(0x11001004);
|
||||
_WDWORD(0x4000013C, 0x11001001);
|
||||
}
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
LOAD 0x10000000
|
||||
{
|
||||
EXE 0x10000000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
RW +0
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
LOAD 0x11001000
|
||||
{
|
||||
EXE 0x11001000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x10000200
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
*(ram_code)
|
||||
}
|
||||
|
||||
ScatterAssert((0x000+ImageLength(RW)) < 1024 * 32)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LOAD 0x11001000 0x0007f000
|
||||
{
|
||||
EXE 0x11001000 0x00010000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
*(InRoot$$Sections)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x100000C8 0x1F38
|
||||
{
|
||||
*(+RW,+ZI)
|
||||
*(ram_code)
|
||||
aeabi_sdiv.o(.text)
|
||||
uread4.o(.text)
|
||||
rt_memclr.o(.text)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Xincboot_tool.exe 0_ram.bin 1_ram_download.bin 0 0 0 0 1
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
.\Tools\xinchip_xip_tool.exe .\Output\0_ram.bin .\Output\xip_dual .\Output\1_xip_download.bin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,232 @@
|
||||
/*!
|
||||
* \file system_it_xinc.c
|
||||
*
|
||||
* \brief Target system interruption implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "system_it_xinc.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles NMI exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END NonMaskableInt_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Hard Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END HardFault_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Memory Manage exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Bus Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Usage Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles SVCall exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END SVCall_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles PendSVC exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END PendSV_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/****************************** Hard Fault Handler Functions *******************************/
|
||||
/*------------------------------------------------------------------------------------
|
||||
Private Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args)
|
||||
{
|
||||
/*栈帧里面内容:*/
|
||||
unsigned int stack_r0; //压栈的 R0
|
||||
unsigned int stack_r1; //压栈的 R1
|
||||
unsigned int stack_r2; //压栈的 R2
|
||||
unsigned int stack_r3; //压栈的 R3
|
||||
unsigned int stack_r12; //压栈的 R12
|
||||
unsigned int stack_lr; //压栈的 lr
|
||||
unsigned int stack_pc; //压栈的 pc
|
||||
unsigned int stack_psr; //压栈的 psr
|
||||
|
||||
stack_r0 = ((unsigned int)HardFault_args[0]);
|
||||
stack_r1 = ((unsigned int)HardFault_args[1]);
|
||||
stack_r2 = ((unsigned int)HardFault_args[2]);
|
||||
stack_r3 = ((unsigned int)HardFault_args[3]);
|
||||
stack_r12 = ((unsigned int)HardFault_args[4]);
|
||||
stack_lr = ((unsigned int)HardFault_args[5]);
|
||||
stack_pc = ((unsigned int)HardFault_args[6]);
|
||||
stack_psr = ((unsigned int)HardFault_args[7]);
|
||||
|
||||
DEBUG("----%s----\n", __func__);
|
||||
DEBUG("R0=%x\n",stack_r0);
|
||||
DEBUG("R1=%x\n",stack_r1);
|
||||
DEBUG("R2=%x\n",stack_r2);
|
||||
DEBUG("R3=%x\n",stack_r3);
|
||||
DEBUG("R12=%x\n",stack_r12);
|
||||
DEBUG("LR[R14]=%x\n",stack_lr);
|
||||
DEBUG("PC[R15]=%x\n",stack_pc);
|
||||
DEBUG("PSR=%x\n",stack_psr);
|
||||
DEBUG("SCB_SHCSR=%x\n",SCB->SHCSR);
|
||||
DEBUG("---------------------------\n");
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file system_it_xinc.h
|
||||
*
|
||||
* \brief The header of system_it_xinc.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SYSTEM_IT_XINC_H__
|
||||
#define __SYSTEM_IT_XINC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void NMI_Handler( void );
|
||||
void HardFault_Handler( void );
|
||||
void MemManage_Handler( void );
|
||||
void BusFault_Handler( void );
|
||||
void UsageFault_Handler( void );
|
||||
void SVC_Handler( void );
|
||||
void DebugMon_Handler( void );
|
||||
void PendSV_Handler( void );
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_IT_XINC_H__ */
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define __DEBUG_OUT_PORT 0
|
||||
#define readl(addr) (*(volatile unsigned int *) (addr))
|
||||
#define writel(addr, value) (*(volatile unsigned int *) (addr) = (value))
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
#define VECTOR_NUM 48
|
||||
|
||||
void set_vector(void)
|
||||
{
|
||||
#if (USE_XIP == 1)
|
||||
GLOBAL_INT_DISABLE();
|
||||
for (uint32_t i = 0, *Pvector = (uint32_t *)(0x11001000 + 0),
|
||||
*_vector_table = (uint32_t *)(0x10000000);
|
||||
i < VECTOR_NUM; i++) // copy vertor table
|
||||
{
|
||||
_vector_table[i] = *Pvector++;
|
||||
}
|
||||
|
||||
*((volatile unsigned int *)(0x4000013C)) =
|
||||
0x10000001; // inter vertor table remap
|
||||
GLOBAL_INT_RESTORE();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void WDT_ResetInit(void)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
|
||||
cpr_lp_ctl__wdt_tclk_en__setf(ENABLE);
|
||||
wdt_cr__wdt_en__setf(DISABLE);
|
||||
}
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
|
||||
WDT_ResetInit();
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
set_vector();
|
||||
#endif
|
||||
writel(0x40000040, readl(0x40000040) | (0x01 << 4) | 0xFFFF0000);
|
||||
|
||||
}
|
||||
|
||||
__RAM_CODE int sendchar(int c)
|
||||
{
|
||||
unsigned int status;
|
||||
#if (__DEBUG_OUT_PORT == 1)
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40011000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40011000 + 0x00))) = c;
|
||||
return (1);
|
||||
#else
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40010000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40010000 + 0x00))) = c;
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle; /* Add whatever you need here */
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
__RAM_CODE int fputc(int ch, FILE *f) { return (sendchar(ch)); }
|
||||
|
||||
int ferror(FILE *f)
|
||||
{
|
||||
/* Your implementation of ferror */
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void _ttywrch(int ch) { sendchar(ch); }
|
||||
|
||||
void _sys_exit(int return_code)
|
||||
{
|
||||
label:
|
||||
goto label; /* endless loop */
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_xinc.s
|
||||
; * @purpose: CMSIS Cortex-M0 Core Device Startup File for the
|
||||
; * Device xinc.
|
||||
; *****************************************************************************/
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
Heap_Size EQU 0x00000100
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
; ToDo: Add here the vectors for the device specific external interrupts handler
|
||||
DCD BLE_Handler ; 0
|
||||
DCD DMA_Handler ; 1
|
||||
DCD CPR_Handler ; 2
|
||||
DCD GPIO_Handler ; 3
|
||||
DCD RTC_Handler ; 4
|
||||
DCD TIMER0_Handler ; 5
|
||||
DCD TIMER1_Handler ; 6
|
||||
DCD TIMER2_Handler ; 7
|
||||
DCD TIMER3_Handler ; 8
|
||||
DCD WDT_Handler ; 9
|
||||
DCD I2C_Handler ; 10
|
||||
DCD UART0_Handler ; 11
|
||||
DCD UART1_Handler ; 12
|
||||
DCD SPI0_Handler ; 13
|
||||
DCD SPI1_Handler ; 14
|
||||
DCD 0 ; 15
|
||||
DCD 0 ; 16
|
||||
DCD GADC_Handler ; 17
|
||||
DCD PWM_Handler ; 18
|
||||
DCD AES_Handler ; 19
|
||||
DCD USB_Handler ; 20
|
||||
DCD AUDIO_Handler ; 21
|
||||
DCD RF24G_Handler ; 22
|
||||
DCD SPI2_Handler ; 23
|
||||
DCD MPU_Handler ; 24
|
||||
DCD UART2_Handler ; 25
|
||||
DCD I2S_Handler ; 26
|
||||
DCD AOTIMER0_Handler ; 27
|
||||
DCD AOTIMER1_Handler ; 28
|
||||
DCD CMP_Handler ; 29
|
||||
DCD FMC_Handler ; 30
|
||||
DCD CAN_Handler ; 31
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
|
||||
LDR r0, =0x4000013C ; remap
|
||||
LDR r1, =0x10000001
|
||||
STR r1, [r0]
|
||||
|
||||
|
||||
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
IMPORT HardFault_Handler_c ;函数声明
|
||||
movs r0, #4 ;判断主栈指针还是进程栈指针
|
||||
mov r1, lr
|
||||
tst r0, r1
|
||||
beq hf_used_msp ;如果是主栈指针
|
||||
mrs r0, psp ;否则是进程栈指针,把进程栈指针地址付给 R0
|
||||
ldr r1, =HardFault_Handler_c ;跳转到 HardFault 中断程序
|
||||
bx r1
|
||||
hf_used_msp
|
||||
mrs r0, msp ;把主栈指针地址赋给 R0
|
||||
ldr r1, =HardFault_Handler_c
|
||||
bx r1
|
||||
;EXPORT HardFault_Handler [WEAK]
|
||||
;B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT BLE_Handler [WEAK]
|
||||
EXPORT DMA_Handler [WEAK]
|
||||
EXPORT CPR_Handler [WEAK]
|
||||
EXPORT GPIO_Handler [WEAK]
|
||||
EXPORT RTC_Handler [WEAK]
|
||||
EXPORT TIMER0_Handler [WEAK]
|
||||
EXPORT TIMER1_Handler [WEAK]
|
||||
EXPORT TIMER2_Handler [WEAK]
|
||||
EXPORT TIMER3_Handler [WEAK]
|
||||
EXPORT WDT_Handler [WEAK]
|
||||
EXPORT I2C_Handler [WEAK]
|
||||
EXPORT UART0_Handler [WEAK]
|
||||
EXPORT UART1_Handler [WEAK]
|
||||
EXPORT SPI0_Handler [WEAK]
|
||||
EXPORT SPI1_Handler [WEAK]
|
||||
;EXPORT KBS_Handler [WEAK]
|
||||
;EXPORT QDEC_Handler [WEAK]
|
||||
EXPORT GADC_Handler [WEAK]
|
||||
EXPORT PWM_Handler [WEAK]
|
||||
EXPORT AES_Handler [WEAK]
|
||||
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
|
||||
EXPORT USB_Handler [WEAK];20
|
||||
EXPORT AUDIO_Handler [WEAK];21
|
||||
EXPORT RF24G_Handler [WEAK];22
|
||||
EXPORT SPI2_Handler [WEAK];23
|
||||
EXPORT MPU_Handler [WEAK];24
|
||||
EXPORT UART2_Handler [WEAK];25
|
||||
EXPORT I2S_Handler [WEAK];26
|
||||
EXPORT AOTIMER0_Handler [WEAK];27
|
||||
EXPORT AOTIMER1_Handler [WEAK];28
|
||||
EXPORT CMP_Handler [WEAK];29
|
||||
EXPORT FMC_Handler [WEAK];30
|
||||
EXPORT CAN_Handler [WEAK];31
|
||||
|
||||
PendSV_Handler
|
||||
SysTick_Handler
|
||||
BLE_Handler
|
||||
RF24G_Handler
|
||||
DMA_Handler
|
||||
CPR_Handler
|
||||
GPIO_Handler
|
||||
RTC_Handler
|
||||
TIMER0_Handler
|
||||
TIMER1_Handler
|
||||
TIMER2_Handler
|
||||
TIMER3_Handler
|
||||
WDT_Handler
|
||||
I2C_Handler
|
||||
I2S_Handler
|
||||
UART0_Handler
|
||||
UART1_Handler
|
||||
UART2_Handler
|
||||
SPI0_Handler
|
||||
SPI1_Handler
|
||||
SPI2_Handler
|
||||
MPU_Handler
|
||||
;KBS_Handler
|
||||
;QDEC_Handler
|
||||
GADC_Handler
|
||||
PWM_Handler
|
||||
AUDIO_Handler
|
||||
;SIM_Handler
|
||||
AES_Handler
|
||||
AOTIMER0_Handler
|
||||
AOTIMER1_Handler
|
||||
CMP_Handler
|
||||
FMC_Handler
|
||||
CAN_Handler
|
||||
USB_Handler
|
||||
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, = (Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
END
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef __APP_64M__
|
||||
#define __APP_64M__
|
||||
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
|
||||
#define __write_hw_reg32(reg, val) ((*reg) = (val))
|
||||
#define __read_hw_reg32(reg, val) ((val) = (*reg))
|
||||
#define CPR_CTLAPBCLKEN_GRCTL ((volatile unsigned *)(0x40000000 + 0x070))
|
||||
#define CPR_AOCLKEN_GRCTL ((volatile unsigned *)(0x40002400 + 0x7C))
|
||||
#define AO_GPIO_MODE ((volatile unsigned *)(0x40002000 + 0x0044))
|
||||
#define AO_GPIO_CTL ((volatile unsigned *)(0x40002000 + 0x0048))
|
||||
|
||||
void use_64m_crtstal_init(void);
|
||||
void rf_64M_set_rx_channel(uint16_t channel);
|
||||
void rf_64M_set_tx_channel(uint16_t channel);
|
||||
void testpin_64M_config(void);
|
||||
void Init_rtc_gpio(uint32_t num, uint8_t inter_mode);
|
||||
#endif //__APP_64M__
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Author: sueRimn
|
||||
* @Date: 2023-12-12 14:23:55
|
||||
* @LastEditors: sueRimn
|
||||
* @LastEditTime: 2024-06-07 13:46:09
|
||||
*/
|
||||
/*!
|
||||
* \file main.h
|
||||
*
|
||||
* \brief The head file of main.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "rf_config.h"
|
||||
#include "xc6xxx.h"
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
#include "rf_compatible_normal.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define DEBUG_LOG
|
||||
|
||||
#define SEND_TIMERMS_CNT 7
|
||||
#define RECV_TIMERMS_OUT (7 + SEND_TIMERMS_CNT)
|
||||
#define XC_SEND_NUM 1000U
|
||||
|
||||
#define RF_TX_TIMERx TIMER0_IDX
|
||||
#define RF_RX_TIMERx TIMER0_IDX
|
||||
|
||||
#define RF_CONFIRMED_VALUE 5
|
||||
|
||||
#define GPIO_TEST 1
|
||||
#define TEST_GPIO_1 GPIO_1
|
||||
#if XC62XX
|
||||
#define TEST_GPIO_2 GPIO_0
|
||||
#else
|
||||
#define TEST_GPIO_2 GPIO_21
|
||||
#endif
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
extern bool rf_send_timer_flag;
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void rf_buff_info(uint8_t *buff, uint16_t len);
|
||||
void rf_2M_reg_info(void);
|
||||
void rf_dump_log(void);
|
||||
uint8_t rf_data_config(uint8_t *buff, uint16_t len);
|
||||
void rf_switch_mode(uint8_t mode, uint16_t channel);
|
||||
void rf_transmit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H__ */
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef __RF_COMPATIBLE_NORMAL__
|
||||
#define __RF_COMPATIBLE_NORMAL__
|
||||
#include "rf_config.h"
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
#include "xc_software_crc.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define RF_ADDR_LEN XINCX_RF_TX_ADDR_WIDTH // 5U
|
||||
#define RF_RECV_EXTEN_LEN 3U
|
||||
#define RF_MAX_RECV_LEN 60U
|
||||
#define RF_CRC_INIT_VALUE 0xFFFF
|
||||
#define PANCHIP_WHITEN_INIT_VAL (0x7F)
|
||||
|
||||
extern uint16_t rf_addr_crc;
|
||||
extern uint8_t panchip_addr_whiten;
|
||||
extern uint8_t addr_buff[5];
|
||||
|
||||
void rf_addr_map(uint8_t *addr_buff);
|
||||
uint16_t rf_get_addr_crc(void);
|
||||
uint8_t rf_recv_addr(void);
|
||||
void rf_compatible_config(void);
|
||||
uint32_t rf_rx_normal_manage(void);
|
||||
uint32_t rf_tx_normal_manage(uint8_t *buff, uint8_t length);
|
||||
|
||||
#endif //__RF_COMPATIBLE_NORMAL__
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
#ifndef SDK_DRIVER_CONFIG_H
|
||||
#define SDK_DRIVER_CONFIG_H
|
||||
// <<< Use Configuration Wizard in Context Menu >>>\n
|
||||
#ifdef USE_APP_CONFIG
|
||||
#include "app_config.h"
|
||||
#endif
|
||||
// <h> XC_Drivers
|
||||
|
||||
// <e> XC_CLOCK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CLOCK_ENABLED
|
||||
#define XC_CLOCK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWR_ENABLED
|
||||
#define XC_PWR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_WDT_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_WDT_ENABLED
|
||||
#define XC_WDT_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_BOR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_BOR_ENABLED
|
||||
#define XC_BOR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SYSTICK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SYSTICK_ENABLED
|
||||
#define XC_SYSTICK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_TIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_TIMER_ENABLED
|
||||
#define XC_TIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_AOTIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_AOTIMER_ENABLED
|
||||
#define XC_AOTIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_GPIO_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_GPIO_ENABLED
|
||||
#define XC_GPIO_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_ADC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_ADC_ENABLED
|
||||
#define XC_ADC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_UART_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_UART_ENABLED
|
||||
#define XC_UART_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWM_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWM_ENABLED
|
||||
#define XC_PWM_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_FMC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_FMC_SPI_ENABLED
|
||||
#define XC_FMC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SPI_ENABLED
|
||||
#define XC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_IIC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_IIC_ENABLED
|
||||
#define XC_IIC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_RTC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_RTC_ENABLED
|
||||
#define XC_RTC_ENABLED 1
|
||||
#endif
|
||||
|
||||
//==========================================================
|
||||
// <q> XC_RTC_DATE_INT_ENABLED
|
||||
|
||||
#ifndef XC_RTC_DATE_INT_ENABLED
|
||||
#define XC_RTC_DATE_INT_ENABLED 0
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_DMA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_DMA_ENABLED
|
||||
#define XC_DMA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PGA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PGA_ENABLED
|
||||
#define XC_PGA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_QDEC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_QDEC_ENABLED
|
||||
#define XC_QDEC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_CALIB_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CALIB_ENABLED
|
||||
#define XC_CALIB_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
#endif //SDK_DRIVER_CONFIG_H
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
#ifndef SDK_CONFIG_H
|
||||
#define SDK_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
// <e> XINCX_RF_NORMAL_PEACKET_MODE - RF normal packet mode
|
||||
// <i> Configure the frame format, which is a static packet format and can only communicate in one direction.
|
||||
#ifndef XINCX_RF_NORMAL_PACKET_MODE
|
||||
#define XINCX_RF_NORMAL_PACKET_MODE 1
|
||||
#endif
|
||||
|
||||
// <o>XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
// <0=> Xinchip
|
||||
// <1=> Panchip
|
||||
// <2=> Beken
|
||||
// <3=> Telink
|
||||
// <4=> Huntersun
|
||||
#ifndef XINCX_RF_COMPATIBILITY_MODE
|
||||
#define XINCX_RF_COMPATIBILITY_MODE 0
|
||||
#endif
|
||||
|
||||
#if (XINCX_RF_NORMAL_PACKET_MODE == 1)
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_RF_MODE - RF Tx or Rx Mode
|
||||
// <0=> TX Mode
|
||||
// <1=> RX Mode
|
||||
// <2=> TRX Mode
|
||||
#ifndef XINCX_RF_MODE
|
||||
#define XINCX_RF_MODE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TRANS_RATE - RF Transmission Rate Config
|
||||
// <0x02=> 1M
|
||||
// <0x0A=> 2M
|
||||
// <0x22=> 250k
|
||||
// <0x2A=> 125k
|
||||
#ifndef XINCX_RF_TRANS_RATE
|
||||
#define XINCX_RF_TRANS_RATE 0x02
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CHANNEL - 2.4g Channel Set
|
||||
#ifndef XINCX_2_4G_CHANNEL
|
||||
#define XINCX_2_4G_CHANNEL 2478
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TX_ADDR_WIDTH - RF Tx Addr Width
|
||||
// <3=> 3 Bytes
|
||||
// <4=> 4 Bytes
|
||||
// <5=> 5 Bytes
|
||||
#ifndef XINCX_RF_TX_ADDR_WIDTH
|
||||
#define XINCX_RF_TX_ADDR_WIDTH 5
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_L - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_L
|
||||
#define XINCX_2_4G_ADDR_L 0xE7E7E7E5 // 0xCCDDEEDD
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_H - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_H
|
||||
#define XINCX_2_4G_ADDR_H 0xe7 // 0xAA
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_POWER - rf Power Set
|
||||
// <1=> -10dbm
|
||||
// <2=> -9dbm
|
||||
// <4=> -4dbm
|
||||
// <6=> 0dbm
|
||||
// <8=> 3dbm
|
||||
// <9=> 5dbm
|
||||
// <12=> 7dbm
|
||||
// <14=> 8dbm
|
||||
// <16=> 9dbm
|
||||
// <19=> 10dbm
|
||||
// <24=> 11dbm
|
||||
// <30=> 12dbm
|
||||
// <36=> 13dbm
|
||||
#ifndef XINCX_POWER
|
||||
#define XINCX_POWER 0x00006
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_NVIC_MODE - RF NVIC Mode
|
||||
// <0=> Disable
|
||||
// <1=> Enable
|
||||
#ifndef XINCX_RF_NVIC_MODE
|
||||
#define XINCX_RF_NVIC_MODE 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE_RX_PAYLEN - 2.4g Pipe Rx Payload Len
|
||||
// <i> Payload length. Configuration of the load length during communication.
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_LEN - 2.4g Pipe0 Rx Payload Len
|
||||
// #ifndef XINCX_2_4G_PIPE0_LEN
|
||||
// #define XINCX_2_4G_PIPE0_LEN 32
|
||||
// #endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_LEN - 2.4g Pipe1 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE1_LEN
|
||||
#define XINCX_2_4G_PIPE1_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_LEN - 2.4g Pipe2 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE2_LEN
|
||||
#define XINCX_2_4G_PIPE2_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_LEN - 2.4g Pipe3 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE3_LEN
|
||||
#define XINCX_2_4G_PIPE3_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_LEN - 2.4g Pipe4 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE4_LEN
|
||||
#define XINCX_2_4G_PIPE4_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_LEN - 2.4g Pipe5 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE5_LEN
|
||||
#define XINCX_2_4G_PIPE5_LEN 32
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
// XINCX_RF_CRC_ENABLE - RF CRC Enable
|
||||
//==========================================================
|
||||
#ifndef XINCX_RF_CRC_ENABLE
|
||||
#define XINCX_RF_CRC_ENABLE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CRC_BYTE - 2.4g CRC Bytes Set
|
||||
// <0=> 0 Byte
|
||||
// <1=> 1 Byte
|
||||
// <2=> 2 Bytes
|
||||
#ifndef XINCX_2_4G_CRC_BYTE
|
||||
#define XINCX_2_4G_CRC_BYTE 2
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_FEATURE_PARAM - 2.4g Feature Parameters
|
||||
//==========================================================
|
||||
// XINCX_2_4G_GUARD_CFG - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_GUARD_CFG
|
||||
#define XINCX_2_4G_GUARD_CFG 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_LONG_PLD_TYPE - 2.4g Long Pld Type
|
||||
#ifndef XINCX_2_4G_LONG_PLD_TYPE
|
||||
#define XINCX_2_4G_LONG_PLD_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_NUM - 2.4g Preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE_NUM
|
||||
#define XINCX_2_4G_PREAMBLE_NUM 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_TYPE - 2.4g Preamble Type
|
||||
#ifndef XINCX_2_4G_PREAMBLE_TYPE
|
||||
#define XINCX_2_4G_PREAMBLE_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_GUARD - 2.4g CRC Scope Guard
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_GUARD
|
||||
#define XINCX_2_4G_CRC_SCOPE_GUARD 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_HEADER - 2.4g CRC Scope Header
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_HEADER
|
||||
#define XINCX_2_4G_CRC_SCOPE_HEADER 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_ADDR - 2.4g CRC Scope Addr
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_ADDR
|
||||
#define XINCX_2_4G_CRC_SCOPE_ADDR 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_LONG_PLD - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_LONG_PLD
|
||||
#define XINCX_2_4G_LONG_PLD 0
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_FEC - 2.4g FEC&Interleave Feature
|
||||
#ifndef XINCX_2_4G_FEC
|
||||
#define XINCX_2_4G_FEC 0
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_WHITEN - 2.4g Whiten Feature
|
||||
#ifndef XINCX_2_4G_WHITEN
|
||||
#define XINCX_2_4G_WHITEN 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DPL - 2.4g Dynamic Payload Length Feature
|
||||
#ifndef XINCX_2_4G_DPL
|
||||
#define XINCX_2_4G_DPL 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_ACK_PAY - 2.4g Payload on ACK
|
||||
#ifndef XINCX_2_4G_ACK_PAY
|
||||
#define XINCX_2_4G_ACK_PAY 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYN_ACK - 2.4g W_TX_PAYLOAD_NOACK Command
|
||||
#ifndef XINCX_2_4G_DYN_ACK
|
||||
#define XINCX_2_4G_DYN_ACK 0
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// XINCX_2_4G_RETRANS_CNT - 2.4g Retransmit Count
|
||||
// <i> Number of retransmissions. The maximum number of times a hardware can automatically transmit an ACK if it does
|
||||
// not receive the correct ACK.
|
||||
#ifndef XINCX_2_4G_RETRANS_CNT
|
||||
#define XINCX_2_4G_RETRANS_CNT 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_RETRANS_DELAY - 2.4g Retransmission Delay
|
||||
// <i> Retransmission delay. For 32 bytes of data, the minimum configuration is 500 us for 1 Mbit/s and 1500 us for 250
|
||||
// kbit/s.
|
||||
#ifndef XINCX_2_4G_RETRANS_DELAY
|
||||
#define XINCX_2_4G_RETRANS_DELAY 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYNPD - 2.4g dynpd
|
||||
#ifndef XINCX_2_4G_DYNPD
|
||||
#define XINCX_2_4G_DYNPD 0x00
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_AUTO_ACK - 2.4g Auto Acknowledgement
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_ENAA - 2.4g Pipe0 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE0_ENAA
|
||||
#define XINCX_2_4G_PIPE0_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_ENAA - 2.4g Pipe1 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE1_ENAA
|
||||
#define XINCX_2_4G_PIPE1_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_ENAA - 2.4g Pipe2 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE2_ENAA
|
||||
#define XINCX_2_4G_PIPE2_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_ENAA - 2.4g Pipe3 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE3_ENAA
|
||||
#define XINCX_2_4G_PIPE3_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_ENAA - 2.4g Pipe4 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE4_ENAA
|
||||
#define XINCX_2_4G_PIPE4_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_ENAA - 2.4g Pipe5 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE5_ENAA
|
||||
#define XINCX_2_4G_PIPE5_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_RF_PIPE_ENABLE
|
||||
#ifndef XINCX_RF_PIPE_ENABLE
|
||||
#define XINCX_RF_PIPE_ENABLE 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// </e> //XINCX_RF_PEACKET_MODE normal normal
|
||||
|
||||
// <e> XINCX_RF_EMHAMCED_PEACKET_MODE - RF enhanced packet mode
|
||||
// <i> Configure the frame format, which is a dynamic packet configuration, which can communicate in both directions,and
|
||||
// <i> ACK can dynamically carry data.
|
||||
#ifndef XINCX_RF_EMHAMCED_PACKET_MODE
|
||||
#define XINCX_RF_EMHAMCED_PACKET_MODE 0
|
||||
#endif
|
||||
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE == 1)
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_RF_MODE - RF Tx or Rx Mode
|
||||
// <0=> TX Mode
|
||||
// <1=> RX Mode
|
||||
#ifndef XINCX_RF_MODE
|
||||
#define XINCX_RF_MODE 0
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TRANS_RATE - RF Transmission Rate Config
|
||||
// <0x02=> 1M
|
||||
// <0x0A=> 2M
|
||||
// <0x22=> 250k
|
||||
// <0x2A=> 125k
|
||||
#ifndef XINCX_RF_TRANS_RATE
|
||||
#define XINCX_RF_TRANS_RATE 0x02
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CHANNEL - 2.4g Channel Set
|
||||
#ifndef XINCX_2_4G_CHANNEL
|
||||
#define XINCX_2_4G_CHANNEL 2440
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TX_ADDR_WIDTH - RF Tx Addr Width
|
||||
// <3=> 3 Bytes
|
||||
// <4=> 4 Bytes
|
||||
// <5=> 5 Bytes
|
||||
#ifndef XINCX_RF_TX_ADDR_WIDTH
|
||||
#define XINCX_RF_TX_ADDR_WIDTH 5
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_L - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_L
|
||||
#define XINCX_2_4G_ADDR_L 0xe7e7e7e7
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_H - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_H
|
||||
#define XINCX_2_4G_ADDR_H 0xe7
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_POWER - rf Power Set
|
||||
// <1=> -10dbm
|
||||
// <2=> -9dbm
|
||||
// <4=> -4dbm
|
||||
// <6=> 0dbm
|
||||
// <8=> 3dbm
|
||||
// <9=> 5dbm
|
||||
// <12=> 7dbm
|
||||
// <14=> 8dbm
|
||||
// <16=> 9dbm
|
||||
// <19=> 10dbm
|
||||
// <24=> 11dbm
|
||||
// <30=> 12dbm
|
||||
// <36=> 13dbm
|
||||
#ifndef XINCX_POWER
|
||||
#define XINCX_POWER 0x00006
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_NVIC_MODE - RF NVIC Mode
|
||||
// <0=> Disable
|
||||
// <1=> Enable
|
||||
#ifndef XINCX_RF_NVIC_MODE
|
||||
#define XINCX_RF_NVIC_MODE 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE_RX_PAYLEN - 2.4g Pipe Rx Payload Len
|
||||
// <i> Payload length. Configuration of the load length during communication.
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_LEN - 2.4g Pipe0 Rx Payload Len
|
||||
// #ifndef XINCX_2_4G_PIPE0_LEN
|
||||
// #define XINCX_2_4G_PIPE0_LEN 32
|
||||
// #endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_LEN - 2.4g Pipe1 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE1_LEN
|
||||
#define XINCX_2_4G_PIPE1_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_LEN - 2.4g Pipe2 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE2_LEN
|
||||
#define XINCX_2_4G_PIPE2_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_LEN - 2.4g Pipe3 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE3_LEN
|
||||
#define XINCX_2_4G_PIPE3_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_LEN - 2.4g Pipe4 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE4_LEN
|
||||
#define XINCX_2_4G_PIPE4_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_LEN - 2.4g Pipe5 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE5_LEN
|
||||
#define XINCX_2_4G_PIPE5_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_RF_CRC_ENABLE - RF CRC Enable
|
||||
//==========================================================
|
||||
#ifndef XINCX_RF_CRC_ENABLE
|
||||
#define XINCX_RF_CRC_ENABLE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CRC_BYTE - 2.4g CRC Bytes Set
|
||||
// <0=> 0 Byte
|
||||
// <1=> 1 Byte
|
||||
// <2=> 2 Bytes
|
||||
#ifndef XINCX_2_4G_CRC_BYTE
|
||||
#define XINCX_2_4G_CRC_BYTE 2
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_FEATURE_PARAM - 2.4g Feature Parameters
|
||||
//==========================================================
|
||||
|
||||
// XINCX_2_4G_GUARD_CFG - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_GUARD_CFG
|
||||
#define XINCX_2_4G_GUARD_CFG 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_LONG_PLD_TYPE - 2.4g Long Pld Type
|
||||
#ifndef XINCX_2_4G_LONG_PLD_TYPE
|
||||
#define XINCX_2_4G_LONG_PLD_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_NUM - 2.4g Preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE_NUM
|
||||
#define XINCX_2_4G_PREAMBLE_NUM 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_TYPE - 2.4g Preamble Type
|
||||
#ifndef XINCX_2_4G_PREAMBLE_TYPE
|
||||
#define XINCX_2_4G_PREAMBLE_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_GUARD - 2.4g CRC Scope Guard
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_GUARD
|
||||
#define XINCX_2_4G_CRC_SCOPE_GUARD 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_HEADER - 2.4g CRC Scope Header
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_HEADER
|
||||
#define XINCX_2_4G_CRC_SCOPE_HEADER 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_ADDR - 2.4g CRC Scope Addr
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_ADDR
|
||||
#define XINCX_2_4G_CRC_SCOPE_ADDR 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_LONG_PLD - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_LONG_PLD
|
||||
#define XINCX_2_4G_LONG_PLD 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_FEC - 2.4g FEC&Interleave Feature
|
||||
#ifndef XINCX_2_4G_FEC
|
||||
#define XINCX_2_4G_FEC 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_WHITEN - 2.4g Whiten Feature
|
||||
#ifndef XINCX_2_4G_WHITEN
|
||||
#define XINCX_2_4G_WHITEN 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DPL - 2.4g Dynamic Payload Length Feature
|
||||
#ifndef XINCX_2_4G_DPL
|
||||
#define XINCX_2_4G_DPL 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_ACK_PAY - 2.4g Payload on ACK
|
||||
#ifndef XINCX_2_4G_ACK_PAY
|
||||
#define XINCX_2_4G_ACK_PAY 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYN_ACK - 2.4g W_TX_PAYLOAD_NOACK Command
|
||||
#ifndef XINCX_2_4G_DYN_ACK
|
||||
#define XINCX_2_4G_DYN_ACK 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYNPD - 2.4g dynpd
|
||||
#ifndef XINCX_2_4G_DYNPD
|
||||
#define XINCX_2_4G_DYNPD 0x3f
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_AUTO_ACK - 2.4g Auto Acknowledgement
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_ENAA - 2.4g Pipe0 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE0_ENAA
|
||||
#define XINCX_2_4G_PIPE0_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_ENAA - 2.4g Pipe1 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE1_ENAA
|
||||
#define XINCX_2_4G_PIPE1_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_ENAA - 2.4g Pipe2 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE2_ENAA
|
||||
#define XINCX_2_4G_PIPE2_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_ENAA - 2.4g Pipe3 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE3_ENAA
|
||||
#define XINCX_2_4G_PIPE3_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_ENAA - 2.4g Pipe4 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE4_ENAA
|
||||
#define XINCX_2_4G_PIPE4_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_ENAA - 2.4g Pipe5 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE5_ENAA
|
||||
#define XINCX_2_4G_PIPE5_ENAA 1
|
||||
#endif
|
||||
// <o.0..5> XINCX_RF_PIPE_ENABLE
|
||||
#ifndef XINCX_RF_PIPE_ENABLE
|
||||
#define XINCX_RF_PIPE_ENABLE 1
|
||||
#endif
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_2_4G_RETRANS_CNT - 2.4g Retransmit Count
|
||||
// <i> Number of retransmissions. The maximum number of times a hardware can automatically transmit an ACK if it does
|
||||
// not receive the correct ACK.
|
||||
// <0=> No retransmission
|
||||
// <1=> 1 time
|
||||
// <2=> 2 times
|
||||
// <3=> 3 times
|
||||
// <4=> 4 times
|
||||
// <5=> 5 times
|
||||
// <6=> 6 times
|
||||
// <7=> 7 times
|
||||
// <8=> 8 times
|
||||
// <9=> 9 times
|
||||
// <10=> 10 times
|
||||
// <11=> 11 times
|
||||
// <12=> 12 times
|
||||
// <13=> 13 times
|
||||
// <14=> 14 times
|
||||
// <15=> 15 times
|
||||
#ifndef XINCX_2_4G_RETRANS_CNT
|
||||
#define XINCX_2_4G_RETRANS_CNT 0
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_RETRANS_DELAY - 2.4g Retransmission Delay
|
||||
// <i> Retransmission delay. For 32 bytes of data, the minimum configuration is 500 us for 1 Mbit/s and 1500 us for 250
|
||||
// kbit/s.
|
||||
// <0=> 250us
|
||||
// <1=> 500us
|
||||
// <2=> 750us
|
||||
// <3=> 1000us
|
||||
// <4=> 1250us
|
||||
// <5=> 1500us
|
||||
// <6=> 1750us
|
||||
// <7=> 2000us
|
||||
// <8=> 2250us
|
||||
// <9=> 2500us
|
||||
// <10=> 2750us
|
||||
// <11=> 3000us
|
||||
// <12=> 3250us
|
||||
// <13=> 3500us
|
||||
// <14=> 3750us
|
||||
// <15=> 4000us
|
||||
#ifndef XINCX_2_4G_RETRANS_DELAY
|
||||
#define XINCX_2_4G_RETRANS_DELAY 3
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// </e> //XINCX_RF_PEACKET_MODE enhanced normal
|
||||
|
||||
// RF 2.4g Compatibility configuration
|
||||
//==========================================================
|
||||
// Compatibility configuration, when you need to be compatible with other RF chips, you don't need to configure this
|
||||
// option when using our company's chips.
|
||||
// XINCX_2_4G_PREAMBLE - 2.4g preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE
|
||||
#define XINCX_2_4G_PREAMBLE 0x710f5555
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_GUARD - 2.4g guard
|
||||
#ifndef XINCX_2_4G_GUARD
|
||||
#define XINCX_2_4G_GUARD 0x8fc9
|
||||
#endif
|
||||
//
|
||||
|
||||
// XINCX_2_4G_CRY_CPT_ARRAY - 2.4g Crystal capacitor array
|
||||
//==========================================================
|
||||
// Crystal capacitor array, adjust to modify the frequency offset of the crystal oscillator.
|
||||
// XINCX_2_4G_CRY_CPT_ARRAY - 2.4g Crystal capacitor array
|
||||
#ifndef XINCX_2_4G_CRY_CPT_ARRAY
|
||||
#ifdef XC62XX
|
||||
#define XINCX_2_4G_CRY_CPT_ARRAY 0x38
|
||||
#else
|
||||
#define XINCX_2_4G_CRY_CPT_ARRAY 0x36
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // SDK_CONFIG_H
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "app_64m.h"
|
||||
|
||||
void use_64m_crtstal_init(void)
|
||||
{
|
||||
testpin_64M_config();
|
||||
xc_pwr_pwrkey_init();
|
||||
Init_rtc_gpio(4, 0x00);
|
||||
}
|
||||
|
||||
__RAM_CODE void rf_64M_set_rx_channel(uint16_t channel)
|
||||
{
|
||||
channel -= 1;
|
||||
uint16_t ch = channel % 2;
|
||||
XC_RF_2_4G->RF_CH &= ~(0x3fff);
|
||||
switch (ch) {
|
||||
case 0:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16));
|
||||
break;
|
||||
case 1:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16) | 0x80008000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(*(volatile unsigned int *)(0x53023010)) &= ~((1 << 24) | (2 << 28));
|
||||
}
|
||||
|
||||
__RAM_CODE void rf_64M_set_tx_channel(uint16_t channel)
|
||||
{
|
||||
uint16_t ch = channel % 2;
|
||||
XC_RF_2_4G->RF_CH &= ~(0x3fff);
|
||||
switch (ch) {
|
||||
case 0:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16));
|
||||
break;
|
||||
case 1:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2 + 1);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16) | 0x80008000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(*(volatile unsigned int *)(0x53023010)) |= ((0x3 << 16) | (1 << 24) | (2 << 28));
|
||||
}
|
||||
|
||||
void testpin_64M_config(void)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
val = (*(volatile unsigned int *)(0x53022040));
|
||||
val |= (0x7 << 4) | (0x7);
|
||||
(*(volatile unsigned int *)(0x53022040)) = val; // TPORT_DATA0_SEL set
|
||||
|
||||
val = (*(volatile unsigned int *)(0x40000134));
|
||||
(*(volatile unsigned int *)(0x40000134)) = ((val & ~(0xfu << 28)) | (1u << 28)); // testpin1_ctrl[3:0]=1
|
||||
// printf("after 0x40000134=0x%x, 0x40000134=0x%x\n", *(volatile unsigned int *)(0x40000134),
|
||||
// *(volatile unsigned int *)(0x40000134));
|
||||
|
||||
val = (*(volatile unsigned int *)(0x53023010));
|
||||
val &= ~(3 << 28);
|
||||
|
||||
#if 1 // diag = 0xc //diag = 0x3
|
||||
|
||||
val |= (0x3 << 20) | (0x3 << 16 | 1 << 24 | 2 << 28); // 0xc
|
||||
(*(volatile unsigned int *)(0x53023010)) = val; // diag_sel[3:0] set
|
||||
#endif
|
||||
|
||||
// LOGI("after 0x53022040=0x%x, 0x53022010=0x%x\n", *(volatile unsigned int *)(0x53022040),
|
||||
//*(volatile unsigned int *)(0x53023010));
|
||||
|
||||
uint32_t addr_val = 0;
|
||||
|
||||
xc_gpio_fun_sel(GPIO_4, GPIO_Dx);
|
||||
xc_gpio_mux_ctl(GPIO_4, GPIO_Mux3); // en test_pin[1]
|
||||
addr_val = 0x40000174;
|
||||
*((uint32_t volatile *)addr_val) = 7;
|
||||
}
|
||||
|
||||
void Init_rtc_gpio(uint32_t num, uint8_t inter_mode)
|
||||
{
|
||||
uint32_t val;
|
||||
// if(!((inter_mode>=0x08) &&(inter_mode<=0x0c))) return;
|
||||
__write_hw_reg32(CPR_CTLAPBCLKEN_GRCTL, 0x20002);
|
||||
__write_hw_reg32(CPR_AOCLKEN_GRCTL, 0x20002);
|
||||
|
||||
__read_hw_reg32(AO_GPIO_MODE, val);
|
||||
val &= ~(0x0f << (num << 2));
|
||||
val |= (inter_mode << (num << 2));
|
||||
__write_hw_reg32(AO_GPIO_MODE, val);
|
||||
|
||||
__read_hw_reg32(AO_GPIO_CTL, val);
|
||||
val |= (1 << (8 + num));
|
||||
__write_hw_reg32(AO_GPIO_CTL, val);
|
||||
// rtc_ao_gpio_mode__aogpio_debounce_en3__setf(1);
|
||||
NVIC_EnableIRQ(RTC_IRQn);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
#include "usbd_core.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_hid_mouse.h"
|
||||
#include "rf_2_4g_main.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void SysTick_Callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void clock_init(void)
|
||||
{
|
||||
CLOCK_InitCfg_t clock_cfg;
|
||||
|
||||
clock_cfg.hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
clock_cfg.hfclk_in = CLOCK_HFCLK_IN_48M;
|
||||
clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
|
||||
if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_XTAL) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32768;
|
||||
} else if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_RC) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
}
|
||||
|
||||
xc_clock_init_cfg(&clock_cfg);
|
||||
|
||||
SysTick_Config(xc_clock_hfclk_in_get() / 100);
|
||||
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
void app_uart_init(void)
|
||||
{
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
}
|
||||
|
||||
|
||||
#ifdef APP_USB_MOUSE_FAST_SEND_DATA
|
||||
void app_usb_mouse_fast_send_data(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
uint8_t data[4];
|
||||
GLOBAL_INT_DISABLE();
|
||||
GetPointerData(data);
|
||||
(void)USBD_LL_Transmit(pdev, HID_MOUSE_EPIN_ADDR, data, HID_MOUSE_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
#endif
|
||||
|
||||
void app_usb_mouse_send_data(uint8_t *data)
|
||||
{
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Mouse_FirstSendReport(&hUsbDeviceFS, data, HID_MOUSE_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
|
||||
volatile uint8_t rf_2_4g_mouse_data_ready = 0;
|
||||
extern uint8_t rx_buff[256];
|
||||
int main(void)
|
||||
{
|
||||
/* Clock initialization */
|
||||
clock_init();
|
||||
|
||||
/* Serial port initialization */
|
||||
app_uart_init( );
|
||||
DEBUG("__USB_HID_2_4G_MOUSE_DEMO__\n");
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
/* rf 2.4g initialization configuration */
|
||||
rf24g_init();
|
||||
rf_compatible_config();
|
||||
|
||||
#if (XINCX_RF_TRANS_RATE == DR_2M)
|
||||
/* Set 2M mode register configuration */
|
||||
/* Don't move this function interface */
|
||||
rf_2M_config();
|
||||
#endif //(XINCX_RF_TRANS_RATE == DR_2M)
|
||||
|
||||
#if (XINCX_RF_NVIC_MODE)
|
||||
|
||||
/* Enable RF2.4G interrupts */
|
||||
NVIC_EnableIRQ(RF24G_IRQn);
|
||||
/* Configure the RF2.4G interrupt priority */
|
||||
NVIC_SetPriority(RF24G_IRQn, 1);
|
||||
#endif // XINCX_RF_NVIC_MODE
|
||||
/* Set the communication mode */
|
||||
rf_switch_mode(XINCX_RF_MODE, XINCX_2_4G_CHANNEL);
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
timer_init(RF_TX_TIMERx, SEND_TIMERMS_CNT);
|
||||
#endif
|
||||
#ifdef DEBUG_LOG
|
||||
/* Register information printing */
|
||||
rf_dump_log();
|
||||
#endif // DEBUG_LOG
|
||||
|
||||
while(1)
|
||||
{
|
||||
rf_transmit();
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_mouse_data_ready)
|
||||
{
|
||||
app_usb_mouse_send_data(rx_buff);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_mouse_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "rf_2_4g_main.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
bool rf_tx_timer_flag = false;
|
||||
bool rf_trx_tx_flag = false;
|
||||
|
||||
uint32_t rx_cnt = 0;
|
||||
uint32_t tx_cnt = 0;
|
||||
uint8_t tx_buff[256] = {0};
|
||||
uint8_t rx_buff[256] = {0};
|
||||
|
||||
uint8_t tx_stat;
|
||||
|
||||
extern bool rf24g_tx_irq_flag;
|
||||
extern bool rf24g_rx_irq_flag;
|
||||
extern uint32_t recv_len;
|
||||
extern uint8_t recv_buf[];
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void timer_init(uint8_t timer_id, uint32_t timer_cnt)
|
||||
{
|
||||
LOGI("timer_init\r\n");
|
||||
|
||||
uint32_t timerx_us = timer_cnt * 1000;
|
||||
Timer_InitCfg_t timer_cfg;
|
||||
|
||||
timer_cfg.timer_src_clk = TIMER_CLK_SRC_32M_DIV;
|
||||
timer_cfg.timer_div_clk = TIMER_DIV_CLK_1MHzOr1K;
|
||||
timer_cfg.timer_mode = TIMER_MODE_CYCLE;
|
||||
|
||||
xc_timer_init(timer_id, &timer_cfg);
|
||||
xc_timer_set_value(timer_id, timerx_us);
|
||||
xc_timer_start(timer_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief timer0_Callback
|
||||
* @param void * - context
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void timer0_callback(void *context)
|
||||
{
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
rf_tx_timer_flag = true;
|
||||
#elif (XINCX_RF_MODE == TRX_MODE)
|
||||
rf_trx_tx_flag = true;
|
||||
#endif //(XINCX_RF_MODE)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LOG
|
||||
/**
|
||||
* @brief RF 2.4g register information printing
|
||||
* @param void
|
||||
* @retval void
|
||||
*/
|
||||
void rf_2M_reg_info(void)
|
||||
{
|
||||
/* Register information printing */
|
||||
LOGI("CFG_TOP: 0x%08x\r\n", XC_RF_2_4G->CFG_TOP);
|
||||
LOGI("TXPROC_CFG: 0x%08x\r\n", XC_RF_2_4G->TXPROC_CFG);
|
||||
LOGI("RXPROC_CFG_L: 0x%08x\r\n", XC_RF_2_4G->RXPROC_CFG_L);
|
||||
LOGI("RF_CH: 0x%08x\r\n", XC_RF_2_4G->RF_CH);
|
||||
LOGI("rccal_reg_l: 0x%08x\r\n", XC_BT_RF->rccal_reg_l);
|
||||
LOGI("ana2_reg_l: 0x%08x\r\n", XC_BT_RF->ana2_reg_l);
|
||||
LOGI("ana3_reg_l: 0x%08x\r\n", XC_BT_RF->ana3_reg_l);
|
||||
LOGI("ana4_reg_l: 0x%08x\r\n", XC_BT_RF->ana4_reg_l);
|
||||
LOGI("ana5_reg_l: 0x%08x\r\n", XC_BT_RF->ana5_reg_l);
|
||||
LOGI("ana14_reg_l: 0x%08x\r\n", XC_BT_RF->ana14_reg_l);
|
||||
LOGI("ana15_reg_l: 0x%08x\r\n", XC_BT_RF->ana15_reg_l);
|
||||
LOGI("ana16_reg_l: 0x%08x\r\n", XC_BT_RF->ana16_reg_l);
|
||||
LOGI("ana17_reg_l: 0x%08x\r\n", XC_BT_RF->ana17_reg_l);
|
||||
LOGI("ana18_reg_l: 0x%08x\r\n", XC_BT_RF->ana18_reg_l);
|
||||
LOGI("ana21_reg_l: 0x%08x\r\n", XC_BT_RF->ana21_reg_l);
|
||||
LOGI("AON_RF_AONREG: 0x%08x\r\n", cprao_aon_rf_aonreg_get()); // 0x36
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Rf 2.4g dump log
|
||||
* @param void
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void rf_dump_log(void)
|
||||
{
|
||||
LOGI("***************** 2.4G Param ******************\n");
|
||||
LOGI("CFG_TOP: 0x%08x\r\n", XC_RF_2_4G->CFG_TOP);
|
||||
LOGI("EN_AA: 0x%08x\r\n", XC_RF_2_4G->EN_AA);
|
||||
LOGI("EN_RXADDR: 0x%08x\r\n", XC_RF_2_4G->EN_RXADDR);
|
||||
LOGI("SETUP_AW: 0x%08x\r\n", XC_RF_2_4G->SETUP_AW);
|
||||
LOGI("SETUP_RETR: 0x%08x\r\n", XC_RF_2_4G->SETUP_RETR);
|
||||
LOGI("RF_CH: 0x%08x\r\n", XC_RF_2_4G->RF_CH);
|
||||
LOGI("SETUP_RF: 0x%08x\r\n", XC_RF_2_4G->SETUP_RF);
|
||||
LOGI("STATUS: 0x%08x\r\n", XC_RF_2_4G->STATUS);
|
||||
LOGI("OBSERVE_TX: 0x%08x\r\n", XC_RF_2_4G->OBSERVE_TX);
|
||||
LOGI("RSSI: 0x%08x\r\n", XC_RF_2_4G->RSSI);
|
||||
LOGI("RX_ADDR_P0: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RX_ADDR_P0_H), XC_RF_2_4G->RX_ADDR_P0_L);
|
||||
LOGI("RX_ADDR_P1: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RX_ADDR_P1_H), XC_RF_2_4G->RX_ADDR_P1_L);
|
||||
LOGI("RX_ADDR_P2TOP5:0x%08x\r\n", XC_RF_2_4G->RX_ADDR_P2TOP5);
|
||||
LOGI("BER_RESULT: 0x%08x%08x\r\n", XC_RF_2_4G->BER_ERR_CNT, XC_RF_2_4G->BER_RECV_CNT);
|
||||
LOGI("AGC_SETTING: 0x%08x\r\n", XC_RF_2_4G->AGC_SETTING);
|
||||
LOGI("PGA_SETTING: 0x%02x %08x\r\n", ((XC_RF_2_4G->TX_ADDR_H) & 0xFF00) >> 8, XC_RF_2_4G->PGA_SETTING);
|
||||
LOGI("TX_ADDR: 0x%02x %08x\r\n", ((XC_RF_2_4G->TX_ADDR_H) & 0xFF), XC_RF_2_4G->TX_ADDR_L);
|
||||
LOGI("RX_PW_PX: 0x%04x %08x\r\n", 0xFFFF & (XC_RF_2_4G->RX_PW_Px_H), XC_RF_2_4G->RX_PW_Px_L);
|
||||
LOGI("STATUS_FIFO: 0x%08x\r\n", XC_RF_2_4G->STATUS_FIFO);
|
||||
LOGI("RSSIREC: 0x%08x\r\n", XC_RF_2_4G->RSSIREC);
|
||||
LOGI("TXPROC_CFG: 0x%08x\r\n", XC_RF_2_4G->TXPROC_CFG);
|
||||
LOGI("RXPROC_CFG: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RXPROC_CFG_H), XC_RF_2_4G->RXPROC_CFG_L);
|
||||
LOGI("DYNPD: 0x%08x\r\n", XC_RF_2_4G->DYNPD);
|
||||
LOGI("FEATURE: 0x%08x\r\n", XC_RF_2_4G->FEATURE);
|
||||
LOGI("PGA_SETTING_H: 0x%08x\r\n", XC_RF_2_4G->TX_ADDR_H);
|
||||
#ifdef XC62XX
|
||||
LOGI("HW_CONFIG: 0x%08x\r\n", XC_RF_2_4G->HW_CONFIG);
|
||||
LOGI("PBT_CONFIG: 0x%08x\r\n", XC_RF_2_4G->PBT_CONFIG);
|
||||
LOGI("PBT_TIMER: 0x%08x\r\n", XC_RF_2_4G->PBT_TIMER);
|
||||
LOGI("PBT_SYNC_TIME: 0x%08x\r\n", XC_RF_2_4G->PBT_SYNC_TIME);
|
||||
LOGI("PBT_TX_HEAD: 0x%08x\r\n", XC_RF_2_4G->PBT_TX_HEAD);
|
||||
LOGI("PBT_RX_HEAD: 0x%08x\r\n", XC_RF_2_4G->PBT_RX_HEAD);
|
||||
LOGI("PBT_AUTO_TRX_TIME: 0x%08x\r\n", XC_RF_2_4G->PBT_AUTO_TRX_TIME);
|
||||
#endif
|
||||
LOGI("TX_POWER 0x%08x\r\n", (XC_BT_RF->ana21_reg_l >> 6) & 0x3f);
|
||||
LOGI("ana11_reg_l: 0x%08x\r\n", XC_BT_RF->ana11_reg_l);
|
||||
LOGI("***********************************************\n");
|
||||
LOGI("\r\n");
|
||||
}
|
||||
#endif // DEBUG_LOG
|
||||
void GetPointerData(uint8_t *pbuf);
|
||||
/**
|
||||
* @brief RF 2.4g data config
|
||||
* @param uint8_t * - buff
|
||||
* uint8 - len
|
||||
* @retval uint8_t - 0
|
||||
*/
|
||||
uint8_t rf_data_config(uint8_t *buff, uint16_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return RF_FAIL;
|
||||
}
|
||||
|
||||
GetPointerData(buff);
|
||||
return RF_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RF 2.4g buff info
|
||||
* @param uint8_t * - buff
|
||||
* uint8_t len
|
||||
* @retval void
|
||||
*/
|
||||
void rf_buff_info(uint8_t *buff, uint16_t len)
|
||||
{
|
||||
for (uint16_t i = 0; i < len; i++)
|
||||
LOGI("%02x ", buff[i]);
|
||||
LOGI("\r\n");
|
||||
}
|
||||
|
||||
void rf_switch_mode(uint8_t mode, uint16_t channel)
|
||||
{
|
||||
CE_CTL_LOW;
|
||||
uint8_t rf_mode = 0;
|
||||
switch (mode) {
|
||||
case TRX_MODE:
|
||||
case TX_MODE:
|
||||
break;
|
||||
case RX_MODE:
|
||||
rf_mode = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("The mode is set incorrectly\n");
|
||||
return;
|
||||
}
|
||||
set_rf_mode(mode);
|
||||
rf_set_channel(channel);
|
||||
#ifdef XC62XX
|
||||
XC_RF_2_4G->STATUS = ((XC_RF_2_4G->CFG_TOP >> 30) & 0x3 << 7) | ((XC_RF_2_4G->CFG_TOP >> 4) & 0x7 << 4);
|
||||
#else
|
||||
XC_RF_2_4G->STATUS = MASK_ALL_INTER;
|
||||
#endif
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
rf_wr_cmd(FLUSH_TX);
|
||||
|
||||
if (rf_mode) {
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
void GetPointerData(uint8_t *pbuf)
|
||||
{
|
||||
static int32_t move_cnt = 0;
|
||||
static uint8_t step_x_y = 0;
|
||||
static int8_t x = 0, y = 0;
|
||||
static uint16_t cursor_step = 2;
|
||||
static uint16_t cursor_width = 200;
|
||||
|
||||
move_cnt++;
|
||||
if (move_cnt > cursor_width) {
|
||||
step_x_y++;
|
||||
step_x_y = step_x_y % 4;
|
||||
move_cnt = 0;
|
||||
}
|
||||
|
||||
switch (step_x_y) {
|
||||
case 0: {
|
||||
y = 0;
|
||||
x = cursor_step;
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
x = 0;
|
||||
y = cursor_step;
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
y = 0;
|
||||
x = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
x = 0;
|
||||
y = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
}
|
||||
|
||||
pbuf[0] = 0;
|
||||
pbuf[1] = x;
|
||||
pbuf[2] = y;
|
||||
pbuf[3] = 0;
|
||||
}
|
||||
|
||||
void rf_24g_tx_ds_cb(void)
|
||||
{
|
||||
rf24g_tx_irq_flag = true;
|
||||
}
|
||||
|
||||
extern uint8_t rf_2_4g_mouse_data_ready;
|
||||
extern bool rf_tx_1ms_transmit;
|
||||
void rf_transmit(void)
|
||||
{
|
||||
#if (XINCX_RF_COMPATIBILITY_MODE == PANCHIP_PACKET)
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf_data_config(tx_buff, XINCX_2_4G_PIPE0_LEN);
|
||||
rf_tx_normal_manage(tx_buff, XINCX_2_4G_PIPE0_LEN);
|
||||
}
|
||||
#else
|
||||
rf_rx_normal_manage();
|
||||
#endif
|
||||
#else
|
||||
#if ((!XINCX_RF_NVIC_MODE) && (XINCX_RF_MODE != TRX_MODE))
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
// 轮询发射
|
||||
rf_data_config(tx_buff, BUFF_LEN);
|
||||
// tx_buff[0] = tx_cnt;
|
||||
tx_stat = rf_tx_event(tx_buff, BUFF_LEN);
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE)
|
||||
if (tx_stat == TX_DATA_OK) {
|
||||
uint16_t ack_len = rf_rx_packet(rx_buff);
|
||||
LOGI("yes ack len:%d\n", ack_len);
|
||||
rx_cnt++;
|
||||
rf_buff_info(rx_buff, ack_len);
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
} else if (tx_stat == TX_RETRANS_MAX) {
|
||||
LOGI("no ack\n");
|
||||
}
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d, rx_cnt:%d\n", tx_cnt, rx_cnt);
|
||||
#else
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d\n", tx_cnt);
|
||||
#endif
|
||||
delay_ms(10);
|
||||
#else
|
||||
|
||||
// 轮询接收
|
||||
uint16_t len = rf_rx_event(rx_buff);
|
||||
|
||||
/* Receiving end polling data processing */
|
||||
if (len != 0) {
|
||||
rf_2_4g_mouse_data_ready = 1;
|
||||
/* Entering standby mode */
|
||||
CE_CTL_LOW;
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
LOGI("rx_cnt:%d,len:%d\n", rx_cnt, len);
|
||||
/* Receive read data buffer reset */
|
||||
// memset(rx_buff, 0, len);
|
||||
len = 0;
|
||||
/* Entering the receiver */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
#endif
|
||||
#elif (XINCX_RF_MODE != TRX_MODE)
|
||||
// 中断接收
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
uint16_t len = recv_len;
|
||||
if (len) {
|
||||
memcpy(rx_buff, recv_buf, len);
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
LOGI("rx_cnt:%d,len:%d\n", rx_cnt, len);
|
||||
rf_2_4g_mouse_data_ready = 1;
|
||||
/* Receive read data buffer reset */
|
||||
// memset(rx_buff, 0, len);
|
||||
memset(recv_buf, 0, len);
|
||||
len = 0;
|
||||
}
|
||||
// rf_wr_cmd(FLUSH_RX);
|
||||
/* Entering the receiver */
|
||||
}
|
||||
// 中断发射
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE)
|
||||
if (tx_stat == TX_DATA_OK) {
|
||||
uint16_t ack_len = rf_rx_packet(rx_buff);
|
||||
LOGI("yes ack len:%d\n", ack_len);
|
||||
rx_cnt++;
|
||||
rf_buff_info(rx_buff, ack_len);
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
} else if (tx_stat == TX_RETRANS_MAX) {
|
||||
LOGI("no ack\n");
|
||||
}
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d, rx_cnt:%d\n", tx_cnt, rx_cnt);
|
||||
#else
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d\n", tx_cnt);
|
||||
#endif
|
||||
tx_stat = TX_DATA_INVALID;
|
||||
rf_data_config(tx_buff, BUFF_LEN);
|
||||
// tx_buff[0] = tx_cnt;
|
||||
rf_tx_packet(tx_buff, BUFF_LEN);
|
||||
delay_ms(10);
|
||||
}
|
||||
|
||||
#endif //!(XINCX_RF_NVIC_MODE)
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
if (rf_trx_tx_flag) {
|
||||
rf_trx_tx_flag = false;
|
||||
tx_cnt += 1;
|
||||
/* 切换发射模式 */
|
||||
rf_switch_mode(TX_MODE, XINCX_2_4G_CHANNEL);
|
||||
tx_buff[0] = tx_cnt;
|
||||
/* 开始发射等到发送完成中断 */
|
||||
rf_tx_packet(tx_buff, 32);
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_2, GPIO_PIN_SET);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 收发切换(中断触发),含有接收超时配置
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
uint16_t len = recv_len;
|
||||
CE_CTL_LOW;
|
||||
if (len) {
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_1, GPIO_PIN_SET);
|
||||
#endif
|
||||
memcpy(rx_buff, recv_buf, len);
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
//LOGI("rx_buff[0]:%02x,rx_cnt:%d, len:%d\n", rx_buff[0], rx_cnt, len);
|
||||
/* Receive read data buffer reset */
|
||||
memset(rx_buff, 0, len);
|
||||
len = 0;
|
||||
recv_len = 0;
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_1, GPIO_PIN_RESET);
|
||||
#endif
|
||||
}
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
//LOGI("tx_cnt:%d\n",tx_cnt);
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_2, GPIO_PIN_RESET);
|
||||
#endif
|
||||
/* 切换接收模式 */
|
||||
rf_switch_mode(RX_MODE, XINCX_2_4G_CHANNEL);
|
||||
}
|
||||
|
||||
#endif // XINCX_RF_MODE
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
#include "rf_compatible_normal.h"
|
||||
uint16_t crc = 0;
|
||||
uint8_t panchip_data_length = XINCX_2_4G_PIPE0_LEN - XINCX_2_4G_CRC_BYTE;
|
||||
|
||||
uint16_t rf_addr_crc = 0;
|
||||
uint8_t panchip_addr_whiten;
|
||||
uint8_t addr_buff[5] = {0};
|
||||
uint32_t send_cnt = 0;
|
||||
uint32_t recv_cnt = 0;
|
||||
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
bool rf24g_tx_irq_flag = true;
|
||||
#elif(XINCX_RF_MODE == RX_MODE)
|
||||
bool rf24g_tx_irq_flag = false;
|
||||
#endif
|
||||
bool rf24g_rx_irq_flag = false;
|
||||
uint32_t recv_len;
|
||||
uint8_t recv_buf[256];
|
||||
|
||||
/**
|
||||
* @brief Rf 2.4g get addr
|
||||
* @param uint8_t *addr_buff
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void rf_addr_map(uint8_t *addr_buff)
|
||||
{
|
||||
uint8_t addr_xsb = (XC_RF_2_4G->CFG_TOP >> 11) & (0x1);
|
||||
LOGI("addr_xsb %02x\r\n", addr_xsb);
|
||||
if (!addr_xsb) {
|
||||
addr_buff[0] = (XC_RF_2_4G->TX_ADDR_L >> 0) & 0xff;
|
||||
addr_buff[1] = (XC_RF_2_4G->TX_ADDR_L >> 8) & 0xff;
|
||||
addr_buff[2] = (XC_RF_2_4G->TX_ADDR_L >> 16) & 0xff;
|
||||
addr_buff[3] = (XC_RF_2_4G->TX_ADDR_L >> 24) & 0xff;
|
||||
addr_buff[4] = (XC_RF_2_4G->TX_ADDR_H >> 0) & 0xff;
|
||||
} else {
|
||||
addr_buff[1] = (XC_RF_2_4G->TX_ADDR_L >> 24) & 0xff;
|
||||
addr_buff[2] = (XC_RF_2_4G->TX_ADDR_L >> 16) & 0xff;
|
||||
addr_buff[3] = (XC_RF_2_4G->TX_ADDR_L >> 8) & 0xff;
|
||||
addr_buff[4] = (XC_RF_2_4G->TX_ADDR_L >> 0) & 0xff;
|
||||
addr_buff[0] = (XC_RF_2_4G->TX_ADDR_H >> 0) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RF 2.4g get address crc
|
||||
* @param void
|
||||
* @retval crc data
|
||||
*/
|
||||
uint16_t rf_get_addr_crc(void)
|
||||
{
|
||||
#if (1 == XINCX_2_4G_CRC_BYTE)
|
||||
return crc8_rohc(addr_buff, RF_ADDR_LEN, RF_CRC_INIT_VALUE, PACKET_NORMAL);
|
||||
#elif (2 == XINCX_2_4G_CRC_BYTE)
|
||||
return crc16_ccitt_false(addr_buff, RF_ADDR_LEN, RF_CRC_INIT_VALUE, PACKET_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Address whitening and writing
|
||||
* @param void
|
||||
* @retval uint8_t whiten_addr
|
||||
*/
|
||||
uint8_t rf_recv_addr(void)
|
||||
{
|
||||
uint16_t whiten_addr = whiten_data((uint8_t *)addr_buff, RF_ADDR_LEN, PANCHIP_WHITEN_INIT_VAL);
|
||||
|
||||
/* Set PTX address */
|
||||
set_rf_txaddr((addr_buff[0] << 0) | (addr_buff[1] << 8) | (addr_buff[2] << 16) | (addr_buff[3] << 24),
|
||||
(addr_buff[4]));
|
||||
/* Set PRX address */
|
||||
set_rf_pipe0_rxaddr((addr_buff[0] << 0) | (addr_buff[1] << 8) | (addr_buff[2] << 16) | (addr_buff[3] << 24),
|
||||
(addr_buff[4]));
|
||||
return whiten_addr;
|
||||
}
|
||||
|
||||
void rf_compatible_config(void)
|
||||
{
|
||||
#if (XINCX_RF_COMPATIBILITY_MODE == BELKEN_PACKET)
|
||||
#if XC62XX
|
||||
set_rf_retr(XINCX_2_4G_RETRANS_CNT, XINCX_2_4G_RETRANS_DELAY);
|
||||
|
||||
XC_RF_2_4G->FEATURE &= ~(1 << 5);
|
||||
|
||||
rf_set_ack_type(1);
|
||||
|
||||
rf_set_freq_dev(RF_FREQ_DEV);
|
||||
#endif
|
||||
#elif (XINCX_RF_COMPATIBILITY_MODE == PANCHIP_PACKET)
|
||||
|
||||
XC_RF_2_4G->FEATURE |= (1 << 11) | (2 << 12) | (1 << 14) | (1 << 18);
|
||||
XC_RF_2_4G->PREAMBLE = 0x710f55;
|
||||
|
||||
/* 白化cc2500、同步字中断、CRC中断 */
|
||||
XC_RF_2_4G->CFG_TOP |= (1 << 30) | (1 << 22);
|
||||
/* get addr */
|
||||
rf_addr_map(addr_buff);
|
||||
/* Calculate the CRC of the address block */
|
||||
rf_addr_crc = rf_get_addr_crc();
|
||||
/* The address range is whitened and the whitened address is rewritten */
|
||||
panchip_addr_whiten = rf_recv_addr();
|
||||
#if XC62XX
|
||||
rf_set_whiten_value(panchip_addr_whiten);
|
||||
rf_set_fifo_len(1);
|
||||
#else
|
||||
XC_RF_2_4G->FEATURE |= (1 << 5);
|
||||
XC_RF_2_4G->CFG_TOP &= ~(0x7f << 23);
|
||||
XC_RF_2_4G->CFG_TOP |= (panchip_addr_whiten << 23);
|
||||
#endif
|
||||
set_rf_crc(CRC_0BYTE);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t rf_panchip_normal_recv_data_cfg(uint8_t *buff, uint8_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t crc_data = 0;
|
||||
/* Whiten */
|
||||
whiten_data(buff, len + 2, panchip_addr_whiten);
|
||||
/* CRC */
|
||||
crc = ~crc16_ccitt_false(buff, len, rf_addr_crc, PACKET_NORMAL);
|
||||
crc_data = ((buff[len] << 8) | (buff[len + 1]));
|
||||
|
||||
if (crc == crc_data) {
|
||||
buff_bigandsmallend(buff, len);
|
||||
} else {
|
||||
len = 0;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
uint8_t rf_panchip_normal_send_data_cfg(uint8_t *buff, uint8_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
buff_bigandsmallend(buff, len);
|
||||
crc = ~crc16_ccitt_false(buff, panchip_data_length, rf_addr_crc, PACKET_NORMAL);
|
||||
|
||||
buff[panchip_data_length] = (crc >> 8) & 0xff;
|
||||
buff[panchip_data_length + 1] = crc & 0xff;
|
||||
|
||||
/* Whiten */
|
||||
whiten_data(buff, len + 2, panchip_addr_whiten);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rf_24g_rx_dr_cb(void)
|
||||
{
|
||||
|
||||
/* stop RF */
|
||||
CE_CTL_LOW;
|
||||
|
||||
recv_len = rf_rx_packet( recv_buf);
|
||||
rf24g_rx_irq_flag = true;
|
||||
|
||||
/* start RF */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
|
||||
uint32_t rf_rx_normal_manage(void)
|
||||
{
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
/* Entering standby mode */
|
||||
CE_CTL_LOW;
|
||||
uint8_t len = recv_len;
|
||||
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_2, GPIO_PIN_SET);
|
||||
#endif
|
||||
len = rf_panchip_normal_recv_data_cfg(recv_buf, len - 2);
|
||||
if (len) {
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_1, GPIO_PIN_SET);
|
||||
#endif
|
||||
// rf_buff_info(recv_buf, len);
|
||||
/* Receive Count */
|
||||
recv_cnt++;
|
||||
LOGI("recv:%d, len:%d\r\n", recv_cnt, len);
|
||||
|
||||
/* Receive read data buffer reset */
|
||||
memset(recv_buf, 0, len);
|
||||
len = 0;
|
||||
}
|
||||
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_1, GPIO_PIN_RESET);
|
||||
xc_gpio_write_pin(TEST_PIN_2, GPIO_PIN_RESET);
|
||||
#endif
|
||||
/* Entering the receiver */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t rf_tx_normal_manage(uint8_t *buff, uint8_t length)
|
||||
{
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
buff[0] = send_cnt++;
|
||||
/* Filling in software frame number */
|
||||
LOGI("data len:%d, send_cnt:%d\n", length - XINCX_2_4G_CRC_BYTE, send_cnt);
|
||||
// rf_buff_info(buff, length);
|
||||
rf_panchip_normal_send_data_cfg(buff, length - XINCX_2_4G_CRC_BYTE);
|
||||
/* data transmission */
|
||||
rf_tx_packet(buff, length);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
SP = _RDWORD(0x10000000);
|
||||
PC = _RDWORD(0x10000004);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
FUNC void InitGpio(void)
|
||||
{
|
||||
// Config IOMUX
|
||||
/*
|
||||
gpio_mux_ctl_u(33,1);//d2
|
||||
gpio_mux_ctl_u(34,1);//d3
|
||||
gpio_mux_ctl_u(35,2);//clk
|
||||
gpio_mux_ctl_u(36,2);//cs
|
||||
gpio_mux_ctl_u(37,2);//d0 rx
|
||||
gpio_mux_ctl_u(38,2);//d1 tx
|
||||
*/
|
||||
_WDWORD(0x4000019c, 0x00002A94);
|
||||
}
|
||||
FUNC void InitFlash(void)
|
||||
{
|
||||
|
||||
}
|
||||
FUNC void InitXIP(void)
|
||||
{
|
||||
|
||||
_WDWORD(0x40000104,0x040000);//reset ssi0
|
||||
_WDWORD(0x40000104,0x040004);//reset ssi0
|
||||
_WDWORD(0x40000050,0x110000);//close spi0 mclk
|
||||
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
|
||||
|
||||
|
||||
//config fmc
|
||||
_WDWORD(0x40000270, 0x0503);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x40000270, 0x3503);
|
||||
//config cache
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x0);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x21);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
|
||||
|
||||
//config xip spi
|
||||
_WDWORD(0x51000008, 0); //disable spi
|
||||
|
||||
_WDWORD(0x5100002c,0); //close IE
|
||||
_WDWORD(0x51000000,0x1F); //32bit SPI data
|
||||
_WDWORD(0x51000010,0x01); //enable select slave -- SE
|
||||
_WDWORD(0x51000018,0x0); //TXFTL be set 0
|
||||
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
|
||||
|
||||
_WDWORD(0x5100010c, 0x01);//enable select slave
|
||||
_WDWORD(0x51000114, 0xFF);//XIP time out
|
||||
|
||||
_WDWORD(0x51000014, 0x2);//div 2
|
||||
|
||||
//quad
|
||||
_WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
|
||||
_WDWORD(0x51000100, 0x6b);//quad read cmd
|
||||
_WDWORD(0x51000104, 0x6b);//quad read cmd
|
||||
|
||||
|
||||
// //dual
|
||||
// _WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
|
||||
// _WDWORD(0x51000100, 0x3b);//dual read cmd
|
||||
// _WDWORD(0x51000104, 0x3b);//dual read cmd
|
||||
|
||||
|
||||
_WDWORD(0x51000008, 1); //enable spi
|
||||
}
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
InitGpio();
|
||||
InitFlash();
|
||||
InitXIP();
|
||||
SP = _RDWORD(0x11001000);
|
||||
PC = _RDWORD(0x11001004);
|
||||
_WDWORD(0x4000013C, 0x11001001);
|
||||
}
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
LOAD 0x10000000
|
||||
{
|
||||
EXE 0x10000000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
RW +0
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
LOAD 0x11001000
|
||||
{
|
||||
EXE 0x11001000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x10000200
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
*(ram_code)
|
||||
}
|
||||
|
||||
ScatterAssert((0x000+ImageLength(RW)) < 1024 * 32)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LOAD 0x11001000 0x0007f000
|
||||
{
|
||||
EXE 0x11001000 0x00010000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
*(InRoot$$Sections)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x100000C8 0x1F38
|
||||
{
|
||||
*(+RW,+ZI)
|
||||
*(ram_code)
|
||||
aeabi_sdiv.o(.text)
|
||||
uread4.o(.text)
|
||||
rt_memclr.o(.text)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Xincboot_tool.exe 0_ram.bin 1_ram_download.bin 0 0 0 0 1
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
.\Tools\xinchip_xip_tool.exe .\Output\0_ram.bin .\Output\xip_dual .\Output\1_xip_download.bin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,618 @@
|
||||
<?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>usbd_hid_24g_mouse_xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM0</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.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>usbd_hid_24g_mouse</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listing\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --text -a -c --output=@L_asm !L</UserProg1Name>
|
||||
<UserProg2Name>.\tools\Xincboot_tool .\Output\0_ram.bin .\Output\1_ram_download.bin</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>1</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=.\Output\0_ram.bin !L</UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</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>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</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>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.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-M0"</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>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</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>0x40000</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>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</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>0x20000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</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>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--c99</MiscControls>
|
||||
<Define>USE_XIP=1 XC65XX XC6XX_5C=0 DEBUG_ENABLE HAL_PCD_MODULE_ENABLED USB_OTG_FS RF_DEMO</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\app\api;..\app\Startup\xc60xx;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device\xc_m0_register;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Inc;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Inc;..\app\Startup;..\app\rf_config;..\..\..\..\..\..\component\rf24\Drivers;..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g;..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register</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>1</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>0x00000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\Linker\cpu_xip.scat</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--entry=Reset_Handler</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm0.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_xinc.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\app\Startup\xc60xx\startup_xinc.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_xinc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_it_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_it_xinc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_64m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_64m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_2_4g_main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_2_4g_main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_compatible_normal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_compatible_normal.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_systick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_ll_usb_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_ll_usb_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_pcd_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_pcd_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_usb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_usb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_fmc_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_calib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/App/hid_mouse</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usb_device.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse\usb_device.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_desc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse\usbd_desc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/Target/hid_mouse</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_conf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse\usbd_conf.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Core</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ctlreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ctlreq.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ioreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ioreq.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Class/HID</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_hid_mouse.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Src\usbd_hid_mouse.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Config</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rf_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\app\rf_config\rf_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>xc_software_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register\xc_software_crc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc6xxx_rf_2_4g.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g\xc6xxx_rf_2_4g.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName>usbd_hid_mouse</LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,618 @@
|
||||
<?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>usbd_hid_24g_mouse</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM0</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.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>usbd_hid_24g_mouse</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listing\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --text -a -c --output=@L_asm !L</UserProg1Name>
|
||||
<UserProg2Name>.\tools\Xincboot_tool .\Output\0_ram.bin .\Output\1_ram_download.bin</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>1</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=.\Output\0_ram.bin !L</UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</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>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</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>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.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-M0"</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>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</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>0x40000</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>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</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>0x20000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</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>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--c99</MiscControls>
|
||||
<Define>USE_XIP=1 XC62XX XC6XX_5C=0 DEBUG_ENABLE HAL_PCD_MODULE_ENABLED USB_OTG_FS RF_DEMO</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\app\api;..\app\Startup\xc60xx;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device\xc_m0_register;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Inc;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Inc;..\app\Startup;..\app\rf_config;..\..\..\..\..\..\component\rf24\Drivers;..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g;..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register</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>1</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>0x00000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\Linker\cpu_xip_xc62xx.scat</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--entry=Reset_Handler</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm0.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_xinc.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\app\Startup\xc60xx\startup_xinc.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_xinc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_it_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_it_xinc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_64m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_64m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_2_4g_main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_2_4g_main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_compatible_normal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_compatible_normal.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_systick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_ll_usb_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_ll_usb_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_pcd_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_pcd_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_usb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_usb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_fmc_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_calib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/App/hid_mouse</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usb_device.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse\usb_device.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_desc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse\usbd_desc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/Target/hid_mouse</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_conf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse\usbd_conf.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Core</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ctlreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ctlreq.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ioreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ioreq.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Class/HID</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_hid_mouse.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Src\usbd_hid_mouse.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Config</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rf_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\app\rf_config\rf_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>xc6xxx_rf_2_4g.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g\xc6xxx_rf_2_4g.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_software_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register\xc_software_crc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName>usbd_hid_24G_xc62xx</LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,193 @@
|
||||
# USBD_HID_24G_MOUSE
|
||||
|
||||
# 1. 介绍
|
||||
|
||||
该文档针对usbd_hid_24g_mouse的demo进行说明,通过USB将设备枚举成鼠标设备,并在此基础上加入2.4G功能。
|
||||
|
||||
## 1.1 工程路径
|
||||
|
||||
在 `..\project\example\driver\usb\usbd_hid_24G_mouse
|
||||
|
||||
```text
|
||||
usb
|
||||
|---usbd_hid_24G_mouse
|
||||
```
|
||||
|
||||
- usbd_hid_24G_mouse:鼠标+2.4G设备
|
||||
|
||||
## 1.2 工程文件结构
|
||||
|
||||
找到自己需要的设备类型,打开文件夹后可以看到如下app和mdk文件夹。
|
||||
|
||||
```text
|
||||
mdk:keil工程文件夹
|
||||
app:内含四个文件夹
|
||||
|---api:应用代码所需要的.h文件
|
||||
|---rf_config:rf 2.4g配置文件
|
||||
|---src:主要应用代码
|
||||
|---Startup:启动文件
|
||||
```
|
||||
|
||||
# 2.使用说明
|
||||
|
||||
## usbd_hid_24G_mouse
|
||||
|
||||
本工程通过USB接口实现一个HID鼠标的功能,同时使用2.4G收发数据。
|
||||
|
||||
工程路径:..\project\example\driver\usb\usbd_hid_24G_mouse\mdk,双击usbd_hid_24g_mouse_xc62xx.uvprojx打开工程。
|
||||
|
||||
打开工程后,在app路径下可以找到main.c,main函数如下:
|
||||
|
||||
```c
|
||||
int main(void)
|
||||
{
|
||||
/* Clock initialization */
|
||||
clock_init();
|
||||
|
||||
/* Serial port initialization */
|
||||
app_uart_init( );
|
||||
DEBUG("__USB_HID_2_4G_MOUSE_DEMO__\n");
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
/* rf 2.4g initialization configuration */
|
||||
rf24g_init();
|
||||
rf_compatible_config();
|
||||
|
||||
#if (XINCX_RF_TRANS_RATE == RATE_2M)
|
||||
/* Set 2M mode register configuration */
|
||||
/* Don't move this function interface */
|
||||
rf_2M_config();
|
||||
#endif //(XINCX_RF_TRANS_RATE == RATE_2M)
|
||||
|
||||
#if (XINCX_RF_NVIC_MODE)
|
||||
|
||||
/* Enable RF2.4G interrupts */
|
||||
NVIC_EnableIRQ(RF24G_IRQn);
|
||||
/* Configure the RF2.4G interrupt priority */
|
||||
NVIC_SetPriority(RF24G_IRQn, 1);
|
||||
#endif // XINCX_RF_NVIC_MODE
|
||||
/* Set the communication mode */
|
||||
rf_switch_mode(XINCX_RF_MODE, XINCX_2_4G_CHANNEL);
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
timer_init(RF_TX_TIMERx, SEND_TIMERMS_CNT);
|
||||
#endif
|
||||
#ifdef DEBUG_LOG
|
||||
/* Register information printing */
|
||||
rf_dump_log();
|
||||
#endif // DEBUG_LOG
|
||||
|
||||
while(1)
|
||||
{
|
||||
rf_transmit();
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_mouse_data_ready)
|
||||
{
|
||||
app_usb_mouse_send_data(rx_buff);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_mouse_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
通过上面的代码可以看到,main函数里同时包含了USB的初始化和rf 2.4g的初始化,实际工程使用时,并不需要过多关注底层代码的实现,更多的是会调用正确的 api 接口直接实现相对应的功能即可。
|
||||
|
||||
main函数的结构说明如下:
|
||||
|
||||
* `clock_init`:mcu 时钟初始化函数;
|
||||
* `app_uart_init`:mcu 打印串口相关的驱动初始化;
|
||||
* `USB_DEVICE_Init`:USB 设备初始化。这个函数是 USB 相关驱动应用的初始化接口,所有的 USB 功能的最开始的入口;
|
||||
* `rf24g_init`:rf 2.4g初始化;
|
||||
* `rf_compatible_config`:rf 2.4g兼容性配置。通过宏定义XINCX_RF_COMPATIBILITY_MODE控制;
|
||||
* `rf_2M_config`:配置rf 2M速率。不需要可以不调用;
|
||||
* `rf_switch_mode`:rf 2.4g接收/发送模式切换。通过修改宏XINCX_RF_MODE控制。
|
||||
|
||||
## 使用步骤
|
||||
|
||||
- 使用前准备两块开发板,并配置好想要的参数信息(也可以先不配置,使用默认的);
|
||||
|
||||
- 通过RF_Config路径下的rf_config.h配置rf 2.4g的特征,配置通过宏定义控制,比如:
|
||||
|
||||

|
||||
|
||||
- 首先在上图中配置XINCX_RF_MODE=RX_mode,然后点击重新编译,生成可烧录的.bin文件,路径为:..\mdk\Output\1_xip_download.bin,使用烧录工具将该.bin文件烧录到开发板一,此时开发板一就作为2.4g的接收端,插上USB连接到电脑可以看到枚举成键盘的设备,保持开发板一连接电脑,打印信息如下:
|
||||
|
||||
```text
|
||||
__USB_HID_2_4G_MOUSE_DEMO__
|
||||
***************** 2.4G Param ******************
|
||||
CFG_TOP: 0x002bc27f
|
||||
EN_AA: 0x00000000
|
||||
EN_RXADDR: 0x00000001
|
||||
SETUP_AW: 0x000000af
|
||||
SETUP_RETR: 0x00000010
|
||||
RF_CH: 0x000609ad
|
||||
SETUP_RF: 0x00000002
|
||||
STATUS: 0x00000000
|
||||
OBSERVE_TX: 0x00803600
|
||||
RSSI: 0x00020000
|
||||
RX_ADDR_P0: 0xe7 e7e7e7e5
|
||||
RX_ADDR_P1: 0xc2 c2c2c2c2
|
||||
RX_ADDR_P2TOP5:0xc6c5c4c3
|
||||
BER_RESULT: 0x0000000000000000
|
||||
AGC_SETTING: 0x2bf207a8
|
||||
PGA_SETTING: 0x1c 26303a44
|
||||
TX_ADDR: 0xe7 e7e7e7e5
|
||||
RX_PW_PX: 0x2020 20202020
|
||||
STATUS_FIFO: 0x0009b311
|
||||
RSSIREC: 0x00000000
|
||||
TXPROC_CFG: 0x080000cd
|
||||
RXPROC_CFG: 0xa0 00b06442
|
||||
DYNPD: 0x00000000
|
||||
FEATURE: 0x00000300
|
||||
PGA_SETTING_H: 0x00001ce7
|
||||
HW_CONFIG: 0x00000001
|
||||
PBT_CONFIG: 0x00555555
|
||||
PBT_TIMER: 0x00000000
|
||||
PBT_SYNC_TIME: 0x00000000
|
||||
PBT_TX_HEAD: 0x00000000
|
||||
PBT_RX_HEAD: 0x00000000
|
||||
PBT_AUTO_TRX_TIME: 0x00000000
|
||||
TX_POWER 0x00000006
|
||||
ana11_reg_l: 0x0000da47
|
||||
***********************************************
|
||||
|
||||
sizeof(USBD_HID_Mouse_HandleTypeDef)=0x10
|
||||
```
|
||||
|
||||
- 再配置XINCX_RF_MODE=TX_Mode,然后重新编译生成.bin文件,在同一个路径,使用烧录工具将该.bin文件烧录到开发板二,此时开发板二就作为2.4g的发射端,重新上电开发板二即可看到通过开发板一控制的鼠标开始画框框。
|
||||
|
||||
## 运行结果
|
||||
|
||||

|
||||
|
||||
## 代码运行逻辑
|
||||
|
||||
- 上电后各项初始化;
|
||||
- while(1)内判断2.4g的收发;
|
||||
|
||||
```c
|
||||
while(1)
|
||||
{
|
||||
rf_transmit();
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_mouse_data_ready)
|
||||
{
|
||||
app_usb_mouse_send_data(rx_buff);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_mouse_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
```
|
||||
|
||||
- 2.4g收发做了两套运行逻辑:中断收发和轮询收发
|
||||
|
||||
中断模式下通过rf24g_tx_irq_flag和rf24g_rx_irq_flag两个标志位判断是否需要接收或者发送。其中tx模式下rf24g_tx_irq_flag默认为true,随后每次发送完成后在tx中断中再置位,实现不断发送;rx模式下等待2.4g接收数据,接收到后在接收中断里置位rf24g_rx_irq_flag,再在应用端处理接收到的数据。
|
||||
|
||||
轮询模式下就不需要标志位判断,tx模式下就间隔一定的delay发送数据;rx模式下就判断寄存器中是否有数据,有数据就接收出来。
|
||||
|
||||
- 当接收到鼠标数据后rf_2_4g_mouse_data_ready=1,执行app_usb_mouse_send_data函数实现USB转发。
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/*!
|
||||
* \file system_it_xinc.c
|
||||
*
|
||||
* \brief Target system interruption implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "system_it_xinc.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles NMI exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END NonMaskableInt_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Hard Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END HardFault_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Memory Manage exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Bus Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Usage Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles SVCall exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END SVCall_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles PendSVC exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END PendSV_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/****************************** Hard Fault Handler Functions *******************************/
|
||||
/*------------------------------------------------------------------------------------
|
||||
Private Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args)
|
||||
{
|
||||
/*栈帧里面内容:*/
|
||||
unsigned int stack_r0; //压栈的 R0
|
||||
unsigned int stack_r1; //压栈的 R1
|
||||
unsigned int stack_r2; //压栈的 R2
|
||||
unsigned int stack_r3; //压栈的 R3
|
||||
unsigned int stack_r12; //压栈的 R12
|
||||
unsigned int stack_lr; //压栈的 lr
|
||||
unsigned int stack_pc; //压栈的 pc
|
||||
unsigned int stack_psr; //压栈的 psr
|
||||
|
||||
stack_r0 = ((unsigned int)HardFault_args[0]);
|
||||
stack_r1 = ((unsigned int)HardFault_args[1]);
|
||||
stack_r2 = ((unsigned int)HardFault_args[2]);
|
||||
stack_r3 = ((unsigned int)HardFault_args[3]);
|
||||
stack_r12 = ((unsigned int)HardFault_args[4]);
|
||||
stack_lr = ((unsigned int)HardFault_args[5]);
|
||||
stack_pc = ((unsigned int)HardFault_args[6]);
|
||||
stack_psr = ((unsigned int)HardFault_args[7]);
|
||||
|
||||
DEBUG("----%s----\n", __func__);
|
||||
DEBUG("R0=%x\n",stack_r0);
|
||||
DEBUG("R1=%x\n",stack_r1);
|
||||
DEBUG("R2=%x\n",stack_r2);
|
||||
DEBUG("R3=%x\n",stack_r3);
|
||||
DEBUG("R12=%x\n",stack_r12);
|
||||
DEBUG("LR[R14]=%x\n",stack_lr);
|
||||
DEBUG("PC[R15]=%x\n",stack_pc);
|
||||
DEBUG("PSR=%x\n",stack_psr);
|
||||
DEBUG("SCB_SHCSR=%x\n",SCB->SHCSR);
|
||||
DEBUG("---------------------------\n");
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file system_it_xinc.h
|
||||
*
|
||||
* \brief The header of system_it_xinc.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SYSTEM_IT_XINC_H__
|
||||
#define __SYSTEM_IT_XINC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void NMI_Handler( void );
|
||||
void HardFault_Handler( void );
|
||||
void MemManage_Handler( void );
|
||||
void BusFault_Handler( void );
|
||||
void UsageFault_Handler( void );
|
||||
void SVC_Handler( void );
|
||||
void DebugMon_Handler( void );
|
||||
void PendSV_Handler( void );
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_IT_XINC_H__ */
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define __DEBUG_OUT_PORT 0
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void debug_uart_init(void)
|
||||
{
|
||||
#if (__DEBUG_OUT_PORT == 0)
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
#else
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART1_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_14;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART1_RX;
|
||||
gpio_cfg.Pin = GPIO_15;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART1_IDX, &uart_cfg);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#define VECTOR_NUM 48
|
||||
|
||||
void set_vector(void)
|
||||
{
|
||||
#if (USE_XIP == 1)
|
||||
GLOBAL_INT_DISABLE();
|
||||
for (uint32_t i = 0, *Pvector = (uint32_t *)(0x11001000 + 0),
|
||||
*_vector_table = (uint32_t *)(0x10000000);
|
||||
i < VECTOR_NUM; i++) // copy vertor table
|
||||
{
|
||||
_vector_table[i] = *Pvector++;
|
||||
}
|
||||
|
||||
*((volatile unsigned int *)(0x4000013C)) =
|
||||
0x10000001; // inter vertor table remap
|
||||
GLOBAL_INT_RESTORE();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WDT_ResetInit(void)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
|
||||
cpr_lp_ctl__ctl_wdt_tclk_en__setf(ENABLE);
|
||||
wdt_cr__wdt_en__setf(DISABLE);
|
||||
}
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
|
||||
WDT_ResetInit();
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
set_vector();
|
||||
#endif
|
||||
|
||||
debug_uart_init();
|
||||
}
|
||||
|
||||
__RAM_CODE int sendchar(int c)
|
||||
{
|
||||
unsigned int status;
|
||||
#if (__DEBUG_OUT_PORT == 1)
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40011000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40011000 + 0x00))) = c;
|
||||
return (1);
|
||||
#else
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40010000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40010000 + 0x00))) = c;
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle; /* Add whatever you need here */
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
__RAM_CODE int fputc(int ch, FILE *f) { return (sendchar(ch)); }
|
||||
|
||||
int ferror(FILE *f)
|
||||
{
|
||||
/* Your implementation of ferror */
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void _ttywrch(int ch) { sendchar(ch); }
|
||||
|
||||
void _sys_exit(int return_code)
|
||||
{
|
||||
label:
|
||||
goto label; /* endless loop */
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_xinc.s
|
||||
; * @purpose: CMSIS Cortex-M0 Core Device Startup File for the
|
||||
; * Device xinc.
|
||||
; *****************************************************************************/
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
Heap_Size EQU 0x00000100
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
; ToDo: Add here the vectors for the device specific external interrupts handler
|
||||
DCD BLE_Handler ; 0
|
||||
DCD DMA_Handler ; 1
|
||||
DCD CPR_Handler ; 2
|
||||
DCD GPIO_Handler ; 3
|
||||
DCD RTC_Handler ; 4
|
||||
DCD TIMER0_Handler ; 5
|
||||
DCD TIMER1_Handler ; 6
|
||||
DCD TIMER2_Handler ; 7
|
||||
DCD TIMER3_Handler ; 8
|
||||
DCD WDT_Handler ; 9
|
||||
DCD I2C_Handler ; 10
|
||||
DCD UART0_Handler ; 11
|
||||
DCD UART1_Handler ; 12
|
||||
DCD SPI0_Handler ; 13
|
||||
DCD SPI1_Handler ; 14
|
||||
DCD 0 ; 15
|
||||
DCD 0 ; 16
|
||||
DCD GADC_Handler ; 17
|
||||
DCD PWM_Handler ; 18
|
||||
DCD AES_Handler ; 19
|
||||
DCD USB_Handler ; 20
|
||||
DCD AUDIO_Handler ; 21
|
||||
DCD RF24G_Handler ; 22
|
||||
DCD SPI2_Handler ; 23
|
||||
DCD MPU_Handler ; 24
|
||||
DCD UART2_Handler ; 25
|
||||
DCD I2S_Handler ; 26
|
||||
DCD AOTIMER0_Handler ; 27
|
||||
DCD AOTIMER1_Handler ; 28
|
||||
DCD CMP_Handler ; 29
|
||||
DCD FMC_Handler ; 30
|
||||
DCD CAN_Handler ; 31
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
|
||||
LDR r0, =0x4000013C ; remap
|
||||
LDR r1, =0x10000001
|
||||
STR r1, [r0]
|
||||
|
||||
|
||||
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
IMPORT HardFault_Handler_c ;函数声明
|
||||
movs r0, #4 ;判断主栈指针还是进程栈指针
|
||||
mov r1, lr
|
||||
tst r0, r1
|
||||
beq hf_used_msp ;如果是主栈指针
|
||||
mrs r0, psp ;否则是进程栈指针,把进程栈指针地址付给 R0
|
||||
ldr r1, =HardFault_Handler_c ;跳转到 HardFault 中断程序
|
||||
bx r1
|
||||
hf_used_msp
|
||||
mrs r0, msp ;把主栈指针地址赋给 R0
|
||||
ldr r1, =HardFault_Handler_c
|
||||
bx r1
|
||||
;EXPORT HardFault_Handler [WEAK]
|
||||
;B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT BLE_Handler [WEAK]
|
||||
EXPORT DMA_Handler [WEAK]
|
||||
EXPORT CPR_Handler [WEAK]
|
||||
EXPORT GPIO_Handler [WEAK]
|
||||
EXPORT RTC_Handler [WEAK]
|
||||
EXPORT TIMER0_Handler [WEAK]
|
||||
EXPORT TIMER1_Handler [WEAK]
|
||||
EXPORT TIMER2_Handler [WEAK]
|
||||
EXPORT TIMER3_Handler [WEAK]
|
||||
EXPORT WDT_Handler [WEAK]
|
||||
EXPORT I2C_Handler [WEAK]
|
||||
EXPORT UART0_Handler [WEAK]
|
||||
EXPORT UART1_Handler [WEAK]
|
||||
EXPORT SPI0_Handler [WEAK]
|
||||
EXPORT SPI1_Handler [WEAK]
|
||||
;EXPORT KBS_Handler [WEAK]
|
||||
;EXPORT QDEC_Handler [WEAK]
|
||||
EXPORT GADC_Handler [WEAK]
|
||||
EXPORT PWM_Handler [WEAK]
|
||||
EXPORT AES_Handler [WEAK]
|
||||
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
|
||||
EXPORT USB_Handler [WEAK];20
|
||||
EXPORT AUDIO_Handler [WEAK];21
|
||||
EXPORT RF24G_Handler [WEAK];22
|
||||
EXPORT SPI2_Handler [WEAK];23
|
||||
EXPORT MPU_Handler [WEAK];24
|
||||
EXPORT UART2_Handler [WEAK];25
|
||||
EXPORT I2S_Handler [WEAK];26
|
||||
EXPORT AOTIMER0_Handler [WEAK];27
|
||||
EXPORT AOTIMER1_Handler [WEAK];28
|
||||
EXPORT CMP_Handler [WEAK];29
|
||||
EXPORT FMC_Handler [WEAK];30
|
||||
EXPORT CAN_Handler [WEAK];31
|
||||
|
||||
PendSV_Handler
|
||||
SysTick_Handler
|
||||
BLE_Handler
|
||||
RF24G_Handler
|
||||
DMA_Handler
|
||||
CPR_Handler
|
||||
GPIO_Handler
|
||||
RTC_Handler
|
||||
TIMER0_Handler
|
||||
TIMER1_Handler
|
||||
TIMER2_Handler
|
||||
TIMER3_Handler
|
||||
WDT_Handler
|
||||
I2C_Handler
|
||||
I2S_Handler
|
||||
UART0_Handler
|
||||
UART1_Handler
|
||||
UART2_Handler
|
||||
SPI0_Handler
|
||||
SPI1_Handler
|
||||
SPI2_Handler
|
||||
MPU_Handler
|
||||
;KBS_Handler
|
||||
;QDEC_Handler
|
||||
GADC_Handler
|
||||
PWM_Handler
|
||||
AUDIO_Handler
|
||||
;SIM_Handler
|
||||
AES_Handler
|
||||
AOTIMER0_Handler
|
||||
AOTIMER1_Handler
|
||||
CMP_Handler
|
||||
FMC_Handler
|
||||
CAN_Handler
|
||||
USB_Handler
|
||||
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, = (Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
END
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef __APP_64M__
|
||||
#define __APP_64M__
|
||||
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
|
||||
#define __write_hw_reg32(reg, val) ((*reg) = (val))
|
||||
#define __read_hw_reg32(reg, val) ((val) = (*reg))
|
||||
#define CPR_CTLAPBCLKEN_GRCTL ((volatile unsigned *)(0x40000000 + 0x070))
|
||||
#define CPR_AOCLKEN_GRCTL ((volatile unsigned *)(0x40002400 + 0x7C))
|
||||
#define AO_GPIO_MODE ((volatile unsigned *)(0x40002000 + 0x0044))
|
||||
#define AO_GPIO_CTL ((volatile unsigned *)(0x40002000 + 0x0048))
|
||||
|
||||
void use_64m_crtstal_init(void);
|
||||
void rf_64M_set_rx_channel(uint16_t channel);
|
||||
void rf_64M_set_tx_channel(uint16_t channel);
|
||||
void testpin_64M_config(void);
|
||||
void Init_rtc_gpio(uint32_t num, uint8_t inter_mode);
|
||||
#endif //__APP_64M__
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Author: sueRimn
|
||||
* @Date: 2023-12-12 14:23:55
|
||||
* @LastEditors: sueRimn
|
||||
* @LastEditTime: 2024-06-07 13:46:09
|
||||
*/
|
||||
/*!
|
||||
* \file main.h
|
||||
*
|
||||
* \brief The head file of main.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "rf_config.h"
|
||||
#include "xc6xxx.h"
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
#include "rf_compatible_normal.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define DEBUG_LOG
|
||||
|
||||
#define SEND_TIMERMS_CNT 7
|
||||
#define RECV_TIMERMS_OUT (7 + SEND_TIMERMS_CNT)
|
||||
#define XC_SEND_NUM 1000U
|
||||
|
||||
#define RF_TX_TIMERx TIMER0_IDX
|
||||
#define RF_RX_TIMERx TIMER0_IDX
|
||||
|
||||
#define RF_CONFIRMED_VALUE 5
|
||||
|
||||
#define GPIO_TEST 1
|
||||
#define TEST_GPIO_1 GPIO_1
|
||||
#if XC62XX
|
||||
#define TEST_GPIO_2 GPIO_0
|
||||
#else
|
||||
#define TEST_GPIO_2 GPIO_21
|
||||
#endif
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
extern bool rf_send_timer_flag;
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void rf_buff_info(uint8_t *buff, uint16_t len);
|
||||
void rf_2M_reg_info(void);
|
||||
void rf_dump_log(void);
|
||||
uint8_t rf_data_config(uint8_t *buff, uint16_t len);
|
||||
void rf_switch_mode(uint8_t mode, uint16_t channel);
|
||||
void rf_transmit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H__ */
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef __RF_COMPATIBLE_NORMAL__
|
||||
#define __RF_COMPATIBLE_NORMAL__
|
||||
#include "rf_config.h"
|
||||
#include "xc6xxx_rf_2_4g.h"
|
||||
#include "xc_software_crc.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define RF_ADDR_LEN XINCX_RF_TX_ADDR_WIDTH // 5U
|
||||
#define RF_RECV_EXTEN_LEN 3U
|
||||
#define RF_MAX_RECV_LEN 60U
|
||||
#define RF_CRC_INIT_VALUE 0xFFFF
|
||||
#define PANCHIP_WHITEN_INIT_VAL (0x7F)
|
||||
|
||||
extern uint16_t rf_addr_crc;
|
||||
extern uint8_t panchip_addr_whiten;
|
||||
extern uint8_t addr_buff[5];
|
||||
|
||||
void rf_addr_map(uint8_t *addr_buff);
|
||||
uint16_t rf_get_addr_crc(void);
|
||||
uint8_t rf_recv_addr(void);
|
||||
void rf_compatible_config(void);
|
||||
uint32_t rf_rx_normal_manage(void);
|
||||
uint32_t rf_tx_normal_manage(uint8_t *buff, uint8_t length);
|
||||
|
||||
#endif //__RF_COMPATIBLE_NORMAL__
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
#ifndef SDK_DRIVER_CONFIG_H
|
||||
#define SDK_DRIVER_CONFIG_H
|
||||
// <<< Use Configuration Wizard in Context Menu >>>\n
|
||||
#ifdef USE_APP_CONFIG
|
||||
#include "app_config.h"
|
||||
#endif
|
||||
// <h> XC_Drivers
|
||||
|
||||
// <e> XC_CLOCK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CLOCK_ENABLED
|
||||
#define XC_CLOCK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWR_ENABLED
|
||||
#define XC_PWR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_WDT_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_WDT_ENABLED
|
||||
#define XC_WDT_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_BOR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_BOR_ENABLED
|
||||
#define XC_BOR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SYSTICK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SYSTICK_ENABLED
|
||||
#define XC_SYSTICK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_TIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_TIMER_ENABLED
|
||||
#define XC_TIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_AOTIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_AOTIMER_ENABLED
|
||||
#define XC_AOTIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_GPIO_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_GPIO_ENABLED
|
||||
#define XC_GPIO_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_ADC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_ADC_ENABLED
|
||||
#define XC_ADC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_UART_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_UART_ENABLED
|
||||
#define XC_UART_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWM_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWM_ENABLED
|
||||
#define XC_PWM_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_FMC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_FMC_SPI_ENABLED
|
||||
#define XC_FMC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SPI_ENABLED
|
||||
#define XC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_IIC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_IIC_ENABLED
|
||||
#define XC_IIC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_RTC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_RTC_ENABLED
|
||||
#define XC_RTC_ENABLED 1
|
||||
#endif
|
||||
|
||||
//==========================================================
|
||||
// <q> XC_RTC_DATE_INT_ENABLED
|
||||
|
||||
#ifndef XC_RTC_DATE_INT_ENABLED
|
||||
#define XC_RTC_DATE_INT_ENABLED 0
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_DMA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_DMA_ENABLED
|
||||
#define XC_DMA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PGA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PGA_ENABLED
|
||||
#define XC_PGA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_QDEC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_QDEC_ENABLED
|
||||
#define XC_QDEC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_CALIB_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CALIB_ENABLED
|
||||
#define XC_CALIB_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
#endif //SDK_DRIVER_CONFIG_H
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
#ifndef SDK_CONFIG_H
|
||||
#define SDK_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
// <e> XINCX_RF_NORMAL_PEACKET_MODE - RF normal packet mode
|
||||
// <i> Configure the frame format, which is a static packet format and can only communicate in one direction.
|
||||
#ifndef XINCX_RF_NORMAL_PACKET_MODE
|
||||
#define XINCX_RF_NORMAL_PACKET_MODE 1
|
||||
#endif
|
||||
|
||||
// <o>XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
// <0=> Xinchip
|
||||
// <1=> Panchip
|
||||
// <2=> Beken
|
||||
// <3=> Telink
|
||||
// <4=> Huntersun
|
||||
#ifndef XINCX_RF_COMPATIBILITY_MODE
|
||||
#define XINCX_RF_COMPATIBILITY_MODE 0
|
||||
#endif
|
||||
|
||||
#if (XINCX_RF_NORMAL_PACKET_MODE == 1)
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_RF_MODE - RF Tx or Rx Mode
|
||||
// <0=> TX Mode
|
||||
// <1=> RX Mode
|
||||
// <2=> TRX Mode
|
||||
#ifndef XINCX_RF_MODE
|
||||
#define XINCX_RF_MODE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TRANS_RATE - RF Transmission Rate Config
|
||||
// <0x02=> 1M
|
||||
// <0x0A=> 2M
|
||||
// <0x22=> 250k
|
||||
// <0x2A=> 125k
|
||||
#ifndef XINCX_RF_TRANS_RATE
|
||||
#define XINCX_RF_TRANS_RATE 0x02
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CHANNEL - 2.4g Channel Set
|
||||
#ifndef XINCX_2_4G_CHANNEL
|
||||
#define XINCX_2_4G_CHANNEL 2478
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TX_ADDR_WIDTH - RF Tx Addr Width
|
||||
// <3=> 3 Bytes
|
||||
// <4=> 4 Bytes
|
||||
// <5=> 5 Bytes
|
||||
#ifndef XINCX_RF_TX_ADDR_WIDTH
|
||||
#define XINCX_RF_TX_ADDR_WIDTH 5
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_L - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_L
|
||||
#define XINCX_2_4G_ADDR_L 0xE7E7E7E5 // 0xCCDDEEDD
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_H - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_H
|
||||
#define XINCX_2_4G_ADDR_H 0xe7 // 0xAA
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_POWER - rf Power Set
|
||||
// <1=> -10dbm
|
||||
// <2=> -9dbm
|
||||
// <4=> -4dbm
|
||||
// <6=> 0dbm
|
||||
// <8=> 3dbm
|
||||
// <9=> 5dbm
|
||||
// <12=> 7dbm
|
||||
// <14=> 8dbm
|
||||
// <16=> 9dbm
|
||||
// <19=> 10dbm
|
||||
// <24=> 11dbm
|
||||
// <30=> 12dbm
|
||||
// <36=> 13dbm
|
||||
#ifndef XINCX_POWER
|
||||
#define XINCX_POWER 0x00006
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_NVIC_MODE - RF NVIC Mode
|
||||
// <0=> Disable
|
||||
// <1=> Enable
|
||||
#ifndef XINCX_RF_NVIC_MODE
|
||||
#define XINCX_RF_NVIC_MODE 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE_RX_PAYLEN - 2.4g Pipe Rx Payload Len
|
||||
// <i> Payload length. Configuration of the load length during communication.
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_LEN - 2.4g Pipe0 Rx Payload Len
|
||||
// #ifndef XINCX_2_4G_PIPE0_LEN
|
||||
// #define XINCX_2_4G_PIPE0_LEN 32
|
||||
// #endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_LEN - 2.4g Pipe1 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE1_LEN
|
||||
#define XINCX_2_4G_PIPE1_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_LEN - 2.4g Pipe2 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE2_LEN
|
||||
#define XINCX_2_4G_PIPE2_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_LEN - 2.4g Pipe3 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE3_LEN
|
||||
#define XINCX_2_4G_PIPE3_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_LEN - 2.4g Pipe4 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE4_LEN
|
||||
#define XINCX_2_4G_PIPE4_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_LEN - 2.4g Pipe5 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE5_LEN
|
||||
#define XINCX_2_4G_PIPE5_LEN 32
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
// XINCX_RF_CRC_ENABLE - RF CRC Enable
|
||||
//==========================================================
|
||||
#ifndef XINCX_RF_CRC_ENABLE
|
||||
#define XINCX_RF_CRC_ENABLE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CRC_BYTE - 2.4g CRC Bytes Set
|
||||
// <0=> 0 Byte
|
||||
// <1=> 1 Byte
|
||||
// <2=> 2 Bytes
|
||||
#ifndef XINCX_2_4G_CRC_BYTE
|
||||
#define XINCX_2_4G_CRC_BYTE 2
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_FEATURE_PARAM - 2.4g Feature Parameters
|
||||
//==========================================================
|
||||
// XINCX_2_4G_GUARD_CFG - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_GUARD_CFG
|
||||
#define XINCX_2_4G_GUARD_CFG 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_LONG_PLD_TYPE - 2.4g Long Pld Type
|
||||
#ifndef XINCX_2_4G_LONG_PLD_TYPE
|
||||
#define XINCX_2_4G_LONG_PLD_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_NUM - 2.4g Preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE_NUM
|
||||
#define XINCX_2_4G_PREAMBLE_NUM 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_TYPE - 2.4g Preamble Type
|
||||
#ifndef XINCX_2_4G_PREAMBLE_TYPE
|
||||
#define XINCX_2_4G_PREAMBLE_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_GUARD - 2.4g CRC Scope Guard
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_GUARD
|
||||
#define XINCX_2_4G_CRC_SCOPE_GUARD 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_HEADER - 2.4g CRC Scope Header
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_HEADER
|
||||
#define XINCX_2_4G_CRC_SCOPE_HEADER 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_ADDR - 2.4g CRC Scope Addr
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_ADDR
|
||||
#define XINCX_2_4G_CRC_SCOPE_ADDR 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_LONG_PLD - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_LONG_PLD
|
||||
#define XINCX_2_4G_LONG_PLD 0
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_FEC - 2.4g FEC&Interleave Feature
|
||||
#ifndef XINCX_2_4G_FEC
|
||||
#define XINCX_2_4G_FEC 0
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_WHITEN - 2.4g Whiten Feature
|
||||
#ifndef XINCX_2_4G_WHITEN
|
||||
#define XINCX_2_4G_WHITEN 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DPL - 2.4g Dynamic Payload Length Feature
|
||||
#ifndef XINCX_2_4G_DPL
|
||||
#define XINCX_2_4G_DPL 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_ACK_PAY - 2.4g Payload on ACK
|
||||
#ifndef XINCX_2_4G_ACK_PAY
|
||||
#define XINCX_2_4G_ACK_PAY 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYN_ACK - 2.4g W_TX_PAYLOAD_NOACK Command
|
||||
#ifndef XINCX_2_4G_DYN_ACK
|
||||
#define XINCX_2_4G_DYN_ACK 0
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// XINCX_2_4G_RETRANS_CNT - 2.4g Retransmit Count
|
||||
// <i> Number of retransmissions. The maximum number of times a hardware can automatically transmit an ACK if it does
|
||||
// not receive the correct ACK.
|
||||
#ifndef XINCX_2_4G_RETRANS_CNT
|
||||
#define XINCX_2_4G_RETRANS_CNT 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_RETRANS_DELAY - 2.4g Retransmission Delay
|
||||
// <i> Retransmission delay. For 32 bytes of data, the minimum configuration is 500 us for 1 Mbit/s and 1500 us for 250
|
||||
// kbit/s.
|
||||
#ifndef XINCX_2_4G_RETRANS_DELAY
|
||||
#define XINCX_2_4G_RETRANS_DELAY 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYNPD - 2.4g dynpd
|
||||
#ifndef XINCX_2_4G_DYNPD
|
||||
#define XINCX_2_4G_DYNPD 0x00
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_AUTO_ACK - 2.4g Auto Acknowledgement
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_ENAA - 2.4g Pipe0 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE0_ENAA
|
||||
#define XINCX_2_4G_PIPE0_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_ENAA - 2.4g Pipe1 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE1_ENAA
|
||||
#define XINCX_2_4G_PIPE1_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_ENAA - 2.4g Pipe2 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE2_ENAA
|
||||
#define XINCX_2_4G_PIPE2_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_ENAA - 2.4g Pipe3 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE3_ENAA
|
||||
#define XINCX_2_4G_PIPE3_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_ENAA - 2.4g Pipe4 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE4_ENAA
|
||||
#define XINCX_2_4G_PIPE4_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_ENAA - 2.4g Pipe5 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE5_ENAA
|
||||
#define XINCX_2_4G_PIPE5_ENAA 0
|
||||
#endif
|
||||
|
||||
// XINCX_RF_PIPE_ENABLE
|
||||
#ifndef XINCX_RF_PIPE_ENABLE
|
||||
#define XINCX_RF_PIPE_ENABLE 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// </e> //XINCX_RF_PEACKET_MODE normal normal
|
||||
|
||||
// <e> XINCX_RF_EMHAMCED_PEACKET_MODE - RF enhanced packet mode
|
||||
// <i> Configure the frame format, which is a dynamic packet configuration, which can communicate in both directions,and
|
||||
// <i> ACK can dynamically carry data.
|
||||
#ifndef XINCX_RF_EMHAMCED_PACKET_MODE
|
||||
#define XINCX_RF_EMHAMCED_PACKET_MODE 0
|
||||
#endif
|
||||
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE == 1)
|
||||
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_RF_MODE - RF Tx or Rx Mode
|
||||
// <0=> TX Mode
|
||||
// <1=> RX Mode
|
||||
#ifndef XINCX_RF_MODE
|
||||
#define XINCX_RF_MODE 0
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TRANS_RATE - RF Transmission Rate Config
|
||||
// <0x02=> 1M
|
||||
// <0x0A=> 2M
|
||||
// <0x22=> 250k
|
||||
// <0x2A=> 125k
|
||||
#ifndef XINCX_RF_TRANS_RATE
|
||||
#define XINCX_RF_TRANS_RATE 0x02
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CHANNEL - 2.4g Channel Set
|
||||
#ifndef XINCX_2_4G_CHANNEL
|
||||
#define XINCX_2_4G_CHANNEL 2440
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_TX_ADDR_WIDTH - RF Tx Addr Width
|
||||
// <3=> 3 Bytes
|
||||
// <4=> 4 Bytes
|
||||
// <5=> 5 Bytes
|
||||
#ifndef XINCX_RF_TX_ADDR_WIDTH
|
||||
#define XINCX_RF_TX_ADDR_WIDTH 5
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_L - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_L
|
||||
#define XINCX_2_4G_ADDR_L 0xe7e7e7e7
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_ADDR_H - rf Address Set
|
||||
#ifndef XINCX_2_4G_ADDR_H
|
||||
#define XINCX_2_4G_ADDR_H 0xe7
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_POWER - rf Power Set
|
||||
// <1=> -10dbm
|
||||
// <2=> -9dbm
|
||||
// <4=> -4dbm
|
||||
// <6=> 0dbm
|
||||
// <8=> 3dbm
|
||||
// <9=> 5dbm
|
||||
// <12=> 7dbm
|
||||
// <14=> 8dbm
|
||||
// <16=> 9dbm
|
||||
// <19=> 10dbm
|
||||
// <24=> 11dbm
|
||||
// <30=> 12dbm
|
||||
// <36=> 13dbm
|
||||
#ifndef XINCX_POWER
|
||||
#define XINCX_POWER 0x00006
|
||||
#endif
|
||||
|
||||
// <o> XINCX_RF_NVIC_MODE - RF NVIC Mode
|
||||
// <0=> Disable
|
||||
// <1=> Enable
|
||||
#ifndef XINCX_RF_NVIC_MODE
|
||||
#define XINCX_RF_NVIC_MODE 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE_RX_PAYLEN - 2.4g Pipe Rx Payload Len
|
||||
// <i> Payload length. Configuration of the load length during communication.
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_LEN - 2.4g Pipe0 Rx Payload Len
|
||||
// #ifndef XINCX_2_4G_PIPE0_LEN
|
||||
// #define XINCX_2_4G_PIPE0_LEN 32
|
||||
// #endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_LEN - 2.4g Pipe1 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE1_LEN
|
||||
#define XINCX_2_4G_PIPE1_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_LEN - 2.4g Pipe2 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE2_LEN
|
||||
#define XINCX_2_4G_PIPE2_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_LEN - 2.4g Pipe3 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE3_LEN
|
||||
#define XINCX_2_4G_PIPE3_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_LEN - 2.4g Pipe4 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE4_LEN
|
||||
#define XINCX_2_4G_PIPE4_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_LEN - 2.4g Pipe5 Rx Payload Len
|
||||
#ifndef XINCX_2_4G_PIPE5_LEN
|
||||
#define XINCX_2_4G_PIPE5_LEN 32
|
||||
#endif
|
||||
|
||||
// XINCX_RF_CRC_ENABLE - RF CRC Enable
|
||||
//==========================================================
|
||||
#ifndef XINCX_RF_CRC_ENABLE
|
||||
#define XINCX_RF_CRC_ENABLE 1
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_CRC_BYTE - 2.4g CRC Bytes Set
|
||||
// <0=> 0 Byte
|
||||
// <1=> 1 Byte
|
||||
// <2=> 2 Bytes
|
||||
#ifndef XINCX_2_4G_CRC_BYTE
|
||||
#define XINCX_2_4G_CRC_BYTE 2
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_FEATURE_PARAM - 2.4g Feature Parameters
|
||||
//==========================================================
|
||||
|
||||
// XINCX_2_4G_GUARD_CFG - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_GUARD_CFG
|
||||
#define XINCX_2_4G_GUARD_CFG 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_LONG_PLD_TYPE - 2.4g Long Pld Type
|
||||
#ifndef XINCX_2_4G_LONG_PLD_TYPE
|
||||
#define XINCX_2_4G_LONG_PLD_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_NUM - 2.4g Preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE_NUM
|
||||
#define XINCX_2_4G_PREAMBLE_NUM 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PREAMBLE_TYPE - 2.4g Preamble Type
|
||||
#ifndef XINCX_2_4G_PREAMBLE_TYPE
|
||||
#define XINCX_2_4G_PREAMBLE_TYPE 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_GUARD - 2.4g CRC Scope Guard
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_GUARD
|
||||
#define XINCX_2_4G_CRC_SCOPE_GUARD 0
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_HEADER - 2.4g CRC Scope Header
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_HEADER
|
||||
#define XINCX_2_4G_CRC_SCOPE_HEADER 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_CRC_SCOPE_ADDR - 2.4g CRC Scope Addr
|
||||
#ifndef XINCX_2_4G_CRC_SCOPE_ADDR
|
||||
#define XINCX_2_4G_CRC_SCOPE_ADDR 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_LONG_PLD - 2.4g Long Payload Feature
|
||||
#ifndef XINCX_2_4G_LONG_PLD
|
||||
#define XINCX_2_4G_LONG_PLD 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_FEC - 2.4g FEC&Interleave Feature
|
||||
#ifndef XINCX_2_4G_FEC
|
||||
#define XINCX_2_4G_FEC 1
|
||||
#endif
|
||||
|
||||
// <q> XINCX_2_4G_WHITEN - 2.4g Whiten Feature
|
||||
#ifndef XINCX_2_4G_WHITEN
|
||||
#define XINCX_2_4G_WHITEN 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DPL - 2.4g Dynamic Payload Length Feature
|
||||
#ifndef XINCX_2_4G_DPL
|
||||
#define XINCX_2_4G_DPL 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_ACK_PAY - 2.4g Payload on ACK
|
||||
#ifndef XINCX_2_4G_ACK_PAY
|
||||
#define XINCX_2_4G_ACK_PAY 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYN_ACK - 2.4g W_TX_PAYLOAD_NOACK Command
|
||||
#ifndef XINCX_2_4G_DYN_ACK
|
||||
#define XINCX_2_4G_DYN_ACK 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_DYNPD - 2.4g dynpd
|
||||
#ifndef XINCX_2_4G_DYNPD
|
||||
#define XINCX_2_4G_DYNPD 0x3f
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_AUTO_ACK - 2.4g Auto Acknowledgement
|
||||
//==========================================================
|
||||
// XINCX_2_4G_PIPE0_ENAA - 2.4g Pipe0 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE0_ENAA
|
||||
#define XINCX_2_4G_PIPE0_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE1_ENAA - 2.4g Pipe1 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE1_ENAA
|
||||
#define XINCX_2_4G_PIPE1_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE2_ENAA - 2.4g Pipe2 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE2_ENAA
|
||||
#define XINCX_2_4G_PIPE2_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE3_ENAA - 2.4g Pipe3 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE3_ENAA
|
||||
#define XINCX_2_4G_PIPE3_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE4_ENAA - 2.4g Pipe4 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE4_ENAA
|
||||
#define XINCX_2_4G_PIPE4_ENAA 1
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_PIPE5_ENAA - 2.4g Pipe5 Auto Ack
|
||||
#ifndef XINCX_2_4G_PIPE5_ENAA
|
||||
#define XINCX_2_4G_PIPE5_ENAA 1
|
||||
#endif
|
||||
// <o.0..5> XINCX_RF_PIPE_ENABLE
|
||||
#ifndef XINCX_RF_PIPE_ENABLE
|
||||
#define XINCX_RF_PIPE_ENABLE 1
|
||||
#endif
|
||||
// XINCX_2_4G_TRANS_PARAM - 2.4g Transmission Parameters
|
||||
//==========================================================
|
||||
|
||||
// <o> XINCX_2_4G_RETRANS_CNT - 2.4g Retransmit Count
|
||||
// <i> Number of retransmissions. The maximum number of times a hardware can automatically transmit an ACK if it does
|
||||
// not receive the correct ACK.
|
||||
// <0=> No retransmission
|
||||
// <1=> 1 time
|
||||
// <2=> 2 times
|
||||
// <3=> 3 times
|
||||
// <4=> 4 times
|
||||
// <5=> 5 times
|
||||
// <6=> 6 times
|
||||
// <7=> 7 times
|
||||
// <8=> 8 times
|
||||
// <9=> 9 times
|
||||
// <10=> 10 times
|
||||
// <11=> 11 times
|
||||
// <12=> 12 times
|
||||
// <13=> 13 times
|
||||
// <14=> 14 times
|
||||
// <15=> 15 times
|
||||
#ifndef XINCX_2_4G_RETRANS_CNT
|
||||
#define XINCX_2_4G_RETRANS_CNT 0
|
||||
#endif
|
||||
|
||||
// <o> XINCX_2_4G_RETRANS_DELAY - 2.4g Retransmission Delay
|
||||
// <i> Retransmission delay. For 32 bytes of data, the minimum configuration is 500 us for 1 Mbit/s and 1500 us for 250
|
||||
// kbit/s.
|
||||
// <0=> 250us
|
||||
// <1=> 500us
|
||||
// <2=> 750us
|
||||
// <3=> 1000us
|
||||
// <4=> 1250us
|
||||
// <5=> 1500us
|
||||
// <6=> 1750us
|
||||
// <7=> 2000us
|
||||
// <8=> 2250us
|
||||
// <9=> 2500us
|
||||
// <10=> 2750us
|
||||
// <11=> 3000us
|
||||
// <12=> 3250us
|
||||
// <13=> 3500us
|
||||
// <14=> 3750us
|
||||
// <15=> 4000us
|
||||
#ifndef XINCX_2_4G_RETRANS_DELAY
|
||||
#define XINCX_2_4G_RETRANS_DELAY 3
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// </e> //XINCX_RF_PEACKET_MODE enhanced normal
|
||||
|
||||
// RF 2.4g Compatibility configuration
|
||||
//==========================================================
|
||||
// Compatibility configuration, when you need to be compatible with other RF chips, you don't need to configure this
|
||||
// option when using our company's chips.
|
||||
// XINCX_2_4G_PREAMBLE - 2.4g preamble
|
||||
#ifndef XINCX_2_4G_PREAMBLE
|
||||
#define XINCX_2_4G_PREAMBLE 0x710f5555
|
||||
#endif
|
||||
|
||||
// XINCX_2_4G_GUARD - 2.4g guard
|
||||
#ifndef XINCX_2_4G_GUARD
|
||||
#define XINCX_2_4G_GUARD 0x8fc9
|
||||
#endif
|
||||
//
|
||||
|
||||
// XINCX_2_4G_CRY_CPT_ARRAY - 2.4g Crystal capacitor array
|
||||
//==========================================================
|
||||
// Crystal capacitor array, adjust to modify the frequency offset of the crystal oscillator.
|
||||
// XINCX_2_4G_CRY_CPT_ARRAY - 2.4g Crystal capacitor array
|
||||
#ifndef XINCX_2_4G_CRY_CPT_ARRAY
|
||||
#ifdef XC62XX
|
||||
#define XINCX_2_4G_CRY_CPT_ARRAY 0x38
|
||||
#else
|
||||
#define XINCX_2_4G_CRY_CPT_ARRAY 0x36
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // SDK_CONFIG_H
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "app_64m.h"
|
||||
|
||||
void use_64m_crtstal_init(void)
|
||||
{
|
||||
testpin_64M_config();
|
||||
xc_pwr_pwrkey_init();
|
||||
Init_rtc_gpio(4, 0x00);
|
||||
}
|
||||
|
||||
__RAM_CODE void rf_64M_set_rx_channel(uint16_t channel)
|
||||
{
|
||||
channel -= 1;
|
||||
uint16_t ch = channel % 2;
|
||||
XC_RF_2_4G->RF_CH &= ~(0x3fff);
|
||||
switch (ch) {
|
||||
case 0:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16));
|
||||
break;
|
||||
case 1:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16) | 0x80008000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(*(volatile unsigned int *)(0x53023010)) &= ~((1 << 24) | (2 << 28));
|
||||
}
|
||||
|
||||
__RAM_CODE void rf_64M_set_tx_channel(uint16_t channel)
|
||||
{
|
||||
uint16_t ch = channel % 2;
|
||||
XC_RF_2_4G->RF_CH &= ~(0x3fff);
|
||||
switch (ch) {
|
||||
case 0:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16));
|
||||
break;
|
||||
case 1:
|
||||
XC_RF_2_4G->RF_CH |= (channel / 2 + 1);
|
||||
*((uint32_t volatile *)0x53022064) = (((channel / 2) << 16) | 0x80008000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(*(volatile unsigned int *)(0x53023010)) |= ((0x3 << 16) | (1 << 24) | (2 << 28));
|
||||
}
|
||||
|
||||
void testpin_64M_config(void)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
val = (*(volatile unsigned int *)(0x53022040));
|
||||
val |= (0x7 << 4) | (0x7);
|
||||
(*(volatile unsigned int *)(0x53022040)) = val; // TPORT_DATA0_SEL set
|
||||
|
||||
val = (*(volatile unsigned int *)(0x40000134));
|
||||
(*(volatile unsigned int *)(0x40000134)) = ((val & ~(0xfu << 28)) | (1u << 28)); // testpin1_ctrl[3:0]=1
|
||||
// printf("after 0x40000134=0x%x, 0x40000134=0x%x\n", *(volatile unsigned int *)(0x40000134),
|
||||
// *(volatile unsigned int *)(0x40000134));
|
||||
|
||||
val = (*(volatile unsigned int *)(0x53023010));
|
||||
val &= ~(3 << 28);
|
||||
|
||||
#if 1 // diag = 0xc //diag = 0x3
|
||||
|
||||
val |= (0x3 << 20) | (0x3 << 16 | 1 << 24 | 2 << 28); // 0xc
|
||||
(*(volatile unsigned int *)(0x53023010)) = val; // diag_sel[3:0] set
|
||||
#endif
|
||||
|
||||
// LOGI("after 0x53022040=0x%x, 0x53022010=0x%x\n", *(volatile unsigned int *)(0x53022040),
|
||||
//*(volatile unsigned int *)(0x53023010));
|
||||
|
||||
uint32_t addr_val = 0;
|
||||
|
||||
xc_gpio_fun_sel(GPIO_4, GPIO_Dx);
|
||||
xc_gpio_mux_ctl(GPIO_4, GPIO_Mux3); // en test_pin[1]
|
||||
addr_val = 0x40000174;
|
||||
*((uint32_t volatile *)addr_val) = 7;
|
||||
}
|
||||
|
||||
void Init_rtc_gpio(uint32_t num, uint8_t inter_mode)
|
||||
{
|
||||
uint32_t val;
|
||||
// if(!((inter_mode>=0x08) &&(inter_mode<=0x0c))) return;
|
||||
__write_hw_reg32(CPR_CTLAPBCLKEN_GRCTL, 0x20002);
|
||||
__write_hw_reg32(CPR_AOCLKEN_GRCTL, 0x20002);
|
||||
|
||||
__read_hw_reg32(AO_GPIO_MODE, val);
|
||||
val &= ~(0x0f << (num << 2));
|
||||
val |= (inter_mode << (num << 2));
|
||||
__write_hw_reg32(AO_GPIO_MODE, val);
|
||||
|
||||
__read_hw_reg32(AO_GPIO_CTL, val);
|
||||
val |= (1 << (8 + num));
|
||||
__write_hw_reg32(AO_GPIO_CTL, val);
|
||||
// rtc_ao_gpio_mode__aogpio_debounce_en3__setf(1);
|
||||
NVIC_EnableIRQ(RTC_IRQn);
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
#include "usbd_core.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_hid_keyboard.h"
|
||||
#include "rf_2_4g_main.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void SysTick_Callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void clock_init(void)
|
||||
{
|
||||
CLOCK_InitCfg_t clock_cfg;
|
||||
|
||||
clock_cfg.hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
clock_cfg.hfclk_in = CLOCK_HFCLK_IN_48M;
|
||||
clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
|
||||
if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_XTAL) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32768;
|
||||
} else if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_RC) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
}
|
||||
|
||||
xc_clock_init_cfg(&clock_cfg);
|
||||
|
||||
SysTick_Config(xc_clock_hfclk_in_get() / 100);
|
||||
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
void app_uart_init(void)
|
||||
{
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void app_usb_keyboard_send_data(uint8_t data)
|
||||
{
|
||||
|
||||
uint8_t key_data[8] = {0};
|
||||
|
||||
key_data[2] = data;
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Keyboard_FirstSendReport(&hUsbDeviceFS, key_data, sizeof(key_data));
|
||||
GLOBAL_INT_RESTORE();
|
||||
delay_ms(50);
|
||||
key_data[2] = 0x00;
|
||||
USBD_HID_Keyboard_FirstSendReport(&hUsbDeviceFS, key_data, sizeof(key_data));
|
||||
delay_ms(50);
|
||||
}
|
||||
volatile uint8_t rf_2_4g_keyboard_data_ready = 0;
|
||||
extern uint8_t rx_buff[256];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clock_init();
|
||||
|
||||
app_uart_init( );
|
||||
|
||||
DEBUG("__USB_HID_2_4G_KEYBOARD_DEMO__\n");
|
||||
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
/* rf 2.4g initialization configuration */
|
||||
rf24g_init();
|
||||
rf_compatible_config();
|
||||
|
||||
#if (XINCX_RF_TRANS_RATE == DR_2M)
|
||||
/* Set 2M mode register configuration */
|
||||
/* Don't move this function interface */
|
||||
rf_2M_config();
|
||||
#endif //(XINCX_RF_TRANS_RATE == DR_2M)
|
||||
|
||||
#if (XINCX_RF_NVIC_MODE)
|
||||
|
||||
/* Enable RF2.4G interrupts */
|
||||
NVIC_EnableIRQ(RF24G_IRQn);
|
||||
/* Configure the RF2.4G interrupt priority */
|
||||
NVIC_SetPriority(RF24G_IRQn, 1);
|
||||
#endif // XINCX_RF_NVIC_MODE
|
||||
/* Set the communication mode */
|
||||
rf_switch_mode(XINCX_RF_MODE, XINCX_2_4G_CHANNEL);
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
timer_init(RF_TX_TIMERx, SEND_TIMERMS_CNT);
|
||||
#endif
|
||||
#ifdef DEBUG_LOG
|
||||
/* Register information printing */
|
||||
rf_dump_log();
|
||||
#endif // DEBUG_LOG
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
rf_transmit();
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_keyboard_data_ready)
|
||||
{
|
||||
app_usb_keyboard_send_data(rx_buff[0]);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_keyboard_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "rf_2_4g_main.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
bool rf_tx_timer_flag = false;
|
||||
bool rf_trx_tx_flag = false;
|
||||
|
||||
uint32_t rx_cnt = 0;
|
||||
uint32_t tx_cnt = 0;
|
||||
uint8_t tx_buff[256] = {0};
|
||||
uint8_t rx_buff[256] = {0};
|
||||
|
||||
uint8_t tx_stat;
|
||||
|
||||
extern bool rf24g_tx_irq_flag;
|
||||
extern bool rf24g_rx_irq_flag;
|
||||
extern uint32_t recv_len;
|
||||
extern uint8_t recv_buf[];
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void timer_init(uint8_t timer_id, uint32_t timer_cnt)
|
||||
{
|
||||
LOGI("timer_init\r\n");
|
||||
|
||||
uint32_t timerx_us = timer_cnt * 1000;
|
||||
Timer_InitCfg_t timer_cfg;
|
||||
|
||||
timer_cfg.timer_src_clk = TIMER_CLK_SRC_32M_DIV;
|
||||
timer_cfg.timer_div_clk = TIMER_DIV_CLK_1MHzOr1K;
|
||||
timer_cfg.timer_mode = TIMER_MODE_CYCLE;
|
||||
|
||||
xc_timer_init(timer_id, &timer_cfg);
|
||||
xc_timer_set_value(timer_id, timerx_us);
|
||||
xc_timer_start(timer_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief timer0_Callback
|
||||
* @param void * - context
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void timer0_callback(void *context)
|
||||
{
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
rf_tx_timer_flag = true;
|
||||
#elif (XINCX_RF_MODE == TRX_MODE)
|
||||
rf_trx_tx_flag = true;
|
||||
#endif //(XINCX_RF_MODE)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LOG
|
||||
/**
|
||||
* @brief RF 2.4g register information printing
|
||||
* @param void
|
||||
* @retval void
|
||||
*/
|
||||
void rf_2M_reg_info(void)
|
||||
{
|
||||
/* Register information printing */
|
||||
LOGI("CFG_TOP: 0x%08x\r\n", XC_RF_2_4G->CFG_TOP);
|
||||
LOGI("TXPROC_CFG: 0x%08x\r\n", XC_RF_2_4G->TXPROC_CFG);
|
||||
LOGI("RXPROC_CFG_L: 0x%08x\r\n", XC_RF_2_4G->RXPROC_CFG_L);
|
||||
LOGI("RF_CH: 0x%08x\r\n", XC_RF_2_4G->RF_CH);
|
||||
LOGI("rccal_reg_l: 0x%08x\r\n", XC_BT_RF->rccal_reg_l);
|
||||
LOGI("ana2_reg_l: 0x%08x\r\n", XC_BT_RF->ana2_reg_l);
|
||||
LOGI("ana3_reg_l: 0x%08x\r\n", XC_BT_RF->ana3_reg_l);
|
||||
LOGI("ana4_reg_l: 0x%08x\r\n", XC_BT_RF->ana4_reg_l);
|
||||
LOGI("ana5_reg_l: 0x%08x\r\n", XC_BT_RF->ana5_reg_l);
|
||||
LOGI("ana14_reg_l: 0x%08x\r\n", XC_BT_RF->ana14_reg_l);
|
||||
LOGI("ana15_reg_l: 0x%08x\r\n", XC_BT_RF->ana15_reg_l);
|
||||
LOGI("ana16_reg_l: 0x%08x\r\n", XC_BT_RF->ana16_reg_l);
|
||||
LOGI("ana17_reg_l: 0x%08x\r\n", XC_BT_RF->ana17_reg_l);
|
||||
LOGI("ana18_reg_l: 0x%08x\r\n", XC_BT_RF->ana18_reg_l);
|
||||
LOGI("ana21_reg_l: 0x%08x\r\n", XC_BT_RF->ana21_reg_l);
|
||||
LOGI("AON_RF_AONREG: 0x%08x\r\n", cprao_aon_rf_aonreg_get()); // 0x36
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Rf 2.4g dump log
|
||||
* @param void
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void rf_dump_log(void)
|
||||
{
|
||||
LOGI("***************** 2.4G Param ******************\n");
|
||||
LOGI("CFG_TOP: 0x%08x\r\n", XC_RF_2_4G->CFG_TOP);
|
||||
LOGI("EN_AA: 0x%08x\r\n", XC_RF_2_4G->EN_AA);
|
||||
LOGI("EN_RXADDR: 0x%08x\r\n", XC_RF_2_4G->EN_RXADDR);
|
||||
LOGI("SETUP_AW: 0x%08x\r\n", XC_RF_2_4G->SETUP_AW);
|
||||
LOGI("SETUP_RETR: 0x%08x\r\n", XC_RF_2_4G->SETUP_RETR);
|
||||
LOGI("RF_CH: 0x%08x\r\n", XC_RF_2_4G->RF_CH);
|
||||
LOGI("SETUP_RF: 0x%08x\r\n", XC_RF_2_4G->SETUP_RF);
|
||||
LOGI("STATUS: 0x%08x\r\n", XC_RF_2_4G->STATUS);
|
||||
LOGI("OBSERVE_TX: 0x%08x\r\n", XC_RF_2_4G->OBSERVE_TX);
|
||||
LOGI("RSSI: 0x%08x\r\n", XC_RF_2_4G->RSSI);
|
||||
LOGI("RX_ADDR_P0: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RX_ADDR_P0_H), XC_RF_2_4G->RX_ADDR_P0_L);
|
||||
LOGI("RX_ADDR_P1: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RX_ADDR_P1_H), XC_RF_2_4G->RX_ADDR_P1_L);
|
||||
LOGI("RX_ADDR_P2TOP5:0x%08x\r\n", XC_RF_2_4G->RX_ADDR_P2TOP5);
|
||||
LOGI("BER_RESULT: 0x%08x%08x\r\n", XC_RF_2_4G->BER_ERR_CNT, XC_RF_2_4G->BER_RECV_CNT);
|
||||
LOGI("AGC_SETTING: 0x%08x\r\n", XC_RF_2_4G->AGC_SETTING);
|
||||
LOGI("PGA_SETTING: 0x%02x %08x\r\n", ((XC_RF_2_4G->TX_ADDR_H) & 0xFF00) >> 8, XC_RF_2_4G->PGA_SETTING);
|
||||
LOGI("TX_ADDR: 0x%02x %08x\r\n", ((XC_RF_2_4G->TX_ADDR_H) & 0xFF), XC_RF_2_4G->TX_ADDR_L);
|
||||
LOGI("RX_PW_PX: 0x%04x %08x\r\n", 0xFFFF & (XC_RF_2_4G->RX_PW_Px_H), XC_RF_2_4G->RX_PW_Px_L);
|
||||
LOGI("STATUS_FIFO: 0x%08x\r\n", XC_RF_2_4G->STATUS_FIFO);
|
||||
LOGI("RSSIREC: 0x%08x\r\n", XC_RF_2_4G->RSSIREC);
|
||||
LOGI("TXPROC_CFG: 0x%08x\r\n", XC_RF_2_4G->TXPROC_CFG);
|
||||
LOGI("RXPROC_CFG: 0x%02x %08x\r\n", 0xFF & (XC_RF_2_4G->RXPROC_CFG_H), XC_RF_2_4G->RXPROC_CFG_L);
|
||||
LOGI("DYNPD: 0x%08x\r\n", XC_RF_2_4G->DYNPD);
|
||||
LOGI("FEATURE: 0x%08x\r\n", XC_RF_2_4G->FEATURE);
|
||||
LOGI("PGA_SETTING_H: 0x%08x\r\n", XC_RF_2_4G->TX_ADDR_H);
|
||||
#ifdef XC62XX
|
||||
LOGI("HW_CONFIG: 0x%08x\r\n", XC_RF_2_4G->HW_CONFIG);
|
||||
LOGI("PBT_CONFIG: 0x%08x\r\n", XC_RF_2_4G->PBT_CONFIG);
|
||||
LOGI("PBT_TIMER: 0x%08x\r\n", XC_RF_2_4G->PBT_TIMER);
|
||||
LOGI("PBT_SYNC_TIME: 0x%08x\r\n", XC_RF_2_4G->PBT_SYNC_TIME);
|
||||
LOGI("PBT_TX_HEAD: 0x%08x\r\n", XC_RF_2_4G->PBT_TX_HEAD);
|
||||
LOGI("PBT_RX_HEAD: 0x%08x\r\n", XC_RF_2_4G->PBT_RX_HEAD);
|
||||
LOGI("PBT_AUTO_TRX_TIME: 0x%08x\r\n", XC_RF_2_4G->PBT_AUTO_TRX_TIME);
|
||||
#endif
|
||||
LOGI("TX_POWER 0x%08x\r\n", (XC_BT_RF->ana21_reg_l >> 6) & 0x3f);
|
||||
LOGI("ana11_reg_l: 0x%08x\r\n", XC_BT_RF->ana11_reg_l);
|
||||
LOGI("***********************************************\n");
|
||||
LOGI("\r\n");
|
||||
}
|
||||
#endif // DEBUG_LOG
|
||||
void GetPointerData(uint8_t *pbuf);
|
||||
|
||||
|
||||
// 1,2,3,4,5,6,7,8,9,0
|
||||
const uint8_t key_codes[] = {0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27};
|
||||
uint8_t key_codes_id = 0;
|
||||
/**
|
||||
* @brief RF 2.4g data config
|
||||
* @param uint8_t * - buff
|
||||
* uint8 - len
|
||||
* @retval uint8_t - 0
|
||||
*/
|
||||
uint8_t rf_data_config(uint8_t *buff, uint16_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return RF_FAIL;
|
||||
}
|
||||
|
||||
buff[0] = key_codes[key_codes_id];
|
||||
key_codes_id = key_codes_id >=9 ? 0: key_codes_id+1;
|
||||
return RF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief RF 2.4g buff info
|
||||
* @param uint8_t * - buff
|
||||
* uint8_t len
|
||||
* @retval void
|
||||
*/
|
||||
void rf_buff_info(uint8_t *buff, uint16_t len)
|
||||
{
|
||||
for (uint16_t i = 0; i < len; i++)
|
||||
LOGI("%02x ", buff[i]);
|
||||
LOGI("\r\n");
|
||||
}
|
||||
|
||||
void rf_switch_mode(uint8_t mode, uint16_t channel)
|
||||
{
|
||||
CE_CTL_LOW;
|
||||
uint8_t rf_mode = 0;
|
||||
switch (mode) {
|
||||
case TRX_MODE:
|
||||
case TX_MODE:
|
||||
break;
|
||||
case RX_MODE:
|
||||
rf_mode = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("The mode is set incorrectly\n");
|
||||
return;
|
||||
}
|
||||
set_rf_mode(mode);
|
||||
rf_set_channel(channel);
|
||||
#ifdef XC62XX
|
||||
XC_RF_2_4G->STATUS = ((XC_RF_2_4G->CFG_TOP >> 30) & 0x3 << 7) | ((XC_RF_2_4G->CFG_TOP >> 4) & 0x7 << 4);
|
||||
#else
|
||||
XC_RF_2_4G->STATUS = MASK_ALL_INTER;
|
||||
#endif
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
rf_wr_cmd(FLUSH_TX);
|
||||
|
||||
if (rf_mode) {
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
void GetPointerData(uint8_t *pbuf)
|
||||
{
|
||||
static int32_t move_cnt = 0;
|
||||
static uint8_t step_x_y = 0;
|
||||
static int8_t x = 0, y = 0;
|
||||
static uint16_t cursor_step = 2;
|
||||
static uint16_t cursor_width = 200;
|
||||
|
||||
move_cnt++;
|
||||
if (move_cnt > cursor_width) {
|
||||
step_x_y++;
|
||||
step_x_y = step_x_y % 4;
|
||||
move_cnt = 0;
|
||||
}
|
||||
|
||||
switch (step_x_y) {
|
||||
case 0: {
|
||||
y = 0;
|
||||
x = cursor_step;
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
x = 0;
|
||||
y = cursor_step;
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
y = 0;
|
||||
x = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
x = 0;
|
||||
y = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
}
|
||||
|
||||
pbuf[0] = 0;
|
||||
pbuf[1] = x;
|
||||
pbuf[2] = y;
|
||||
pbuf[3] = 0;
|
||||
}
|
||||
|
||||
void rf_24g_tx_ds_cb(void)
|
||||
{
|
||||
rf24g_tx_irq_flag = true;
|
||||
}
|
||||
|
||||
extern uint8_t rf_2_4g_keyboard_data_ready;
|
||||
extern bool rf_tx_1ms_transmit;
|
||||
void rf_transmit(void)
|
||||
{
|
||||
#if (XINCX_RF_COMPATIBILITY_MODE == PANCHIP_PACKET)
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf_data_config(tx_buff, XINCX_2_4G_PIPE0_LEN);
|
||||
rf_tx_normal_manage(tx_buff, XINCX_2_4G_PIPE0_LEN);
|
||||
}
|
||||
#else
|
||||
rf_rx_normal_manage();
|
||||
#endif
|
||||
#else
|
||||
#if ((!XINCX_RF_NVIC_MODE) && (XINCX_RF_MODE != TRX_MODE))
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
// 轮询发射
|
||||
rf_data_config(tx_buff, BUFF_LEN);
|
||||
// tx_buff[0] = tx_cnt;
|
||||
tx_stat = rf_tx_event(tx_buff, BUFF_LEN);
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE)
|
||||
if (tx_stat == TX_DATA_OK) {
|
||||
uint16_t ack_len = rf_rx_packet(rx_buff);
|
||||
LOGI("yes ack len:%d\n", ack_len);
|
||||
rx_cnt++;
|
||||
rf_buff_info(rx_buff, ack_len);
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
} else if (tx_stat == TX_RETRANS_MAX) {
|
||||
LOGI("no ack\n");
|
||||
}
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d, rx_cnt:%d\n", tx_cnt, rx_cnt);
|
||||
#else
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d\n", tx_cnt);
|
||||
#endif
|
||||
delay_ms(105);
|
||||
#else
|
||||
|
||||
// 轮询接收
|
||||
uint16_t len = rf_rx_event(rx_buff);
|
||||
|
||||
/* Receiving end polling data processing */
|
||||
if (len != 0) {
|
||||
rf_2_4g_keyboard_data_ready = 1;
|
||||
/* Entering standby mode */
|
||||
CE_CTL_LOW;
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
LOGI("rx_cnt:%d,len:%d\n", rx_cnt, len);
|
||||
/* Receive read data buffer reset */
|
||||
// memset(rx_buff, 0, len);
|
||||
len = 0;
|
||||
/* Entering the receiver */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
#endif
|
||||
#elif (XINCX_RF_MODE != TRX_MODE)
|
||||
// 中断接收
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
CE_CTL_LOW;
|
||||
uint16_t len = recv_len;
|
||||
if (len) {
|
||||
memcpy(rx_buff, recv_buf, len);
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
LOGI("rx_cnt:%d,len:%d\n", rx_cnt, len);
|
||||
rf_2_4g_keyboard_data_ready = 1;
|
||||
/* Receive read data buffer reset */
|
||||
// memset(rx_buff, 0, len);
|
||||
memset(recv_buf, 0, len);
|
||||
len = 0;
|
||||
}
|
||||
// rf_wr_cmd(FLUSH_RX);
|
||||
/* Entering the receiver */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
// 中断发射
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
#if (XINCX_RF_EMHAMCED_PACKET_MODE)
|
||||
if (tx_stat == TX_DATA_OK) {
|
||||
uint16_t ack_len = rf_rx_packet(rx_buff);
|
||||
LOGI("yes ack len:%d\n", ack_len);
|
||||
rx_cnt++;
|
||||
rf_buff_info(rx_buff, ack_len);
|
||||
rf_wr_cmd(FLUSH_RX);
|
||||
} else if (tx_stat == TX_RETRANS_MAX) {
|
||||
LOGI("no ack\n");
|
||||
}
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d, rx_cnt:%d\n", tx_cnt, rx_cnt);
|
||||
#else
|
||||
tx_cnt += 1;
|
||||
LOGI("tx_cnt:%d\n", tx_cnt);
|
||||
#endif
|
||||
tx_stat = TX_DATA_INVALID;
|
||||
rf_data_config(tx_buff, BUFF_LEN);
|
||||
// tx_buff[0] = tx_cnt;
|
||||
rf_tx_packet(tx_buff, BUFF_LEN);
|
||||
delay_ms(105);
|
||||
}
|
||||
|
||||
#endif //!(XINCX_RF_NVIC_MODE)
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
if (rf_trx_tx_flag) {
|
||||
rf_trx_tx_flag = false;
|
||||
tx_cnt += 1;
|
||||
/* 切换发射模式 */
|
||||
rf_switch_mode(TX_MODE, XINCX_2_4G_CHANNEL);
|
||||
tx_buff[0] = tx_cnt;
|
||||
/* 开始发射等到发送完成中断 */
|
||||
rf_tx_packet(tx_buff, 32);
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_2, GPIO_PIN_SET);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 收发切换(中断触发),含有接收超时配置
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
uint16_t len = recv_len;
|
||||
CE_CTL_LOW;
|
||||
if (len) {
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_1, GPIO_PIN_SET);
|
||||
#endif
|
||||
memcpy(rx_buff, recv_buf, len);
|
||||
/* Receive Count */
|
||||
rx_cnt += 1;
|
||||
// rf_buff_info(rx_buff, len);
|
||||
//LOGI("rx_buff[0]:%02x,rx_cnt:%d, len:%d\n", rx_buff[0], rx_cnt, len);
|
||||
/* Receive read data buffer reset */
|
||||
memset(rx_buff, 0, len);
|
||||
len = 0;
|
||||
recv_len = 0;
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_1, GPIO_PIN_RESET);
|
||||
#endif
|
||||
}
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
//LOGI("tx_cnt:%d\n",tx_cnt);
|
||||
#if GPIO_TEST
|
||||
xc_gpio_write_pin(TEST_GPIO_2, GPIO_PIN_RESET);
|
||||
#endif
|
||||
/* 切换接收模式 */
|
||||
rf_switch_mode(RX_MODE, XINCX_2_4G_CHANNEL);
|
||||
}
|
||||
|
||||
#endif // XINCX_RF_MODE
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
#include "rf_compatible_normal.h"
|
||||
uint16_t crc = 0;
|
||||
uint8_t panchip_data_length = XINCX_2_4G_PIPE0_LEN - XINCX_2_4G_CRC_BYTE;
|
||||
|
||||
uint16_t rf_addr_crc = 0;
|
||||
uint8_t panchip_addr_whiten;
|
||||
uint8_t addr_buff[5] = {0};
|
||||
uint32_t send_cnt = 0;
|
||||
uint32_t recv_cnt = 0;
|
||||
|
||||
#if (XINCX_RF_MODE == TX_MODE)
|
||||
bool rf24g_tx_irq_flag = true;
|
||||
#elif(XINCX_RF_MODE == RX_MODE)
|
||||
bool rf24g_tx_irq_flag = false;
|
||||
#endif
|
||||
bool rf24g_rx_irq_flag = false;
|
||||
uint32_t recv_len;
|
||||
uint8_t recv_buf[256];
|
||||
/**
|
||||
* @brief Rf 2.4g get addr
|
||||
* @param uint8_t *addr_buff
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
void rf_addr_map(uint8_t *addr_buff)
|
||||
{
|
||||
uint8_t addr_xsb = (XC_RF_2_4G->CFG_TOP >> 11) & (0x1);
|
||||
LOGI("addr_xsb %02x\r\n", addr_xsb);
|
||||
if (!addr_xsb) {
|
||||
addr_buff[0] = (XC_RF_2_4G->TX_ADDR_L >> 0) & 0xff;
|
||||
addr_buff[1] = (XC_RF_2_4G->TX_ADDR_L >> 8) & 0xff;
|
||||
addr_buff[2] = (XC_RF_2_4G->TX_ADDR_L >> 16) & 0xff;
|
||||
addr_buff[3] = (XC_RF_2_4G->TX_ADDR_L >> 24) & 0xff;
|
||||
addr_buff[4] = (XC_RF_2_4G->TX_ADDR_H >> 0) & 0xff;
|
||||
} else {
|
||||
addr_buff[1] = (XC_RF_2_4G->TX_ADDR_L >> 24) & 0xff;
|
||||
addr_buff[2] = (XC_RF_2_4G->TX_ADDR_L >> 16) & 0xff;
|
||||
addr_buff[3] = (XC_RF_2_4G->TX_ADDR_L >> 8) & 0xff;
|
||||
addr_buff[4] = (XC_RF_2_4G->TX_ADDR_L >> 0) & 0xff;
|
||||
addr_buff[0] = (XC_RF_2_4G->TX_ADDR_H >> 0) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RF 2.4g get address crc
|
||||
* @param void
|
||||
* @retval crc data
|
||||
*/
|
||||
uint16_t rf_get_addr_crc(void)
|
||||
{
|
||||
#if (1 == XINCX_2_4G_CRC_BYTE)
|
||||
return crc8_rohc(addr_buff, RF_ADDR_LEN, RF_CRC_INIT_VALUE, PACKET_NORMAL);
|
||||
#elif (2 == XINCX_2_4G_CRC_BYTE)
|
||||
return crc16_ccitt_false(addr_buff, RF_ADDR_LEN, RF_CRC_INIT_VALUE, PACKET_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Address whitening and writing
|
||||
* @param void
|
||||
* @retval uint8_t whiten_addr
|
||||
*/
|
||||
uint8_t rf_recv_addr(void)
|
||||
{
|
||||
uint16_t whiten_addr = whiten_data((uint8_t *)addr_buff, RF_ADDR_LEN, PANCHIP_WHITEN_INIT_VAL);
|
||||
|
||||
/* Set PTX address */
|
||||
set_rf_txaddr((addr_buff[0] << 0) | (addr_buff[1] << 8) | (addr_buff[2] << 16) | (addr_buff[3] << 24),
|
||||
(addr_buff[4]));
|
||||
/* Set PRX address */
|
||||
set_rf_pipe0_rxaddr((addr_buff[0] << 0) | (addr_buff[1] << 8) | (addr_buff[2] << 16) | (addr_buff[3] << 24),
|
||||
(addr_buff[4]));
|
||||
return whiten_addr;
|
||||
}
|
||||
|
||||
void rf_compatible_config(void)
|
||||
{
|
||||
#if (XINCX_RF_COMPATIBILITY_MODE == BELKEN_PACKET)
|
||||
#if XC62XX
|
||||
set_rf_retr(XINCX_2_4G_RETRANS_CNT, XINCX_2_4G_RETRANS_DELAY);
|
||||
|
||||
XC_RF_2_4G->FEATURE &= ~(1 << 5);
|
||||
|
||||
rf_set_ack_type(1);
|
||||
|
||||
rf_set_freq_dev(RF_FREQ_DEV);
|
||||
#endif
|
||||
#elif (XINCX_RF_COMPATIBILITY_MODE == PANCHIP_PACKET)
|
||||
|
||||
XC_RF_2_4G->FEATURE |= (1 << 11) | (2 << 12) | (1 << 14) | (1 << 18);
|
||||
XC_RF_2_4G->PREAMBLE = 0x710f55;
|
||||
|
||||
/* 白化cc2500、同步字中断、CRC中断 */
|
||||
XC_RF_2_4G->CFG_TOP |= (1 << 30) | (1 << 22);
|
||||
/* get addr */
|
||||
rf_addr_map(addr_buff);
|
||||
/* Calculate the CRC of the address block */
|
||||
rf_addr_crc = rf_get_addr_crc();
|
||||
/* The address range is whitened and the whitened address is rewritten */
|
||||
panchip_addr_whiten = rf_recv_addr();
|
||||
#if XC62XX
|
||||
rf_set_whiten_value(panchip_addr_whiten);
|
||||
rf_set_fifo_len(1);
|
||||
#else
|
||||
XC_RF_2_4G->FEATURE |= (1 << 5);
|
||||
XC_RF_2_4G->CFG_TOP &= ~(0x7f << 23);
|
||||
XC_RF_2_4G->CFG_TOP |= (panchip_addr_whiten << 23);
|
||||
#endif
|
||||
set_rf_crc(CRC_0BYTE);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t rf_panchip_normal_recv_data_cfg(uint8_t *buff, uint8_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t crc_data = 0;
|
||||
/* Whiten */
|
||||
whiten_data(buff, len + 2, panchip_addr_whiten);
|
||||
/* CRC */
|
||||
crc = ~crc16_ccitt_false(buff, len, rf_addr_crc, PACKET_NORMAL);
|
||||
crc_data = ((buff[len] << 8) | (buff[len + 1]));
|
||||
|
||||
if (crc == crc_data) {
|
||||
buff_bigandsmallend(buff, len);
|
||||
} else {
|
||||
len = 0;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
uint8_t rf_panchip_normal_send_data_cfg(uint8_t *buff, uint8_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
buff_bigandsmallend(buff, len);
|
||||
crc = ~crc16_ccitt_false(buff, panchip_data_length, rf_addr_crc, PACKET_NORMAL);
|
||||
|
||||
buff[panchip_data_length] = (crc >> 8) & 0xff;
|
||||
buff[panchip_data_length + 1] = crc & 0xff;
|
||||
|
||||
/* Whiten */
|
||||
whiten_data(buff, len + 2, panchip_addr_whiten);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rf_24g_rx_dr_cb(void)
|
||||
{
|
||||
recv_len = rf_rx_packet( recv_buf);
|
||||
rf24g_rx_irq_flag = true;
|
||||
}
|
||||
|
||||
|
||||
uint32_t rf_rx_normal_manage(void)
|
||||
{
|
||||
if (rf24g_rx_irq_flag) {
|
||||
rf24g_rx_irq_flag = false;
|
||||
/* Entering standby mode */
|
||||
CE_CTL_LOW;
|
||||
uint8_t len = recv_len;
|
||||
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_2, GPIO_PIN_SET);
|
||||
#endif
|
||||
len = rf_panchip_normal_recv_data_cfg(recv_buf, len - 2);
|
||||
if (len) {
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_1, GPIO_PIN_SET);
|
||||
#endif
|
||||
// rf_buff_info(recv_buf, len);
|
||||
/* Receive Count */
|
||||
recv_cnt++;
|
||||
LOGI("recv:%d, len:%d\r\n", recv_cnt, len);
|
||||
|
||||
/* Receive read data buffer reset */
|
||||
memset(recv_buf, 0, len);
|
||||
len = 0;
|
||||
}
|
||||
|
||||
#if (DEBUG_PIN)
|
||||
xc_gpio_write_pin(TEST_PIN_1, GPIO_PIN_RESET);
|
||||
xc_gpio_write_pin(TEST_PIN_2, GPIO_PIN_RESET);
|
||||
#endif
|
||||
/* Entering the receiver */
|
||||
CE_CTL_HIGH;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t rf_tx_normal_manage(uint8_t *buff, uint8_t length)
|
||||
{
|
||||
if (rf24g_tx_irq_flag) {
|
||||
rf24g_tx_irq_flag = false;
|
||||
buff[0] = send_cnt++;
|
||||
/* Filling in software frame number */
|
||||
LOGI("data len:%d, send_cnt:%d\n", length - XINCX_2_4G_CRC_BYTE, send_cnt);
|
||||
// rf_buff_info(buff, length);
|
||||
rf_panchip_normal_send_data_cfg(buff, length - XINCX_2_4G_CRC_BYTE);
|
||||
/* data transmission */
|
||||
rf_tx_packet(buff, length);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
SP = _RDWORD(0x10000000);
|
||||
PC = _RDWORD(0x10000004);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
FUNC void InitGpio(void)
|
||||
{
|
||||
// Config IOMUX
|
||||
/*
|
||||
gpio_mux_ctl_u(33,1);//d2
|
||||
gpio_mux_ctl_u(34,1);//d3
|
||||
gpio_mux_ctl_u(35,2);//clk
|
||||
gpio_mux_ctl_u(36,2);//cs
|
||||
gpio_mux_ctl_u(37,2);//d0 rx
|
||||
gpio_mux_ctl_u(38,2);//d1 tx
|
||||
*/
|
||||
_WDWORD(0x4000019c, 0x00002A94);
|
||||
}
|
||||
FUNC void InitFlash(void)
|
||||
{
|
||||
|
||||
}
|
||||
FUNC void InitXIP(void)
|
||||
{
|
||||
|
||||
_WDWORD(0x40000104,0x040000);//reset ssi0
|
||||
_WDWORD(0x40000104,0x040004);//reset ssi0
|
||||
_WDWORD(0x40000050,0x110000);//close spi0 mclk
|
||||
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
|
||||
|
||||
|
||||
//config fmc
|
||||
_WDWORD(0x40000270, 0x0503);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x40000270, 0x3503);
|
||||
//config cache
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x0);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x21);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
|
||||
|
||||
//config xip spi
|
||||
_WDWORD(0x51000008, 0); //disable spi
|
||||
|
||||
_WDWORD(0x5100002c,0); //close IE
|
||||
_WDWORD(0x51000000,0x1F); //32bit SPI data
|
||||
_WDWORD(0x51000010,0x01); //enable select slave -- SE
|
||||
_WDWORD(0x51000018,0x0); //TXFTL be set 0
|
||||
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
|
||||
|
||||
_WDWORD(0x5100010c, 0x01);//enable select slave
|
||||
_WDWORD(0x51000114, 0xFF);//XIP time out
|
||||
|
||||
_WDWORD(0x51000014, 0x2);//div 2
|
||||
|
||||
//quad
|
||||
_WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
|
||||
_WDWORD(0x51000100, 0x6b);//quad read cmd
|
||||
_WDWORD(0x51000104, 0x6b);//quad read cmd
|
||||
|
||||
|
||||
// //dual
|
||||
// _WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
|
||||
// _WDWORD(0x51000100, 0x3b);//dual read cmd
|
||||
// _WDWORD(0x51000104, 0x3b);//dual read cmd
|
||||
|
||||
|
||||
_WDWORD(0x51000008, 1); //enable spi
|
||||
}
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
InitGpio();
|
||||
InitFlash();
|
||||
InitXIP();
|
||||
SP = _RDWORD(0x11001000);
|
||||
PC = _RDWORD(0x11001004);
|
||||
_WDWORD(0x4000013C, 0x11001001);
|
||||
}
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
LOAD 0x10000000
|
||||
{
|
||||
EXE 0x10000000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
RW +0
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
LOAD 0x11001000
|
||||
{
|
||||
EXE 0x11001000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x10000200
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
*(ram_code)
|
||||
}
|
||||
|
||||
ScatterAssert((0x000+ImageLength(RW)) < 1024 * 32)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LOAD 0x11001000 0x0007f000
|
||||
{
|
||||
EXE 0x11001000 0x00010000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
*(InRoot$$Sections)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x100000C8 0x1F38
|
||||
{
|
||||
*(+RW,+ZI)
|
||||
*(ram_code)
|
||||
aeabi_sdiv.o(.text)
|
||||
uread4.o(.text)
|
||||
rt_memclr.o(.text)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+2802
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Xincboot_tool.exe 0_ram.bin 1_ram_download.bin 0 0 0 0 1
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
.\Tools\xinchip_xip_tool.exe .\Output\0_ram.bin .\Output\xip_dual .\Output\1_xip_download.bin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,618 @@
|
||||
<?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>usbd_hid_24g_keyboard_xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM0</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.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>usbd_hid_24g_keyboard</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listing\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --text -a -c --output=@L_asm !L</UserProg1Name>
|
||||
<UserProg2Name>.\tools\Xincboot_tool .\Output\0_ram.bin .\Output\1_ram_download.bin</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>1</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=.\Output\0_ram.bin !L</UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</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>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</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>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.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-M0"</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>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</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>0x40000</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>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</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>0x20000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</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>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--c99</MiscControls>
|
||||
<Define>USE_XIP=1 XC65XX XC6XX_5C=0 DEBUG_ENABLE HAL_PCD_MODULE_ENABLED USB_OTG_FS USB_HID_KEYBOARD RF_DEMO</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\app\api;..\app\Startup\xc60xx;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device\xc_m0_register;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Inc;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Inc;..\app\Startup;..\app\rf_config;..\..\..\..\..\..\component\rf24\Drivers;..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g;..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register</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>1</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>0x00000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\Linker\cpu_xip.scat</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--entry=Reset_Handler</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm0.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_xinc.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\app\Startup\xc60xx\startup_xinc.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_xinc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_it_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_it_xinc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_64m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_64m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_2_4g_main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_2_4g_main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_compatible_normal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_compatible_normal.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_systick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_ll_usb_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_ll_usb_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_pcd_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_pcd_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_usb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_usb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_fmc_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_calib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/App/hid_keyboard</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usb_device.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_keyboard\usb_device.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_desc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_keyboard\usbd_desc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/Target/hid_keyboard</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_conf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_keyboard\usbd_conf.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Core</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ctlreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ctlreq.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ioreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ioreq.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Class/HID</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_hid_keyboard.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Src\usbd_hid_keyboard.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Config</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rf_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\app\rf_config\rf_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>xc_software_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register\xc_software_crc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc6xxx_rf_2_4g.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g\xc6xxx_rf_2_4g.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName>usbd_hid_keyboard</LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
+618
@@ -0,0 +1,618 @@
|
||||
<?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>usbd_hid_keyboard_xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM0</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.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>usbd_hid_24g_keyboard</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listing\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --text -a -c --output=@L_asm !L</UserProg1Name>
|
||||
<UserProg2Name>.\tools\Xincboot_tool .\Output\0_ram.bin .\Output\1_ram_download.bin</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>1</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=.\Output\0_ram.bin !L</UserProg1Name>
|
||||
<UserProg2Name>.\Output\xip_program.bat</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>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</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>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.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-M0"</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>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</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>0x40000</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>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</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>0x20000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</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>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--c99</MiscControls>
|
||||
<Define>USE_XIP=1 XC62XX XC6XX_5C=0 DEBUG_ENABLE HAL_PCD_MODULE_ENABLED USB_OTG_FS USB_HID_KEYBOARD RF_DEMO</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\app\api;..\app\Startup\xc60xx;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device\xc_m0_register;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_mouse;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Inc;..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Inc;..\app\Startup;..\app\rf_config;..\..\..\..\..\..\component\rf24\Drivers;..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g;..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register</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>1</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>0x00000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\Linker\cpu_xip_xc62xx.scat</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--entry=Reset_Handler</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm0.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_xinc.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\app\Startup\xc60xx\startup_xinc.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_xinc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_it_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\system_it_xinc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>app</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_64m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_64m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_2_4g_main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_2_4g_main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rf_compatible_normal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\rf_compatible_normal.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_systick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_ll_usb_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_ll_usb_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_pcd_np.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_pcd_np.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_hal_usb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\usb_driver\xc_hal_usb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_fmc_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_calib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/App/hid_keyboard</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usb_device.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_keyboard\usb_device.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_desc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\App\hid_keyboard\usbd_desc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>USB_DEVICE/Target/hid_keyboard</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_conf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\USB_DEVICE\Target\hid_keyboard\usbd_conf.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Core</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ctlreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ctlreq.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usbd_ioreq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Core\Src\usbd_ioreq.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Middlewares/Library/Class/HID</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>usbd_hid_keyboard.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\xc6xx_drivers\Drivers\USB\Middlewares\Library\Class\HID\Src\usbd_hid_keyboard.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Config</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rf_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\app\rf_config\rf_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>RF_Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>xc6xxx_rf_2_4g.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc6xxx_rf_2_4g\xc6xxx_rf_2_4g.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_software_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\..\component\rf24\Drivers\xc_rf24g_register\xc_software_crc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName>usbd_hid_keyboard_xc62xx</LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -0,0 +1,203 @@
|
||||
# USBD_HID_24G_KEYBOARD
|
||||
|
||||
# 1. 介绍
|
||||
|
||||
该文档针对usbd_hid_24g_keyboard的demo进行说明,通过USB将设备枚举成键盘设备,并在此基础上加入2.4G功能。
|
||||
|
||||
## 1.1 工程路径
|
||||
|
||||
在 `..\project\example\driver\usb\usbd_hid_24g_keyboard`
|
||||
|
||||
```text
|
||||
usb
|
||||
|---usbd_hid_24g_keyboard
|
||||
```
|
||||
|
||||
- usbd_hid_24g_keyboard:键盘+2.4G设备
|
||||
|
||||
## 1.2 工程文件结构
|
||||
|
||||
找到自己需要的设备类型,打开文件夹后可以看到如下app和mdk文件夹。
|
||||
|
||||
```text
|
||||
mdk:keil工程文件夹
|
||||
app:内含四个文件夹
|
||||
|---api:应用代码所需要的.h文件
|
||||
|---rf_config:rf 2.4g配置文件
|
||||
|---src:主要应用代码
|
||||
|---Startup:启动文件
|
||||
```
|
||||
|
||||
# 2.使用说明
|
||||
|
||||
## usbd_hid_24g_keyboard
|
||||
|
||||
本工程通过USB接口实现一个HID键盘的功能,同时使用2.4G收发数据。
|
||||
|
||||
工程路径:..\project\example\driver\usb\usbd_hid_24g_keyboard\mdk,双击usbd_hid_24g_keyboard_xc62xx.uvprojx打开工程。
|
||||
|
||||
打开工程后,在app路径下可以找到main.c,main函数如下:
|
||||
|
||||
```c
|
||||
int main(void)
|
||||
{
|
||||
clock_init();
|
||||
|
||||
app_uart_init( );
|
||||
|
||||
DEBUG("__USB_HID_2_4G_KEYBOARD_DEMO__\n");
|
||||
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
/* rf 2.4g initialization configuration */
|
||||
rf24g_init();
|
||||
rf_compatible_config();
|
||||
|
||||
#if (XINCX_RF_TRANS_RATE == RATE_2M)
|
||||
/* Set 2M mode register configuration */
|
||||
/* Don't move this function interface */
|
||||
rf_2M_config();
|
||||
#endif //(XINCX_RF_TRANS_RATE == RATE_2M)
|
||||
|
||||
#if (XINCX_RF_NVIC_MODE)
|
||||
|
||||
/* Enable RF2.4G interrupts */
|
||||
NVIC_EnableIRQ(RF24G_IRQn);
|
||||
/* Configure the RF2.4G interrupt priority */
|
||||
NVIC_SetPriority(RF24G_IRQn, 1);
|
||||
#endif // XINCX_RF_NVIC_MODE
|
||||
/* Set the communication mode */
|
||||
rf_switch_mode(XINCX_RF_MODE, XINCX_2_4G_CHANNEL);
|
||||
|
||||
#if (XINCX_RF_MODE == TRX_MODE)
|
||||
timer_init(RF_TX_TIMERx, SEND_TIMERMS_CNT);
|
||||
#endif
|
||||
#ifdef DEBUG_LOG
|
||||
/* Register information printing */
|
||||
rf_dump_log();
|
||||
#endif // DEBUG_LOG
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
rf_transmit();
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_mouse_data_ready)
|
||||
{
|
||||
app_usb_keyboard_send_data(rx_buff[0]);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_mouse_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
通过上面的代码可以看到,main函数里同时包含了USB的初始化和rf 2.4g的初始化,实际工程使用时,并不需要过多关注底层代码的实现,更多的是会调用正确的 api 接口直接实现相对应的功能即可。
|
||||
|
||||
main函数的结构说明如下:
|
||||
|
||||
* `clock_init`:mcu 时钟初始化函数;
|
||||
* `app_uart_init`:mcu 打印串口相关的驱动初始化;
|
||||
* `USB_DEVICE_Init`:USB 设备初始化。这个函数是 USB 相关驱动应用的初始化接口,所有的 USB 功能的最开始的入口;
|
||||
* `rf24g_init`:rf 2.4g初始化;
|
||||
* `rf_compatible_config`:rf 2.4g兼容性配置。通过宏定义XINCX_RF_COMPATIBILITY_MODE控制;
|
||||
* `rf_2M_config`:配置rf 2M速率。不需要可以不调用;
|
||||
* `rf_switch_mode`:rf 2.4g接收/发送模式切换。通过修改宏XINCX_RF_MODE控制。
|
||||
|
||||
## 使用步骤
|
||||
|
||||
- 使用前准备两块开发板,并配置好想要的参数信息(也可以先不配置,使用默认的);
|
||||
|
||||
- 通过RF_Config路径下的rf_config.h配置rf 2.4g的特征,配置通过宏定义控制,比如:
|
||||
|
||||

|
||||
|
||||
- 首先在上图中配置XINCX_RF_MODE=RX_Mode,然后点击重新编译,生成可烧录的.bin文件,路径为:..\mdk\Output\1_xip_download.bin,使用烧录工具将该.bin文件烧录到开发板一,此时开发板一就作为2.4g的接收端,插上USB连接到电脑可以看到枚举成键盘的设备,打印信息如下:
|
||||
|
||||
```text
|
||||
__USB_HID_2_4G_KEYBOARD_DEMO__
|
||||
***************** 2.4G Param ******************
|
||||
CFG_TOP: 0x002bc27f
|
||||
EN_AA: 0x00000000
|
||||
EN_RXADDR: 0x00000001
|
||||
SETUP_AW: 0x000000af
|
||||
SETUP_RETR: 0x00000010
|
||||
|
||||
RF_CH: 0x000609ad
|
||||
SETUP_RF: 0x00000002
|
||||
STATUS: 0x00000000
|
||||
OBSERVE_TX: 0x00803700
|
||||
|
||||
RSSI: 0x00020000
|
||||
RX_ADDR_P0: 0xe7 e7e7e7e5
|
||||
RX_ADDR_P1: 0xc2 c2c2c2c2
|
||||
RX_ADDR_P2TOP5:0xc6c5c4c3
|
||||
BER_RESULT: 0x0000000000000000
|
||||
AGC_SETTING: 0x2bf207a8
|
||||
PGA_SETTING: 0x1c 26303a44
|
||||
TX_ADDR: 0xe7 e7e7e7e5
|
||||
RX_PW_PX: 0x2020 20202020
|
||||
STATUS_FIFO: 0x0009b311
|
||||
|
||||
RSSIREC: 0x00000000
|
||||
TXPROC_CFG: 0x080000cd
|
||||
RXPROC_CFG: 0xa0 00b06442
|
||||
DYNPD: 0x00000000
|
||||
FEATURE: 0x00000300
|
||||
PGA_SETTING_H: 0x00001ce7
|
||||
HW_CONFIG: 0x00000001
|
||||
PBT_CONFIG: 0x00555555
|
||||
PBT_TIMER: 0x00000000
|
||||
PBT_SYNC_TIME: 0x00000000
|
||||
PBT_TX_HEAD: 0x00000000
|
||||
PBT_RX_HEAD: 0x00000000
|
||||
PBT_AUTO_TRX_TIME: 0x00000000
|
||||
TX_POWER 0x00000006
|
||||
ana11_reg_l: 0x0000da47
|
||||
***********************************************
|
||||
|
||||
sizeof(USBD_HID_Keyboard_HandleTypeDef)=0x14
|
||||
```
|
||||
|
||||
- 再配置XINCX_RF_MODE=TX_Mode,然后重新编译生成.bin文件,在同一个路径,使用烧录工具将该.bin文件烧录到开发板二,此时开发板二就作为2.4g的发射端,先不要重新上电。
|
||||
|
||||
- 打开一个空白文档用于记录模拟按键盘产生的输入打印,最好点击一下文档确保光标在文档中。
|
||||
|
||||
- 给开发板二重新上电,就会看到通过开发板一不断地在向文档中打字"1234567890"。运行结果如下:
|
||||
|
||||
## 运行结果
|
||||
|
||||

|
||||
|
||||
## 代码运行逻辑
|
||||
|
||||
- 上电后各项初始化;
|
||||
- while(1)内判断2.4g的收发;
|
||||
|
||||
```c
|
||||
while(1)
|
||||
{
|
||||
rf_transmit(); //判断2.4g收发
|
||||
#if (XINCX_RF_MODE == RX_MODE)
|
||||
if(rf_2_4g_keyboard_data_ready) //判断有无鼠标数据需要USB发送
|
||||
{
|
||||
app_usb_keyboard_send_data(rx_buff[0]);
|
||||
memset(rx_buff,0,sizeof(rx_buff));
|
||||
rf_2_4g_keyboard_data_ready = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
```
|
||||
|
||||
- 2.4g收发做了两套运行逻辑:中断收发和轮询收发
|
||||
|
||||
中断模式下通过rf24g_tx_irq_flag和rf24g_rx_irq_flag两个标志位判断是否需要接收或者发送。其中tx模式下rf24g_tx_irq_flag默认为true,随后每次发送完成后在tx中断中再置位,实现不断发送;rx模式下等待2.4g接收数据,接收到后在接收中断里置位rf24g_rx_irq_flag,再在应用端处理接收到的数据。
|
||||
|
||||
轮询模式下就不需要标志位判断,tx模式下间隔一定的delay发送数据;rx模式下就判断寄存器中是否有数据,有数据就接收出来。
|
||||
|
||||
- 当接收到鼠标数据后rf_2_4g_keyboard_data_ready=1,执行app_usb_keyboard_send_data函数实现USB转发。
|
||||
|
||||
注意:demo中一次键盘的按下抬起是100ms,所以发送不能太快,要同步调节
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
#ifndef SDK_DRIVER_CONFIG_H
|
||||
#define SDK_DRIVER_CONFIG_H
|
||||
// <<< Use Configuration Wizard in Context Menu >>>\n
|
||||
#ifdef USE_APP_CONFIG
|
||||
#include "app_config.h"
|
||||
#endif
|
||||
// <h> XC_Drivers
|
||||
|
||||
// <e> XC_CLOCK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CLOCK_ENABLED
|
||||
#define XC_CLOCK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWR_ENABLED
|
||||
#define XC_PWR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_WDT_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_WDT_ENABLED
|
||||
#define XC_WDT_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_BOR_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_BOR_ENABLED
|
||||
#define XC_BOR_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SYSTICK_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SYSTICK_ENABLED
|
||||
#define XC_SYSTICK_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_TIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_TIMER_ENABLED
|
||||
#define XC_TIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_AOTIMER_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_AOTIMER_ENABLED
|
||||
#define XC_AOTIMER_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_GPIO_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_GPIO_ENABLED
|
||||
#define XC_GPIO_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_ADC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_ADC_ENABLED
|
||||
#define XC_ADC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_UART_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_UART_ENABLED
|
||||
#define XC_UART_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PWM_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PWM_ENABLED
|
||||
#define XC_PWM_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_FMC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_FMC_SPI_ENABLED
|
||||
#define XC_FMC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_SPI_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_SPI_ENABLED
|
||||
#define XC_SPI_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_IIC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_IIC_ENABLED
|
||||
#define XC_IIC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_RTC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_RTC_ENABLED
|
||||
#define XC_RTC_ENABLED 1
|
||||
#endif
|
||||
|
||||
//==========================================================
|
||||
// <q> XC_RTC_DATE_INT_ENABLED
|
||||
|
||||
#ifndef XC_RTC_DATE_INT_ENABLED
|
||||
#define XC_RTC_DATE_INT_ENABLED 0
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_DMA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_DMA_ENABLED
|
||||
#define XC_DMA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_PGA_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_PGA_ENABLED
|
||||
#define XC_PGA_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_QDEC_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_QDEC_ENABLED
|
||||
#define XC_QDEC_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <e> XC_CALIB_ENABLED
|
||||
//==========================================================
|
||||
#ifndef XC_CALIB_ENABLED
|
||||
#define XC_CALIB_ENABLED 1
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
#endif //SDK_DRIVER_CONFIG_H
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/*!
|
||||
* \file system_it_xinc.c
|
||||
*
|
||||
* \brief Target system interruption implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "system_it_xinc.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Func Prototype
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles NMI exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END NonMaskableInt_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Hard Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END HardFault_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Memory Manage exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Bus Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Usage Fault exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles SVCall exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END SVCall_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles Debug Monitor exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief This function handles PendSVC exception.
|
||||
*
|
||||
* @param[in]
|
||||
* @param[in]
|
||||
****************************************************************************************
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn */
|
||||
DEBUG("%s\n", __func__);
|
||||
/* USER CODE END PendSV_IRQn */
|
||||
while (1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/****************************** Hard Fault Handler Functions *******************************/
|
||||
/*------------------------------------------------------------------------------------
|
||||
Private Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args)
|
||||
{
|
||||
/*栈帧里面内容:*/
|
||||
unsigned int stack_r0; //压栈的 R0
|
||||
unsigned int stack_r1; //压栈的 R1
|
||||
unsigned int stack_r2; //压栈的 R2
|
||||
unsigned int stack_r3; //压栈的 R3
|
||||
unsigned int stack_r12; //压栈的 R12
|
||||
unsigned int stack_lr; //压栈的 lr
|
||||
unsigned int stack_pc; //压栈的 pc
|
||||
unsigned int stack_psr; //压栈的 psr
|
||||
|
||||
stack_r0 = ((unsigned int)HardFault_args[0]);
|
||||
stack_r1 = ((unsigned int)HardFault_args[1]);
|
||||
stack_r2 = ((unsigned int)HardFault_args[2]);
|
||||
stack_r3 = ((unsigned int)HardFault_args[3]);
|
||||
stack_r12 = ((unsigned int)HardFault_args[4]);
|
||||
stack_lr = ((unsigned int)HardFault_args[5]);
|
||||
stack_pc = ((unsigned int)HardFault_args[6]);
|
||||
stack_psr = ((unsigned int)HardFault_args[7]);
|
||||
|
||||
DEBUG("----%s----\n", __func__);
|
||||
DEBUG("R0=%x\n",stack_r0);
|
||||
DEBUG("R1=%x\n",stack_r1);
|
||||
DEBUG("R2=%x\n",stack_r2);
|
||||
DEBUG("R3=%x\n",stack_r3);
|
||||
DEBUG("R12=%x\n",stack_r12);
|
||||
DEBUG("LR[R14]=%x\n",stack_lr);
|
||||
DEBUG("PC[R15]=%x\n",stack_pc);
|
||||
DEBUG("PSR=%x\n",stack_psr);
|
||||
DEBUG("SCB_SHCSR=%x\n",SCB->SHCSR);
|
||||
DEBUG("---------------------------\n");
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file system_it_xinc.h
|
||||
*
|
||||
* \brief The header of system_it_xinc.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SYSTEM_IT_XINC_H__
|
||||
#define __SYSTEM_IT_XINC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void NMI_Handler( void );
|
||||
void HardFault_Handler( void );
|
||||
void MemManage_Handler( void );
|
||||
void BusFault_Handler( void );
|
||||
void UsageFault_Handler( void );
|
||||
void SVC_Handler( void );
|
||||
void DebugMon_Handler( void );
|
||||
void PendSV_Handler( void );
|
||||
|
||||
void HardFault_Handler_c(unsigned int * HardFault_args);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_IT_XINC_H__ */
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define __DEBUG_OUT_PORT 0
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
void debug_uart_init(void)
|
||||
{
|
||||
#if (__DEBUG_OUT_PORT == 0)
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
#else
|
||||
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART1_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_14;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART1_RX;
|
||||
gpio_cfg.Pin = GPIO_15;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART1_IDX, &uart_cfg);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#define VECTOR_NUM 48
|
||||
|
||||
void set_vector(void)
|
||||
{
|
||||
#if (USE_XIP == 1)
|
||||
GLOBAL_INT_DISABLE();
|
||||
for (uint32_t i = 0, *Pvector = (uint32_t *)(0x11001000 + 0),
|
||||
*_vector_table = (uint32_t *)(0x10000000);
|
||||
i < VECTOR_NUM; i++) // copy vertor table
|
||||
{
|
||||
_vector_table[i] = *Pvector++;
|
||||
}
|
||||
|
||||
*((volatile unsigned int *)(0x4000013C)) =
|
||||
0x10000001; // inter vertor table remap
|
||||
GLOBAL_INT_RESTORE();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WDT_ResetInit(void)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
|
||||
cpr_lp_ctl__ctl_wdt_tclk_en__setf(ENABLE);
|
||||
wdt_cr__wdt_en__setf(DISABLE);
|
||||
}
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
|
||||
WDT_ResetInit();
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
set_vector();
|
||||
#endif
|
||||
|
||||
debug_uart_init();
|
||||
}
|
||||
|
||||
__RAM_CODE int sendchar(int c)
|
||||
{
|
||||
unsigned int status;
|
||||
#if (__DEBUG_OUT_PORT == 1)
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40011000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40011000 + 0x00))) = c;
|
||||
return (1);
|
||||
#else
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40010000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40010000 + 0x00))) = c;
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle; /* Add whatever you need here */
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
__RAM_CODE int fputc(int ch, FILE *f) { return (sendchar(ch)); }
|
||||
|
||||
int ferror(FILE *f)
|
||||
{
|
||||
/* Your implementation of ferror */
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void _ttywrch(int ch) { sendchar(ch); }
|
||||
|
||||
void _sys_exit(int return_code)
|
||||
{
|
||||
label:
|
||||
goto label; /* endless loop */
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_xinc.s
|
||||
; * @purpose: CMSIS Cortex-M0 Core Device Startup File for the
|
||||
; * Device xinc.
|
||||
; *****************************************************************************/
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
; ToDo: Add here the vectors for the device specific external interrupts handler
|
||||
DCD BLE_Handler ; 0
|
||||
DCD DMA_Handler ; 1
|
||||
DCD CPR_Handler ; 2
|
||||
DCD GPIO_Handler ; 3
|
||||
DCD RTC_Handler ; 4
|
||||
DCD TIMER0_Handler ; 5
|
||||
DCD TIMER1_Handler ; 6
|
||||
DCD TIMER2_Handler ; 7
|
||||
DCD TIMER3_Handler ; 8
|
||||
DCD WDT_Handler ; 9
|
||||
DCD I2C_Handler ; 10
|
||||
DCD UART0_Handler ; 11
|
||||
DCD UART1_Handler ; 12
|
||||
DCD SPI0_Handler ; 13
|
||||
DCD SPI1_Handler ; 14
|
||||
DCD 0 ; 15
|
||||
DCD 0 ; 16
|
||||
DCD GADC_Handler ; 17
|
||||
DCD PWM_Handler ; 18
|
||||
DCD AES_Handler ; 19
|
||||
DCD USB_Handler ; 20
|
||||
DCD AUDIO_Handler ; 21
|
||||
DCD RF24G_Handler ; 22
|
||||
DCD SPI2_Handler ; 23
|
||||
DCD MPU_Handler ; 24
|
||||
DCD UART2_Handler ; 25
|
||||
DCD I2S_Handler ; 26
|
||||
DCD AOTIMER0_Handler ; 27
|
||||
DCD AOTIMER1_Handler ; 28
|
||||
DCD CMP_Handler ; 29
|
||||
DCD FMC_Handler ; 30
|
||||
DCD CAN_Handler ; 31
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
|
||||
LDR r0, =0x4000013C ; remap
|
||||
LDR r1, =0x10000001
|
||||
STR r1, [r0]
|
||||
|
||||
|
||||
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
IMPORT HardFault_Handler_c ;函数声明
|
||||
movs r0, #4 ;判断主栈指针还是进程栈指针
|
||||
mov r1, lr
|
||||
tst r0, r1
|
||||
beq hf_used_msp ;如果是主栈指针
|
||||
mrs r0, psp ;否则是进程栈指针,把进程栈指针地址付给 R0
|
||||
ldr r1, =HardFault_Handler_c ;跳转到 HardFault 中断程序
|
||||
bx r1
|
||||
hf_used_msp
|
||||
mrs r0, msp ;把主栈指针地址赋给 R0
|
||||
ldr r1, =HardFault_Handler_c
|
||||
bx r1
|
||||
;EXPORT HardFault_Handler [WEAK]
|
||||
;B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT BLE_Handler [WEAK]
|
||||
EXPORT DMA_Handler [WEAK]
|
||||
EXPORT CPR_Handler [WEAK]
|
||||
EXPORT GPIO_Handler [WEAK]
|
||||
EXPORT RTC_Handler [WEAK]
|
||||
EXPORT TIMER0_Handler [WEAK]
|
||||
EXPORT TIMER1_Handler [WEAK]
|
||||
EXPORT TIMER2_Handler [WEAK]
|
||||
EXPORT TIMER3_Handler [WEAK]
|
||||
EXPORT WDT_Handler [WEAK]
|
||||
EXPORT I2C_Handler [WEAK]
|
||||
EXPORT UART0_Handler [WEAK]
|
||||
EXPORT UART1_Handler [WEAK]
|
||||
EXPORT SPI0_Handler [WEAK]
|
||||
EXPORT SPI1_Handler [WEAK]
|
||||
;EXPORT KBS_Handler [WEAK]
|
||||
;EXPORT QDEC_Handler [WEAK]
|
||||
EXPORT GADC_Handler [WEAK]
|
||||
EXPORT PWM_Handler [WEAK]
|
||||
EXPORT AES_Handler [WEAK]
|
||||
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
|
||||
EXPORT USB_Handler [WEAK];20
|
||||
EXPORT AUDIO_Handler [WEAK];21
|
||||
EXPORT RF24G_Handler [WEAK];22
|
||||
EXPORT SPI2_Handler [WEAK];23
|
||||
EXPORT MPU_Handler [WEAK];24
|
||||
EXPORT UART2_Handler [WEAK];25
|
||||
EXPORT I2S_Handler [WEAK];26
|
||||
EXPORT AOTIMER0_Handler [WEAK];27
|
||||
EXPORT AOTIMER1_Handler [WEAK];28
|
||||
EXPORT CMP_Handler [WEAK];29
|
||||
EXPORT FMC_Handler [WEAK];30
|
||||
EXPORT CAN_Handler [WEAK];31
|
||||
|
||||
PendSV_Handler
|
||||
SysTick_Handler
|
||||
BLE_Handler
|
||||
RF24G_Handler
|
||||
DMA_Handler
|
||||
CPR_Handler
|
||||
GPIO_Handler
|
||||
RTC_Handler
|
||||
TIMER0_Handler
|
||||
TIMER1_Handler
|
||||
TIMER2_Handler
|
||||
TIMER3_Handler
|
||||
WDT_Handler
|
||||
I2C_Handler
|
||||
I2S_Handler
|
||||
UART0_Handler
|
||||
UART1_Handler
|
||||
UART2_Handler
|
||||
SPI0_Handler
|
||||
SPI1_Handler
|
||||
SPI2_Handler
|
||||
MPU_Handler
|
||||
;KBS_Handler
|
||||
;QDEC_Handler
|
||||
GADC_Handler
|
||||
PWM_Handler
|
||||
AUDIO_Handler
|
||||
;SIM_Handler
|
||||
AES_Handler
|
||||
AOTIMER0_Handler
|
||||
AOTIMER1_Handler
|
||||
CMP_Handler
|
||||
FMC_Handler
|
||||
CAN_Handler
|
||||
USB_Handler
|
||||
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, = (Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
END
|
||||
@@ -0,0 +1,216 @@
|
||||
/*!
|
||||
* \file main.c
|
||||
*
|
||||
* \brief Target main implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include "xc6xxx.h"
|
||||
#include "usbd_core.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_hid_mouse.h"
|
||||
#include "usbd_hid_keyboard.h"
|
||||
#include "usbd_hid_custom.h"
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void SysTick_Callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void clock_init(void)
|
||||
{
|
||||
CLOCK_InitCfg_t clock_cfg;
|
||||
|
||||
clock_cfg.hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
clock_cfg.hfclk_in = CLOCK_HFCLK_IN_48M;
|
||||
clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
|
||||
if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_XTAL) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32768;
|
||||
} else if (clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_RC) {
|
||||
clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
}
|
||||
|
||||
xc_clock_init_cfg(&clock_cfg);
|
||||
|
||||
SysTick_Config(xc_clock_hfclk_in_get() / 100);
|
||||
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
void app_uart_init(void)
|
||||
{
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
}
|
||||
|
||||
void GetPointerData(uint8_t *pbuf)
|
||||
{
|
||||
static int32_t move_cnt = 0;
|
||||
static uint8_t step_x_y = 0;
|
||||
static int8_t x = 0, y = 0;
|
||||
static uint16_t cursor_step = 2;
|
||||
static uint16_t cursor_width = 200;
|
||||
|
||||
move_cnt++;
|
||||
if (move_cnt > cursor_width) {
|
||||
step_x_y++;
|
||||
step_x_y = step_x_y % 4;
|
||||
move_cnt = 0;
|
||||
}
|
||||
|
||||
switch (step_x_y) {
|
||||
case 0: {
|
||||
y = 0;
|
||||
x = cursor_step;
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
x = 0;
|
||||
y = cursor_step;
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
y = 0;
|
||||
x = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
x = 0;
|
||||
y = (int8_t)(-cursor_step);
|
||||
} break;
|
||||
}
|
||||
|
||||
pbuf[0] = 0;
|
||||
pbuf[1] = x;
|
||||
pbuf[2] = y;
|
||||
pbuf[3] = 0;
|
||||
}
|
||||
|
||||
#ifdef APP_USB_MOUSE_FAST_SEND_DATA
|
||||
void app_usb_mouse_fast_send_data(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
uint8_t data[4];
|
||||
GLOBAL_INT_DISABLE();
|
||||
GetPointerData(data);
|
||||
(void)USBD_LL_Transmit(pdev, HID_MOUSE_EPIN_ADDR, data, HID_MOUSE_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
#endif
|
||||
|
||||
void app_usb_mouse_send_data(void)
|
||||
{
|
||||
uint8_t data[4];
|
||||
GetPointerData(data);
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Mouse_FirstSendReport(&hUsbDeviceFS, data, HID_MOUSE_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
|
||||
void app_usb_keyboard_send_data(void)
|
||||
{
|
||||
const uint8_t key_codes[] = {0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26};
|
||||
uint8_t key_data[HID_KEYBOARD_EPIN_SIZE] = {0};
|
||||
for(int i=0;i<9;i++){
|
||||
|
||||
key_data[2] = key_codes[i];
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Keyboard_FirstSendReport(&hUsbDeviceFS, key_data, HID_KEYBOARD_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
delay_ms(50);
|
||||
|
||||
key_data[2] = 0x0;
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Keyboard_FirstSendReport(&hUsbDeviceFS, key_data, HID_KEYBOARD_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
delay_ms(50);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void app_usb_custom_send_data(void)
|
||||
{
|
||||
uint8_t data[HID_CUSTOM_EPIN_SIZE];
|
||||
|
||||
for (int i = 0; i < HID_CUSTOM_EPIN_SIZE; i++) {
|
||||
data[i] = i;
|
||||
}
|
||||
GLOBAL_INT_DISABLE();
|
||||
USBD_HID_Custom_FirstSendReport(&hUsbDeviceFS, data, HID_CUSTOM_EPIN_SIZE);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clock_init();
|
||||
|
||||
app_uart_init( );
|
||||
|
||||
DEBUG("__USB_HID_COMPOSITE_DEMO__\n");
|
||||
|
||||
/* USB Device Initialization */
|
||||
USB_DEVICE_Init( );
|
||||
|
||||
while(1)
|
||||
{
|
||||
delay_ms(1);
|
||||
app_usb_mouse_send_data();
|
||||
app_usb_keyboard_send_data();
|
||||
app_usb_custom_send_data();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
SP = _RDWORD(0x10000000);
|
||||
PC = _RDWORD(0x10000004);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
FUNC void InitGpio(void)
|
||||
{
|
||||
// Config IOMUX
|
||||
/*
|
||||
gpio_mux_ctl_u(33,1);//d2
|
||||
gpio_mux_ctl_u(34,1);//d3
|
||||
gpio_mux_ctl_u(35,2);//clk
|
||||
gpio_mux_ctl_u(36,2);//cs
|
||||
gpio_mux_ctl_u(37,2);//d0 rx
|
||||
gpio_mux_ctl_u(38,2);//d1 tx
|
||||
*/
|
||||
_WDWORD(0x4000019c, 0x00002A94);
|
||||
}
|
||||
FUNC void InitFlash(void)
|
||||
{
|
||||
|
||||
}
|
||||
FUNC void InitXIP(void)
|
||||
{
|
||||
|
||||
_WDWORD(0x40000104,0x040000);//reset ssi0
|
||||
_WDWORD(0x40000104,0x040004);//reset ssi0
|
||||
_WDWORD(0x40000050,0x110000);//close spi0 mclk
|
||||
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
|
||||
|
||||
|
||||
//config fmc
|
||||
_WDWORD(0x40000270, 0x0503);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x40000270, 0x3503);
|
||||
//config cache
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x0);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x21);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
|
||||
|
||||
//config xip spi
|
||||
_WDWORD(0x51000008, 0); //disable spi
|
||||
|
||||
_WDWORD(0x5100002c,0); //close IE
|
||||
_WDWORD(0x51000000,0x1F); //32bit SPI data
|
||||
_WDWORD(0x51000010,0x01); //enable select slave -- SE
|
||||
_WDWORD(0x51000018,0x0); //TXFTL be set 0
|
||||
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
|
||||
|
||||
_WDWORD(0x5100010c, 0x01);//enable select slave
|
||||
_WDWORD(0x51000114, 0xFF);//XIP time out
|
||||
|
||||
_WDWORD(0x51000014, 0x2);//div 2
|
||||
|
||||
//quad
|
||||
_WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
|
||||
_WDWORD(0x51000100, 0x6b);//quad read cmd
|
||||
_WDWORD(0x51000104, 0x6b);//quad read cmd
|
||||
|
||||
|
||||
// //dual
|
||||
// _WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
|
||||
// _WDWORD(0x51000100, 0x3b);//dual read cmd
|
||||
// _WDWORD(0x51000104, 0x3b);//dual read cmd
|
||||
|
||||
|
||||
_WDWORD(0x51000008, 1); //enable spi
|
||||
}
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
InitGpio();
|
||||
InitFlash();
|
||||
InitXIP();
|
||||
SP = _RDWORD(0x11001000);
|
||||
PC = _RDWORD(0x11001004);
|
||||
_WDWORD(0x4000013C, 0x11001001);
|
||||
}
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
LOAD 0x10000000
|
||||
{
|
||||
EXE 0x10000000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
RW +0
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
LOAD 0x11001000
|
||||
{
|
||||
EXE 0x11001000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x10000200
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
*(ram_code)
|
||||
}
|
||||
|
||||
ScatterAssert((0x000+ImageLength(RW)) < 1024 * 32)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LOAD 0x11001000 0x0007f000
|
||||
{
|
||||
EXE 0x11001000 0x00010000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
*(InRoot$$Sections)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
RW 0x100000C8 0x1F38
|
||||
{
|
||||
*(+RW,+ZI)
|
||||
*(ram_code)
|
||||
aeabi_sdiv.o(.text)
|
||||
uread4.o(.text)
|
||||
rt_memclr.o(.text)
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user