Ignore:
Timestamp:
2010-04-04T21:41:47Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5db9084
Parents:
36a75a2 (diff), ee7e82a9 (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 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r36a75a2 r59ecd4a  
    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.