Changeset 7fc092a in mainline for uspace/app


Ignore:
Timestamp:
2011-01-27T22:09:29Z (15 years ago)
Author:
Jan Vesely <jano.vesely@…>
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.
Message:

Changes from development branch

Location:
uspace/app
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/ping/ping.c

    r9ee87f6 r7fc092a  
    340340            config.dest_str, config.size, config.size);
    341341       
    342         int icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
     342        int icmp_phone = icmp_connect_module(ICMP_CONNECT_TIMEOUT);
    343343        if (icmp_phone < 0) {
    344344                fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME,
  • uspace/app/tasks/tasks.c

    r9ee87f6 r7fc092a  
    6666        }
    6767       
    68         printf("     ID  Threads      Mem       uCycles       kCycles   Name\n");
     68        printf(" Task ID  Threads      Mem       uCycles       kCycles   Name\n");
    6969       
    7070        size_t i;
     
    9696        }
    9797       
    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");
    9999        size_t i;
    100100        for (i = 0; i < count; i++) {
  • uspace/app/tester/Makefile

    r9ee87f6 r7fc092a  
    5353        loop/loop1.c \
    5454        mm/malloc1.c \
     55        mm/mapping1.c \
    5556        hw/misc/virtchar1.c \
    5657        hw/serial/serial1.c
  • uspace/app/tester/tester.c

    r9ee87f6 r7fc092a  
    6262#include "loop/loop1.def"
    6363#include "mm/malloc1.def"
     64#include "mm/mapping1.def"
    6465#include "hw/serial/serial1.def"
    6566#include "adt/usbaddrkeep.def"
  • uspace/app/tester/tester.h

    r9ee87f6 r7fc092a  
    7979extern const char *test_loop1(void);
    8080extern const char *test_malloc1(void);
     81extern const char *test_mapping1(void);
    8182extern const char *test_serial1(void);
    8283extern const char *test_usbaddrkeep(void);
  • uspace/app/top/screen.c

    r9ee87f6 r7fc092a  
    274274{
    275275        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");
    278278        screen_newline();
    279279        screen_style_normal();
     
    295295                perc_task_t *perc = data->tasks_perc + data->tasks_map[i];
    296296               
     297                uint64_t resmem;
     298                char resmem_suffix;
     299                order_suffix(task->resmem, &resmem, &resmem_suffix);
     300               
    297301                uint64_t virtmem;
    298302                char virtmem_suffix;
    299303                order_suffix(task->virtmem, &virtmem, &virtmem_suffix);
    300304               
    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);
    303309                print_percent(perc->virtmem, 2);
    304310                puts(" ");
    305311                print_percent(perc->ucycles, 2);
    306                 puts("   ");
     312                puts(" ");
    307313                print_percent(perc->kcycles, 2);
    308314                puts(" ");
  • uspace/app/top/top.c

    r9ee87f6 r7fc092a  
    195195       
    196196        uint64_t virtmem_total = 0;
     197        uint64_t resmem_total = 0;
    197198        uint64_t ucycles_total = 0;
    198199        uint64_t kcycles_total = 0;
     
    223224               
    224225                virtmem_total += new_data->tasks[i].virtmem;
     226                resmem_total += new_data->tasks[i].resmem;
    225227                ucycles_total += new_data->ucycles_diff[i];
    226228                kcycles_total += new_data->kcycles_diff[i];
     
    232234                FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem,
    233235                    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);
    234238                FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles,
    235239                    new_data->ucycles_diff[i] * 100, ucycles_total);
  • uspace/app/top/top.h

    r9ee87f6 r7fc092a  
    7777typedef struct {
    7878        fixed_float virtmem;
     79        fixed_float resmem;
    7980        fixed_float ucycles;
    8081        fixed_float kcycles;
  • uspace/app/trace/syscalls.c

    r9ee87f6 r7fc092a  
    7373    [SYS_PHYSMEM_MAP] = { "physmem_map",                4,      V_ERRNO },
    7474    [SYS_IOSPACE_ENABLE] = { "iospace_enable",          1,      V_ERRNO },
    75     [SYS_INTERRUPT_ENABLE] = { "interrupt_enable",      2,      V_ERRNO },
    7675
    7776    [SYS_SYSINFO_GET_TAG] = { "sysinfo_get_tag",                2,      V_INTEGER },
    7877    [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value",            3,      V_ERRNO },
    7978    [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 },
    8180
    8281    [SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0,   V_ERRNO },
  • uspace/app/usbinfo/dump.c

    r9ee87f6 r7fc092a  
    4343#include <usb/usb.h>
    4444#include <usb/descriptor.h>
     45#include <usb/debug.h>
     46#include <usb/classes/classes.h>
    4547
    4648#include "usbinfo.h"
     49#include <usb/dp.h>
    4750
    4851#define INDENT "  "
    4952#define BYTES_PER_LINE 12
    5053
    51 #define BCD_INT(a) (((unsigned int)(a)) / 256)
    52 #define BCD_FRAC(a) (((unsigned int)(a)) % 256)
    5354
    54 #define BCD_FMT "%x.%x"
    55 #define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a))
     55static 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}
    5670
    57 void dump_buffer(const char *msg, const uint8_t *buffer, size_t length)
     71void dump_buffer(const char *msg, size_t indent,
     72    const uint8_t *buffer, size_t length)
    5873{
    59         printf("%s\n", msg);
     74        if (msg != NULL) {
     75                printf("%s\n", msg);
     76        }
    6077
    6178        size_t i;
     79        if (length > 0) {
     80                printf("%s", get_indent(indent));
     81        }
    6282        for (i = 0; i < length; i++) {
    63                 printf("  0x%02X", buffer[i]);
     83                printf("0x%02X", buffer[i]);
    6484                if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0))
    6585                    || (i + 1 == length)) {
    6686                        printf("\n");
     87                        if (i + 1 < length) {
     88                                printf("%s", get_indent(indent));
     89                        }
     90                } else {
     91                        printf("  ");
    6792                }
    6893        }
     94}
     95
     96void dump_usb_descriptor(uint8_t *descriptor, size_t size)
     97{
     98        usb_dump_standard_descriptor(stdout, get_indent(0), "\n",
     99            descriptor, size);
    69100}
    70101
     
    82113}
    83114
    84 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *d)
     115static void dump_tree_descriptor(uint8_t *descriptor, size_t depth)
    85116{
    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]);
    103139}
    104140
    105 void dump_standard_configuration_descriptor(
    106     int index, usb_standard_configuration_descriptor_t *d)
     141static void dump_tree_internal(usb_dp_parser_t *parser, usb_dp_parser_data_t *data,
     142    uint8_t *root, size_t depth)
    107143{
    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);
    125153}
    126154
     155static 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
     169static 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
     178static usb_dp_parser_t parser = {
     179        .nesting = descriptor_nesting
     180};
     181
     182void 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}
    127192
    128193/** @}
  • uspace/app/usbinfo/info.c

    r9ee87f6 r7fc092a  
    7272                return rc;
    7373        }
    74         dump_standard_device_descriptor(&device_descriptor);
     74        dump_usb_descriptor((uint8_t *)&device_descriptor, sizeof(device_descriptor));
    7575
    7676        /*
     
    9191                return rc;
    9292        }
    93         dump_standard_configuration_descriptor(config_index,
    94             &config_descriptor);
     93        //dump_standard_configuration_descriptor(config_index, &config_descriptor);
    9594
    9695        void *full_config_descriptor = malloc(config_descriptor.total_length);
     
    109108                return rc;
    110109        }
    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);
    113113
    114114        return EOK;
  • uspace/app/usbinfo/usbinfo.h

    r9ee87f6 r7fc092a  
    4444#define NAME "usbinfo"
    4545
    46 void dump_buffer(const char *, const uint8_t *, size_t);
     46void dump_buffer(const char *, size_t, const uint8_t *, size_t);
    4747void 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 *);
     48void dump_usb_descriptor(uint8_t *, size_t);
    5149int dump_device(int, usb_address_t);
     50void dump_descriptor_tree(uint8_t *, size_t);
    5251
    5352static inline void internal_error(int err)
  • uspace/app/virtusbkbd/keys.h

    r9ee87f6 r7fc092a  
    4040
    4141/** Maximum number of keys that can be pressed simultaneously. */
    42 #define KB_MAX_KEYS_AT_ONCE 4
     42#define KB_MAX_KEYS_AT_ONCE 6
    4343
    4444/** Key code type. */
  • uspace/app/virtusbkbd/virtusbkbd.c

    r9ee87f6 r7fc092a  
    271271        printf("%s: Simulating keyboard events...\n", NAME);
    272272        fibril_sleep(10);
    273         while (1) {
     273        //while (1) {
    274274                kb_process_events(&status, keyboard_events, keyboard_events_count,
    275275                        on_keyboard_change);
    276         }
     276        //}
    277277       
    278278        printf("%s: Terminating...\n", NAME);
Note: See TracChangeset for help on using the changeset viewer.