From owner-p4-projects@FreeBSD.ORG Wed Jun 9 06:13:41 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5B75016A52F; Wed, 9 Jun 2004 06:13:41 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E62D216A51D for ; Wed, 9 Jun 2004 06:13:40 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDD9543D41 for ; Wed, 9 Jun 2004 06:13:40 +0000 (GMT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i596DeOo016943 for ; Wed, 9 Jun 2004 06:13:40 GMT (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i596DeGQ016937 for perforce@freebsd.org; Wed, 9 Jun 2004 06:13:40 GMT (envelope-from jmallett@freebsd.org) Date: Wed, 9 Jun 2004 06:13:40 GMT Message-Id: <200406090613.i596DeGQ016937@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 54449 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 06:13:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=54449 Change 54449 by jmallett@jmallett_oingo on 2004/06/09 06:13:31 Stab stab stab, I think I'll do bus stuff this way. Affected files ... .. //depot/projects/mips/sys/mips/include/bus.h#3 edit Differences ... ==== //depot/projects/mips/sys/mips/include/bus.h#3 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002 Juli Mallett. All rights reserved. + * Copyright (c) 2002-2004 Juli Mallett. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,50 @@ typedef unsigned long bus_addr_t; typedef unsigned long bus_size_t; -typedef int bus_type_t; typedef unsigned long bus_space_handle_t; -typedef unsigned long bus_space_tag_t; +typedef unsigned long bus_space_word_t; + +struct bus_space_tag { + const char *bst_name; + bus_space_word_t (*bst_read)(char, bus_space_handle_t, bus_size_t); + void (*bst_write)(char, bus_space_handle_t, bus_size_t, bus_space_word_t); +}; + +typedef struct bus_space_tag *bus_space_tag_t; + +#define BUSSPACE_READ(size, type) \ +static __inline type \ +bus_space_read_ ## size(bus_space_tag_t t, \ + bus_space_handle_t h, \ + bus_size_t o) \ +{ \ + return ((type)((*(t)->bst_read)((size), h, o))); \ +} \ +struct __hack + +#define BUSSPACE_WRITE(size, type) \ +static __inline void \ +bus_space_write_ ## size(bus_space_tag_t t, \ + bus_space_handle_t h, \ + bus_size_t o, \ + type v) \ +{ \ + ((*(t)->bst_write)((size), h, o, v)); \ +} \ +struct __hack + +#define BUSSPACE_WRAPPER(size, type) \ +BUSSPACE_READ(size, type); \ +BUSSPACE_WRITE(size, type); \ +struct __hack + +BUSSPACE_WRAPPER(1, uint8_t); +BUSSPACE_WRAPPER(2, uint16_t); +BUSSPACE_WRAPPER(4, uint32_t); +BUSSPACE_WRAPPER(8, uint64_t); + +#undef BUSSPACE_READ +#undef BUSSPACE_WRITE +#undef BUSSPACE_WRAPPER #endif /* !_MACHINE_BUS_H_ */