Changeset 60b2b69 in mainline for uspace/lib
- Timestamp:
- 2011-01-14T13:04:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5f635ca
- Parents:
- 5ccb15c (diff), 00c2d035 (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. - Location:
- uspace/lib
- Files:
-
- 4 added
- 4 deleted
- 14 edited
- 6 moved
-
c/generic/ddi.c (modified) (1 diff)
-
c/generic/devman.c (modified) (1 diff)
-
c/include/ddi.h (modified) (1 diff)
-
c/include/ipc/il.h (modified) (2 diffs)
-
c/include/ipc/ip.h (modified) (2 diffs)
-
c/include/ipc/services.h (modified) (1 diff)
-
net/Makefile (modified) (2 diffs)
-
net/generic/protocol_map.c (modified) (3 diffs)
-
net/il/il_remote.c (moved) (moved from uspace/lib/net/il/il_interface.c ) (1 diff)
-
net/il/il_skel.c (added)
-
net/il/ip_remote.c (modified) (4 diffs)
-
net/include/il_local.h (deleted)
-
net/include/il_remote.h (moved) (moved from uspace/lib/net/include/il_interface.h ) (1 diff)
-
net/include/il_skel.h (moved) (moved from uspace/srv/net/tl/tcp/tcp_module.c ) (2 diffs)
-
net/include/nil_interface.h (deleted)
-
net/include/nil_local.h (deleted)
-
net/include/nil_remote.h (modified) (1 diff)
-
net/include/nil_skel.h (added)
-
net/include/tl_local.h (deleted)
-
net/include/tl_remote.h (moved) (moved from uspace/lib/net/include/tl_interface.h ) (2 diffs)
-
net/include/tl_skel.h (moved) (moved from uspace/srv/net/nil/eth/eth_module.c ) (2 diffs)
-
net/netif/netif_skel.c (modified) (4 diffs)
-
net/nil/nil_remote.c (modified) (2 diffs)
-
net/nil/nil_skel.c (added)
-
net/tl/tl_common.c (modified) (1 diff)
-
net/tl/tl_remote.c (moved) (moved from uspace/lib/net/tl/tl_interface.c ) (2 diffs)
-
net/tl/tl_skel.c (added)
-
usb/src/usbdrvreq.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ddi.c
r5ccb15c r60b2b69 96 96 } 97 97 98 /** Enable an interrupt.99 *100 * @param irq the interrupt.101 *102 * @return Zero on success, negative error code otherwise.103 */104 int interrupt_enable(int irq)105 {106 return __SYSCALL2(SYS_INTERRUPT_ENABLE, (sysarg_t) irq, 1);107 }108 109 /** Disable an interrupt.110 *111 * @param irq the interrupt.112 *113 * @return Zero on success, negative error code otherwise.114 */115 int interrupt_disable(int irq)116 {117 return __SYSCALL2(SYS_INTERRUPT_ENABLE, (sysarg_t) irq, 0);118 }119 120 98 /** Enable PIO for specified I/O range. 121 99 * -
uspace/lib/c/generic/devman.c
r5ccb15c r60b2b69 79 79 } 80 80 81 if (flags & IPC_FLAG_BLOCKING) 81 if (flags & IPC_FLAG_BLOCKING) { 82 82 devman_phone_client = async_connect_me_to_blocking( 83 83 PHONE_NS, SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 84 else84 } else { 85 85 devman_phone_client = async_connect_me_to(PHONE_NS, 86 86 SERVICE_DEVMAN, DEVMAN_CLIENT, 0); 87 } 87 88 88 89 fibril_mutex_unlock(&devman_phone_mutex); -
uspace/lib/c/include/ddi.h
r5ccb15c r60b2b69 42 42 extern int iospace_enable(task_id_t, void *, unsigned long); 43 43 extern int pio_enable(void *, size_t, void **); 44 extern int interrupt_enable(int);45 extern int interrupt_disable(int);46 44 47 45 #endif -
uspace/lib/c/include/ipc/il.h
r5ccb15c r60b2b69 33 33 /** @file 34 34 * Internetwork layer modules messages. 35 * @see il_ interface.h35 * @see il_remote.h 36 36 * @see ip_interface.h 37 37 */ … … 45 45 /** Internet layer modules messages. */ 46 46 typedef enum { 47 /** New device message.48 * @see ip_device_req()49 */50 NET_IL_DEVICE = NET_IL_FIRST,51 47 /** Device state changed message. 52 48 * @see il_device_state_msg() 53 49 */ 54 NET_IL_DEVICE_STATE, 50 NET_IL_DEVICE_STATE = NET_IL_FIRST, 51 55 52 /** Device MTU changed message. 56 53 * @see il_mtu_changed_msg() 57 54 */ 58 55 NET_IL_MTU_CHANGED, 59 /** Packet size message. 60 * @see il_packet_size_req() 61 */ 62 NET_IL_PACKET_SPACE, 56 63 57 /** Packet received message. 64 58 * @see il_received_msg() 65 59 */ 66 NET_IL_RECEIVED, 67 /** Packet send message. 68 * @see il_send_msg() 69 */ 70 NET_IL_SEND 60 NET_IL_RECEIVED 71 61 } il_messages; 72 62 -
uspace/lib/c/include/ipc/ip.h
r5ccb15c r60b2b69 47 47 /** IP module messages. */ 48 48 typedef enum { 49 /** New device message. 50 * @see ip_device_req() 51 */ 52 NET_IP_DEVICE = NET_IP_FIRST, 53 49 54 /** Adds the routing entry. 50 55 * @see ip_add_route() 51 56 */ 52 NET_IP_ADD_ROUTE = NET_IP_FIRST,57 NET_IP_ADD_ROUTE, 53 58 54 59 /** Gets the actual route information. … … 65 70 * @see ip_set_default_gateway() 66 71 */ 67 NET_IP_SET_GATEWAY 72 NET_IP_SET_GATEWAY, 73 74 /** Packet size message. 75 * @see ip_packet_size_req() 76 */ 77 NET_IP_PACKET_SPACE, 78 79 /** Packet send message. 80 * @see ip_send_msg() 81 */ 82 NET_IP_SEND 68 83 } ip_messages; 69 84 -
uspace/lib/c/include/ipc/services.h
r5ccb15c r60b2b69 54 54 SERVICE_NETWORKING, 55 55 SERVICE_LO, 56 SERVICE_ DP8390,56 SERVICE_NE2000, 57 57 SERVICE_ETHERNET, 58 58 SERVICE_NILDUMMY, -
uspace/lib/net/Makefile
r5ccb15c r60b2b69 43 43 netif/netif_skel.c \ 44 44 nil/nil_remote.c \ 45 il/il_interface.c \ 45 nil/nil_skel.c \ 46 il/il_remote.c \ 47 il/il_skel.c \ 46 48 il/ip_remote.c \ 47 49 il/ip_client.c \ … … 50 52 tl/icmp_client.c \ 51 53 tl/socket_core.c \ 52 tl/tl_interface.c \ 53 tl/tl_common.c 54 tl/tl_common.c \ 55 tl/tl_remote.c \ 56 tl/tl_skel.c 54 57 55 58 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/net/generic/protocol_map.c
r5ccb15c r60b2b69 50 50 switch (nil) { 51 51 case SERVICE_ETHERNET: 52 case SERVICE_ DP8390:52 case SERVICE_NE2000: 53 53 switch (il) { 54 54 case SERVICE_IP: … … 76 76 switch (nil) { 77 77 case SERVICE_ETHERNET: 78 case SERVICE_ DP8390:78 case SERVICE_NE2000: 79 79 switch (protocol) { 80 80 case ETH_P_IP: … … 139 139 switch (nil) { 140 140 case SERVICE_ETHERNET: 141 case SERVICE_ DP8390:141 case SERVICE_NE2000: 142 142 return HW_ETHER; 143 143 default: -
uspace/lib/net/il/il_remote.c
r5ccb15c r60b2b69 33 33 /** @file 34 34 * Internetwork layer module interface for the underlying network interface 35 * layer. This interface is always called by the remote modules.35 * layer. 36 36 */ 37 37 38 #include <il_ interface.h>38 #include <il_remote.h> 39 39 #include <generic.h> 40 40 #include <packet_client.h> -
uspace/lib/net/il/ip_remote.c
r5ccb15c r60b2b69 36 36 * 37 37 * @see ip_interface.h 38 * @see il_ interface.h38 * @see il_remote.h 39 39 * 40 40 */ … … 121 121 services_t service) 122 122 { 123 return generic_device_req_remote(ip_phone, NET_I L_DEVICE, device_id, 0,123 return generic_device_req_remote(ip_phone, NET_IP_DEVICE, device_id, 0, 124 124 service); 125 125 } … … 188 188 packet_dimension_t *packet_dimension) 189 189 { 190 return generic_packet_size_req_remote(ip_phone, NET_I L_PACKET_SPACE,190 return generic_packet_size_req_remote(ip_phone, NET_IP_PACKET_SPACE, 191 191 device_id, packet_dimension); 192 192 } … … 228 228 services_t sender, services_t error) 229 229 { 230 return generic_send_msg_remote(ip_phone, NET_I L_SEND, device_id,230 return generic_send_msg_remote(ip_phone, NET_IP_SEND, device_id, 231 231 packet_get_id(packet), sender, error); 232 232 } -
uspace/lib/net/include/il_remote.h
r5ccb15c r60b2b69 36 36 */ 37 37 38 #ifndef LIBNET_IL_ INTERFACE_H_39 #define LIBNET_IL_ INTERFACE_H_38 #ifndef LIBNET_IL_REMOTE_H_ 39 #define LIBNET_IL_REMOTE_H_ 40 40 41 41 #include <ipc/services.h> -
uspace/lib/net/include/il_skel.h
r5ccb15c r60b2b69 1 1 /* 2 * Copyright (c) 20 08 Lukas Mejdrech2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup tcp29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_IL_SKEL_H_ 34 #define LIBNET_IL_SKEL_H_ 35 33 36 /** @file 34 * TCP standalone module implementation. 35 * Contains skeleton module functions mapping. 36 * The functions are used by the module skeleton as module specific entry 37 * points. 38 * @see module.c 37 * Internetwork layer module skeleton. 38 * The skeleton has to be part of each internetwork layer module. 39 39 */ 40 40 41 #include "tcp.h"42 #include "tcp_module.h"43 44 41 #include <async.h> 45 #include <stdio.h> 46 #include <errno.h> 42 #include <fibril_synch.h> 47 43 #include <ipc/ipc.h> 48 44 #include <ipc/services.h> 49 45 50 #include < net/ip_protocols.h>51 #include <net/ modules.h>46 #include <adt/measured_strings.h> 47 #include <net/device.h> 52 48 #include <net/packet.h> 53 #include <net_interface.h>54 49 55 #include <ip_interface.h> 56 #include <tl_local.h> 50 /** Module initialization. 51 * 52 * This has to be implemented in user code. 53 * 54 * @param[in] net_phone Networking module phone. 55 * 56 * @return EOK on success. 57 * @return Other error codes as defined for each specific module 58 * initialize function. 59 * 60 */ 61 extern int il_initialize(int net_phone); 57 62 58 /** TCP module global data. */ 59 extern tcp_globals_t tcp_globals; 63 /** Process the internetwork layer module message. 64 * 65 * This has to be implemented in user code. 66 * 67 * @param[in] callid Message identifier. 68 * @param[in] call Message parameters. 69 * @param[out] answer Answer. 70 * @param[out] count Number of arguments of the answer. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module. 74 * 75 */ 76 extern int il_module_message(ipc_callid_t callid, ipc_call_t *call, 77 ipc_call_t *answer, size_t *answer_count); 60 78 61 int tl_module_start_standalone(async_client_conn_t client_connection) 62 { 63 sysarg_t phonehash; 64 int rc; 79 extern int il_module_start(int); 65 80 66 async_set_client_connection(client_connection); 67 tcp_globals.net_phone = net_connect_module(); 68 69 rc = pm_init(); 70 if (rc != EOK) 71 return rc; 72 73 rc = tcp_initialize(client_connection); 74 if (rc != EOK) 75 goto out; 76 77 rc = ipc_connect_to_me(PHONE_NS, SERVICE_TCP, 0, 0, &phonehash); 78 if (rc != EOK) 79 goto out; 80 81 async_manager(); 82 83 out: 84 pm_destroy(); 85 return rc; 86 } 87 88 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 89 ipc_call_t *answer, size_t *count) 90 { 91 return tcp_message_standalone(callid, call, answer, count); 92 } 81 #endif 93 82 94 83 /** @} -
uspace/lib/net/include/nil_remote.h
r5ccb15c r60b2b69 37 37 #include <net/device.h> 38 38 #include <net/packet.h> 39 #include <generic.h> 39 40 40 extern int nil_device_state_msg_remote(int, device_id_t, int); 41 extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t); 41 #define nil_bind_service(service, device_id, me, receiver) \ 42 bind_service(service, device_id, me, 0, receiver) 43 44 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 45 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \ 46 device_id, packet_dimension) 47 48 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 49 generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data) 50 51 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 52 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \ 53 address, data) 54 55 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 56 generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \ 57 packet_get_id(packet), sender, 0) 58 59 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 60 generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \ 61 netif_service) 62 63 extern int nil_device_state_msg(int, device_id_t, int); 64 extern int nil_received_msg(int, device_id_t, packet_t *, services_t); 42 65 43 66 #endif -
uspace/lib/net/include/tl_remote.h
r5ccb15c r60b2b69 35 35 */ 36 36 37 #ifndef LIBNET_TL_ INTERFACE_H_38 #define LIBNET_TL_ INTERFACE_H_37 #ifndef LIBNET_TL_REMOTE_H_ 38 #define LIBNET_TL_REMOTE_H_ 39 39 40 40 #include <async.h> … … 52 52 /*@{*/ 53 53 54 extern int tl_received_msg(int, device_id_t, packet_t *, services_t, services_t); 54 extern int tl_received_msg(int, device_id_t, packet_t *, services_t, 55 services_t); 55 56 56 57 /*@}*/ -
uspace/lib/net/include/tl_skel.h
r5ccb15c r60b2b69 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup eth29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_TL_SKEL_H_ 34 #define LIBNET_TL_SKEL_H_ 35 33 36 /** @file 34 * Ethernet module stub.35 * @see module.c37 * Transport layer module skeleton. 38 * The skeleton has to be part of each transport layer module. 36 39 */ 37 40 38 #include "eth.h"39 40 41 #include <async.h> 41 #include <stdio.h> 42 #include <errno.h> 43 42 #include <fibril_synch.h> 44 43 #include <ipc/ipc.h> 45 44 #include <ipc/services.h> 46 45 47 #include < net/modules.h>48 #include <net _interface.h>46 #include <adt/measured_strings.h> 47 #include <net/device.h> 49 48 #include <net/packet.h> 50 #include <nil_local.h>51 49 52 int nil_module_start_standalone(async_client_conn_t client_connection) 53 { 54 sysarg_t phonehash; 55 int rc; 56 57 async_set_client_connection(client_connection); 58 int net_phone = net_connect_module(); 50 /** Module initialization. 51 * 52 * This has to be implemented in user code. 53 * 54 * @param[in] net_phone Networking module phone. 55 * 56 * @return EOK on success. 57 * @return Other error codes as defined for each specific module 58 * initialize function. 59 * 60 */ 61 extern int tl_initialize(int net_phone); 59 62 60 rc = pm_init(); 61 if (rc != EOK) 62 return rc; 63 64 rc = nil_initialize(net_phone); 65 if (rc != EOK) 66 goto out; 63 /** Process the transport layer module message. 64 * 65 * This has to be implemented in user code. 66 * 67 * @param[in] callid Message identifier. 68 * @param[in] call Message parameters. 69 * @param[out] answer Answer. 70 * @param[out] count Number of arguments of the answer. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module. 74 * 75 */ 76 extern int tl_module_message(ipc_callid_t, ipc_call_t *, 77 ipc_call_t *, size_t *); 67 78 68 rc = ipc_connect_to_me(PHONE_NS, SERVICE_ETHERNET, 0, 0, &phonehash); 69 if (rc != EOK) 70 goto out; 71 72 async_manager(); 79 extern int tl_module_start(int); 73 80 74 out: 75 pm_destroy(); 76 return rc; 77 } 78 79 int nil_module_message_standalone(const char *name, ipc_callid_t callid, 80 ipc_call_t *call, ipc_call_t *answer, size_t *count) 81 { 82 return nil_message_standalone(name, callid, call, answer, count); 83 } 81 #endif 84 82 85 83 /** @} -
uspace/lib/net/netif/netif_skel.c
r5ccb15c r60b2b69 33 33 /** @file 34 34 * Network interface module skeleton implementation. 35 * @see netif .h35 * @see netif_skel.h 36 36 */ 37 37 … … 52 52 #include <adt/measured_strings.h> 53 53 #include <net/device.h> 54 #include <nil_interface.h>55 54 #include <netif_skel.h> 55 #include <nil_remote.h> 56 56 57 57 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t); … … 130 130 if (result > NETIF_NULL) { 131 131 int phone = device->nil_phone; 132 nil_device_state_msg(phone, device_id, result); 132 133 fibril_rwlock_write_unlock(&netif_globals.lock); 133 nil_device_state_msg(phone, device_id, result);134 134 return EOK; 135 135 } … … 166 166 if (result > NETIF_NULL) { 167 167 int phone = device->nil_phone; 168 nil_device_state_msg(phone, device_id, result); 168 169 fibril_rwlock_write_unlock(&netif_globals.lock); 169 nil_device_state_msg(phone, device_id, result);170 170 return EOK; 171 171 } -
uspace/lib/net/nil/nil_remote.c
r5ccb15c r60b2b69 33 33 /** @file 34 34 * Network interface layer interface implementation for remote modules. 35 * @see nil_ interface.h35 * @see nil_remote.h 36 36 */ 37 37 38 38 #include <nil_remote.h> 39 #include <nil_interface.h>40 39 #include <generic.h> 41 40 #include <net/device.h> 42 41 #include <net/packet.h> 43 42 #include <packet_client.h> 44 45 43 #include <ipc/nil.h> 46 44 47 45 /** Notify the network interface layer about the device state change. 48 46 * 49 * @param[in] nil_phone The network interface layer phone. 50 * @param[in] device_id The device identifier. 51 * @param[in] state The new device state. 52 * @return EOK on success. 53 * @return Other error codes as defined for each specific module 54 * device state function. 47 * @param[in] nil_phone Network interface layer phone. 48 * @param[in] device_id Device identifier. 49 * @param[in] state New device state. 50 * 51 * @return EOK on success. 52 * @return Other error codes as defined for each specific module 53 * device state function. 54 * 55 55 */ 56 int nil_device_state_msg _remote(int nil_phone, device_id_t device_id, int state)56 int nil_device_state_msg(int nil_phone, device_id_t device_id, int state) 57 57 { 58 58 return generic_device_state_msg_remote(nil_phone, NET_NIL_DEVICE_STATE, … … 65 65 * upper layers. 66 66 * 67 * @param[in] nil_phone The network interface layer phone. 68 * @param[in] device_id The source device identifier. 69 * @param[in] packet The received packet or the received packet queue. 70 * @param target The target service. Ignored parameter. 71 * @return EOK on success. 72 * @return Other error codes as defined for each specific module 73 * received function. 67 * @param[in] nil_phone Network interface layer phone. 68 * @param[in] device_id Source device identifier. 69 * @param[in] packet Received packet or the received packet queue. 70 * @param[in] target Target service. Ignored parameter. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module 74 * received function. 75 * 74 76 */ 75 int nil_received_msg _remote(int nil_phone, device_id_t device_id,77 int nil_received_msg(int nil_phone, device_id_t device_id, 76 78 packet_t *packet, services_t target) 77 79 { -
uspace/lib/net/tl/tl_common.c
r5ccb15c r60b2b69 42 42 #include <ip_remote.h> 43 43 #include <ip_interface.h> 44 #include <tl_ interface.h>44 #include <tl_remote.h> 45 45 46 46 #include <net/socket_codes.h> -
uspace/lib/net/tl/tl_remote.c
r5ccb15c r60b2b69 31 31 */ 32 32 33 #include <tl_ interface.h>33 #include <tl_remote.h> 34 34 #include <generic.h> 35 35 #include <packet_client.h> … … 57 57 * 58 58 */ 59 int 60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 59 int tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 61 60 services_t target, services_t error) 62 61 { -
uspace/lib/usb/src/usbdrvreq.c
r5ccb15c r60b2b69 60 60 #define PREPARE_SETUP_PACKET(name, p_direction, p_type, p_recipient, \ 61 61 p_request, p_value, p_index, p_length) \ 62 usb_device_request_setup_packet_t setup_packet= { \62 usb_device_request_setup_packet_t name = { \ 63 63 .request_type = \ 64 64 ((p_direction) == USB_DIRECTION_IN ? 128 : 0) \
Note:
See TracChangeset
for help on using the changeset viewer.
