Files and functions that may be used in bare metal programs
#include“system.h”
/*************************************************************************************************************************
* Function: voidSetEINT_TriggerMode(u8EINT0_N, u8Trigger)
*Function: Set the external interrupt group 0 trigger mode
* Parameters: EINT0_N: interrupt source number (see: Interrupt group 0 number definition); Trigger: trigger mode (EXT_LowLevel: low level trigger; EXT_HighLevel: high level trigger;
EXT_NegEdge: falling edge trigger; EXT_PosEdge: rising edge trigger; EXT_Edge: edge trigger)
*Return: None
*Depends on: underlying macro definitions
*Author: cp1300@139.com
* Date: 20120304
*Last modified: 20120304
* Note: No. GPN0---》GPN1 5G PL8---》GPL14GPM0---》GPM4, interrupt settings must be set two by two
*************************************************************************************************************************/
voidSetEINT0_TriggerMode(vu8EINT0_N,vu8Trigger)
{
if(EINT0_N&0x80)//EINT0CON1
{
EINT0_N-=0x80; //subtract flag
rEINT0CON1&=~(7《
rEINT0CON1|=Trigger《
}
else//EINT0CON0
{
rEINT0CON0&=~(7《
rEINT0CON0|=Trigger《
}
}
/*************************************************************************************************************************
* Function: void Set_GateClk(u8HCLK_DIV, Func tionalStateEnable )
* Function: CLK clock gating setting (HCLK, PCLK, SCLK)
*Parameters: CLK_DIV: peripheral (see: CLK gated clock definition); Enable = ENABLE, 1 to enable; = DISABLE, 0 to disable
*Return: None
*Depends on: underlying macro definitions
*Author: cp1300@139.com
*Time: 20120305
*Last modified: 20121005
* Note: PCLK_GATE adds the mark 0x40, SCLK_GATE adds the mark 0x80;
*************************************************************************************************************************/
voidSet_GateClk(vu8CLK_DIV,FuncTIonalStateEnable)
{
vu32*P=&rHCLK_GATE;
if(CLK_DIV&0x80)//SCLK
{
P=&rSCLK_GATE;
CLK_DIV-=0x80; //Remove the mark
}
elseif(CLK_DIV&0x40)//PCLK
{
P=&rPCLK_GATE;
CLK_DIV-=0x40; //Remove the mark
}
if (Enable == ENABLE) // Enable
*P|=1《
else//disability
*P&=~(1《
}
/*************************************************************************************************************************
* Function: voidSet_INTtoIRQ(u8INT_N)
*Function: Set an interrupt as IRQ
* Parameters: INT_N: interrupt number (see: Interrupt source number definition);
*Return: None
*Depends on: underlying macro definitions
*Author: cp1300@139.com
*Time: 20120305
*Last modified: 20120305
*Description: Set an interrupt to normal interrupt mode
*************************************************************************************************************************/
voidSet_INTtoIRQ(vu8INT_N)
{
if(INT_N》31)//VIC1
{
INT_N-=32;
VIC1-》INTSELECT&=~(1《
}
else//VIC0
VIC0-》INTSELECT&=~(1《
}
/*************************************************************************************************************************
* Function: voidSet_INTtoFIQ(u8INT_N)
*Function: Set an interrupt to FIQ
* Parameters: INT_N: interrupt number (see: Interrupt source number definition);
*Return: None
*Depends on: underlying macro definitions
*Author: cp1300@139.com
*Time: 20120305
*Last modified: 20120305
* Description: Set an interrupt to fast interrupt mode
*************************************************************************************************************************/
voidSet_INTtoFIQ(vu8INT_N)
{
if(INT_N》31)//VIC1
{
INT_N-=32;
VIC1-》INTSELECT|=(1《
}
else//VIC0
VIC0-》INTSELECT|=(1《
}
/**********************************************************************************
Previous article:Mini2440+jlink+mkd bare metal key interrupt debugging experience
Next article:Brief Analysis of Linux Exception Handling Code on ARM Platform
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- 【LSM6DSOX's MLC machine learning understanding】--Training data set display gadget
- What is the difference between GD32F350 Timer 14 and Timer 2?
- Popular power supply design
- MAX232cse chip introduction
- [Fudan Micro FM33LG0 Series Development Board Review] Driving SPI TFT Display
- Come to Infineon flagship store to find good things in autumn! Get coupons and win a 50-yuan JD card
- [2022 Digi-Key Innovation Design Competition] Material unboxing ESP32-S3 SHT30 LMG5200 and other devices
- Help, power circuit analysis
- If there is a bug in the third-party code, how can everyone adapt it to the original version after it is fixed?
- Share a general good book Digital Signal Processing C Language Program Collection-DSP Algorithm Encyclopedia C Language Version Original Book