source: mainline/uspace/lib/usb/include/usb/usbmem.h@ 103a3626

lfn serial ticket/834-toolchain-update topic/fix-logger-deadlock topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 103a3626 was 103a3626, checked in by Matus Dekanek <smekideki@…>, 15 years ago

a bit of codelifting, dprintf correctly used in usb hub driver

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2011 Matus Dekanek
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef USBMEM_H
30#define USBMEM_H
31
32
33// group should be changed - this is not usb specific
34/** @addtogroup usb
35 * @{
36 */
37/** @file definitions of memory management with address translation, used mostly in usb stack
38 *
39 * USB HCD needs traslation between physical and virtual addresses. These
40 * functions implement such functionality. For each allocated virtual address
41 * the memory manager gets also it`s physical translation and remembers it.
42 * Addresses allocated byt this manager can be therefore translated from and to
43 * physical addresses.
44 * Typical use:
45 * void * address = mman_malloc(some_size);
46 * void * physical_address = mman_getPA(address);
47 * void * the_same_address = mman_getVA(physical_address);
48 * void * null_address = mman_getPA(non_existing_address);
49 * mman_free(address);
50 * // physical_address, adress and the_same_address are no longer valid here
51 *
52 *
53 * @note Addresses allocated by this memory manager should be as well
54 * deallocated byt it.
55 *
56 */
57
58#include <sys/types.h>
59
60extern void * mman_malloc(
61 size_t size,
62 size_t alignment,
63 unsigned long max_physical_address);
64
65extern void * mman_getVA(void * addr);
66
67extern void * mman_getPA(void * addr);
68
69extern void mman_free(void * addr);
70
71
72
73
74
75
76/** @}
77 */
78
79
80#endif /* USBMEM_H */
81
Note: See TracBrowser for help on using the repository browser.