Changeset 357b5f5 in mainline for uspace/lib/c/generic/device/hw_res.c


Ignore:
Timestamp:
2011-01-23T20:09:13Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdb9982c
Parents:
cead2aa (diff), 7e36c8d (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:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/hw_res.c

    rcead2aa r357b5f5  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929 /** @addtogroup libc
    3030 * @{
     
    3232/** @file
    3333 */
    34  
     34
    3535#include <device/hw_res.h>
    3636#include <errno.h>
     
    3838#include <malloc.h>
    3939
    40 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
     40int hw_res_get_resource_list(int dev_phone, hw_resource_list_t *hw_resources)
    4141{
    42         ipcarg_t count = 0;
    43         int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count);
     42        sysarg_t count = 0;
     43
     44        int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     45            HW_RES_GET_RESOURCE_LIST, &count);
     46
    4447        hw_resources->count = count;
    45         if (EOK != rc) {
    46                 return false;
    47         }
     48        if (rc != EOK)
     49                return rc;
    4850       
    4951        size_t size = count * sizeof(hw_resource_t);
    5052        hw_resources->resources = (hw_resource_t *)malloc(size);
    51         if (NULL == hw_resources->resources) {
    52                 return false;
     53        if (!hw_resources->resources)
     54                return ENOMEM;
     55       
     56        rc = async_data_read_start(dev_phone, hw_resources->resources, size);
     57        if (rc != EOK) {
     58                free(hw_resources->resources);
     59                hw_resources->resources = NULL;
     60                return rc;
    5361        }
    5462       
    55         rc = async_data_read_start(dev_phone, hw_resources->resources, size);
    56         if (EOK != rc) {
    57                 free(hw_resources->resources);
    58                 hw_resources->resources = NULL;
    59                 return false;
    60         }
    61                  
    62         return true;     
     63        return EOK;
    6364}
    6465
    65 bool enable_interrupt(int dev_phone)
     66bool hw_res_enable_interrupt(int dev_phone)
    6667{
    67         int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), ENABLE_INTERRUPT);
     68        int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     69            HW_RES_ENABLE_INTERRUPT);
     70
    6871        return rc == EOK;
    6972}
    70  
    71  
    72  
    73  /** @}
     73
     74/** @}
    7475 */
Note: See TracChangeset for help on using the changeset viewer.