- Timestamp:
- 2006-05-16T09:30:42Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ec153a0
- Parents:
- 51d6f80
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pci/pci.c
r51d6f80 r250717cc 15 15 #include <stdlib.h> 16 16 #include <ipc.h> 17 #include <services.h> 17 18 #include <errno.h> 18 19 … … 24 25 #define NAME "PCI" 25 26 27 static struct pci_access *pacc; 28 26 29 int main(int argc, char *argv[]) 27 30 { 28 struct pci_access *pacc;29 31 struct pci_dev *dev; 30 32 unsigned int c; 31 33 char buf[80]; 32 33 int ipc_res;34 34 ipcarg_t ns_in_phone_hash; 35 35 … … 53 53 dev->vendor_id, dev->device_id)); 54 54 } 55 pci_cleanup(pacc); /* Close everything */56 55 57 56 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) { 59 58 printf("Failed to register %s at naming service.\n", NAME); 60 59 return -1; 61 60 } 62 61 63 62 printf("%s: accepting connections\n", NAME); 64 while (1) { 63 while (1) { 65 64 ipc_call_t call; 66 65 ipc_callid_t callid; 67 66 int retval; 67 68 68 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); 70 78 } 79 80 pci_cleanup(pacc); 71 81 return 0; 72 82 }
Note:
See TracChangeset
for help on using the changeset viewer.