cun
This commit is contained in:
21
apps/earphone/94_rfid_stc/inc/MIFARE.h
Normal file
21
apps/earphone/94_rfid_stc/inc/MIFARE.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef _MIFARE_H_
|
||||
#define _MIFARE_H_
|
||||
#define KEY_A_M1 0
|
||||
#define KEY_B_M1 1
|
||||
|
||||
extern unsigned char SECTOR,BLOCK,BLOCK_NUM;
|
||||
extern unsigned char BLOCK_DATA[16];
|
||||
extern unsigned char KEY_A[16][6];
|
||||
extern unsigned char KEY_B[16][6];
|
||||
extern unsigned char MIFARE_CARD_EVENT(void);
|
||||
extern void Mifare_Clear_Crypto(void);
|
||||
unsigned char Mifare_LoadKey(unsigned char *mifare_key);
|
||||
extern unsigned char Mifare_Transfer(unsigned char block);
|
||||
extern unsigned char Mifare_Restore(unsigned char block);
|
||||
extern unsigned char Mifare_Blockset(unsigned char block,unsigned char *data_buff);
|
||||
extern unsigned char Mifare_Blockinc(unsigned char block,unsigned char *data_buff);
|
||||
extern unsigned char Mifare_Blockdec(unsigned char block,unsigned char *data_buff);
|
||||
extern unsigned char Mifare_Blockwrite(unsigned char block,unsigned char *data_buff);
|
||||
extern unsigned char Mifare_Blockread(unsigned char block,unsigned char *data_buff);
|
||||
extern unsigned char Mifare_Auth(unsigned char key_mode,unsigned char sector,unsigned char *mifare_key,unsigned char *card_uid);
|
||||
#endif
|
||||
73
apps/earphone/94_rfid_stc/inc/MIFARE_commented.h
Normal file
73
apps/earphone/94_rfid_stc/inc/MIFARE_commented.h
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @file MIFARE.h
|
||||
* @brief MIFARE Classic 卡应用层驱动接口
|
||||
* @version 1.0
|
||||
* @date 2024-05-20
|
||||
*
|
||||
* @par 文件作用:
|
||||
* 该文件为操作 MIFARE Classic 卡片提供了高层接口。它建立在 READER.c
|
||||
* 提供的 Type A 协议基础之上,封装了 MIFARE 卡特有的操作,如密码认证、
|
||||
* 块读写和值块操作。
|
||||
* 主应用逻辑通过包含此文件并调用其声明的函数,来完成对 MIFARE 卡的
|
||||
* 具体业务操作。
|
||||
*/
|
||||
#ifndef _MIFARE_H_
|
||||
#define _MIFARE_H_
|
||||
|
||||
//==================================================================================
|
||||
// 1. 宏定义
|
||||
//==================================================================================
|
||||
#define KEY_A_M1 0 // 定义认证模式为 Key A
|
||||
#define KEY_B_M1 1 // 定义认证模式为 Key B
|
||||
|
||||
//==================================================================================
|
||||
// 2. 全局变量声明
|
||||
// 这些变量用于在不同函数间传递操作上下文。
|
||||
//==================================================================================
|
||||
extern unsigned char SECTOR; // 当前要操作的扇区号
|
||||
extern unsigned char BLOCK; // 当前要操作的扇区内块号 (0-3)
|
||||
extern unsigned char BLOCK_NUM; // 当前要操作的块的绝对地址 (0-63 for 1K)
|
||||
extern unsigned char BLOCK_DATA[16]; // 用于暂存读/写块数据的16字节缓冲区
|
||||
extern unsigned char KEY_A[16][6]; // 存储16个扇区的 Key A 密钥
|
||||
extern unsigned char KEY_B[16][6]; // 存储16个扇区的 Key B 密钥
|
||||
|
||||
//==================================================================================
|
||||
// 3. 函数原型声明
|
||||
//==================================================================================
|
||||
|
||||
/** @brief MIFARE 卡事件处理流程 (示例函数) */
|
||||
extern unsigned char MIFARE_CARD_EVENT(void);
|
||||
|
||||
/** @brief 清除芯片的 MIFARE 加密状态 */
|
||||
extern void Mifare_Clear_Crypto(void);
|
||||
|
||||
/** @brief 加载6字节密钥到读卡器芯片内部的密钥缓冲器 */
|
||||
unsigned char Mifare_LoadKey(unsigned char *mifare_key);
|
||||
|
||||
/** @brief **核心函数**: 对指定扇区进行密码认证 */
|
||||
extern unsigned char Mifare_Auth(unsigned char key_mode, unsigned char sector, unsigned char *mifare_key, unsigned char *card_uid);
|
||||
|
||||
/** @brief 读取一个16字节的数据块 */
|
||||
extern unsigned char Mifare_Blockread(unsigned char block, unsigned char *data_buff);
|
||||
|
||||
/** @brief 写入一个16字节的数据块 */
|
||||
extern unsigned char Mifare_Blockwrite(unsigned char block, unsigned char *data_buff);
|
||||
|
||||
// --- 值块操作函数 (用于电子钱包等应用) ---
|
||||
|
||||
/** @brief 将一个块格式化为值块 */
|
||||
extern unsigned char Mifare_Blockset(unsigned char block, unsigned char *data_buff);
|
||||
|
||||
/** @brief 对值块进行加值操作 */
|
||||
extern unsigned char Mifare_Blockinc(unsigned char block, unsigned char *data_buff);
|
||||
|
||||
/** @brief 对值块进行减值操作 */
|
||||
extern unsigned char Mifare_Blockdec(unsigned char block, unsigned char *data_buff);
|
||||
|
||||
/** @brief 将值块缓冲区的数据传送到数据块 */
|
||||
extern unsigned char Mifare_Transfer(unsigned char block);
|
||||
|
||||
/** @brief 将数据块内容加载到值块缓冲区 */
|
||||
extern unsigned char Mifare_Restore(unsigned char block);
|
||||
|
||||
#endif
|
||||
83
apps/earphone/94_rfid_stc/inc/board.h
Normal file
83
apps/earphone/94_rfid_stc/inc/board.h
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file board.h
|
||||
* @author SRG
|
||||
* @version V1.0.0
|
||||
* @date 2020-03-17
|
||||
* @brief
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 FudanMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H_
|
||||
#define __BOARD_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
//#include "fm15l0xx.h"
|
||||
|
||||
|
||||
|
||||
//typedef enum
|
||||
//{
|
||||
// Mode_In_Up = 0, //<2F><><EFBFBD>٣<EFBFBD>pullup
|
||||
// Mode_In_No, //<2F><><EFBFBD>٣<EFBFBD>nopull
|
||||
// Mode_In_Down, //<2F><><EFBFBD>٣<EFBFBD>pulldown
|
||||
// Mode_Out_Up, //<2F><><EFBFBD>٣<EFBFBD><D9A3><EFBFBD><EFBFBD>죬pullup
|
||||
// Mode_Out_No, //<2F><><EFBFBD>٣<EFBFBD><D9A3><EFBFBD><EFBFBD>죬nopull
|
||||
// Mode_Out_Down, //<2F><><EFBFBD>٣<EFBFBD><D9A3><EFBFBD><EFBFBD>죬pulldown
|
||||
//} eGPIOMode;
|
||||
|
||||
|
||||
//HMI LED
|
||||
|
||||
|
||||
#define LED1_PIN LL_GPIO_Pin3 //PC3
|
||||
#define LED2_PIN LL_GPIO_Pin4 //PC4
|
||||
#define LED_GPIO GPIOC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define LED1_On LL_GPIO_SetOutputPin( LED_GPIO, LED1_PIN )
|
||||
#define LED1_Off LL_GPIO_ResetOutputPin( LED_GPIO, LED1_PIN )
|
||||
|
||||
#define LED2_On LL_GPIO_SetOutputPin( LED_GPIO, LED2_PIN )
|
||||
#define LED2_Off LL_GPIO_ResetOutputPin( LED_GPIO, LED2_PIN )
|
||||
|
||||
|
||||
|
||||
|
||||
#define TEST_ADC_CH LL_ADC_CHANNEL_1
|
||||
|
||||
uint8_t UserKey_GetData( void );
|
||||
|
||||
void GPIO_NVIC_Init( void );
|
||||
|
||||
void Set_Clk(unsigned char mode);
|
||||
void SVD_Init( void );
|
||||
void BSP_Init( void );
|
||||
|
||||
uint16_t Get_Adc_Average( uint32_t ch, uint32_t ch_in, uint8_t cnt );
|
||||
|
||||
void LowPower_test( void );
|
||||
|
||||
void MCU_EnterLowerPowerMode( void );
|
||||
|
||||
void Set_Output(unsigned char mode);
|
||||
void Set_Pwm(unsigned char mode);
|
||||
void Set_FM440_Power(unsigned char mode);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
10
apps/earphone/94_rfid_stc/inc/bsp.h
Normal file
10
apps/earphone/94_rfid_stc/inc/bsp.h
Normal file
@ -0,0 +1,10 @@
|
||||
#include "main.h"
|
||||
|
||||
void bsp_init( void );
|
||||
|
||||
|
||||
void gpio_init( void );
|
||||
|
||||
|
||||
void uart_init( void );
|
||||
|
||||
46
apps/earphone/94_rfid_stc/inc/fm15l0xx_it.h
Normal file
46
apps/earphone/94_rfid_stc/inc/fm15l0xx_it.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file Templates_LL/Inc/fm15l0xx_it.h
|
||||
* @author FMSH AS Embedded Software Team
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FM15L0XX_IT_H__
|
||||
#define __FM15L0XX_IT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
// #include "main.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void NMI_Handler( void );
|
||||
|
||||
|
||||
void HardFault_Handler( void );
|
||||
|
||||
|
||||
void SVC_Handler( void );
|
||||
|
||||
|
||||
void PendSV_Handler( void );
|
||||
|
||||
|
||||
void SysTick_Handler( void );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FM15L0XX_IT_H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT FMSH Microelectronics *****END OF FILE****/
|
||||
146
apps/earphone/94_rfid_stc/inc/fm15l0xx_ll_rng.h
Normal file
146
apps/earphone/94_rfid_stc/inc/fm15l0xx_ll_rng.h
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
************************************************************************************************************
|
||||
* @file : fm15l0xx_ll_rng.h
|
||||
* @author : weifan
|
||||
* @version : V1.0.0
|
||||
* @date : 2020-12-15
|
||||
* @brief :
|
||||
************************************************************************************************************
|
||||
* @attention :
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 FudanMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
************************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __FM15L0XX_LL_RNG_H__
|
||||
#define __FM15L0XX_LL_RNG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "fm15l0xx.h"
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Set RegBit 'RNG_CR_RNGEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @return : None
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE void LL_RNG_Enable( void )
|
||||
{
|
||||
SET_BIT( RNG->CR, RNG_CR_RNGEN_MSK );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Set RegBit 'RNG_CR_RNGEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @return : None
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE void LL_RNG_Disable( void )
|
||||
{
|
||||
CLEAR_BIT( RNG->CR, RNG_CR_RNGEN_MSK );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Get RegBit 'RNG_CR_RNGEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @retrun : RNGEN : uint32_t, RNGEN
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE uint32_t LL_RNG_IsEnabled( void )
|
||||
{
|
||||
return ( (uint32_t) (READ_BIT( RNG->CR, RNG_CR_RNGEN_MSK ) == RNG_CR_RNGEN_MSK) );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Set RegBit 'RNG_CR_SRCEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @return : None
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE void LL_RNG_EnableNoiseSource( void )
|
||||
{
|
||||
SET_BIT( RNG->CR, RNG_CR_SRCEN_MSK );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Set RegBit 'RNG_CR_SRCEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @return : None
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE void LL_RNG_DisableNoiseSource( void )
|
||||
{
|
||||
CLEAR_BIT( RNG->CR, RNG_CR_SRCEN_MSK );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Get RegBit 'RNG_CR_SRCEN' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @retrun : SRCEN : uint32_t, SRCEN
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE uint32_t LL_RNG_IsEnabledNoiseSource( void )
|
||||
{
|
||||
return ( (uint32_t) (READ_BIT( RNG->CR, RNG_CR_SRCEN_MSK ) == RNG_CR_SRCEN_MSK) );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Get RegBit 'RNG_SR_DRDY' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @retrun : DRDY : uint32_t, DRDY
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE uint32_t LL_RNG_IsDataReady( void )
|
||||
{
|
||||
return ( (uint32_t) (READ_BIT( RNG->SR, RNG_SR_DRDY_MSK ) == RNG_SR_DRDY_MSK) );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Set RegBit 'RNG_SR_SFAIL' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// SFAIL : uint32_t, SFAIL
|
||||
// @return : None
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE void LL_RNG_ClearFlag_SFAIL( void )
|
||||
{
|
||||
RNG->SR = RNG_SR_SFAIL_MSK;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Get RegBit 'RNG_SR_SFAIL' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @retrun : SFAIL : uint32_t, SFAIL
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SFAIL( void )
|
||||
{
|
||||
return ( (uint32_t) (READ_BIT( RNG->SR, RNG_SR_SFAIL_MSK ) == RNG_SR_SFAIL_MSK) );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// @descrption : This Function Get RegBit 'RNG_DR_RNGOUT' Value
|
||||
// @arguments : *RNGx : Struct RNG_Typedef Pointer
|
||||
// @retrun : RNGOUT : uint32_t, RNGOUT
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
__STATIC_INLINE uint32_t LL_RNG_GetRandomData( void )
|
||||
{
|
||||
return ( (uint32_t) (READ_BIT( RNG->DR, RNG_DR_RNGOUT_MSK ) ) );
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#endif // __FM15L0XX_LL_RNG_H__
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT FudanMicroelectronics *****END OF FILE****/
|
||||
|
||||
191
apps/earphone/94_rfid_stc/inc/function.h
Normal file
191
apps/earphone/94_rfid_stc/inc/function.h
Normal file
@ -0,0 +1,191 @@
|
||||
/**
|
||||
************************************* Copyright ******************************
|
||||
* (C) Copyright 2019,TuYW,FMSH,China.
|
||||
* All Rights Reserved
|
||||
* By(Shanghai Fudan MicroeleCardTyperonics Group Company Limited)
|
||||
* https://www.fmsh.com
|
||||
*
|
||||
* FileName : function.h
|
||||
* Version : v1.0
|
||||
* Author : TuYW
|
||||
* Date : 2019-03-19
|
||||
* Description:
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FUNCTION_H_
|
||||
#define __FUNCTION_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
//#include "stdint.h"
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
// #include "fm15l0xx.h"
|
||||
//#include "core_cm3.h"
|
||||
//#include "sys.h"
|
||||
|
||||
|
||||
//#if APP_NO_IAP == 1
|
||||
// #define APP_ADDR 1
|
||||
//#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
#define REG32( addr ) (*( ( volatile unsigned long *) (addr) ) )
|
||||
|
||||
//#define assert_param(expr) ((void)0)
|
||||
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */
|
||||
typedef signed char INT8S; /* Signed 8 bit quantity */
|
||||
typedef unsigned short INT16U; /* Unsigned 16 bit quantity */
|
||||
typedef signed short INT16S; /* Signed 16 bit quantity */
|
||||
typedef unsigned int INT32U; /* Unsigned 32 bit quantity */
|
||||
typedef signed int INT32S; /* Signed 32 bit quantity */
|
||||
typedef float FP32; /* Single precision floating point */
|
||||
typedef double FP64; /* Double precision floating point */
|
||||
|
||||
|
||||
/*********************************************************************************************************
|
||||
ͨ<>ú궨<C3BA><EAB6A8>
|
||||
*********************************************************************************************************/
|
||||
#define PROGRAM_IAP_BASE FLASH_IAP_ADDR
|
||||
#define PROGRAM_IAP_LENGTH 0X6000
|
||||
|
||||
#define PROGRAM_APP_BASE FLASH_APP1_ADDR
|
||||
#define PROGRAM_APP_LENGTH 0X30000
|
||||
|
||||
#ifndef HIGH
|
||||
#define HIGH 1
|
||||
#endif
|
||||
|
||||
#ifndef LOW
|
||||
#define LOW 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif //TRUE
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif //FALSE
|
||||
|
||||
#ifndef ON
|
||||
#define ON 1
|
||||
#endif //ON
|
||||
|
||||
#ifndef OFF
|
||||
#define OFF 0
|
||||
#endif //OFF
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ( (void *) 0)
|
||||
//<2F><>ַΪ0<CEAA><30>ָ<EFBFBD><D6B8>,void*<2A><><EFBFBD>͵<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD>͵<EFBFBD>ָ<EFBFBD>롣<EFBFBD><EBA1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵĿ<C7B5>ָ<EFBFBD><D6B8>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endif
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//#define ClrLongBuf(buf) memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
|
||||
/** The upper 8 bits of a 32 bit value */
|
||||
//lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value"
|
||||
#define MSB_32( a ) ( ( (a) & 0xFF000000) >> 24)
|
||||
/** The lower 8 bits (of a 32 bit value) */
|
||||
#define LSB_32( a ) ( (a) & 0x000000FF)
|
||||
|
||||
/** The upper 8 bits of a 16 bit value */
|
||||
//lint -emacro(572,MSB_16) // Suppress warning 572 "Excessive shift value"
|
||||
#define MSB_16( a ) ( ( (a) & 0xFF00) >> 8)
|
||||
/** The lower 8 bits (of a 16 bit value) */
|
||||
#define LSB_16( a ) ( (a) & 0x00FF)
|
||||
|
||||
///** Leaves the minimum of the two 32-bit arguments */
|
||||
///*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */
|
||||
//#define MIN( a, b ) ( (a) < (b) ? (a) : (b) )
|
||||
///** Leaves the maximum of the two 32-bit arguments */
|
||||
///*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */
|
||||
//#define MAX( a, b ) ( (a) < (b) ? (b) : (a) )
|
||||
|
||||
|
||||
/** Concatenates two parameters. Useful as a second level of indirection,
|
||||
* when a parameter can be macro itself. */
|
||||
#define CONCAT_2( p1, p2 ) p1 ## p2
|
||||
|
||||
|
||||
/** Concatenates three parameters. Useful as a second level of indirection,
|
||||
* when a parameter can be macro itself. */
|
||||
#define CONCAT_3( p1, p2, p3 ) p1 ## p2 ## p3
|
||||
|
||||
|
||||
/**@brief Set a bit in the uint32 word.
|
||||
*
|
||||
* @param[in] W Word whose bit is being set.
|
||||
* @param[in] B Bit number in the word to be set.
|
||||
*/
|
||||
#ifndef SET_BIT
|
||||
#define SET_BIT( W, B ) ( (W) |= (uint32_t) (1U << (B) ) )
|
||||
#endif
|
||||
|
||||
|
||||
/**@brief Clears a bit in the uint32 word.
|
||||
*
|
||||
* @param[in] W Word whose bit is to be cleared.
|
||||
* @param[in] B Bit number in the word to be cleared.
|
||||
*/
|
||||
#ifndef SET_BIT
|
||||
#define CLR_BIT( W, B ) ( (W) &= (~( (uint32_t) 1 << (B) ) ) )
|
||||
#endif
|
||||
|
||||
//typedef unsigned char BOOLEAN;
|
||||
|
||||
typedef unsigned char UINT8, U8, BYTE, u8, uint8_t;
|
||||
typedef unsigned short UINT16, U16, u16, uint16_t;
|
||||
typedef unsigned int UINT32, U32, DWORD, u32, uint32_t;
|
||||
|
||||
//typedef int32_t s32;
|
||||
//typedef int16_t s16;
|
||||
//typedef int8_t s8;
|
||||
|
||||
//typedef const int32_t sc32; /*!< Read Only */
|
||||
//typedef const int16_t sc16; /*!< Read Only */
|
||||
//typedef const int8_t sc8; /*!< Read Only */
|
||||
|
||||
//typedef __IO int32_t vs32;
|
||||
//typedef __IO int16_t vs16;
|
||||
//typedef __IO int8_t vs8;
|
||||
|
||||
//typedef __I int32_t vsc32; /*!< Read Only */
|
||||
//typedef __I int16_t vsc16; /*!< Read Only */
|
||||
//typedef __I int8_t vsc8; /*!< Read Only */
|
||||
|
||||
//typedef uint32_t u32;
|
||||
//typedef uint16_t u16;
|
||||
//typedef uint8_t u8;
|
||||
|
||||
//typedef const uint32_t uc32; /*!< Read Only */
|
||||
//typedef const uint16_t uc16; /*!< Read Only */
|
||||
//typedef const uint8_t uc8; /*!< Read Only */
|
||||
|
||||
//typedef __IO uint32_t vu32;
|
||||
//typedef __IO uint16_t vu16;
|
||||
//typedef __IO uint8_t vu8;
|
||||
|
||||
//typedef __I uint32_t vuc32; /*!< Read Only */
|
||||
//typedef __I uint16_t vuc16; /*!< Read Only */
|
||||
//typedef __I uint8_t vuc8; /*!< Read Only */
|
||||
|
||||
typedef void (*pFunction)( void );
|
||||
|
||||
void StrToHex( BYTE *pbDest, BYTE *pbSrc, int nLen );
|
||||
|
||||
|
||||
void HexToStr( BYTE *pbDest, BYTE *pbSrc, int nLen );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
64
apps/earphone/94_rfid_stc/inc/main.h
Normal file
64
apps/earphone/94_rfid_stc/inc/main.h
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file Templates_LL/Inc/main.h
|
||||
* @author FMSH AS Embedded Software Team
|
||||
* @brief Header for main.c module
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 FMSH Microelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of FMSH Microelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* LL drivers common to all LL examples */
|
||||
//#include "fm15l0xx_ll_cmu.h"
|
||||
/* LL drivers specific to LL examples IPs */
|
||||
//#include "fm15l0xx_ll_gpio.h"
|
||||
//#include "fm15l0xx_ll_uart.h"
|
||||
|
||||
|
||||
//#if defined(USE_FULL_ASSERT)
|
||||
// #include "fm15l0xx_assert.h"
|
||||
//#endif /* USE_FULL_ASSERT */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ============== BOARD SPECIFIC CONFIGURATION CODE BEGIN ============== */
|
||||
/* ============== BOARD SPECIFIC CONFIGURATION CODE END ============== */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#define UARTx UART0
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
int vdd_is_low( void );
|
||||
#endif /* __MAIN_H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT FMSH Microelectronics *****END OF FILE****/
|
||||
11
apps/earphone/94_rfid_stc/inc/print.h
Normal file
11
apps/earphone/94_rfid_stc/inc/print.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef __PRINT_H_
|
||||
#define __PRINT_H_
|
||||
extern unsigned char lsfr[48];
|
||||
extern unsigned char lsfr_length;
|
||||
extern unsigned char ciphertext_to_binary[48];
|
||||
extern void Print_AUTH(unsigned char *key,unsigned char *TOKEN,unsigned char *rece_buff);//print <20><>֤
|
||||
extern void lsfr_init(unsigned char *S022_Token2);
|
||||
extern unsigned char lsfr_fm458(void);
|
||||
extern unsigned char PRINT_Calc_sendData(unsigned char *data_buf, unsigned char data_len);
|
||||
extern unsigned char PRINT_Calc_recvData(unsigned char *data_buf, unsigned char data_len);
|
||||
#endif
|
||||
7
apps/earphone/94_rfid_stc/inc/random_generator.h
Normal file
7
apps/earphone/94_rfid_stc/inc/random_generator.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include "main.h"
|
||||
|
||||
void RNG_init( void );
|
||||
|
||||
|
||||
uint32_t Get_RandomNumber( void );
|
||||
|
||||
Reference in New Issue
Block a user