Changeset eb522e8 in mainline for uspace/drv/ohci/utils/malloc32.h


Ignore:
Timestamp:
2011-06-01T08:43:42Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d6c1f1
Parents:
9e2e715 (diff), e51a514 (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:

Huuuuuge merge from development - all the work actually :)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/utils/malloc32.h

    r9e2e715 reb522e8  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2010 Jan Vesely
    33 * All rights reserved.
    44 *
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    29 /** @addtogroup ip
     28/** @addtogroup drvusbohci
    3029 * @{
    3130 */
     31/** @file
     32 * @brief OHCI driver
     33 */
     34#ifndef DRV_OHCI_UTILS_MALLOC32_H
     35#define DRV_OHCI_UTILS_MALLOC32_H
    3236
    33 /** @file
    34  * IP standalone module implementation.
    35  * Contains skeleton module functions mapping.
    36  * The functions are used by the module skeleton as module specific entry
    37  * points.
     37#include <assert.h>
     38#include <malloc.h>
     39#include <errno.h>
     40#include <mem.h>
     41#include <as.h>
     42
     43/** Get physical address translation
    3844 *
    39  * @see module.c
     45 * @param[in] addr Virtual address to translate
     46 * @return Physical address if exists, NULL otherwise.
    4047 */
     48static inline uintptr_t addr_to_phys(void *addr)
     49{
     50        uintptr_t result;
     51        int ret = as_get_physical_mapping(addr, &result);
    4152
    42 #include <async.h>
    43 #include <stdio.h>
    44 #include <ipc/ipc.h>
    45 #include <ipc/services.h>
    46 #include <errno.h>
    47 
    48 #include <net/modules.h>
    49 #include <net_interface.h>
    50 #include <net/packet.h>
    51 #include <il_local.h>
    52 
    53 #include "ip.h"
    54 #include "ip_module.h"
    55 
    56 /** IP module global data. */
    57 extern ip_globals_t ip_globals;
    58 
    59 int
    60 il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    61     ipc_call_t *answer, int *answer_count)
    62 {
    63         return ip_message_standalone(callid, call, answer, answer_count);
     53        if (ret != EOK)
     54                return 0;
     55        return (result | ((uintptr_t)addr & 0xfff));
    6456}
    65 
    66 int il_module_start_standalone(async_client_conn_t client_connection)
    67 {
    68         ipcarg_t phonehash;
    69         int rc;
    70        
    71         async_set_client_connection(client_connection);
    72         ip_globals.net_phone = net_connect_module();
    73 
    74         rc = pm_init();
    75         if (rc != EOK)
    76                 return rc;
    77        
    78         rc = ip_initialize(client_connection);
    79         if (rc != EOK)
    80                 goto out;
    81        
    82         rc = REGISTER_ME(SERVICE_IP, &phonehash);
    83         if (rc != EOK)
    84                 goto out;
    85        
    86         async_manager();
    87 
    88 out:
    89         pm_destroy();
    90         return rc;
    91 }
    92 
    93 /** @}
     57/*----------------------------------------------------------------------------*/
     58/** Physical mallocator simulator
     59 *
     60 * @param[in] size Size of the required memory space
     61 * @return Address of the aligned and big enough memory place, NULL on failure.
    9462 */
     63static inline void * malloc32(size_t size)
     64        { return memalign(size, size); }
     65/*----------------------------------------------------------------------------*/
     66/** Physical mallocator simulator
     67 *
     68 * @param[in] addr Address of the place allocated by malloc32
     69 */
     70static inline void free32(void *addr)
     71        { if (addr) free(addr); }
     72#endif
     73/**
     74 * @}
     75 */
Note: See TracChangeset for help on using the changeset viewer.