Changeset 9e9ced0 in mainline for uspace/lib/c/generic/ddi.c


Ignore:
Timestamp:
2018-05-22T19:06:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6c0016
Parents:
a86174ec
git-author:
Jakub Jermar <jakub@…> (2018-04-22 12:14:08)
git-committer:
Jakub Jermar <jakub@…> (2018-05-22 19:06:50)
Message:

Return also the size of the enabled resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ddi.c

    ra86174ec r9e9ced0  
    220220/** Enable PIO for specified HW resource wrt. to the PIO window.
    221221 *
    222  * @param win      PIO window. May be NULL if the resources are known to be
    223  *                 absolute.
    224  * @param res      Resources specifying the I/O range wrt. to the PIO window.
    225  * @param virt     Virtual address for application's PIO operations.
     222 * @param win        PIO window. May be NULL if the resources are known to be
     223 *                   absolute.
     224 * @param res        Resources specifying the I/O range wrt. to the PIO window.
     225 * @param[out] virt  Virtual address for application's PIO operations.
     226 * @param[out] size  If non-NULL, size of the enabled resource.
    226227 *
    227228 * @return EOK on success.
     
    229230 *
    230231 */
    231 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt)
     232errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt,
     233    size_t *size)
    232234{
    233235        uintptr_t addr;
    234         size_t size;
     236        size_t sz;
    235237
    236238        switch (res->type) {
     
    242244                        addr += win->io.base;
    243245                }
    244                 size = res->res.io_range.size;
     246                sz = res->res.io_range.size;
    245247                break;
    246248        case MEM_RANGE:
     
    251253                        addr += win->mem.base;
    252254                }
    253                 size = res->res.mem_range.size;
     255                sz = res->res.mem_range.size;
    254256                break;
    255257        default:
     
    257259        }
    258260
    259         return pio_enable((void *) addr, size, virt);
     261        if (size)
     262                *size = sz;
     263
     264        return pio_enable((void *) addr, sz, virt);
    260265}
    261266
Note: See TracChangeset for help on using the changeset viewer.