Changeset 4687a26c in mainline for uspace/lib/c/generic/device/hw_res.c
- Timestamp:
- 2010-11-02T18:29:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f35b9ff
- Parents:
- 76e1121f (diff), 28f4adb (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
r76e1121f r4687a26c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2010 Lenka Trochtova 3 3 * All rights reserved. 4 4 * … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 /** @addtogroup ip 28 29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 /** @file 33 */ 34 35 #include <device/hw_res.h> 36 #include <errno.h> 37 #include <async.h> 38 #include <malloc.h> 32 39 33 #ifndef __NET_IP_LOCAL_H__ 34 #define __NET_IP_LOCAL_H__ 40 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources) 41 { 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); 44 hw_resources->count = count; 45 if (EOK != rc) { 46 return false; 47 } 48 49 size_t size = count * sizeof(hw_resource_t); 50 hw_resources->resources = (hw_resource_t *)malloc(size); 51 if (NULL == hw_resources->resources) { 52 return false; 53 } 54 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 } 35 64 36 #include <async.h> 37 #include <ipc/services.h> 38 39 #include <ip_codes.h> 40 #include <inet.h> 41 #include <in.h> 42 #include <socket.h> 43 44 extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t, 45 services_t); 46 extern int ip_set_gateway_req_local(int, device_id_t, in_addr_t); 47 extern int ip_packet_size_req_local(int, device_id_t, packet_dimension_ref); 48 extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t, 49 services_t); 50 extern int ip_device_req_local(int, device_id_t, services_t); 51 extern int ip_add_route_req_local(int, device_id_t, in_addr_t, in_addr_t, 52 in_addr_t); 53 extern int ip_send_msg_local(int, device_id_t, packet_t, services_t, 54 services_t); 55 extern int ip_get_route_req_local(int, ip_protocol_t, const struct sockaddr *, 56 socklen_t, device_id_t *, void **, size_t *); 57 58 #endif 59 60 /** @} 65 bool enable_interrupt(int dev_phone) 66 { 67 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), ENABLE_INTERRUPT); 68 return rc == EOK; 69 } 70 71 72 73 /** @} 61 74 */
Note:
See TracChangeset
for help on using the changeset viewer.