source: rtems/cpukit/libdrvmgr/drvmgr_translate_check.c @ 30594a9

4.115
Last change on this file since 30594a9 was e7fade3, checked in by Daniel Hellstrom <daniel@…>, on 11/28/11 at 08:52:03

DRVMGR: added driver manager to cpukit/libdrvmgr

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