Changes in uspace/lib/c/generic/ddi.c [fbcdeb8:b5c2f56] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ddi.c
rfbcdeb8 rb5c2f56 34 34 35 35 #include <assert.h> 36 #include <atomic.h> 36 37 #include <unistd.h> 38 #include <stdio.h> 37 39 #include <errno.h> 38 40 #include <sys/types.h> … … 47 49 #include "private/libc.h" 48 50 51 49 52 /** Return unique device number. 50 53 * … … 120 123 * 121 124 */ 122 int iospace_enable(task_id_t id, void *ioaddr, unsigned longsize)123 { 124 ddi_ioarg_t arg;125 126 arg.task_id = id;127 arg.ioaddr = ioaddr;128 arg.size = size;125 static int iospace_enable(task_id_t id, void *ioaddr, size_t size) 126 { 127 const ddi_ioarg_t arg = { 128 .task_id = id, 129 .ioaddr = ioaddr, 130 .size = size 131 }; 129 132 130 133 return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg); … … 136 139 * @param size Size of the I/O region. 137 140 * @param virt Virtual address for application's 138 * PIO operations. 141 * PIO operations. Can be NULL for PMIO. 139 142 * 140 143 * @return EOK on success. … … 146 149 #ifdef IO_SPACE_BOUNDARY 147 150 if (pio_addr < IO_SPACE_BOUNDARY) { 148 *virt = pio_addr; 151 if (virt) 152 *virt = pio_addr; 149 153 return iospace_enable(task_get_id(), pio_addr, size); 150 154 } 155 #else 156 (void) iospace_enable; 151 157 #endif 152 158 if (!virt) 159 return EINVAL; 160 153 161 void *phys_frame = 154 162 (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE); … … 166 174 } 167 175 176 void pio_write_8(ioport8_t *reg, uint8_t val) 177 { 178 pio_trace_log(reg, val, true); 179 arch_pio_write_8(reg, val); 180 } 181 182 void pio_write_16(ioport16_t *reg, uint16_t val) 183 { 184 pio_trace_log(reg, val, true); 185 arch_pio_write_16(reg, val); 186 } 187 188 void pio_write_32(ioport32_t *reg, uint32_t val) 189 { 190 pio_trace_log(reg, val, true); 191 arch_pio_write_32(reg, val); 192 } 193 194 uint8_t pio_read_8(const ioport8_t *reg) 195 { 196 const uint8_t val = arch_pio_read_8(reg); 197 pio_trace_log(reg, val, false); 198 return val; 199 } 200 201 uint16_t pio_read_16(const ioport16_t *reg) 202 { 203 const uint16_t val = arch_pio_read_16(reg); 204 pio_trace_log(reg, val, false); 205 return val; 206 } 207 208 uint32_t pio_read_32(const ioport32_t *reg) 209 { 210 const uint32_t val = arch_pio_read_32(reg); 211 pio_trace_log(reg, val, false); 212 return val; 213 } 214 168 215 /** Register IRQ notification. 169 216 *
Note:
See TracChangeset
for help on using the changeset viewer.