Access Io before the kernel runs

Source: Internet
Author: User

If you want to access some of the CPU's I/O ports before the kernel runs, use the pointer to define the register for operations. For example, you can run the IO command to feed the dog when extracting the kernel:

In the ARCH/ARM/boot/compressed/Misc. c file: 307 arch_decomp_setup (); 308 309 makecrc (); 310 * (volatile unsigned long *) 0x40e00054) & = (~ (3 <28); // abing gpaf0_l 311 * (volatile unsigned long *) 0x40e0001c) = (1 <14 ); // abing gpdr0 312 * (volatile unsigned long *) 0x40e00024) = (1 <14); // abing gpcr0 313 putstr ("Uncompressing Linux... "); 314 * (volatile unsigned long *) 0x40e00018) = (1 <14); // abing gpsr0 315 gunzip (); 316 * (volatile unsigned long *) 0x40e00024) = (1 <14); // abing gpcr0 317 putstr ("done, booting the kernel. \ n "); 318 return output_ptr; refer to include/ASM-arm/arch-PXA/uncompress. code for accessing the serial port of an H file:
  12#define FFUART          ((volatile unsigned long *)0x40100000)  13#define BTUART          ((volatile unsigned long *)0x40200000)  14#define STUART          ((volatile unsigned long *)0x40700000)  15  16#define UART            FFUART  17  18  19static __inline__ void putc(char c)  20{  21        while (!(UART[5] & 0x20));  22        UART[0] = c;  23}  24  25/*  26 * This does not append a newline  27 */  28static void putstr(const char *s)  29{  30        while (*s) {  31                putc(*s);  32                if (*s == '\n')  33                        putc('\r');  34                s++;  35        }  36}
 
 
It can be defined as follows:
#define __raw_readl(a)    (*(volatile unsigned int *)(a))#define __raw_writel(v,a) (*(volatile unsigned int *)(a) = (v))#define __raw_readw(a)    (*(volatile unsigned short *)(a))#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.