1/* $FreeBSD: head/sys/dev/usb/template/usb_template.c 250207 2013-05-03 11:10:04Z hselasky $ */ |
2/*- 3 * Copyright (c) 2007 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 54 unchanged lines hidden (view full) --- 64#include <dev/usb/usb_process.h> 65#include <dev/usb/usb_device.h> 66 67#define USB_DEBUG_VAR usb_debug 68#include <dev/usb/usb_debug.h> 69 70#include <dev/usb/usb_controller.h> 71#include <dev/usb/usb_bus.h> |
72#include <dev/usb/usb_request.h> |
73#include <dev/usb/template/usb_template.h> 74#endif /* USB_GLOBAL_INCLUDE_FILE */ 75 76MODULE_DEPEND(usb_template, usb, 1, 1, 1); 77MODULE_VERSION(usb_template, 1); 78 79/* function prototypes */ 80 --- 1182 unchanged lines hidden (view full) --- 1263 goto done; 1264 } 1265 /* sanity check */ 1266 if (uts->size == 0) { 1267 uts->err = USB_ERR_INVAL; 1268 goto done; 1269 } 1270 /* allocate zeroed memory */ |
1271 uts->buf = usbd_alloc_config_desc(udev, uts->size); |
1272 /* 1273 * Allow malloc() to return NULL regardless of M_WAITOK flag. 1274 * This helps when porting the software to non-FreeBSD 1275 * systems. 1276 */ 1277 if (uts->buf == NULL) { 1278 /* could not allocate memory */ 1279 uts->err = USB_ERR_NOMEM; --- 52 unchanged lines hidden (view full) --- 1332 * usb_temp_unsetup 1333 * 1334 * This function frees any memory associated with the currently 1335 * setup template, if any. 1336 *------------------------------------------------------------------------*/ 1337void 1338usb_temp_unsetup(struct usb_device *udev) 1339{ |
1340 usbd_free_config_desc(udev, udev->usb_template_ptr); 1341 udev->usb_template_ptr = NULL; |
1342} 1343 1344static usb_error_t 1345usb_temp_setup_by_index(struct usb_device *udev, uint16_t index) 1346{ 1347 usb_error_t err; 1348 1349 switch (index) { --- 39 unchanged lines hidden --- |