Changeset 7fc092a in mainline for uspace/app
- Timestamp:
- 2011-01-27T22:09:29Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- db7ed07
- Parents:
- 9ee87f6 (diff), 6265a2b (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. - Location:
- uspace/app
- Files:
-
- 2 added
- 14 edited
-
ping/ping.c (modified) (1 diff)
-
tasks/tasks.c (modified) (2 diffs)
-
tester/Makefile (modified) (1 diff)
-
tester/mm/mapping1.c (added)
-
tester/mm/mapping1.def (added)
-
tester/tester.c (modified) (1 diff)
-
tester/tester.h (modified) (1 diff)
-
top/screen.c (modified) (2 diffs)
-
top/top.c (modified) (3 diffs)
-
top/top.h (modified) (1 diff)
-
trace/syscalls.c (modified) (1 diff)
-
usbinfo/dump.c (modified) (2 diffs)
-
usbinfo/info.c (modified) (3 diffs)
-
usbinfo/usbinfo.h (modified) (1 diff)
-
virtusbkbd/keys.h (modified) (1 diff)
-
virtusbkbd/virtusbkbd.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ping/ping.c
r9ee87f6 r7fc092a 340 340 config.dest_str, config.size, config.size); 341 341 342 int icmp_phone = icmp_connect_module( SERVICE_ICMP,ICMP_CONNECT_TIMEOUT);342 int icmp_phone = icmp_connect_module(ICMP_CONNECT_TIMEOUT); 343 343 if (icmp_phone < 0) { 344 344 fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME, -
uspace/app/tasks/tasks.c
r9ee87f6 r7fc092a 66 66 } 67 67 68 printf(" ID Threads Mem uCycles kCycles Name\n");68 printf(" Task ID Threads Mem uCycles kCycles Name\n"); 69 69 70 70 size_t i; … … 96 96 } 97 97 98 printf(" ID State CPU Prio [k]uCycles [k]kcycles Cycle fault\n");98 printf(" ThrID State CPU Prio [k]uCycles [k]kcycles Cycle fault\n"); 99 99 size_t i; 100 100 for (i = 0; i < count; i++) { -
uspace/app/tester/Makefile
r9ee87f6 r7fc092a 53 53 loop/loop1.c \ 54 54 mm/malloc1.c \ 55 mm/mapping1.c \ 55 56 hw/misc/virtchar1.c \ 56 57 hw/serial/serial1.c -
uspace/app/tester/tester.c
r9ee87f6 r7fc092a 62 62 #include "loop/loop1.def" 63 63 #include "mm/malloc1.def" 64 #include "mm/mapping1.def" 64 65 #include "hw/serial/serial1.def" 65 66 #include "adt/usbaddrkeep.def" -
uspace/app/tester/tester.h
r9ee87f6 r7fc092a 79 79 extern const char *test_loop1(void); 80 80 extern const char *test_malloc1(void); 81 extern const char *test_mapping1(void); 81 82 extern const char *test_serial1(void); 82 83 extern const char *test_usbaddrkeep(void); -
uspace/app/top/screen.c
r9ee87f6 r7fc092a 274 274 { 275 275 screen_style_inverted(); 276 printf("[taskid] [threads] [ virtual] [%%virt] [%%user]"277 " [%% kernel] [name");276 printf("[taskid] [threads] [resident] [%%resi] [virtual] [%%virt]" 277 " [%%user] [%%kern] [name"); 278 278 screen_newline(); 279 279 screen_style_normal(); … … 295 295 perc_task_t *perc = data->tasks_perc + data->tasks_map[i]; 296 296 297 uint64_t resmem; 298 char resmem_suffix; 299 order_suffix(task->resmem, &resmem, &resmem_suffix); 300 297 301 uint64_t virtmem; 298 302 char virtmem_suffix; 299 303 order_suffix(task->virtmem, &virtmem, &virtmem_suffix); 300 304 301 printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id, 302 task->threads, virtmem, virtmem_suffix); 305 printf("%-8" PRIu64 " %9zu %9" PRIu64 "%c ", 306 task->task_id, task->threads, resmem, resmem_suffix); 307 print_percent(perc->resmem, 2); 308 printf(" %8" PRIu64 "%c ", virtmem, virtmem_suffix); 303 309 print_percent(perc->virtmem, 2); 304 310 puts(" "); 305 311 print_percent(perc->ucycles, 2); 306 puts(" ");312 puts(" "); 307 313 print_percent(perc->kcycles, 2); 308 314 puts(" "); -
uspace/app/top/top.c
r9ee87f6 r7fc092a 195 195 196 196 uint64_t virtmem_total = 0; 197 uint64_t resmem_total = 0; 197 198 uint64_t ucycles_total = 0; 198 199 uint64_t kcycles_total = 0; … … 223 224 224 225 virtmem_total += new_data->tasks[i].virtmem; 226 resmem_total += new_data->tasks[i].resmem; 225 227 ucycles_total += new_data->ucycles_diff[i]; 226 228 kcycles_total += new_data->kcycles_diff[i]; … … 232 234 FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem, 233 235 new_data->tasks[i].virtmem * 100, virtmem_total); 236 FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem, 237 new_data->tasks[i].resmem * 100, resmem_total); 234 238 FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles, 235 239 new_data->ucycles_diff[i] * 100, ucycles_total); -
uspace/app/top/top.h
r9ee87f6 r7fc092a 77 77 typedef struct { 78 78 fixed_float virtmem; 79 fixed_float resmem; 79 80 fixed_float ucycles; 80 81 fixed_float kcycles; -
uspace/app/trace/syscalls.c
r9ee87f6 r7fc092a 73 73 [SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO }, 74 74 [SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO }, 75 [SYS_INTERRUPT_ENABLE] = { "interrupt_enable", 2, V_ERRNO },76 75 77 76 [SYS_SYSINFO_GET_TAG] = { "sysinfo_get_tag", 2, V_INTEGER }, 78 77 [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO }, 79 78 [SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size", 3, V_ERRNO }, 80 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 4, V_ERRNO },79 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO }, 81 80 82 81 [SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0, V_ERRNO }, -
uspace/app/usbinfo/dump.c
r9ee87f6 r7fc092a 43 43 #include <usb/usb.h> 44 44 #include <usb/descriptor.h> 45 #include <usb/debug.h> 46 #include <usb/classes/classes.h> 45 47 46 48 #include "usbinfo.h" 49 #include <usb/dp.h> 47 50 48 51 #define INDENT " " 49 52 #define BYTES_PER_LINE 12 50 53 51 #define BCD_INT(a) (((unsigned int)(a)) / 256)52 #define BCD_FRAC(a) (((unsigned int)(a)) % 256)53 54 54 #define BCD_FMT "%x.%x" 55 #define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a)) 55 static const char *get_indent(size_t level) 56 { 57 static const char *indents[] = { 58 INDENT, 59 INDENT INDENT, 60 INDENT INDENT INDENT, 61 INDENT INDENT INDENT INDENT, 62 INDENT INDENT INDENT INDENT INDENT 63 }; 64 static size_t indents_count = sizeof(indents)/sizeof(indents[0]); 65 if (level >= indents_count) { 66 return indents[indents_count - 1]; 67 } 68 return indents[level]; 69 } 56 70 57 void dump_buffer(const char *msg, const uint8_t *buffer, size_t length) 71 void dump_buffer(const char *msg, size_t indent, 72 const uint8_t *buffer, size_t length) 58 73 { 59 printf("%s\n", msg); 74 if (msg != NULL) { 75 printf("%s\n", msg); 76 } 60 77 61 78 size_t i; 79 if (length > 0) { 80 printf("%s", get_indent(indent)); 81 } 62 82 for (i = 0; i < length; i++) { 63 printf(" 0x%02X", buffer[i]);83 printf("0x%02X", buffer[i]); 64 84 if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0)) 65 85 || (i + 1 == length)) { 66 86 printf("\n"); 87 if (i + 1 < length) { 88 printf("%s", get_indent(indent)); 89 } 90 } else { 91 printf(" "); 67 92 } 68 93 } 94 } 95 96 void dump_usb_descriptor(uint8_t *descriptor, size_t size) 97 { 98 usb_dump_standard_descriptor(stdout, get_indent(0), "\n", 99 descriptor, size); 69 100 } 70 101 … … 82 113 } 83 114 84 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *d)115 static void dump_tree_descriptor(uint8_t *descriptor, size_t depth) 85 116 { 86 printf("Standard device descriptor:\n"); 87 88 printf(INDENT "bLength = %d\n", d->length); 89 printf(INDENT "bDescriptorType = 0x%02x\n", d->descriptor_type); 90 printf(INDENT "bcdUSB = %d (" BCD_FMT ")\n", d->usb_spec_version, 91 BCD_ARGS(d->usb_spec_version)); 92 printf(INDENT "bDeviceClass = 0x%02x\n", d->device_class); 93 printf(INDENT "bDeviceSubClass = 0x%02x\n", d->device_subclass); 94 printf(INDENT "bDeviceProtocol = 0x%02x\n", d->device_protocol); 95 printf(INDENT "bMaxPacketSize0 = %d\n", d->max_packet_size); 96 printf(INDENT "idVendor = %d\n", d->vendor_id); 97 printf(INDENT "idProduct = %d\n", d->product_id); 98 printf(INDENT "bcdDevice = %d\n", d->device_version); 99 printf(INDENT "iManufacturer = %d\n", d->str_manufacturer); 100 printf(INDENT "iProduct = %d\n", d->str_product); 101 printf(INDENT "iSerialNumber = %d\n", d->str_serial_number); 102 printf(INDENT "bNumConfigurations = %d\n", d->configuration_count); 117 if (descriptor == NULL) { 118 return; 119 } 120 int type = (int) *(descriptor + 1); 121 const char *name = "unknown"; 122 switch (type) { 123 #define _TYPE(descriptor_type) \ 124 case USB_DESCTYPE_##descriptor_type: name = #descriptor_type; break 125 _TYPE(DEVICE); 126 _TYPE(CONFIGURATION); 127 _TYPE(STRING); 128 _TYPE(INTERFACE); 129 _TYPE(ENDPOINT); 130 _TYPE(HID); 131 _TYPE(HID_REPORT); 132 _TYPE(HID_PHYSICAL); 133 _TYPE(HUB); 134 #undef _TYPE 135 } 136 printf("%s%s (0x%02X):\n", get_indent(depth), name, type); 137 usb_dump_standard_descriptor(stdout, get_indent(depth), "\n", 138 descriptor, descriptor[0]); 103 139 } 104 140 105 void dump_standard_configuration_descriptor( 106 int index, usb_standard_configuration_descriptor_t *d)141 static void dump_tree_internal(usb_dp_parser_t *parser, usb_dp_parser_data_t *data, 142 uint8_t *root, size_t depth) 107 143 { 108 bool self_powered = d->attributes & 64; 109 bool remote_wakeup = d->attributes & 32; 110 111 printf("Standard configuration descriptor #%d\n", index); 112 printf(INDENT "bLength = %d\n", d->length); 113 printf(INDENT "bDescriptorType = 0x%02x\n", d->descriptor_type); 114 printf(INDENT "wTotalLength = %d\n", d->total_length); 115 printf(INDENT "bNumInterfaces = %d\n", d->interface_count); 116 printf(INDENT "bConfigurationValue = %d\n", d->configuration_number); 117 printf(INDENT "iConfiguration = %d\n", d->str_configuration); 118 printf(INDENT "bmAttributes = %d [%s%s%s]\n", d->attributes, 119 self_powered ? "self-powered" : "", 120 (self_powered & remote_wakeup) ? ", " : "", 121 remote_wakeup ? "remote-wakeup" : ""); 122 printf(INDENT "MaxPower = %d (%dmA)\n", d->max_power, 123 2 * d->max_power); 124 // printf(INDENT " = %d\n", d->); 144 if (root == NULL) { 145 return; 146 } 147 dump_tree_descriptor(root, depth); 148 uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root); 149 do { 150 dump_tree_internal(parser, data, child, depth + 1); 151 child = usb_dp_get_sibling_descriptor(parser, data, root, child); 152 } while (child != NULL); 125 153 } 126 154 155 static void dump_tree(usb_dp_parser_t *parser, usb_dp_parser_data_t *data) 156 { 157 uint8_t *ptr = data->data; 158 printf("Descriptor tree:\n"); 159 dump_tree_internal(parser, data, ptr, 0); 160 } 161 162 #define NESTING(parentname, childname) \ 163 { \ 164 .child = USB_DESCTYPE_##childname, \ 165 .parent = USB_DESCTYPE_##parentname, \ 166 } 167 #define LAST_NESTING { -1, -1 } 168 169 static usb_dp_descriptor_nesting_t descriptor_nesting[] = { 170 NESTING(CONFIGURATION, INTERFACE), 171 NESTING(INTERFACE, ENDPOINT), 172 NESTING(INTERFACE, HUB), 173 NESTING(INTERFACE, HID), 174 NESTING(HID, HID_REPORT), 175 LAST_NESTING 176 }; 177 178 static usb_dp_parser_t parser = { 179 .nesting = descriptor_nesting 180 }; 181 182 void dump_descriptor_tree(uint8_t *descriptors, size_t length) 183 { 184 usb_dp_parser_data_t data = { 185 .data = descriptors, 186 .size = length, 187 .arg = NULL 188 }; 189 190 dump_tree(&parser, &data); 191 } 127 192 128 193 /** @} -
uspace/app/usbinfo/info.c
r9ee87f6 r7fc092a 72 72 return rc; 73 73 } 74 dump_ standard_device_descriptor(&device_descriptor);74 dump_usb_descriptor((uint8_t *)&device_descriptor, sizeof(device_descriptor)); 75 75 76 76 /* … … 91 91 return rc; 92 92 } 93 dump_standard_configuration_descriptor(config_index, 94 &config_descriptor); 93 //dump_standard_configuration_descriptor(config_index, &config_descriptor); 95 94 96 95 void *full_config_descriptor = malloc(config_descriptor.total_length); … … 109 108 return rc; 110 109 } 111 dump_buffer("Full configuration descriptor:", 112 full_config_descriptor, config_descriptor.total_length); 110 111 dump_descriptor_tree(full_config_descriptor, 112 config_descriptor.total_length); 113 113 114 114 return EOK; -
uspace/app/usbinfo/usbinfo.h
r9ee87f6 r7fc092a 44 44 #define NAME "usbinfo" 45 45 46 void dump_buffer(const char *, const uint8_t *, size_t);46 void dump_buffer(const char *, size_t, const uint8_t *, size_t); 47 47 void dump_match_ids(match_id_list_t *matches); 48 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *); 49 void dump_standard_configuration_descriptor(int, 50 usb_standard_configuration_descriptor_t *); 48 void dump_usb_descriptor(uint8_t *, size_t); 51 49 int dump_device(int, usb_address_t); 50 void dump_descriptor_tree(uint8_t *, size_t); 52 51 53 52 static inline void internal_error(int err) -
uspace/app/virtusbkbd/keys.h
r9ee87f6 r7fc092a 40 40 41 41 /** Maximum number of keys that can be pressed simultaneously. */ 42 #define KB_MAX_KEYS_AT_ONCE 442 #define KB_MAX_KEYS_AT_ONCE 6 43 43 44 44 /** Key code type. */ -
uspace/app/virtusbkbd/virtusbkbd.c
r9ee87f6 r7fc092a 271 271 printf("%s: Simulating keyboard events...\n", NAME); 272 272 fibril_sleep(10); 273 while (1) {273 //while (1) { 274 274 kb_process_events(&status, keyboard_events, keyboard_events_count, 275 275 on_keyboard_change); 276 }276 //} 277 277 278 278 printf("%s: Terminating...\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.
