Changeset 7c95d6f5 in mainline


Ignore:
Timestamp:
2011-10-15T12:13:59Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
065064e6
Parents:
8a121b1
Message:

usb: Further const madness.

Location:
uspace
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/usbinfo/dump.c

    r8a121b1 r7c95d6f5  
    153153static void dump_tree(usb_dp_parser_t *parser, usb_dp_parser_data_t *data)
    154154{
    155         uint8_t *ptr = data->data;
     155        const uint8_t *ptr = data->data;
    156156        printf("Descriptor tree:\n");
    157157        dump_tree_internal(parser, data, ptr, 0);
  • uspace/drv/bus/usb/usbmid/dump.c

    r8a121b1 r7c95d6f5  
    9393static void dump_tree(usb_dp_parser_t *parser, usb_dp_parser_data_t *data)
    9494{
    95         uint8_t *ptr = data->data;
     95        const uint8_t *ptr = data->data;
    9696        dump_tree_internal(parser, data, ptr, 0);
    9797}
  • uspace/drv/bus/usb/usbmid/explore.c

    r8a121b1 r7c95d6f5  
    7373 * @param list List where to add the interfaces.
    7474 */
    75 static void create_interfaces(uint8_t *config_descriptor,
     75static void create_interfaces(const uint8_t *config_descriptor,
    7676    size_t config_descriptor_size, list_t *list)
    7777{
    78         usb_dp_parser_data_t data = {
     78        const usb_dp_parser_data_t data = {
    7979                .data = config_descriptor,
    8080                .size = config_descriptor_size,
     
    149149
    150150        /* Short cuts to save on typing ;-). */
    151         uint8_t *config_descriptor_raw = dev->descriptors.configuration;
     151        const void *config_descriptor_raw = dev->descriptors.configuration;
    152152        size_t config_descriptor_size = dev->descriptors.configuration_size;
    153         usb_standard_configuration_descriptor_t *config_descriptor =
    154             (usb_standard_configuration_descriptor_t *) config_descriptor_raw;
     153        const usb_standard_configuration_descriptor_t *config_descriptor =
     154            config_descriptor_raw;
    155155
    156156        /* Select the first configuration */
  • uspace/lib/usbdev/include/usb/dev/dp.h

    r8a121b1 r7c95d6f5  
    6565typedef struct {
    6666        /** Data to be parsed. */
    67         uint8_t *data;
     67        const uint8_t *data;
    6868        /** Size of input data in bytes. */
    6969        size_t size;
  • uspace/lib/usbdev/include/usb/dev/driver.h

    r8a121b1 r7c95d6f5  
    4343        usb_standard_device_descriptor_t device;
    4444        /** Full configuration descriptor of current configuration. */
    45         uint8_t *configuration;
     45        const uint8_t *configuration;
    4646        size_t configuration_size;
    4747} usb_device_descriptors_t;
     
    168168int usb_device_retrieve_descriptors(usb_pipe_t *, usb_device_descriptors_t *);
    169169int usb_device_create_pipes(const ddf_dev_t *, usb_device_connection_t *,
    170     usb_endpoint_description_t **, uint8_t *, size_t, int, int,
     170    usb_endpoint_description_t **, const uint8_t *, size_t, int, int,
    171171    usb_endpoint_mapping_t **, size_t *);
    172172int usb_device_destroy_pipes(const ddf_dev_t *, usb_endpoint_mapping_t *, size_t);
     
    174174void usb_device_destroy(usb_device_t *);
    175175
    176 size_t usb_interface_count_alternates(uint8_t *, size_t, uint8_t);
    177 int usb_alternate_interfaces_create(uint8_t *, size_t, int,
     176size_t usb_interface_count_alternates(const uint8_t *, size_t, uint8_t);
     177int usb_alternate_interfaces_create(const uint8_t *, size_t, int,
    178178    usb_alternate_interfaces_t **);
    179179
  • uspace/lib/usbdev/include/usb/dev/pipes.h

    r8a121b1 r7c95d6f5  
    171171int usb_pipe_probe_default_control(usb_pipe_t *);
    172172int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
    173     size_t, uint8_t *, size_t, usb_device_connection_t *);
     173    size_t, const uint8_t *, size_t, usb_device_connection_t *);
    174174int usb_pipe_register_with_speed(usb_pipe_t *, usb_speed_t,
    175175    unsigned int, usb_hc_connection_t *);
  • uspace/lib/usbdev/src/altiface.c

    r8a121b1 r7c95d6f5  
    4848 * @return Number of alternate interfaces for @p interface_no interface.
    4949 */
    50 size_t usb_interface_count_alternates(uint8_t *config_descr,
     50size_t usb_interface_count_alternates(const uint8_t *config_descr,
    5151    size_t config_descr_size, uint8_t interface_no)
    5252{
     
    9090 * @return Error code.
    9191 */
    92 int usb_alternate_interfaces_create(uint8_t *config_descr,
     92int usb_alternate_interfaces_create(const uint8_t *config_descr,
    9393    size_t config_descr_size, int interface_number,
    9494    usb_alternate_interfaces_t **alternates_ptr)
     
    160160                    dp_data.data, iface_ptr);
    161161                if (iface_ptr == NULL) {
    162                         uint8_t *next = dp_data.data + dp_data.size;
     162                        const uint8_t *next = dp_data.data + dp_data.size;
    163163                        cur_alt_iface->nested_descriptors_size
    164164                            = next - cur_alt_iface->nested_descriptors;
  • uspace/lib/usbdev/src/devdrv.c

    r8a121b1 r7c95d6f5  
    115115        int rc = usb_device_create_pipes(dev->ddf_dev, &dev->wire, endpoints,
    116116            dev->descriptors.configuration, dev->descriptors.configuration_size,
    117             dev->interface_no, alternate_setting,
    118             &pipes, &pipes_count);
     117            dev->interface_no, alternate_setting, &pipes, &pipes_count);
    119118
    120119        if (rc != EOK) {
     
    319318int usb_device_create_pipes(const ddf_dev_t *dev, usb_device_connection_t *wire,
    320319    usb_endpoint_description_t **endpoints,
    321     uint8_t *config_descr, size_t config_descr_size,
     320    const uint8_t *config_descr, size_t config_descr_size,
    322321    int interface_no, int interface_setting,
    323322    usb_endpoint_mapping_t **pipes_ptr, size_t *pipes_count_ptr)
  • uspace/lib/usbdev/src/pipesinit.c

    r8a121b1 r7c95d6f5  
    224224static int process_interface(
    225225    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    226     usb_dp_parser_t *parser, usb_dp_parser_data_t *parser_data,
     226    const usb_dp_parser_t *parser, const usb_dp_parser_data_t *parser_data,
    227227    const uint8_t *interface_descriptor)
    228228{
     
    284284int usb_pipe_initialize_from_configuration(
    285285    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    286     uint8_t *configuration_descriptor, size_t configuration_descriptor_size,
     286    const uint8_t *config_descriptor, size_t config_descriptor_size,
    287287    usb_device_connection_t *connection)
    288288{
    289289        assert(connection);
    290290
    291         if (configuration_descriptor == NULL) {
     291        if (config_descriptor == NULL) {
    292292                return EBADMEM;
    293293        }
    294         if (configuration_descriptor_size
     294        if (config_descriptor_size
    295295            < sizeof(usb_standard_configuration_descriptor_t)) {
    296296                return ERANGE;
     
    310310         * Prepare the descriptor parser.
    311311         */
    312         usb_dp_parser_t dp_parser = {
     312        const usb_dp_parser_t dp_parser = {
    313313                .nesting = descriptor_nesting
    314314        };
    315         usb_dp_parser_data_t dp_data = {
    316                 .data = configuration_descriptor,
    317                 .size = configuration_descriptor_size,
     315        const usb_dp_parser_data_t dp_data = {
     316                .data = config_descriptor,
     317                .size = config_descriptor_size,
    318318                .arg = connection
    319319        };
     
    323323         */
    324324        const uint8_t *interface = usb_dp_get_nested_descriptor(&dp_parser,
    325             &dp_data, configuration_descriptor);
     325            &dp_data, config_descriptor);
    326326        if (interface == NULL) {
    327327                return ENOENT;
     
    331331                    &dp_parser, &dp_data, interface);
    332332                interface = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
    333                     configuration_descriptor, interface);
     333                    config_descriptor, interface);
    334334        } while (interface != NULL);
    335335
Note: See TracChangeset for help on using the changeset viewer.