Changeset 8436590 in mainline for uspace/app/tester/devs/devman1.c
- Timestamp:
- 2011-04-07T21:38:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 033cbf82
- Parents:
- 3acb285 (diff), ccca251 (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/app/tester/devs/devman1.c
r3acb285 r8436590 1 1 /* 2 * Copyright (c) 2007 Jan Hudecek 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2011 Vojtech Horky 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup genericproc 29 /** @addtogroup tester 30 * @brief Test devman service. 31 31 * @{ 32 32 */ 33 /** @file tasklet.h34 * @ brief Tasklets declarations33 /** 34 * @file 35 35 */ 36 36 37 #ifndef KERN_TASKLET_H_ 38 #define KERN_TASKLET_H_ 37 #include <inttypes.h> 38 #include <errno.h> 39 #include <str_error.h> 40 #include <sys/types.h> 41 #include <async.h> 42 #include <devman.h> 43 #include <str.h> 44 #include <vfs/vfs.h> 45 #include <sys/stat.h> 46 #include <fcntl.h> 47 #include "../tester.h" 39 48 40 #include <adt/list.h> 49 #define DEVICE_PATH_NORMAL "/virt/null/a" 50 #define DEVICE_CLASS "virt-null" 51 #define DEVICE_CLASS_NAME "1" 52 #define DEVICE_PATH_CLASSES DEVICE_CLASS "/" DEVICE_CLASS_NAME 41 53 42 /** Tasklet callback type */ 43 typedef void (* tasklet_callback_t)(void *arg); 54 const char *test_devman1(void) 55 { 56 devman_handle_t handle_primary; 57 devman_handle_t handle_class; 58 59 int rc; 60 61 TPRINTF("Asking for handle of `%s'...\n", DEVICE_PATH_NORMAL); 62 rc = devman_device_get_handle(DEVICE_PATH_NORMAL, &handle_primary, 0); 63 if (rc != EOK) { 64 TPRINTF(" ...failed: %s.\n", str_error(rc)); 65 if (rc == ENOENT) { 66 TPRINTF("Have you compiled the test drivers?\n"); 67 } 68 return "Failed getting device handle"; 69 } 44 70 45 /** Tasklet state */ 46 typedef enum { 47 NotActive,48 Scheduled,49 InProgress,50 Disabled51 } tasklet_state_t; 71 TPRINTF("Asking for handle of `%s' by class..\n", DEVICE_PATH_CLASSES); 72 rc = devman_device_get_handle_by_class(DEVICE_CLASS, DEVICE_CLASS_NAME, 73 &handle_class, 0); 74 if (rc != EOK) { 75 TPRINTF(" ...failed: %s.\n", str_error(rc)); 76 return "Failed getting device class handle"; 77 } 52 78 53 /** Structure describing a tasklet */ 54 typedef struct tasklet_descriptor { 55 link_t link; 56 57 /** Callback to call */ 58 tasklet_callback_t callback; 59 60 /** Argument passed to the callback */ 61 void *arg; 62 63 /** State of the tasklet */ 64 tasklet_state_t state; 65 } tasklet_descriptor_t; 79 TPRINTF("Received handles %" PRIun " and %" PRIun ".\n", 80 handle_primary, handle_class); 81 if (handle_primary != handle_class) { 82 return "Retrieved different handles for the same device"; 83 } 66 84 67 68 extern void tasklet_init(void); 69 70 #endif 85 return NULL; 86 } 71 87 72 88 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.