arm: use structures to manipulate registers

Publisher:colcheryLatest update time:2023-09-01 Source: elecfansKeywords:arm Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Use structures to manipulate registers:


//When assigning and retrieving register values, pay attention to the length of the register. Some register values ​​are only 8 bits.

//Also note, use volatile to modify register variables. volatile reference http://www.cnblogs.com/mylinux/p/4630749.html


//addr.h

typedef unsigned int S3C24X0_REG32;


/* NAND FLASH (see S3C2410 manual chapter 6) */

typedef struct {

    S3C24X0_REG32 NFCONF;

    S3C24X0_REG32 NFCMD;

    S3C24X0_REG32 NFADDR;

    S3C24X0_REG32 NFDATA;

    S3C24X0_REG32 NFSTAT;

    S3C24X0_REG32 NFECC;

} S3C2410_NAND;


//nand.c

static S3C2410_NAND* s3c2410nand = (S3C2410_NAND *)0x4e000000;

//In this way, s3c2410nand represents the starting address of the register group.

//&s3c2410nand->NFCMD represents the address of the NFCMD register.

//s3c2410nand->NFCMD represents the value of the NFCMD register.

//When assigning and retrieving register values, pay attention to the length of the register. Some register values ​​are only 8 bits.

//Also note, use volatile to modify register variables.


/* Read data */

static unsigned char s3c2410_read_data(void)

{

    volatile unsigned char *p = (volatile unsigned char *)&s3c2410nand->NFDATA;

    return *p;

}


Keywords:arm Reference address:arm: use structures to manipulate registers

Previous article:Gcc code disassembly to view memory distribution[1]: gcc
Next article:arm: The startup code determines whether to start from nand or norflash, and the process of copying the program to memory

Recommended ReadingLatest update time:2024-11-16 21:43

Realizing remote real-time monitoring of equipment based on ARM embedded system and Internet network technology
At present, the observatory remote monitoring system used by foreign countries for large-scale photoelectric telescope systems has been relatively complete, but it has not been well applied in China. This project will design an observatory remote monitoring system, apply the ARM-Linux embedded system to the system, an
[Microcontroller]
Realizing remote real-time monitoring of equipment based on ARM embedded system and Internet network technology
Common ARM concepts that you must know!
Introduction: This article lists 22 common concepts about ARM, including some usage precautions, ARM startup code design, ARM processor operation mode, exception types supported by ARM architecture and some basic operation methods, etc. 1. Explanation of some common English abbreviations in ARM MSB: Most Significa
[Microcontroller]
ARM_linux development environment establishment (2)
Install FTP, SSH, and NFS server software - apt-get. Install VMware Tools and share files between the local machine and the virtual machine Installing VMWare Tools has several advantages: .When transferring files between Host OS and Guest OS, you only need to drag the mouse. When switching between Host OS and Guest
[Microcontroller]
Qualcomm CEO: Hope to invest in Arm with other chipmakers
US chipmaker Qualcomm wants to buy a stake in Arm alongside its rivals and create a consortium to keep the British chip designer neutral in the competitive semiconductor market, the Financial Times reported. Japanese conglomerate SoftBank plans to list Arm on the New York Stock Exchange after Nvidia's $66 billion t
[Semiconductor design/manufacturing]
Some issues on address line connection between ARM and 8, 16, 32-bit wide memory
       ARM is 32-bit, and the address space is 2 to the power of 32, 4G address space. All peripherals (FLASH, RAM, SD card, etc.) are mapped to this 4G space. For example, most ARM7s map RAM to 0x40000000, so the operation of RAM starts at 0X40000000. FLASH starts at 0X0. When using FLASH, you also need to consider ad
[Microcontroller]
Design and implementation of USB based on embedded ARM9
Introduction USB (Universal Serial Bus) is the abbreviation of Universal Serial Bus. It has become the mainstream interface of computers because of its convenience, dynamic bandwidth allocation, excellent fault tolerance and high cost performance. With the widespread application of embedded systems, various
[Microcontroller]
Design and implementation of USB based on embedded ARM9
The process of migrating 8051 applications to ARM Cortex-M processors
    The Cortex-M processor series includes the widely used Cortex-M3 processor, the Cortex-M1 processor for FPGA, the Cortex-M0 processor (the smallest ARM processor) launched in early 2009, and the Cortex-M4 processor (supporting floating-point and digital signal processing enhanced instructions) launched in early 20
[Microcontroller]
The process of migrating 8051 applications to ARM Cortex-M processors
Learn ARM development(14)
Since it is still troublesome to develop under LINUX, is there a more convenient and simple development method under WINDOWS? The answer is yes. Of course, we cannot choose a development tool like ADS, because it is too expensive. Even if we use pirated software, we will not feel at ease, so we have to adopt other s
[Microcontroller]
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号