2011-04-05 20:49:01 +08:00
|
|
|
/*
|
2021-04-09 10:52:34 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2011-04-05 20:49:01 +08:00
|
|
|
*
|
2021-04-09 10:52:34 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2011-04-05 20:49:01 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2011-01-13 weety first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_ARCH_IO_H
|
|
|
|
#define __ASM_ARCH_IO_H
|
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
#define AT91_BASE_SYS 0xffffe800
|
2011-04-05 20:49:01 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
#define IO_SPACE_LIMIT 0xFFFFFFFF
|
2011-04-05 20:49:01 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
#define readb(a) (*(volatile unsigned char *)(a))
|
|
|
|
#define readw(a) (*(volatile unsigned short *)(a))
|
|
|
|
#define readl(a) (*(volatile unsigned int *)(a))
|
2011-04-05 20:49:01 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
#define writeb(v,a) (*(volatile unsigned char *)(a) = (v))
|
|
|
|
#define writew(v,a) (*(volatile unsigned short *)(a) = (v))
|
|
|
|
#define writel(v,a) (*(volatile unsigned int *)(a) = (v))
|
2011-04-05 20:49:01 +08:00
|
|
|
|
|
|
|
|
2011-08-23 22:48:10 +08:00
|
|
|
rt_inline unsigned int at91_sys_read(unsigned int reg_offset)
|
2011-04-05 20:49:01 +08:00
|
|
|
{
|
2021-04-09 10:52:34 +08:00
|
|
|
unsigned int addr = AT91_BASE_SYS;
|
2011-04-05 20:49:01 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
return readl(addr + reg_offset);
|
2011-04-05 20:49:01 +08:00
|
|
|
}
|
|
|
|
|
2011-08-23 22:48:10 +08:00
|
|
|
rt_inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
|
2011-04-05 20:49:01 +08:00
|
|
|
{
|
2021-04-09 10:52:34 +08:00
|
|
|
unsigned int addr = AT91_BASE_SYS;
|
2011-04-05 20:49:01 +08:00
|
|
|
|
2021-04-09 10:52:34 +08:00
|
|
|
writel(value, addr + reg_offset);
|
2011-04-05 20:49:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|