Changeset 7fc092a in mainline for uspace/lib/usb/include/usb/usbmem.h


Ignore:
Timestamp:
2011-01-27T22:09:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db7ed07
Parents:
9ee87f6 (diff), 6265a2b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Changes from development branch

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/usbmem.h

    r9ee87f6 r7fc092a  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2010 Matus Dekanek
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup arp
    30  *  @{
     29#ifndef USBMEM_H
     30#define USBMEM_H
     31
     32
     33// group should be changed - this is not usb specific
     34/** @addtogroup usb
     35 * @{
    3136 */
    32 
    33 /** @file
    34  * ARP protocol header.
    35  * Based on the RFC 826.
     37/** @file definitions of special memory management, 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 *
    3656 */
    37 
    38 #ifndef NET_ARP_HEADER_H_
    39 #define NET_ARP_HEADER_H_
    4057
    4158#include <sys/types.h>
    4259
    43 /** Type definition of an ARP protocol header.
    44  * @see arp_header
    45  */
    46 typedef struct arp_header arp_header_t;
     60extern void * mman_malloc(
     61                size_t size,
     62                size_t alignment,
     63                unsigned long max_physical_address);
    4764
    48 /** ARP protocol header. */
    49 struct arp_header {
    50         /**
    51          * Hardware type identifier.
    52          * @see hardware.h
    53          */
    54         uint16_t hardware;
    55        
    56         /** Protocol identifier. */
    57         uint16_t protocol;
    58         /** Hardware address length in bytes. */
    59         uint8_t hardware_length;
    60         /** Protocol address length in bytes. */
    61         uint8_t protocol_length;
    62        
    63         /**
    64          * ARP packet type.
    65          * @see arp_oc.h
    66          */
    67         uint16_t operation;
    68 } __attribute__ ((packed));
     65extern void * mman_getVA(void * addr);
    6966
    70 #endif
     67extern void * mman_getPA(void * addr);
     68
     69extern void mman_free(void * addr);
     70
     71
     72
     73
     74
    7175
    7276/** @}
    7377 */
     78
     79
     80#endif  /* USBMEM_H */
     81
Note: See TracChangeset for help on using the changeset viewer.