HC32L17x的LL驱动库之system
作者:互联网
#ifndef HC32L1XX_LL_SYSTEM_H_
#define HC32L1XX_LL_SYSTEM_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "hc32l1xx.h"
///
//===FLASH读周期
#define LL_FLASH_LATENCY_0 FLASH_CR_WAIT_0
#define LL_FLASH_LATENCY_1 FLASH_CR_WAIT_1
#define LL_FLASH_LATENCY_2 FLASH_CR_WAIT_2
#define LL_FLASH_LATENCY_3 FLASH_CR_WAIT_2
#define LL_FLASH_LATENCY_4 FLASH_CR_WAIT_2
#define LL_FLASH_LATENCY_5 FLASH_CR_WAIT_2
///
//函 数:
//功 能:Flash解锁操作
//输入参 数:
//输出参 数:
//说 明:
//
static inline void LL_FLASH_BYPASS(void)
{
FLASH->BYPASS = 0x5A5A;
FLASH->BYPASS = 0xA5A5;
}
///
//函 数:
//功 能:配置FLASH读取的延迟周期
//输入参 数:
//输出参 数:
//说 明:
//
static inline void LL_FLASH_SetLatency(uint32_t Latency)
{
LL_FLASH_BYPASS();
MODIFY_REG(FLASH->CR, FLASH_CR_WAIT, Latency);
}
///
//函 数:
//功 能:
//输入参 数:
//输出参 数:
//说 明:
//
static inline void LL_FLASH_GetUID(uint8_t *pUID)
{
pUID[0] = *(volatile uint8_t*)(UID_BASE+0);
pUID[1] = *(volatile uint8_t*)(UID_BASE+1);
pUID[2] = *(volatile uint8_t*)(UID_BASE+2);
pUID[3] = *(volatile uint8_t*)(UID_BASE+3);
pUID[4] = *(volatile uint8_t*)(UID_BASE+4);
pUID[5] = *(volatile uint8_t*)(UID_BASE+5);
pUID[6] = *(volatile uint8_t*)(UID_BASE+6);
pUID[7] = *(volatile uint8_t*)(UID_BASE+7);
pUID[8] = *(volatile uint8_t*)(UID_BASE+8);
pUID[9] = *(volatile uint8_t*)(UID_BASE+9);
}
///
//函 数:
//功 能:
//输入参 数:
//输出参 数:
//说 明:
//
static inline void LL_FLASH_GetPID(uint8_t *pPID)
{
pPID[0] = *(volatile uint8_t*)(PID_BASE + 0);
pPID[1] = *(volatile uint8_t*)(PID_BASE + 1);
pPID[2] = *(volatile uint8_t*)(PID_BASE + 2);
pPID[3] = *(volatile uint8_t*)(PID_BASE + 3);
pPID[4] = *(volatile uint8_t*)(PID_BASE + 4);
pPID[5] = *(volatile uint8_t*)(PID_BASE + 5);
pPID[6] = *(volatile uint8_t*)(PID_BASE + 6);
pPID[7] = *(volatile uint8_t*)(PID_BASE + 7);
pPID[8] = *(volatile uint8_t*)(PID_BASE + 8);
pPID[9] = *(volatile uint8_t*)(PID_BASE + 9);
pPID[10] = *(volatile uint8_t*)(PID_BASE + 10);
pPID[11] = *(volatile uint8_t*)(PID_BASE + 11);
pPID[12] = *(volatile uint8_t*)(PID_BASE + 12);
pPID[13] = *(volatile uint8_t*)(PID_BASE + 13);
pPID[14] = *(volatile uint8_t*)(PID_BASE + 14);
pPID[15] = *(volatile uint8_t*)(PID_BASE + 15);
}
///
//函 数:
//功 能:
//输入参 数:
//输出参 数:
//说 明:
//
static inline uint32_t LL_FLASH_GetFlashSize(void)
{
return *(volatile uint32_t*)(FLASH_SIZE_BASE);
}
///
//函 数:
//功 能:
//输入参 数:
//输出参 数:
//说 明:
//
static inline uint32_t LL_FLASH_GetRamSize(void)
{
return *(volatile uint32_t*)(SRAM_SIZE_BASE);
}
///
//函 数:
//功 能:
//输入参 数:
//输出参 数:
//说 明:
//
static inline uint32_t LL_FLASH_GetPinNum(void)
{
return *(volatile uint32_t*)(PIN_NUM_BASE);
}
///
#ifdef __cplusplus
}
#endif
#endif /* HC32L1XX_LL_SYSTEM_H */
标签:LL,FLASH,HC32L17x,system,uint8,BASE,volatile,pPID 来源: https://blog.csdn.net/Haiguozhe/article/details/121007300