blob: 6579ddaee1a042bab0a66418b2db81e262245849 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/***************************************************************
*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd
*����� lib_scs.c
*�� �ߣ� Liut
*�� ���� V1.00
*�� �ڣ� 2017/07/14
*�� ���� �ں�ģ��⺯��
*�� ע�� ������ ES8P508xоƬ
����������ѧϰ����ʾʹ�ã����û�ֱ�����ô����������ķ��ջ������е��κη������Ρ�
***************************************************************/
#include "lib_scs.h"
/***************************************************************
��������NVIC_Init
�� ����NVIC��ʼ������
����ֵ��Channel���ж�ͨ�� �� Priority���ж����ȼ� �� Cmd��ʧ�ܻ�ʹ��
���ֵ����
����ֵ����
***************************************************************/
void NVIC_Init(NVIC_IRQChannel Channel,NVIC_IRQPriority Priority,TYPE_FUNCEN Cmd)
{
uint32_t tmppriority = 0x00;
if (Cmd != DISABLE)
{
/* Compute the Corresponding IRQ Priority */
tmppriority = NVIC->IP[Channel >> 0x02];
tmppriority &= (uint32_t)(~(((uint32_t)0xFF) << ((Channel & 0x03) * 8)));
tmppriority |= (uint32_t)((((uint32_t)Priority << 6) & 0xFF) << ((Channel & 0x03) * 8));
NVIC->IP[Channel >> 0x02] = tmppriority;
/* Enable the Selected IRQ Channels */
NVIC->ISER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F);
}
else
{
/* Disable the Selected IRQ Channels */
NVIC->ICER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F);
}
}
/***************************************************************
��������SCB_SystemLPConfig
�� ��������ϵͳ����ģʽ
����ֵ��LowPowerMode������ģʽ �� NewState��ʹ�ܡ�ʹ��
���ֵ����
����ֵ����
***************************************************************/
void SCB_SystemLPConfig(SCB_TYPE_SCR LowPowerMode, TYPE_FUNCEN NewState)
{
if (NewState != DISABLE)
SCB->SCR |= LowPowerMode;
else
SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode);
}
/***************************************************************
��������SCB_GetCpuID
�� ������ȡCPUID
����ֵ����
���ֵ����
����ֵ��32λIDֵ
***************************************************************/
uint32_t SCB_GetCpuID(void)
{
return (SCB->CPUID);
}
/***************************************************************
��������SysTick_Init
�� ����SysTick��ʼ������
����ֵ����ʼ�����ýṹ���ַ
���ֵ����
����ֵ����
***************************************************************/
void SysTick_Init(SYSTICK_InitStruType* SysT_InitStruct)
{
uint32_t temp32 = 0;
SysTick->LOAD = SysT_InitStruct->SysTick_Value;
SysTick->VAL = (uint32_t)0;
if(SysT_InitStruct->SysTick_ClkSource != SysTick_ClkS_Base)
temp32 |= 0x00000004;
else
temp32 &= 0xFFFFFFFB;
if(SysT_InitStruct->SysTick_ITEnable != DISABLE)
temp32 |= 0x00000002;
else
temp32 &= 0xFFFFFFFD;
SysTick->CTRL = temp32;
}
/*************************END OF FILE**********************/
|