Changeset eeb5cc2 in mainline
- Timestamp:
- 2013-09-12T12:24:09Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46eb2c4
- Parents:
- 9e470c0
- Location:
- uspace/lib/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ddi.c
r9e470c0 reeb5cc2 136 136 } 137 137 138 /** Enable PIO for specified HW resource. 139 * 140 * @param win PIO window. May be NULL if the resources are known to be 141 * absolute. 142 * @param res Resources specifying the I/O range wrt. to the PIO window. 143 * @param virt Virtual address for application's PIO operations. 144 * 145 * @return EOK on success. 146 * @return Negative error code on failure. 147 * 148 */ 149 int pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt) 150 { 151 uintptr_t addr; 152 size_t size; 153 154 switch (res->type) { 155 case IO_RANGE: 156 addr = res->res.io_range.address; 157 if (res->res.io_range.relative) { 158 if (!win) 159 return EINVAL; 160 addr += win->io.base; 161 } 162 size = res->res.io_range.size; 163 break; 164 case MEM_RANGE: 165 addr = res->res.mem_range.address; 166 if (res->res.mem_range.relative) { 167 if (!win) 168 return EINVAL; 169 addr += win->mem.base; 170 } 171 size = res->res.mem_range.size; 172 break; 173 default: 174 return EINVAL; 175 } 176 177 return pio_enable((void *) addr, size, virt); 178 } 179 138 180 /** Enable PIO for specified I/O range. 139 181 * -
uspace/lib/c/include/ddi.h
r9e470c0 reeb5cc2 40 40 #include <sys/time.h> 41 41 #include <abi/ddi/irq.h> 42 #include <device/hw_res.h> 43 #include <device/pio_window.h> 42 44 #include <task.h> 43 45 … … 55 57 extern int dmamem_unmap_anonymous(void *); 56 58 59 extern int pio_enable_resource(pio_window_t *, hw_resource_t *, void **); 57 60 extern int pio_enable(void *, size_t, void **); 58 61
Note:
See TracChangeset
for help on using the changeset viewer.