source: rtems/cpukit/libdrvmgr/drvmgr_translate_check.c @ 7075fb11

Last change on this file since 7075fb11 was ede1a41, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 21, 2016 at 11:12:31 AM

Make rtems/print.h independent of rtems/bspIo.h

  • Property mode set to 100644
File size: 956 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#include <rtems/bspIo.h>
13
14/* Calls drvmgr_translate() to translate an address range and check the result,
15 * a printout is generated if the check fails. See paramters of
16 * drvmgr_translate().
17 * If size=0 only the starting address is not checked.
18 */
19int drvmgr_translate_check(
20        struct drvmgr_dev *dev,
21        unsigned int options,
22        void *src_address,
23        void **dst_address,
24        unsigned int size)
25{
26        unsigned int max;
27
28        max = drvmgr_translate(dev, options, src_address, dst_address);
29        if (max == 0 || (max < size && (size != 0))) {
30                printk(" ### dev %p (%s) failed mapping %p\n",
31                        dev, dev->name ? dev->name : "unnamed", src_address);
32                return -1;
33        }
34
35        return 0;
36}
Note: See TracBrowser for help on using the repository browser.