S3C2440 GPIO Control

Publisher:吾道明亮Latest update time:2016-08-26 Source: eefocusKeywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
/****************************************************************

 NAME: u2440mon.c
 DESC: u2440mon entry point,menu,download
 ****************************************************************/
#define GLOBAL_CLK  1
//头文件
#include
#include
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"
#include "clock.h"


void Isr_Init(void);

//******************************************
//Test function
void test_led(U32 i)
{
  rGPBDAT =~ (1< }

//延时
void delay(U32 i)
{
  U32 del;
  while(i--)
  {
    for(del=0;del<1000000;del++);
  }
}

/****************************************Main function********************************************/
void Main(void)
{

 /******************************************************************************
     Hardware initialization
 **********************************************************************/
    MMU_Init(); //Initialize MMU
    Port_Init(); //Initialize I/O portIsr_Init
    (); //Disable all
    interruptscal_cpu_bus_clk(); //Clock division 1:4:8, FCLK = 400MHZ, HCLK = 100MHZ, PCLK = 50MHZ, UCLK=48MHZ
    Uart_Init( 0,115200 ); //Initialize serial port 0, baud rate 115200
    Uart_Select( 0 ); //Select serial port 0, pass global parametersUart_SendByte
    ('\n');
    Uart_Printf("GT2440 TEST \n");
    Uart_Printf("*******************Init clock :*******************\n\n");
    Uart_Printf("HCLK= %d ,PCLK= %d, FCLK= %d\n\n",HCLK,PCLK,FCLK);
    Uart_Printf("*******************Init uart0 :*******************\n\n");
    Uart_Printf(" Enter= 0 ,RATE= 115200 \n\n");
//---------------------------------------------------------------------------
/********************************************************************************
   User test program
****************************************************************************/

 //GPB5: LED1, GPB6: LED2, GPB7: LED3, GPB8: LED4
 //00: input, 01:
    outputrGPBCON = (0X01<<5*2)+(0X01<<6*2)+(0X01<<7*2)+(0X01<<8*2);
 //GPDAT = 1, output high
    levelrGPBDAT = 0Xff<<5;
 while(1)
 {
      test_led(5); //LED1 is on
      delay(10);
      test_led(6); //LED2 is on
      delay(10);   
      test_led(7); //LED3 is on
      delay(10);
      test_led(8); //LED4 is on
      delay(10);
      test_led(7); //LED7 is on
      delay(10);   
      test_led(6); //LED6 is on
      delay(10);
 }    

}

/**********************Interrupt setting****************************/
void Isr_Init(void)
{
 rINTMOD=0x0; // All=IRQ mode
 rINTMSK=BIT_ALLMSK; // All interrupt is masked.
}

Keywords:S3C2440 Reference address:S3C2440 GPIO Control

Previous article:S3C2410 Interrupt Register
Next article:Design of GPRS network electric energy meter

Recommended ReadingLatest update time:2024-11-15 14:52

SPI analysis of S3C2440
The Serial Peripheral Interface (SPI) of the S3C2440A can be connected to serial data transmission. The S3C2440A contains two SPIs, each with two 8-bit shift registers for sending and receiving. During one SPI transmission, data is sent (serial shift out) and received (serial shift in) at the same time. The frequency
[Microcontroller]
SPI analysis of S3C2440
S3C2440 cpu initialization (reset content)
reset content (start.S file): 1. Set svc mode Set the processor mode to svc mode. According to the ARM architecture reference manual, the processor has seven working modes: In the program status register, the mode is set to 10011: The assembly code is as follows: set_svc: mrs r0, cpsr bic r0, r0, #0x1f orr r0, r0
[Microcontroller]
S3C2440 cpu initialization (reset content)
Getting Started | Analysis of the S3C2440 boot process
The S3C2440 startup process is a difficult point and not easy to understand. The understanding of the S3C2440 startup process affects the subsequent analysis of the bare metal code execution process, thus showing the importance of the S3C2440 startup process. S3C2440 startup mode and startup mode selection Search f
[Microcontroller]
Getting Started | Analysis of the S3C2440 boot process
S3C2440 Interrupt Study Notes
When entering an exception, the CPU will do the following 1. Copy the value of pc at the time of interruption to lr (the value of pc is the interrupt instruction position + 8, so the returned instruction address should be the current pc value + 4) 2.CPSR- SPSR_(irq) (equivalent to bl jump) 3. Forced t
[Microcontroller]
s3c2440 bare metal-NorFlash1-principle
1. Flash types and characteristics: Flash is generally divided into NAND flash and NOR flash, and their respective characteristics are as follows: - Nor NAND XIP (Execute in Place) yes no Performance(Erase) Very slow (5s, chunks are too big)
[Microcontroller]
Design and implementation of firewall supporting IPv6 protocol based on S3C2440 processor
1 Introduction Among many network security facilities, firewall is an important and effective network security device. It filters and shields network communications to prevent unauthorized access into and out of the computer network. A firewall is a security barrier between a trusted network and an untrusted network.
[Microcontroller]
Design and implementation of firewall supporting IPv6 protocol based on S3C2440 processor
uboot-2011.12 ported to S3C2440 (Part 3) - Hardware initialization: watchdog, interrupt, clock
/* * turn off dog, see C18P3 */ ldr r0, =pWTCON mov r1, #0x0 str r1,   /* * C14 * mask all IRQs by setting all bits in the INTMR - default */ mov r1, #0xffffffff ldr r0, =INTMSK str r1, ldr r1, =0x7fff ldr r0, =INTSUBMSK str r1,   /* * FCLK:HCLK:PCLK = 1:4:8 * because
[Microcontroller]
Design of automobile safety defense system based on embedded technology
  introduction   In recent years, the combination of embedded technology and Internet technology has made embedded technology play an increasingly important role in remote control, intelligent transportation, video conferencing, security and other fields. With the improvement of people's living standards and the acc
[Microcontroller]
Design of automobile safety defense system based on embedded technology
Latest Microcontroller Articles
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号