2011-04-05 20:49:01 +08:00
|
|
|
/*
|
|
|
|
* File : io.h
|
|
|
|
* This file is part of RT-Thread RTOS
|
|
|
|
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
|
|
|
*
|
2013-07-21 20:01:24 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
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
|
|
|
|
|
|
|
|
#define AT91_BASE_SYS 0xffffe800
|
|
|
|
|
|
|
|
#define IO_SPACE_LIMIT 0xFFFFFFFF
|
|
|
|
|
|
|
|
#define readb(a) (*(volatile unsigned char *)(a))
|
|
|
|
#define readw(a) (*(volatile unsigned short *)(a))
|
|
|
|
#define readl(a) (*(volatile unsigned int *)(a))
|
|
|
|
|
|
|
|
#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-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
|
|
|
{
|
2011-08-23 22:48:10 +08:00
|
|
|
unsigned int addr = AT91_BASE_SYS;
|
2011-04-05 20:49:01 +08:00
|
|
|
|
|
|
|
return readl(addr + reg_offset);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2011-08-23 22:48:10 +08:00
|
|
|
unsigned int addr = AT91_BASE_SYS;
|
2011-04-05 20:49:01 +08:00
|
|
|
|
|
|
|
writel(value, addr + reg_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|