/* 2012-09-16: File added by Sony Corporation */
/*
 * icx_io.h -- Header file for I/O access
 *
 * Copyright 2011 Sony Corporation.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef __ICX_IO_H__
#define __ICX_IO_H__

#ifndef outb
#define outb(v, p) (*(volatile unsigned char  *)(p) = (v))
#endif
#ifndef outh
#define outh(v, p) (*(volatile unsigned short *)(p) = (v))
#endif
#ifndef outl
#define outl(v, p) (*(volatile unsigned int   *)(p) = (v))
#endif

#ifndef inb
#define inb(p) (*(volatile unsigned char  *)(p))
#endif
#ifndef inh
#define inh(p) (*(volatile unsigned short *)(p))
#endif
#ifndef inl
#define inl(p) (*(volatile unsigned int   *)(p))
#endif

#define setb(v, m, p) (*(volatile unsigned char  *)(p) = ((*(volatile unsigned char  *)(p)&~(m)) | ((v)&(m))))
#define seth(v, m, p) (*(volatile unsigned short *)(p) = ((*(volatile unsigned short *)(p)&~(m)) | ((v)&(m))))
#define setl(v, m, p) (*(volatile unsigned int   *)(p) = ((*(volatile unsigned int   *)(p)&~(m)) | ((v)&(m))))

#endif /* __ICX_IO_H__ */

