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.
This commit is contained in:
parent
1383b5af08
commit
4559857c8e
@ -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}/..
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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;
|
@ -1,4 +1,4 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/..
|
||||
SRCS+= bus_space.c busdma.c
|
||||
SRCS+= bus.c busdma.c
|
||||
|
@ -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
|
||||
|
@ -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 *args)
|
||||
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);
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user