Changeset 250717cc in mainline for pci/pci.c


Ignore:
Timestamp:
2006-05-16T09:30:42Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ec153a0
Parents:
51d6f80
Message:

Add services.h to codify service numbers.
Assign codes for PCI, keyboard and frame buffer services.

Rename ipc_answer() to ipc_answer_fast() and add the basic
slower variant and call it ipc_answer(). Add some doxygen comments.

Remove unused bits from the libpci library.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pci/pci.c

    r51d6f80 r250717cc  
    1515#include <stdlib.h>
    1616#include <ipc.h>
     17#include <services.h>
    1718#include <errno.h>
    1819
     
    2425#define NAME            "PCI"
    2526
     27static struct pci_access *pacc;
     28
    2629int main(int argc, char *argv[])
    2730{
    28         struct pci_access *pacc;
    2931        struct pci_dev *dev;
    3032        unsigned int c;
    3133        char buf[80];
    32 
    33         int ipc_res;
    3434        ipcarg_t ns_in_phone_hash;
    3535
     
    5353                        dev->vendor_id, dev->device_id));
    5454        }
    55         pci_cleanup(pacc);            /* Close everything */
    5655
    5756        printf("%s: registering at naming service.\n", NAME);
    58         if (ipc_connect_to_me(PHONE_NS, 40, 70, &ns_in_phone_hash) != 0) {
     57        if (ipc_connect_to_me(PHONE_NS, SERVICE_PCI, 0, &ns_in_phone_hash) != 0) {
    5958                printf("Failed to register %s at naming service.\n", NAME);
    6059                return -1;
    6160        }
    62        
     61
    6362        printf("%s: accepting connections\n", NAME);
    64         while (1) {
     63        while (1) {             
    6564                ipc_call_t call;
    6665                ipc_callid_t callid;
    67                
     66                int retval;
     67
    6868                callid = ipc_wait_for_call(&call, 0);
    69                 ipc_answer(callid, EHANGUP, 0, 0);
     69                switch(IPC_GET_METHOD(call)) {
     70                case IPC_M_CONNECT_ME_TO:
     71                        IPC_SET_RETVAL(call, 0);
     72                        break;
     73                }
     74                if (! (callid & IPC_CALLID_NOTIFICATION)) {
     75                        ipc_answer(callid, &call);
     76                }
     77                printf("%s: received call from %lX\n", NAME, call.in_phone_hash);
    7078        }
     79
     80        pci_cleanup(pacc);
    7181        return 0;
    7282}
Note: See TracChangeset for help on using the changeset viewer.