Changeset 904dcc6 in mainline for uspace/lib/usbdev/src/altiface.c
- Timestamp:
- 2011-11-05T13:54:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7fc260ff
- Parents:
- 99a1a56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/altiface.c
r99a1a56 r904dcc6 90 90 * @return Error code. 91 91 */ 92 int usb_alternate_interfaces_create(const uint8_t *config_descr, 93 size_t config_descr_size, int interface_number, 94 usb_alternate_interfaces_t **alternates_ptr) 92 int usb_alternate_interfaces_init(usb_alternate_interfaces_t *alternates, 93 const uint8_t *config_descr, size_t config_descr_size, int interface_number) 95 94 { 96 assert(alternates _ptr!= NULL);95 assert(alternates != NULL); 97 96 assert(config_descr != NULL); 98 97 assert(config_descr_size > 0); 99 98 100 *alternates_ptr = NULL; 99 alternates->alternatives = NULL; 100 alternates->alternative_count = 0; 101 alternates->current = 0; 102 101 103 if (interface_number < 0) { 102 104 return EOK; 103 }104 105 usb_alternate_interfaces_t *alternates106 = malloc(sizeof(usb_alternate_interfaces_t));107 if (alternates == NULL) {108 return ENOMEM;109 105 } 110 106 … … 114 110 115 111 if (alternates->alternative_count == 0) { 116 free(alternates);117 112 return ENOENT; 118 113 } … … 121 116 sizeof(usb_alternate_interface_descriptors_t)); 122 117 if (alternates->alternatives == NULL) { 123 free(alternates);124 118 return ENOMEM; 125 119 } 126 120 127 alternates->current = 0; 128 129 usb_dp_parser_t dp_parser = { 121 const usb_dp_parser_t dp_parser = { 130 122 .nesting = usb_dp_standard_descriptor_nesting 131 123 }; 132 usb_dp_parser_data_t dp_data = {124 const usb_dp_parser_data_t dp_data = { 133 125 .data = config_descr, 134 126 .size = config_descr_size, … … 170 162 } 171 163 172 *alternates_ptr = alternates;173 174 164 return EOK; 175 165 } 176 166 177 void usb_alternate_interfaces_de stroy(usb_alternate_interfaces_t *alternate)167 void usb_alternate_interfaces_deinit(usb_alternate_interfaces_t *alternate) 178 168 { 179 169 if (!alternate) 180 170 return; 181 171 free(alternate->alternatives); 182 free(alternate);183 172 } 184 173 /**
Note:
See TracChangeset
for help on using the changeset viewer.