# HG changeset patch # User Paul Boddie # Date 1592064254 -7200 # Node ID 2b0ee534897cdc9a39eb8c90f466f32923a9eb7f # Parent d9480ff7284a982815596e7d3418c27c7b48ab87 Added missing memory and IRQ functions, somehow previously omitted. diff -r d9480ff7284a -r 2b0ee534897c pkg/devices/util/include/memory.h --- a/pkg/devices/util/include/memory.h Sat Jun 06 01:22:58 2020 +0200 +++ b/pkg/devices/util/include/memory.h Sat Jun 13 18:04:14 2020 +0200 @@ -1,7 +1,7 @@ /* - * Memory allocation utility functions. + * Memory and resource allocation utility functions. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2019 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -25,10 +25,16 @@ #include #include +EXTERN_C_BEGIN + int get_device(char const *hid, l4io_device_handle_t *dh, l4io_resource_handle_t *rh); +int get_irq(char const *hid, l4_uint32_t *start, l4_uint32_t *end); + int get_resource(l4io_device_handle_t dh, l4io_resource_t *res, enum l4io_resource_types_t type); int get_memory(char const *hid, l4_addr_t *start, l4_addr_t *end); + +EXTERN_C_END diff -r d9480ff7284a -r 2b0ee534897c pkg/devices/util/src/memory.cc --- a/pkg/devices/util/src/memory.cc Sat Jun 06 01:22:58 2020 +0200 +++ b/pkg/devices/util/src/memory.cc Sat Jun 13 18:04:14 2020 +0200 @@ -1,7 +1,7 @@ /* - * Memory allocation utility functions. + * Memory and resource allocation utility functions. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2019 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -33,6 +33,29 @@ return l4io_lookup_device(hid, dh, 0, rh); } +int get_irq(char const *hid, l4_uint32_t *start, l4_uint32_t *end) +{ + l4io_device_handle_t dh; + l4io_resource_handle_t rh; + l4io_resource_t res; + int result; + + result = get_device(hid, &dh, &rh); + + if (result < 0) + return result; + + result = get_resource(dh, &res, L4IO_RESOURCE_IRQ); + + if (result) + return result; + + *start = res.start; + *end = res.end; + + return result; +} + int get_resource(l4io_device_handle_t dh, l4io_resource_t *res, enum l4io_resource_types_t type) {