source: rtems/cpukit/libdrvmgr/drvmgr_translate_check.c @ e53daed

4.115
Last change on this file since e53daed was 0decc806, checked in by Daniel Hellstrom <daniel@…>, on 04/09/15 at 14:09:13

DRVMGR: updated license to rtems.org

  • Property mode set to 100644
File size: 930 bytes
Line 
1/* Driver Manager Driver Translate Interface Implementation
2 *
3 * COPYRIGHT (c) 2010 Cobham Gaisler AB.
4 *
5 * The license and distribution terms for this file may be
6 * found in the file LICENSE in this distribution or at
7 * http://www.rtems.org/license/LICENSE.
8 */
9
10#include <drvmgr/drvmgr.h>
11
12/* Calls drvmgr_translate() to translate an address range and check the result,
13 * a printout is generated if the check fails. See paramters of
14 * drvmgr_translate().
15 * If size=0 only the starting address is not checked.
16 */
17int drvmgr_translate_check(
18        struct drvmgr_dev *dev,
19        unsigned int options,
20        void *src_address,
21        void **dst_address,
22        unsigned int size)
23{
24        unsigned int max;
25
26        max = drvmgr_translate(dev, options, src_address, dst_address);
27        if (max == 0 || (max < size && (size != 0))) {
28                printk(" ### dev %p (%s) failed mapping %p\n",
29                        dev, dev->name ? dev->name : "unnamed", src_address);
30                return -1;
31        }
32
33        return 0;
34}
Note: See TracBrowser for help on using the repository browser.