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;
}
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to record and call script files in Allegro software?
- TI Cup 2019 National Undergraduate Electronic Design Competition National Review Results Announcement
- Current reversible chopper circuit
- [TI Live Broadcast] The new generation of C2000 and MSP430 series is released, take a look! Register to watch and win gifts
- Do you remember the ZTE power supply I bought at the ghost market? I DIYed it in my spare time.
- Notes on commonly used modules inside MSP430 microcontroller
- Share: CCS dual-core chip DSP end development
- I would like to ask how the parameters of the bandpass filter are derived.
- How to use Wireshark to capture Zigbee packets
- esp32 flash micropython firmware plug in computer no such file directory