diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-11-11 15:15:16 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-11-11 15:15:16 -0500 |
commit | 5a059c8d6ecfe2f98a77570b8b6cf13c500398f7 (patch) | |
tree | db8d337eb96c44feff77d5564eb9da697e8b961b /ChibiOS_16.1.5/community/os/hal/include/usbh | |
parent | 7772ea4579a45bcf63ebd5e68be66ba1a9c72dfa (diff) |
tar'd chibi
Diffstat (limited to 'ChibiOS_16.1.5/community/os/hal/include/usbh')
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/debug.h | 44 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/defs.h | 160 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/desciter.h | 63 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/dev/ftdi.h | 154 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/dev/hub.h | 138 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/dev/msd.h | 125 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/internal.h | 148 | ||||
-rw-r--r-- | ChibiOS_16.1.5/community/os/hal/include/usbh/list.h | 598 |
8 files changed, 0 insertions, 1430 deletions
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/debug.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/debug.h deleted file mode 100644 index 5120121..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/debug.h +++ /dev/null @@ -1,44 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-
-#ifndef USBH_DEBUG_H_
-#define USBH_DEBUG_H_
-
-#include "hal_usbh.h"
-
-#if HAL_USE_USBH
-
-//TODO: Debug is only for USBHD1, make it generic.
-
-#if USBH_DEBUG_ENABLE
- void usbDbgPrintf(const char *fmt, ...);
- void usbDbgPuts(const char *s);
- void usbDbgInit(USBHDriver *host);
- void usbDbgReset(void);
- void usbDbgSystemHalted(void);
-#else
-#define usbDbgPrintf(fmt, ...) do {} while(0)
-#define usbDbgPuts(s) do {} while(0)
-#define usbDbgInit(host) do {} while(0)
-#define usbDbgReset() do {} while(0)
-#define usbDbgSystemHalted() do {} while(0)
-#endif
-
-#endif
-
-#endif /* USBH_DEBUG_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/defs.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/defs.h deleted file mode 100644 index c3d8a9a..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/defs.h +++ /dev/null @@ -1,160 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef USBH_DEFS_H_
-#define USBH_DEFS_H_
-
-#include "hal.h"
-
-#if HAL_USE_USBH
-
-#include "osal.h"
-
-#ifdef __IAR_SYSTEMS_ICC__
-#define PACKED_STRUCT typedef PACKED_VAR struct
-#else
-#define PACKED_STRUCT typedef struct PACKED_VAR
-#endif
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint16_t bcdUSB;
- uint8_t bDeviceClass;
- uint8_t bDeviceSubClass;
- uint8_t bDeviceProtocol;
- uint8_t bMaxPacketSize0;
- uint16_t idVendor;
- uint16_t idProduct;
- uint16_t bcdDevice;
- uint8_t iManufacturer;
- uint8_t iProduct;
- uint8_t iSerialNumber;
- uint8_t bNumConfigurations;
-} usbh_device_descriptor_t;
-#define USBH_DT_DEVICE 0x01
-#define USBH_DT_DEVICE_SIZE 18
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint16_t wTotalLength;
- uint8_t bNumInterfaces;
- uint8_t bConfigurationValue;
- uint8_t iConfiguration;
- uint8_t bmAttributes;
- uint8_t bMaxPower;
-} usbh_config_descriptor_t;
-#define USBH_DT_CONFIG 0x02
-#define USBH_DT_CONFIG_SIZE 9
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint16_t wData[1];
-} usbh_string_descriptor_t;
-#define USBH_DT_STRING 0x03
-#define USBH_DT_STRING_SIZE 2
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint8_t bInterfaceNumber;
- uint8_t bAlternateSetting;
- uint8_t bNumEndpoints;
- uint8_t bInterfaceClass;
- uint8_t bInterfaceSubClass;
- uint8_t bInterfaceProtocol;
- uint8_t iInterface;
-} usbh_interface_descriptor_t;
-#define USBH_DT_INTERFACE 0x04
-#define USBH_DT_INTERFACE_SIZE 9
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint8_t bEndpointAddress;
- uint8_t bmAttributes;
- uint16_t wMaxPacketSize;
- uint8_t bInterval;
-} usbh_endpoint_descriptor_t;
-#define USBH_DT_ENDPOINT 0x05
-#define USBH_DT_ENDPOINT_SIZE 7
-
-PACKED_STRUCT {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint8_t bFirstInterface;
- uint8_t bInterfaceCount;
- uint8_t bFunctionClass;
- uint8_t bFunctionSubClass;
- uint8_t bFunctionProtocol;
- uint8_t iFunction;
-} usbh_ia_descriptor_t;
-#define USBH_DT_INTERFACE_ASSOCIATION 0x0b
-#define USBH_DT_INTERFACE_ASSOCIATION_SIZE 8
-
-PACKED_STRUCT {
- uint8_t bDescLength;
- uint8_t bDescriptorType;
- uint8_t bNbrPorts;
- uint16_t wHubCharacteristics;
- uint8_t bPwrOn2PwrGood;
- uint8_t bHubContrCurrent;
- uint32_t DeviceRemovable;
-} usbh_hub_descriptor_t;
-#define USBH_DT_HUB 0x29
-#define USBH_DT_HUB_SIZE (7 + 4)
-
-PACKED_STRUCT {
- uint8_t bmRequestType;
- uint8_t bRequest;
- uint16_t wValue;
- uint16_t wIndex;
- uint16_t wLength;
-} usbh_control_request_t;
-
-
-#define USBH_REQ_GET_STATUS 0x00
-#define USBH_REQ_CLEAR_FEATURE 0x01
-#define USBH_REQ_SET_FEATURE 0x03
-#define USBH_REQ_SET_ADDRESS 0x05
-#define USBH_REQ_GET_DESCRIPTOR 0x06
-#define USBH_REQ_SET_DESCRIPTOR 0x07
-#define USBH_REQ_GET_CONFIGURATION 0x08
-#define USBH_REQ_SET_CONFIGURATION 0x09
-#define USBH_REQ_GET_INTERFACE 0x0A
-#define USBH_REQ_SET_INTERFACE 0x0B
-#define USBH_REQ_SYNCH_FRAME 0x0C
-
-
-#define USBH_REQTYPE_IN 0x80
-#define USBH_REQTYPE_OUT 0x00
-
-#define USBH_REQTYPE_STANDARD 0x00
-#define USBH_REQTYPE_CLASS 0x20
-#define USBH_REQTYPE_VENDOR 0x40
-
-#define USBH_REQTYPE_DEVICE 0x00
-#define USBH_REQTYPE_INTERFACE 0x01
-#define USBH_REQTYPE_ENDPOINT 0x02
-#define USBH_REQTYPE_OTHER 0x03
-
-#endif
-
-
-#endif /* USBH_DEFS_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/desciter.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/desciter.h deleted file mode 100644 index 52b0c98..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/desciter.h +++ /dev/null @@ -1,63 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-
-#ifndef USBH_DESCITER_H_
-#define USBH_DESCITER_H_
-
-#include "hal.h"
-
-#if HAL_USE_USBH
-
-#include "usbh/defs.h"
-
-
-/* DESCRIPTOR PARSING */
-#define _generic_iterator_fields \
- const uint8_t *curr; \
- uint16_t rem; \
- bool valid;
-
-typedef struct {
- _generic_iterator_fields
-} generic_iterator_t;
-
-typedef struct {
- _generic_iterator_fields
- const usbh_ia_descriptor_t *iad;
-} if_iterator_t;
-
-void cfg_iter_init(generic_iterator_t *icfg, const uint8_t *buff, uint16_t rem);
-void if_iter_init(if_iterator_t *iif, const generic_iterator_t *icfg);
-void ep_iter_init(generic_iterator_t *iep, const if_iterator_t *iif);
-void cs_iter_init(generic_iterator_t *ics, const generic_iterator_t *iter);
-void if_iter_next(if_iterator_t *iif);
-void ep_iter_next(generic_iterator_t *iep);
-void cs_iter_next(generic_iterator_t *ics);
-static inline const usbh_config_descriptor_t *cfg_get(generic_iterator_t *icfg) {
- return (const usbh_config_descriptor_t *)icfg->curr;
-}
-static inline const usbh_interface_descriptor_t *if_get(if_iterator_t *iif) {
- return (const usbh_interface_descriptor_t *)iif->curr;
-}
-static inline const usbh_endpoint_descriptor_t *ep_get(generic_iterator_t *iep) {
- return (const usbh_endpoint_descriptor_t *)iep->curr;
-}
-
-#endif
-
-#endif /* USBH_DESCITER_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/ftdi.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/ftdi.h deleted file mode 100644 index ad6b4cd..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/ftdi.h +++ /dev/null @@ -1,154 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef USBH_FTDI_H_
-#define USBH_FTDI_H_
-
-#include "hal_usbh.h"
-
-#if HAL_USE_USBH && HAL_USBH_USE_FTDI
-
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-#define USBHFTDI_FRAMING_DATABITS_7 (0x7 << 0)
-#define USBHFTDI_FRAMING_DATABITS_8 (0x8 << 0)
-#define USBHFTDI_FRAMING_PARITY_NONE (0x0 << 8)
-#define USBHFTDI_FRAMING_PARITY_NONE (0x0 << 8)
-#define USBHFTDI_FRAMING_PARITY_ODD (0x1 << 8)
-#define USBHFTDI_FRAMING_PARITY_EVEN (0x2 << 8)
-#define USBHFTDI_FRAMING_PARITY_MARK (0x3 << 8)
-#define USBHFTDI_FRAMING_PARITY_SPACE (0x4 << 8)
-#define USBHFTDI_FRAMING_STOP_BITS_1 (0x0 << 11)
-#define USBHFTDI_FRAMING_STOP_BITS_15 (0x1 << 11)
-#define USBHFTDI_FRAMING_STOP_BITS_2 (0x2 << 11)
-
-#define USBHFTDI_HANDSHAKE_NONE (0x0)
-#define USBHFTDI_HANDSHAKE_RTS_CTS (0x1)
-#define USBHFTDI_HANDSHAKE_DTR_DSR (0x2)
-#define USBHFTDI_HANDSHAKE_XON_XOFF (0x4)
-
-
-
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
-typedef struct {
- uint32_t speed;
- uint16_t framing;
- uint8_t handshake;
- uint8_t xon_character;
- uint8_t xoff_character;
-} USBHFTDIPortConfig;
-
-typedef enum {
- USBHFTDI_TYPE_A,
- USBHFTDI_TYPE_B,
- USBHFTDI_TYPE_H,
-} usbhftdi_type_t;
-
-typedef enum {
- USBHFTDIP_STATE_UNINIT = 0,
- USBHFTDIP_STATE_STOP = 1,
- USBHFTDIP_STATE_ACTIVE = 2,
- USBHFTDIP_STATE_READY = 3
-} usbhftdip_state_t;
-
-
-#define _ftdi_port_driver_methods \
- _base_asynchronous_channel_methods
-
-struct FTDIPortDriverVMT {
- _ftdi_port_driver_methods
-};
-
-typedef struct USBHFTDIPortDriver USBHFTDIPortDriver;
-typedef struct USBHFTDIDriver USBHFTDIDriver;
-
-struct USBHFTDIPortDriver {
- /* inherited from abstract asyncrhonous channel driver */
- const struct FTDIPortDriverVMT *vmt;
- _base_asynchronous_channel_data
-
- USBHFTDIDriver *ftdip;
-
- usbhftdip_state_t state;
-
- usbh_ep_t epin;
- usbh_urb_t iq_urb;
- threads_queue_t iq_waiting;
- uint32_t iq_counter;
- USBH_DEFINE_BUFFER(uint8_t, iq_buff[64]);
- uint8_t *iq_ptr;
-
-
- usbh_ep_t epout;
- usbh_urb_t oq_urb;
- threads_queue_t oq_waiting;
- uint32_t oq_counter;
- USBH_DEFINE_BUFFER(uint8_t, oq_buff[64]);
- uint8_t *oq_ptr;
-
- virtual_timer_t vt;
- uint8_t ifnum;
-
- USBHFTDIPortDriver *next;
-};
-
-typedef struct USBHFTDIDriver {
- /* inherited from abstract class driver */
- _usbh_base_classdriver_data
-
- usbhftdi_type_t type;
- USBHFTDIPortDriver *ports;
-
- mutex_t mtx;
-} USBHFTDIDriver;
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-extern USBHFTDIDriver USBHFTDID[HAL_USBHFTDI_MAX_INSTANCES];
-extern USBHFTDIPortDriver FTDIPD[HAL_USBHFTDI_MAX_PORTS];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- /* FTDI device driver */
- void usbhftdiObjectInit(USBHFTDIDriver *ftdip);
-
- /* FTDI port driver */
- void usbhftdipObjectInit(USBHFTDIPortDriver *ftdipp);
- void usbhftdipStart(USBHFTDIPortDriver *ftdipp, const USBHFTDIPortConfig *config);
- void usbhftdipStop(USBHFTDIPortDriver *ftdipp);
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
-#endif /* USBH_FTDI_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/hub.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/hub.h deleted file mode 100644 index 07e88e6..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/hub.h +++ /dev/null @@ -1,138 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef USBH_HUB_H_
-#define USBH_HUB_H_
-
-#include "hal_usbh.h"
-
-#if HAL_USE_USBH
-#if HAL_USBH_USE_HUB
-
-typedef struct USBHHubDriver {
- /* inherited from abstract class driver */
- _usbh_base_classdriver_data
-
- struct list_head node;
-
- usbh_ep_t epint;
- usbh_urb_t urb;
-
- USBH_DEFINE_BUFFER(uint8_t, scbuff[4]);
- volatile uint32_t statuschange;
- uint16_t status;
- uint16_t c_status;
-
- usbh_port_t *ports;
-
- USBH_DEFINE_BUFFER(usbh_hub_descriptor_t, hubDesc);
-
- /* Low level part */
- _usbh_hub_ll_data
-
-} USBHHubDriver;
-
-extern USBHHubDriver USBHHUBD[HAL_USBHHUB_MAX_INSTANCES];
-
-
-usbh_urbstatus_t usbhhubControlRequest(USBHDriver *host, USBHHubDriver *hub,
- uint8_t bmRequestType,
- uint8_t bRequest,
- uint16_t wValue,
- uint16_t wIndex,
- uint16_t wLength,
- uint8_t *buf);
-
-
-static inline usbh_urbstatus_t usbhhubClearFeaturePort(usbh_port_t *port, uint8_t feature) {
- return usbhhubControlRequest(port->device.host, port->hub,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER,
- USBH_REQ_CLEAR_FEATURE,
- feature,
- port->number,
- 0,
- 0);
-}
-
-static inline usbh_urbstatus_t usbhhubClearFeatureHub(USBHDriver *host, USBHHubDriver *hub, uint8_t feature) {
- return usbhhubControlRequest(host, hub,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE,
- USBH_REQ_CLEAR_FEATURE,
- feature,
- 0,
- 0,
- 0);
-}
-
-static inline usbh_urbstatus_t usbhhubSetFeaturePort(usbh_port_t *port, uint8_t feature) {
- return usbhhubControlRequest(port->device.host, port->hub,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER,
- USBH_REQ_SET_FEATURE,
- feature,
- port->number,
- 0,
- 0);
-}
-
-void usbhhubObjectInit(USBHHubDriver *hubdp);
-#else
-
-static inline usbh_urbstatus_t usbhhubControlRequest(USBHDriver *host,
- uint8_t bmRequestType,
- uint8_t bRequest,
- uint16_t wValue,
- uint16_t wIndex,
- uint16_t wLength,
- uint8_t *buf) {
- return usbh_lld_root_hub_request(host, bmRequestType, bRequest, wValue, wIndex, wLength, buf);
-}
-
-static inline usbh_urbstatus_t usbhhubClearFeaturePort(usbh_port_t *port, uint8_t feature) {
- return usbhhubControlRequest(port->device.host,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER,
- USBH_REQ_CLEAR_FEATURE,
- feature,
- port->number,
- 0,
- 0);
-}
-
-static inline usbh_urbstatus_t usbhhubClearFeatureHub(USBHDriver *host, uint8_t feature) {
- return usbhhubControlRequest(host,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE,
- USBH_REQ_CLEAR_FEATURE,
- feature,
- 0,
- 0,
- 0);
-}
-
-static inline usbh_urbstatus_t usbhhubSetFeaturePort(usbh_port_t *port, uint8_t feature) {
- return usbhhubControlRequest(port->device.host,
- USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER,
- USBH_REQ_SET_FEATURE,
- feature,
- port->number,
- 0,
- 0);
-}
-
-#endif
-
-#endif
-
-#endif /* USBH_HUB_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/msd.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/msd.h deleted file mode 100644 index d164618..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/dev/msd.h +++ /dev/null @@ -1,125 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef USBH_MSD_H_
-#define USBH_MSD_H_
-
-#include "hal_usbh.h"
-
-#if HAL_USE_USBH && HAL_USBH_USE_MSD
-
-/* TODO:
- *
- * - Implement of conditional compilation of multiple-luns per instance.
- * - Implement error checking and recovery when commands fail.
- *
- */
-
-
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
-
-#define _usbhmsd_driver_methods \
- _base_block_device_methods
-
-struct USBHMassStorageDriverVMT {
- _usbhmsd_driver_methods
-};
-
-typedef struct USBHMassStorageLUNDriver USBHMassStorageLUNDriver;
-typedef struct USBHMassStorageDriver USBHMassStorageDriver;
-
-struct USBHMassStorageLUNDriver {
- /* inherited from abstract block driver */
- const struct USBHMassStorageDriverVMT *vmt;
- _base_block_device_data
-
- BlockDeviceInfo info;
- USBHMassStorageDriver *msdp;
-
- USBHMassStorageLUNDriver *next;
-};
-
-typedef struct USBHMassStorageDriver {
- /* inherited from abstract class driver */
- _usbh_base_classdriver_data
-
- /* for LUN request serialization, can be removed
- * if the driver is configured to support only one LUN
- * per USBHMassStorageDriver instance */
- mutex_t mtx;
-
- usbh_ep_t epin;
- usbh_ep_t epout;
- uint8_t ifnum;
- uint8_t max_lun;
- uint32_t tag;
-
- USBHMassStorageLUNDriver *luns;
-} USBHMassStorageDriver;
-
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-extern USBHMassStorageLUNDriver MSBLKD[HAL_USBHMSD_MAX_LUNS];
-extern USBHMassStorageDriver USBHMSD[HAL_USBHMSD_MAX_INSTANCES];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- /* Mass Storage Driver */
- void usbhmsdObjectInit(USBHMassStorageDriver *msdp);
-
- /* Mass Storage LUN Driver (block driver) */
- void usbhmsdLUNObjectInit(USBHMassStorageLUNDriver *lunp);
- void usbhmsdLUNStart(USBHMassStorageLUNDriver *lunp);
- void usbhmsdLUNStop(USBHMassStorageLUNDriver *lunp);
- bool usbhmsdLUNConnect(USBHMassStorageLUNDriver *lunp);
- bool usbhmsdLUNDisconnect(USBHMassStorageLUNDriver *lunp);
- bool usbhmsdLUNRead(USBHMassStorageLUNDriver *lunp, uint32_t startblk,
- uint8_t *buffer, uint32_t n);
- bool usbhmsdLUNWrite(USBHMassStorageLUNDriver *lunp, uint32_t startblk,
- const uint8_t *buffer, uint32_t n);
- bool usbhmsdLUNSync(USBHMassStorageLUNDriver *lunp);
- bool usbhmsdLUNGetInfo(USBHMassStorageLUNDriver *lunp, BlockDeviceInfo *bdip);
- bool usbhmsdLUNIsInserted(USBHMassStorageLUNDriver *lunp);
- bool usbhmsdLUNIsProtected(USBHMassStorageLUNDriver *lunp);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* USBH_MSD_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/internal.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/internal.h deleted file mode 100644 index baa477f..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/internal.h +++ /dev/null @@ -1,148 +0,0 @@ -/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
- Copyright (C) 2015 Diego Ismirlian, TISA, (dismirlian (at) google's mail)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#ifndef USBH_INTERNAL_H_
-#define USBH_INTERNAL_H_
-
-#include "hal_usbh.h"
-
-#if HAL_USE_USBH
-
-/*===========================================================================*/
-/* These declarations are not part of the public API. */
-/*===========================================================================*/
-
-#if HAL_USBH_USE_FTDI
-extern const usbh_classdriverinfo_t usbhftdiClassDriverInfo;
-#endif
-#if HAL_USBH_USE_MSD
-extern const usbh_classdriverinfo_t usbhmsdClassDriverInfo;
-#endif
-#if HAL_USBH_USE_UVC
-extern const usbh_classdriverinfo_t usbhuvcClassDriverInfo;
-#endif
-#if HAL_USBH_USE_HUB
-extern const usbh_classdriverinfo_t usbhhubClassDriverInfo;
-void _usbhub_port_object_init(usbh_port_t *port, USBHDriver *usbh,
- USBHHubDriver *hub, uint8_t number);
-#else
-void _usbhub_port_object_init(usbh_port_t *port, USBHDriver *usbh, uint8_t number);
-#endif
-
-void _usbh_port_disconnected(usbh_port_t *port);
-void _usbh_urb_completeI(usbh_urb_t *urb, usbh_urbstatus_t status);
-bool _usbh_urb_abortI(usbh_urb_t *urb, usbh_urbstatus_t status);
-void _usbh_urb_abort_and_waitS(usbh_urb_t *urb, usbh_urbstatus_t status);
-
-
-#define USBH_CLASSIN(type, req, value, index) \
- (USBH_REQTYPE_IN | type | USBH_REQTYPE_CLASS), \
- req, \
- value, \
- index
-
-#define USBH_CLASSOUT(type, req, value, index) \
- (USBH_REQTYPE_OUT | type | USBH_REQTYPE_CLASS), \
- req, \
- value, \
- index
-
-#define USBH_STANDARDIN(type, req, value, index) \
- (USBH_REQTYPE_IN | type | USBH_REQTYPE_STANDARD), \
- req, \
- value, \
- index
-
-#define USBH_STANDARDOUT(type, req, value, index) \
- (USBH_REQTYPE_OUT | type | USBH_REQTYPE_STANDARD), \
- req, \
- value, \
- index
-
-
-#define USBH_PID_DATA0 0
-#define USBH_PID_DATA2 1
-#define USBH_PID_DATA1 2
-#define USBH_PID_MDATA 3
-#define USBH_PID_SETUP 3
-
-
-/* GetBusState and SetHubDescriptor are optional, omitted */
-#define ClearHubFeature (((USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE) << 8) \
- | USBH_REQ_CLEAR_FEATURE)
-#define SetHubFeature (((USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE) << 8) \
- | USBH_REQ_SET_FEATURE)
-#define ClearPortFeature (((USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER) << 8) \
- | USBH_REQ_CLEAR_FEATURE)
-#define SetPortFeature (((USBH_REQTYPE_OUT | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER) << 8) \
- | USBH_REQ_SET_FEATURE)
-#define GetHubDescriptor (((USBH_REQTYPE_IN | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE) << 8) \
- | USBH_REQ_GET_DESCRIPTOR)
-#define GetHubStatus (((USBH_REQTYPE_IN | USBH_REQTYPE_CLASS | USBH_REQTYPE_DEVICE) << 8) \
- | USBH_REQ_GET_STATUS)
-#define GetPortStatus (((USBH_REQTYPE_IN | USBH_REQTYPE_CLASS | USBH_REQTYPE_OTHER) << 8) \
- | USBH_REQ_GET_STATUS)
-
-
-#define USBH_PORTSTATUS_CONNECTION 0x0001
-#define USBH_PORTSTATUS_ENABLE 0x0002
-#define USBH_PORTSTATUS_SUSPEND 0x0004
-#define USBH_PORTSTATUS_OVERCURRENT 0x0008
-#define USBH_PORTSTATUS_RESET 0x0010
-/* bits 5 to 7 are reserved */
-#define USBH_PORTSTATUS_POWER 0x0100
-#define USBH_PORTSTATUS_LOW_SPEED 0x0200
-#define USBH_PORTSTATUS_HIGH_SPEED 0x0400
-#define USBH_PORTSTATUS_TEST 0x0800
-#define USBH_PORTSTATUS_INDICATOR 0x1000
-/* bits 13 to 15 are reserved */
-
-#define USBH_PORTSTATUS_C_CONNECTION 0x0001
-#define USBH_PORTSTATUS_C_ENABLE 0x0002
-#define USBH_PORTSTATUS_C_SUSPEND 0x0004
-#define USBH_PORTSTATUS_C_OVERCURRENT 0x0008
-#define USBH_PORTSTATUS_C_RESET 0x0010
-
-#define USBH_HUBSTATUS_C_HUB_LOCAL_POWER 0x0001
-#define USBH_HUBSTATUS_C_HUB_OVER_CURRENT 0x0002
-
-/*
- * Port feature numbers
- * See USB 2.0 spec Table 11-17
- */
-#define USBH_HUB_FEAT_C_HUB_LOCAL_POWER 0
-#define USBH_HUB_FEAT_C_HUB_OVER_CURRENT 1
-#define USBH_PORT_FEAT_CONNECTION 0
-#define USBH_PORT_FEAT_ENABLE 1
-#define USBH_PORT_FEAT_SUSPEND 2
-#define USBH_PORT_FEAT_OVERCURRENT 3
-#define USBH_PORT_FEAT_RESET 4
-#define USBH_PORT_FEAT_POWER 8
-#define USBH_PORT_FEAT_LOWSPEED 9
-#define USBH_PORT_FEAT_C_CONNECTION 16
-#define USBH_PORT_FEAT_C_ENABLE 17
-#define USBH_PORT_FEAT_C_SUSPEND 18
-#define USBH_PORT_FEAT_C_OVERCURRENT 19
-#define USBH_PORT_FEAT_C_RESET 20
-#define USBH_PORT_FEAT_TEST 21
-#define USBH_PORT_FEAT_INDICATOR 22
-
-#define sizeof_array(x) (sizeof(x)/sizeof(*(x)))
-
-#endif
-
-#endif /* USBH_INTERNAL_H_ */
diff --git a/ChibiOS_16.1.5/community/os/hal/include/usbh/list.h b/ChibiOS_16.1.5/community/os/hal/include/usbh/list.h deleted file mode 100644 index 4eceacd..0000000 --- a/ChibiOS_16.1.5/community/os/hal/include/usbh/list.h +++ /dev/null @@ -1,598 +0,0 @@ -#ifndef USBH_LIST_H_
-#define USBH_LIST_H_
-
-/* TODO: re-write this file; stolen from linux */
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-#define container_of(ptr, type, member) ((type *)(void *)((char *)(ptr) - offsetof(type, member)))
-#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const typeof(((type *)0)->member) * __mptr = (ptr); \
- (type *)((char *)__mptr - offsetof(type, member)); })
-#endif
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-struct list_head {
- struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
-
-static inline void INIT_LIST_HEAD(struct list_head *list)
-{
- list->next = list;
- list->prev = list;
-}
-
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-#ifndef CONFIG_DEBUG_LIST
-static inline void __list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next)
-{
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
-}
-#else
-extern void __list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next);
-#endif
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head, head->next);
-}
-
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty() on entry does not return true after this, the entry is
- * in an undefined state.
- */
-#ifndef CONFIG_DEBUG_LIST
-static inline void __list_del_entry(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
-}
-
-static inline void list_del(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
- // entry->next = LIST_POISON1;
- // entry->prev = LIST_POISON2;
-}
-#else
-extern void __list_del_entry(struct list_head *entry);
-extern void list_del(struct list_head *entry);
-#endif
-
-/**
- * list_replace - replace old entry by new one
- * @old : the element to be replaced
- * @new : the new element to insert
- *
- * If @old was empty, it will be overwritten.
- */
-static inline void list_replace(struct list_head *old,
- struct list_head *new)
-{
- new->next = old->next;
- new->next->prev = new;
- new->prev = old->prev;
- new->prev->next = new;
-}
-
-static inline void list_replace_init(struct list_head *old,
- struct list_head *new)
-{
- list_replace(old, new);
- INIT_LIST_HEAD(old);
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
- __list_del_entry(entry);
- INIT_LIST_HEAD(entry);
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
- __list_del_entry(list);
- list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
- struct list_head *head)
-{
- __list_del_entry(list);
- list_add_tail(list, head);
-}
-
-/**
- * list_is_last - tests whether @list is the last entry in list @head
- * @list: the entry to test
- * @head: the head of the list
- */
-static inline int list_is_last(const struct list_head *list,
- const struct list_head *head)
-{
- return list->next == head;
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(const struct list_head *head)
-{
- return head->next == head;
-}
-
-/**
- * list_empty_careful - tests whether a list is empty and not being modified
- * @head: the list to test
- *
- * Description:
- * tests whether a list is empty _and_ checks that no other CPU might be
- * in the process of modifying either member (next or prev)
- *
- * NOTE: using list_empty_careful() without synchronization
- * can only be safe if the only activity that can happen
- * to the list entry is list_del_init(). Eg. it cannot be used
- * if another CPU could re-list_add() it.
- */
-static inline int list_empty_careful(const struct list_head *head)
-{
- struct list_head *next = head->next;
- return (next == head) && (next == head->prev);
-}
-
-/**
- * list_rotate_left - rotate the list to the left
- * @head: the head of the list
- */
-static inline void list_rotate_left(struct list_head *head)
-{
- struct list_head *first;
-
- if (!list_empty(head)) {
- first = head->next;
- list_move_tail(first, head);
- }
-}
-
-/**
- * list_is_singular - tests whether a list has just one entry.
- * @head: the list to test.
- */
-static inline int list_is_singular(const struct list_head *head)
-{
- return !list_empty(head) && (head->next == head->prev);
-}
-
-static inline void __list_cut_position(struct list_head *list,
- struct list_head *head, struct list_head *entry)
-{
- struct list_head *new_first = entry->next;
- list->next = head->next;
- list->next->prev = list;
- list->prev = entry;
- entry->next = list;
- head->next = new_first;
- new_first->prev = head;
-}
-
-/**
- * list_cut_position - cut a list into two
- * @list: a new list to add all removed entries
- * @head: a list with entries
- * @entry: an entry within head, could be the head itself
- * and if so we won't cut the list
- *
- * This helper moves the initial part of @head, up to and
- * including @entry, from @head to @list. You should
- * pass on @entry an element you know is on @head. @list
- * should be an empty list or a list you do not care about
- * losing its data.
- *
- */
-static inline void list_cut_position(struct list_head *list,
- struct list_head *head, struct list_head *entry)
-{
- if (list_empty(head))
- return;
- if (list_is_singular(head) &&
- (head->next != entry && head != entry))
- return;
- if (entry == head)
- INIT_LIST_HEAD(list);
- else
- __list_cut_position(list, head, entry);
-}
-
-static inline void __list_splice(const struct list_head *list,
- struct list_head *prev,
- struct list_head *next)
-{
- struct list_head *first = list->next;
- struct list_head *last = list->prev;
-
- first->prev = prev;
- prev->next = first;
-
- last->next = next;
- next->prev = last;
-}
-
-/**
- * list_splice - join two lists, this is designed for stacks
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(const struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list))
- __list_splice(list, head, head->next);
-}
-
-/**
- * list_splice_tail - join two lists, each list being a queue
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice_tail(struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list))
- __list_splice(list, head->prev, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list)) {
- __list_splice(list, head, head->next);
- INIT_LIST_HEAD(list);
- }
-}
-
-/**
- * list_splice_tail_init - join two lists and reinitialise the emptied list
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * Each of the lists is a queue.
- * The list at @list is reinitialised
- */
-static inline void list_splice_tail_init(struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list)) {
- __list_splice(list, head->prev, head);
- INIT_LIST_HEAD(list);
- }
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_head within the struct.
- */
-#define list_entry(ptr, type, member) \
- container_of(ptr, type, member)
-
-/**
- * list_first_entry - get the first element from a list
- * @ptr: the list head to take the element from.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_head within the struct.
- *
- * Note, that list is expected to be not empty.
- */
-#define list_first_entry(ptr, type, member) \
- list_entry((ptr)->next, type, member)
-
-/**
- * list_last_entry - get the last element from a list
- * @ptr: the list head to take the element from.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_head within the struct.
- *
- * Note, that list is expected to be not empty.
- */
-#define list_last_entry(ptr, type, member) \
- list_entry((ptr)->prev, type, member)
-
-/**
- * list_first_entry_or_null - get the first element from a list
- * @ptr: the list head to take the element from.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_head within the struct.
- *
- * Note that if the list is empty, it returns NULL.
- */
-#define list_first_entry_or_null(ptr, type, member) \
- (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
-
-/**
- * list_next_entry - get the next element in list
- * @pos: the type * to cursor
- * @member: the name of the list_head within the struct.
- */
-#define list_next_entry(pos, type, member) \
- list_entry((pos)->member.next, type, member)
-
-/**
- * list_prev_entry - get the prev element in list
- * @pos: the type * to cursor
- * @member: the name of the list_head within the struct.
- */
-#define list_prev_entry(pos, type, member) \
- list_entry((pos)->member.prev, type, member)
-
-/**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop cursor.
- * @head: the head for your list.
- */
-#define list_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_prev - iterate over a list backwards
- * @pos: the &struct list_head to use as a loop cursor.
- * @head: the head for your list.
- */
-#define list_for_each_prev(pos, head) \
- for (pos = (head)->prev; pos != (head); pos = pos->prev)
-
-/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop cursor.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-/**
- * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
- * @pos: the &struct list_head to use as a loop cursor.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
- */
-#define list_for_each_prev_safe(pos, n, head) \
- for (pos = (head)->prev, n = pos->prev; \
- pos != (head); \
- pos = n, n = pos->prev)
-
-/**
- * list_for_each_entry - iterate over list of given type
- * @pos: the type * to use as a loop cursor.
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- */
-#define list_for_each_entry(pos, type, head, member) \
- for (pos = list_first_entry(head, type, member); \
- &pos->member != (head); \
- pos = list_next_entry(pos, type, member))
-
-/**
- * list_for_each_entry_reverse - iterate backwards over list of given type.
- * @pos: the type * to use as a loop cursor.
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- */
-#define list_for_each_entry_reverse(pos, type, head, member) \
- for (pos = list_last_entry(head, type, member); \
- &pos->member != (head); \
- pos = list_prev_entry(pos, type, member))
-
-/**
- * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
- * @pos: the type * to use as a start point
- * @head: the head of the list
- * @member: the name of the list_head within the struct.
- *
- * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
- */
-#define list_prepare_entry(pos, type, head, member) \
- ((pos) ? : list_entry(head, type, member))
-
-/**
- * list_for_each_entry_continue - continue iteration over list of given type
- * @pos: the type * to use as a loop cursor.
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Continue to iterate over list of given type, continuing after
- * the current position.
- */
-#define list_for_each_entry_continue(pos, type, head, member) \
- for (pos = list_next_entry(pos, type, member); \
- &pos->member != (head); \
- pos = list_next_entry(pos, type, member))
-
-/**
- * list_for_each_entry_continue_reverse - iterate backwards from the given point
- * @pos: the type * to use as a loop cursor.
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Start to iterate over list of given type backwards, continuing after
- * the current position.
- */
-#define list_for_each_entry_continue_reverse(pos, type, head, member) \
- for (pos = list_prev_entry(pos, type, member); \
- &pos->member != (head); \
- pos = list_prev_entry(pos, type, member))
-
-/**
- * list_for_each_entry_from - iterate over list of given type from the current point
- * @pos: the type * to use as a loop cursor.
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Iterate over list of given type, continuing from current position.
- */
-#define list_for_each_entry_from(pos, type, head, member) \
- for (; &pos->member != (head); \
- pos = list_next_entry(pos, type, member))
-
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos: the type * to use as a loop cursor.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- */
-#define list_for_each_entry_safe(pos, type, n, head, member) \
- for (pos = list_first_entry(head, type, member), \
- n = list_next_entry(pos, type, member); \
- &pos->member != (head); \
- pos = n, n = list_next_entry(n, type, member))
-
-/**
- * list_for_each_entry_safe_continue - continue list iteration safe against removal
- * @pos: the type * to use as a loop cursor.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Iterate over list of given type, continuing after current point,
- * safe against removal of list entry.
- */
-#define list_for_each_entry_safe_continue(pos, type, n, head, member) \
- for (pos = list_next_entry(pos, type, member), \
- n = list_next_entry(pos, type, member); \
- &pos->member != (head); \
- pos = n, n = list_next_entry(n, type, member))
-
-/**
- * list_for_each_entry_safe_from - iterate over list from current point safe against removal
- * @pos: the type * to use as a loop cursor.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Iterate over list of given type from current point, safe against
- * removal of list entry.
- */
-#define list_for_each_entry_safe_from(pos, type, n, head, member) \
- for (n = list_next_entry(pos, type, member); \
- &pos->member != (head); \
- pos = n, n = list_next_entry(n, type, member))
-
-/**
- * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
- * @pos: the type * to use as a loop cursor.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_head within the struct.
- *
- * Iterate backwards over list of given type, safe against removal
- * of list entry.
- */
-#define list_for_each_entry_safe_reverse(pos, type, n, head, member) \
- for (pos = list_last_entry(head, type, member), \
- n = list_prev_entry(pos, type, member); \
- &pos->member != (head); \
- pos = n, n = list_prev_entry(n, type, member))
-
-/**
- * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
- * @pos: the loop cursor used in the list_for_each_entry_safe loop
- * @n: temporary storage used in list_for_each_entry_safe
- * @member: the name of the list_head within the struct.
- *
- * list_safe_reset_next is not safe to use in general if the list may be
- * modified concurrently (eg. the lock is dropped in the loop body). An
- * exception to this is if the cursor element (pos) is pinned in the list,
- * and list_safe_reset_next is called after re-taking the lock and before
- * completing the current iteration of the loop body.
- */
-#define list_safe_reset_next(pos, type, n, member) \
- n = list_next_entry(pos, type, member)
-
-#endif /* USBH_LIST_H_ */
|