Sharing of functions that may be used in bare metal programs based on S3C6410

Publisher:数据小巨人Latest update time:2020-06-03 Source: elecfansKeywords:S3C6410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

*************************************************************************************************************************/

Sharing of functions that may be used in bare metal programs based on S3C6410

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《

}

/**********************************************************************************

Keywords:S3C6410 Reference address:Sharing of functions that may be used in bare metal programs based on S3C6410

Previous article:Mini2440+jlink+mkd bare metal key interrupt debugging experience
Next article:Brief Analysis of Linux Exception Handling Code on ARM Platform

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号