diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2015-07-03 02:06:47 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2015-07-03 02:06:47 +0000 |
commit | 22900685fd7640bdc6eb8f09c44d2126e360ddb8 (patch) | |
tree | dc7a73b15347e172d9087c8cd7ba8fb72abc7196 /tools/bus_space/Python | |
parent | e08d13cf837ac74b4c6088539a00600ac6677ff4 (diff) | |
download | src-22900685fd7640bdc6eb8f09c44d2126e360ddb8.tar.gz src-22900685fd7640bdc6eb8f09c44d2126e360ddb8.zip |
Notes
Diffstat (limited to 'tools/bus_space/Python')
-rw-r--r-- | tools/bus_space/Python/lang.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/bus_space/Python/lang.c b/tools/bus_space/Python/lang.c index 2127df57fa4f..a90e0bd89565 100644 --- a/tools/bus_space/Python/lang.c +++ b/tools/bus_space/Python/lang.c @@ -229,6 +229,55 @@ busdma_tag_destroy(PyObject *self, PyObject *args) } static PyObject * +busdma_md_create(PyObject *self, PyObject *args) +{ + u_int flags; + int error, mdid, tid; + + if (!PyArg_ParseTuple(args, "iI", &tid, &flags)) + return (NULL); + mdid = bd_md_create(tid, flags); + if (mdid == -1) { + PyErr_SetString(PyExc_IOError, strerror(errno)); + return (NULL); + } + return (Py_BuildValue("i", mdid)); +} + +static PyObject * +busdma_md_destroy(PyObject *self, PyObject *args) +{ + int error, mdid; + + if (!PyArg_ParseTuple(args, "i", &mdid)) + return (NULL); + error = bd_md_destroy(mdid); + if (error) { + PyErr_SetString(PyExc_IOError, strerror(error)); + return (NULL); + } + Py_RETURN_NONE; +} + +static PyObject * +busdma_md_load(PyObject *self, PyObject *args) +{ + void *buf; + u_long len; + u_int flags; + int error, mdid; + + if (!PyArg_ParseTuple(args, "iwkI", &mdid, &buf, &len, &flags)) + return (NULL); + error = bd_md_load(mdid, buf, len, flags); + if (error) { + PyErr_SetString(PyExc_IOError, strerror(error)); + return (NULL); + } + Py_RETURN_NONE; +} + +static PyObject * busdma_mem_alloc(PyObject *self, PyObject *args) { u_int flags; @@ -347,6 +396,14 @@ static PyMethodDef busdma_methods[] = { "Derive a child tag." }, { "tag_destroy", busdma_tag_destroy, METH_VARARGS, "Destroy a tag." }, + + { "md_create", busdma_md_create, METH_VARARGS, + "Create a new and empty memory descriptor." }, + { "md_destroy", busdma_md_destroy, METH_VARARGS, + "Destroy a previously created memory descriptor." }, + { "md_load", busdma_md_load, METH_VARARGS, + "Load a buffer into a memory descriptor." }, + { "mem_alloc", busdma_mem_alloc, METH_VARARGS, "Allocate memory according to the DMA constraints." }, { "mem_free", busdma_mem_free, METH_VARARGS, |