Linux kernel device driver address mapping notes

Linux kernel device driver address mapping notes
#include <asm/io.h>
#define ioremap(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
//cookie indicates the physical address, size indicates the mapping size. ioremap maps the specified physical address to an idle virtual address void __iomem *
__arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
{
return __arm_ioremap_caller(phys_addr, size, mtype,
__builtin_return_address(0));
}

1. Virtual address after mapping from physical address

  • Virtual address = ioremap(physical address, mapping size);
  • After use, iounmap(virtual address); //delete the mapping table

2.

ioread8(address)/readb()
ioread16(address)/readw()
ioread32(address)/readl()

iowrite8(value, address) / writeb
iowrite16(value, address) / writew
iowrite32(value, address) / writel
#include <asm/sizes.h>
SZ_4K
SZ_1M

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • An easy way to port Linux code to Windows
  • Linux kernel device driver memory management notes
  • Linux kernel device driver kernel time management notes
  • Linux kernel device driver character device driver notes
  • Linux kernel device driver virtual file system notes
  • Linux kernel device driver system call notes
  • Linux kernel device driver kernel debugging technical notes collation
  • Linux kernel device driver kernel linked list usage notes
  • Linux kernel device driver proc file system notes
  • Linux kernel device driver advanced character device driver notes
  • Linux kernel device driver Linux kernel module loading mechanism notes summary
  • Linux kernel device driver Linux kernel basic notes summary
  • Steps to transplant the new kernel to the Linux system

<<:  Tutorial on how to remotely connect to MySQL database under Linux system

>>:  Example of downloading files with vue+django

Recommend

Example analysis of mysql non-primary key self-increment usage

This article uses an example to illustrate the us...

JavaScript flow control (loop)

Table of contents 1. for loop 2. Double for loop ...

Why is it not recommended to use index as key in react?

1. Compare the old virtual DOM with the new virtu...

Binary Type Operations in MySQL

This article mainly introduces the binary type op...

Security configuration and detection of SSL after the website enables https

It is standard for websites to enable SSL nowaday...

Pure CSS to achieve the water drop animation button in Material Design

Preface You should often see this kind of special...

Vue3.0 handwriting magnifying glass effect

The effect to be achieved is: fixed zoom in twice...

Summary of HTML Hack Tags in IE Browser

Copy code The code is as follows: <!--[if !IE]...

MySQL 8.0.18 installation and configuration graphic tutorial

Learning objectives: Learn to use Windows system ...

How to get the size of a Linux system directory using the du command

Anyone who has used the Linux system should know ...

NULL and Empty String in Mysql

I recently came into contact with MySQL. Yesterda...

Implementation of services in docker accessing host services

Table of contents 1. Scenario 2. Solution 3. Conc...

Solve the problem of installing Theano on Ubuntu 19

Solution: Directly in the directory where you dow...

js to achieve simple front-end paging effect

Some projects have relatively simple business, bu...