Changeset 849ed54 in mainline for uspace/srv/hw/netif


Ignore:
Timestamp:
2010-03-30T18:39:04Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7553689
Parents:
7d6fe4db
Message:

Networking work:
Split the networking stack into end-user library (libsocket) and two helper libraries (libnet and libnetif).
Don't use over-the-hand compiling and linking, but rather separation of conserns.
There might be still some issues and the non-modular networking architecture is currently broken, but this will be fixed soon.

Location:
uspace/srv/hw/netif/dp8390
Files:
9 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
    3231ROOT_PATH = $(USPACE_PREFIX)/..
     32LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     33EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3334
    3435COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
    3536CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3637
    37 BINARY = dp8390
    38 
    3938-include $(COMMON_MAKEFILE)
    4039-include $(CONFIG_MAKEFILE)
     40
     41ifeq ($(CONFIG_NETWORKING),modular)
     42        BINARY = dp8390
     43endif
     44
     45ifeq ($(CONFIG_NETWORKING),module)
     46        LIBRARY = libdp8390
     47endif
    4148
    4249SOURCES = \
    4350        dp8390.c \
    4451        dp8390_module.c \
    45         ne2000.c \
    46         $(NET_BASE)/module.c \
    47         $(NET_BASE)/modules.c \
    48         $(NET_BASE)/netif/netif.c \
    49         $(NET_BASE)/structures/measured_strings.c \
    50         $(NET_BASE)/structures/packet/packet.c \
    51         $(NET_BASE)/structures/packet/packet_client.c \
    52         $(NET_BASE)/structures/packet/packet_remote.c
    53 
    54 ifeq ($(CONFIG_NETWORKING),module)
    55         SOURCES += \
    56                 $(NET_BASE)/checksum.c \
    57                 $(NET_BASE)/nil/eth/eth.c \
    58                 $(NET_BASE)/net/net_remote.c \
    59                 $(NET_BASE)/netif/netif_nil_bundle.c
    60 endif
    61 
    62 ifeq ($(CONFIG_NETWORKING),modular)
    63         SOURCES += \
    64                 $(NET_BASE)/nil/nil_remote.c \
    65                 $(NET_BASE)/netif/netif_standalone.c
    66 endif
     52        ne2000.c
    6753
    6854include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r7d6fe4db r849ed54  
    3636#include <errno.h>
    3737
    38 #include "../../include/byteorder.h"
    39 
    40 #include "../../structures/packet/packet.h"
    41 #include "../../structures/packet/packet_client.h"
    42 
    43 #include "../netif.h"
     38#include <net_byteorder.h>
     39
     40#include <packet/packet.h>
     41#include <packet/packet_client.h>
     42
     43#include <netif.h>
    4444
    4545#include "dp8390_drv.h"
  • uspace/srv/hw/netif/dp8390/dp8390.h

    r7d6fe4db r849ed54  
    3636#define __NET_NETIF_DP8390_H__
    3737
    38 #include "../../structures/packet/packet.h"
     38#include <packet/packet.h>
    3939
    4040#include "dp8390_port.h"
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r7d6fe4db r849ed54  
    4040#include <errno.h>
    4141#include <malloc.h>
    42 //#include <stdio.h>
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../messages.h"
    48 #include "../../modules.h"
    49 
    50 #include "../../structures/packet/packet_client.h"
    51 #include "../../structures/measured_strings.h"
    52 
    53 #include "../../include/device.h"
    54 #include "../../include/nil_interface.h"
    55 
    56 #include "../netif.h"
    57 #include "../netif_module.h"
     45#include <net_err.h>
     46#include <net_messages.h>
     47#include <net_modules.h>
     48#include <packet/packet_client.h>
     49#include <adt/measured_strings.h>
     50#include <net_device.h>
     51#include <nil_interface.h>
     52#include <netif.h>
     53#include <netif_module.h>
    5854
    5955#include "dp8390.h"
     
    10298 */
    10399netif_globals_t netif_globals;
    104 
    105 /** Prints the module name.
    106  *  @see NAME
    107  */
    108 void module_print_name(void);
    109100
    110101/** Handles the interrupt messages.
     
    151142        stats->send_window_errors = de_stat->ets_OWC;
    152143        return EOK;
    153 }
    154 
    155 void module_print_name(void){
    156         printf("%s", NAME);
    157144}
    158145
     
    329316}
    330317
     318#ifdef CONFIG_NETWORKING_modular
     319
     320#include <netif_standalone.h>
     321
     322/** Default thread for new connections.
     323 *
     324 *  @param[in] iid The initial message identifier.
     325 *  @param[in] icall The initial message call structure.
     326 *
     327 */
     328static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     329{
     330        /*
     331         * Accept the connection
     332         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     333         */
     334        ipc_answer_0(iid, EOK);
     335       
     336        while(true) {
     337                ipc_call_t answer;
     338                int answer_count;
     339               
     340                /* Clear the answer structure */
     341                refresh_answer(&answer, &answer_count);
     342               
     343                /* Fetch the next message */
     344                ipc_call_t call;
     345                ipc_callid_t callid = async_get_call(&call);
     346               
     347                /* Process the message */
     348                int res = netif_module_message(callid, &call, &answer, &answer_count);
     349               
     350                /* End if said to either by the message or the processing result */
     351                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     352                        return;
     353               
     354                /* Answer the message */
     355                answer_call(callid, res, &answer, answer_count);
     356        }
     357}
     358
     359/** Starts the module.
     360 *
     361 *  @param argc The count of the command line arguments. Ignored parameter.
     362 *  @param argv The command line parameters. Ignored parameter.
     363 *
     364 *  @returns EOK on success.
     365 *  @returns Other error codes as defined for each specific module start function.
     366 *
     367 */
     368int main(int argc, char *argv[])
     369{
     370        ERROR_DECLARE;
     371       
     372        /* Print the module label */
     373        printf("Task %d - %s\n", task_get_id(), NAME);
     374       
     375        /* Start the module */
     376        if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
     377                printf(" - ERROR %i\n", ERROR_CODE);
     378                return ERROR_CODE;
     379        }
     380       
     381        return EOK;
     382}
     383
     384#endif /* CONFIG_NETWORKING_modular */
     385
     386
    331387/** @}
    332388 */
Note: See TracChangeset for help on using the changeset viewer.