Changeset eb522e8 in mainline for uspace/drv/uhci-hcd/transfer_list.h
- Timestamp:
- 2011-06-01T08:43:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d6c1f1
- Parents:
- 9e2e715 (diff), e51a514 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/transfer_list.h
r9e2e715 reb522e8 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Jan Vesely 3 3 * All rights reserved. 4 4 * … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 /** @addtogroup net 28 /** @addtogroup drvusbuhcihc 30 29 * @{ 31 30 */ 31 /** @file 32 * @brief UHCI driver transfer list structure 33 */ 34 #ifndef DRV_UHCI_TRANSFER_LIST_H 35 #define DRV_UHCI_TRANSFER_LIST_H 32 36 33 /** @file 34 * Start the networking subsystem. 37 #include <fibril_synch.h> 38 #include <usb/host/batch.h> 39 40 #include "hw_struct/queue_head.h" 41 42 /** Structure maintaining both hw queue and software list 43 * of currently executed transfers 35 44 */ 45 typedef struct transfer_list { 46 /** Guard against multiple add/remove races */ 47 fibril_mutex_t guard; 48 /** UHCI hw structure represeting this queue */ 49 qh_t *queue_head; 50 /** Assigned name, for nicer debug output */ 51 const char *name; 52 /** List of all batches in this list */ 53 link_t batch_list; 54 } transfer_list_t; 36 55 37 #define NAME "netstart" 38 39 #include <async.h> 40 #include <stdio.h> 41 #include <task.h> 42 #include <str_error.h> 43 #include <ipc/ipc.h> 44 #include <ipc/services.h> 45 #include <ipc/net_net.h> 46 47 #include <net/modules.h> 48 49 /** Start a module. 50 * 51 * @param[in] desc The module description 52 * @param[in] path The module absolute path. 53 * @returns True on succesful spanwning. 54 * @returns False on failure 56 void transfer_list_fini(transfer_list_t *instance); 57 int transfer_list_init(transfer_list_t *instance, const char *name); 58 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next); 59 void transfer_list_add_batch( 60 transfer_list_t *instance, usb_transfer_batch_t *batch); 61 void transfer_list_remove_finished(transfer_list_t *instance, link_t *done); 62 void transfer_list_abort_all(transfer_list_t *instance); 63 #endif 64 /** 65 * @} 55 66 */ 56 static bool spawn(const char *desc, const char *path)57 {58 int rc;59 60 printf("%s: Spawning %s (%s)\n", NAME, desc, path);61 rc = task_spawnl(NULL, path, path, NULL);62 if (rc != EOK) {63 fprintf(stderr, "%s: Error spawning %s (%s)\n", NAME, path,64 str_error(rc));65 return false;66 }67 68 return true;69 }70 71 int main(int argc, char *argv[])72 {73 int rc;74 75 if (!spawn("networking service", "/srv/net"))76 return EINVAL;77 78 printf("%s: Initializing networking\n", NAME);79 80 int net_phone = connect_to_service(SERVICE_NETWORKING);81 rc = ipc_call_sync_0_0(net_phone, NET_NET_STARTUP);82 if (rc != EOK) {83 fprintf(stderr, "%s: Startup error %d\n", NAME, rc);84 return rc;85 }86 87 return EOK;88 }89 90 /** @}91 */
Note:
See TracChangeset
for help on using the changeset viewer.