This commit is contained in:
lmx
2025-12-01 10:01:10 +08:00
parent 627780ea20
commit 6248a4fc34
96 changed files with 9752 additions and 11943 deletions

View 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