xref: /netbsd-src/sys/arch/ews4800mips/include/sector.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: sector.h,v 1.3 2008/04/28 20:23:18 martin Exp $	*/
204faabf0Stsutsui 
304faabf0Stsutsui /*-
404faabf0Stsutsui  * Copyright (c) 2004 The NetBSD Foundation, Inc.
504faabf0Stsutsui  * All rights reserved.
604faabf0Stsutsui  *
704faabf0Stsutsui  * This code is derived from software contributed to The NetBSD Foundation
804faabf0Stsutsui  * by UCHIYAMA Yasushi.
904faabf0Stsutsui  *
1004faabf0Stsutsui  * Redistribution and use in source and binary forms, with or without
1104faabf0Stsutsui  * modification, are permitted provided that the following conditions
1204faabf0Stsutsui  * are met:
1304faabf0Stsutsui  * 1. Redistributions of source code must retain the above copyright
1404faabf0Stsutsui  *    notice, this list of conditions and the following disclaimer.
1504faabf0Stsutsui  * 2. Redistributions in binary form must reproduce the above copyright
1604faabf0Stsutsui  *    notice, this list of conditions and the following disclaimer in the
1704faabf0Stsutsui  *    documentation and/or other materials provided with the distribution.
1804faabf0Stsutsui  *
1904faabf0Stsutsui  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2004faabf0Stsutsui  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2104faabf0Stsutsui  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2204faabf0Stsutsui  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2304faabf0Stsutsui  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2404faabf0Stsutsui  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2504faabf0Stsutsui  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2604faabf0Stsutsui  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2704faabf0Stsutsui  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2804faabf0Stsutsui  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2904faabf0Stsutsui  * POSSIBILITY OF SUCH DAMAGE.
3004faabf0Stsutsui  */
3104faabf0Stsutsui 
3204faabf0Stsutsui #ifndef _EWS4800MIPS_SECTOR_H_
3304faabf0Stsutsui #define	_EWS4800MIPS_SECTOR_H_
3404faabf0Stsutsui #ifdef _KERNEL
3504faabf0Stsutsui void *sector_init(dev_t, void (*)(struct buf *));
3604faabf0Stsutsui #endif
3704faabf0Stsutsui void sector_fini(void *);
38712239e3Sthorpej bool sector_read_n(void *, uint8_t *, daddr_t, int);
39712239e3Sthorpej bool sector_read(void *, uint8_t *, daddr_t);
40712239e3Sthorpej bool sector_write_n(void *, uint8_t *, daddr_t, int);
41712239e3Sthorpej bool sector_write(void *, uint8_t *, daddr_t);
4204faabf0Stsutsui 
4304faabf0Stsutsui #define	ROUND_SECTOR(x)		(((x) + 511) & ~511)
4404faabf0Stsutsui #define	TRUNC_SECTOR(x)		((x) & ~511)
4504faabf0Stsutsui 
4604faabf0Stsutsui #endif /* _EWS4800MIPS_SECTOR_H_ */
47