Author: marcel
Date: Wed Jun 10 16:00:09 2015
New Revision: 284228
URL: https://svnweb.freebsd.org/changeset/base/284228

Log:
  Rename bus_space to bus (i.e. drop _space). This makes the
  API match the convenience macros in <sys/bus.h>. Bus space
  can now reference both bus and busdma.

Added:
  head/tools/bus_space/C/libbus.h
     - copied, changed from r284227, head/tools/bus_space/C/libbus_space.h
  head/tools/bus_space/bus.c
     - copied, changed from r284226, head/tools/bus_space/bus_space.c
  head/tools/bus_space/bus.h
     - copied unchanged from r284226, head/tools/bus_space/bus_space.h
Deleted:
  head/tools/bus_space/C/libbus_space.h
  head/tools/bus_space/bus_space.c
  head/tools/bus_space/bus_space.h
Modified:
  head/tools/bus_space/C/Makefile
  head/tools/bus_space/C/lang.c
  head/tools/bus_space/Makefile.inc
  head/tools/bus_space/Python/Makefile
  head/tools/bus_space/Python/lang.c

Modified: head/tools/bus_space/C/Makefile
==============================================================================
--- head/tools/bus_space/C/Makefile     Wed Jun 10 15:53:39 2015        
(r284227)
+++ head/tools/bus_space/C/Makefile     Wed Jun 10 16:00:09 2015        
(r284228)
@@ -1,9 +1,9 @@
 # $FreeBSD$
 
-LIB=           bus_space
+LIB=           bus
 SHLIB_MAJOR=   0
 SRCS=          lang.c
-INCS=          libbus_space.h
+INCS=          libbus.h
 
 CFLAGS+= -I${.CURDIR}/..
 

Modified: head/tools/bus_space/C/lang.c
==============================================================================
--- head/tools/bus_space/C/lang.c       Wed Jun 10 15:53:39 2015        
(r284227)
+++ head/tools/bus_space/C/lang.c       Wed Jun 10 16:00:09 2015        
(r284228)
@@ -30,12 +30,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.h>
 #include <errno.h>
 
-#include "bus_space.h"
+#include "bus.h"
 #include "busdma.h"
-#include "libbus_space.h"
+#include "libbus.h"
 
 int16_t
-bus_space_read_1(int rid, long ofs)
+bus_read_1(int rid, long ofs)
 {
        uint8_t val;
 
@@ -43,7 +43,7 @@ bus_space_read_1(int rid, long ofs)
 }
 
 int32_t
-bus_space_read_2(int rid, long ofs)
+bus_read_2(int rid, long ofs)
 {
        uint16_t val;
 
@@ -51,7 +51,7 @@ bus_space_read_2(int rid, long ofs)
 }
 
 int64_t
-bus_space_read_4(int rid, long ofs)
+bus_read_4(int rid, long ofs)
 {
        uint32_t val;
 
@@ -59,42 +59,42 @@ bus_space_read_4(int rid, long ofs)
 }
 
 int
-bus_space_write_1(int rid, long ofs, uint8_t val)
+bus_write_1(int rid, long ofs, uint8_t val)
 {
 
        return ((!bs_write(rid, ofs, &val, sizeof(val))) ? errno : 0);
 }
 
 int
-bus_space_write_2(int rid, long ofs, uint16_t val)
+bus_write_2(int rid, long ofs, uint16_t val)
 {
 
        return ((!bs_write(rid, ofs, &val, sizeof(val))) ? errno : 0);
 }
 
 int
-bus_space_write_4(int rid, long ofs, uint32_t val)
+bus_write_4(int rid, long ofs, uint32_t val)
 {
 
        return ((!bs_write(rid, ofs, &val, sizeof(val))) ? errno : 0);
 }
 
 int
-bus_space_map(const char *dev)
+bus_map(const char *dev)
 {
 
        return (bs_map(dev));
 }
 
 int
-bus_space_unmap(int rid)
+bus_unmap(int rid)
 {
 
        return ((!bs_unmap(rid)) ? errno : 0);
 }
 
 int
-bus_space_subregion(int rid, long ofs, long sz)
+bus_subregion(int rid, long ofs, long sz)
 {
 
        return (bs_subregion(rid, ofs, sz));

Copied and modified: head/tools/bus_space/C/libbus.h (from r284227, 
head/tools/bus_space/C/libbus_space.h)
==============================================================================
--- head/tools/bus_space/C/libbus_space.h       Wed Jun 10 15:53:39 2015        
(r284227, copy source)
+++ head/tools/bus_space/C/libbus.h     Wed Jun 10 16:00:09 2015        
(r284228)
@@ -29,15 +29,15 @@
 #ifndef _LIBBUS_SPACE_H_
 #define        _LIBBUS_SPACE_H_
 
-int    bus_space_map(const char *dev);
-int16_t        bus_space_read_1(int rid, long ofs);
-int32_t        bus_space_read_2(int rid, long ofs);
-int64_t bus_space_read_4(int rid, long ofs);
-int    bus_space_subregion(int rid, long ofs, long sz);
-int    bus_space_unmap(int rid);
-int    bus_space_write_1(int rid, long ofs, uint8_t val);
-int    bus_space_write_2(int rid, long ofs, uint16_t val);
-int    bus_space_write_4(int rid, long ofs, uint32_t val);
+int    bus_map(const char *dev);
+int16_t        bus_read_1(int rid, long ofs);
+int32_t        bus_read_2(int rid, long ofs);
+int64_t bus_read_4(int rid, long ofs);
+int    bus_subregion(int rid, long ofs, long sz);
+int    bus_unmap(int rid);
+int    bus_write_1(int rid, long ofs, uint8_t val);
+int    bus_write_2(int rid, long ofs, uint16_t val);
+int    bus_write_4(int rid, long ofs, uint32_t val);
 
 typedef unsigned long bus_addr_t;
 typedef unsigned long bus_size_t;

Modified: head/tools/bus_space/Makefile.inc
==============================================================================
--- head/tools/bus_space/Makefile.inc   Wed Jun 10 15:53:39 2015        
(r284227)
+++ head/tools/bus_space/Makefile.inc   Wed Jun 10 16:00:09 2015        
(r284228)
@@ -1,4 +1,4 @@
 # $FreeBSD$
 
 .PATH: ${.CURDIR}/..
-SRCS+= bus_space.c busdma.c
+SRCS+= bus.c busdma.c

Modified: head/tools/bus_space/Python/Makefile
==============================================================================
--- head/tools/bus_space/Python/Makefile        Wed Jun 10 15:53:39 2015        
(r284227)
+++ head/tools/bus_space/Python/Makefile        Wed Jun 10 16:00:09 2015        
(r284228)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-SHLIB_NAME=    bus_space.so
+SHLIB_NAME=    bus.so
 SRCS=          lang.c
 
 CFLAGS+= -I${.CURDIR}/.. -I/usr/local/include/python2.7

Modified: head/tools/bus_space/Python/lang.c
==============================================================================
--- head/tools/bus_space/Python/lang.c  Wed Jun 10 15:53:39 2015        
(r284227)
+++ head/tools/bus_space/Python/lang.c  Wed Jun 10 16:00:09 2015        
(r284228)
@@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$");
 
 #include <Python.h>
 
-#include "bus_space.h"
+#include "bus.h"
 #include "busdma.h"
 
 static PyObject *
@@ -259,7 +259,7 @@ busdma_mem_free(PyObject *self, PyObject
        Py_RETURN_NONE;
 }
 
-static PyMethodDef bus_space_methods[] = {
+static PyMethodDef bus_methods[] = {
     { "read_1", bus_read_1, METH_VARARGS, "Read a 1-byte data item." },
     { "read_2", bus_read_2, METH_VARARGS, "Read a 2-byte data item." },
     { "read_4", bus_read_4, METH_VARARGS, "Read a 4-byte data item." },
@@ -293,9 +293,9 @@ static PyMethodDef busdma_methods[] = {
 };
 
 PyMODINIT_FUNC
-initbus_space(void)
+initbus(void)
 {
 
-       Py_InitModule("bus_space", bus_space_methods);
+       Py_InitModule("bus", bus_methods);
        Py_InitModule("busdma", busdma_methods);
 }

Copied and modified: head/tools/bus_space/bus.c (from r284226, 
head/tools/bus_space/bus_space.c)
==============================================================================
--- head/tools/bus_space/bus_space.c    Wed Jun 10 15:34:43 2015        
(r284226, copy source)
+++ head/tools/bus_space/bus.c  Wed Jun 10 16:00:09 2015        (r284228)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "bus_space.h"
+#include "bus.h"
 
 #include "../../sys/dev/proto/proto_dev.h"
 

Copied: head/tools/bus_space/bus.h (from r284226, 
head/tools/bus_space/bus_space.h)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/bus_space/bus.h  Wed Jun 10 16:00:09 2015        (r284228, copy 
of r284226, head/tools/bus_space/bus_space.h)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2014 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _TOOLS_BUS_SPACE_H_
+#define        _TOOLS_BUS_SPACE_H_
+
+int bs_map(const char *dev);
+int bs_read(int rid, off_t ofs, void *buf, ssize_t bufsz);
+int bs_subregion(int rid0, long ofs, long sz);
+int bs_unmap(int rid);
+int bs_write(int rid, off_t ofs, void *buf, ssize_t bufsz);
+
+#endif /* _TOOLS_BUS_SPACE_H_ */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to