Print this page
2976 remove useless offsetof() macros


  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_USB_USBVC_VAR_H
  27 #define _SYS_USB_USBVC_VAR_H
  28 
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 #include <sys/list.h>

  35 #include <sys/usb/usba/usbai_private.h>
  36 #include <sys/videodev2.h>
  37 #include <sys/usb/clients/video/usbvc/usbvc.h>
  38 
  39 typedef struct usbvc_state usbvc_state_t;
  40 
  41 /*
  42  * Power Management support
  43  */
  44 typedef struct usbvc_power  {
  45 
  46         void            *usbvc_state;   /* points back to usbvc_state */
  47         uint8_t         usbvc_pwr_states; /* bit mask of device pwr states */
  48         int             usbvc_pm_busy;
  49 
  50         /* Wakeup and power transistion capabilites of an interface */
  51         uint8_t         usbvc_pm_capabilities;
  52 
  53         /* flag to indicate if driver is about to raise power level */
  54         boolean_t       usbvc_raise_power;


 156 
 157 /* For serialization. */
 158 #define USBVC_SER_NOSIG B_FALSE
 159 #define USBVC_SER_SIG           B_TRUE
 160 
 161 /*
 162  * Masks for debug printing
 163  */
 164 #define PRINT_MASK_ATTA         0x00000001
 165 #define PRINT_MASK_OPEN         0x00000002
 166 #define PRINT_MASK_CLOSE        0x00000004
 167 #define PRINT_MASK_READ         0x00000008
 168 #define PRINT_MASK_IOCTL        0x00000010
 169 #define PRINT_MASK_PM   0x00000020
 170 #define PRINT_MASK_CB   0x00000040
 171 #define PRINT_MASK_HOTPLUG      0x00000080
 172 #define PRINT_MASK_DEVCTRL      0x00000100
 173 #define PRINT_MASK_DEVMAP       0x00000200
 174 #define PRINT_MASK_ALL          0xFFFFFFFF
 175 
 176 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
 177 
 178 #define USBVC_MAX_PKTS 40
 179 
 180 #define USBVC_DEFAULT_READ_BUF_NUM 3
 181 #define USBVC_MAX_READ_BUF_NUM 40
 182 #define USBVC_MAX_MAP_BUF_NUM 40
 183 
 184 /* According to UVC specs, the frame interval is in 100ns unit */
 185 #define USBVC_FRAME_INTERVAL_DENOMINATOR        10000000
 186 
 187 /* Only D3...D0 are writable, Table 4-6, UVC Spec */
 188 #define USBVC_POWER_MODE_MASK   0xf0;
 189 
 190 enum usbvc_buf_status {
 191         USBVC_BUF_INIT          = 0,  /* Allocated, to be queued */
 192             USBVC_BUF_MAPPED    = 1,  /* For map I/O only. Memory is mapped. */
 193             USBVC_BUF_EMPTY             = 2, /* not initialized, to be filled */
 194 
 195         /*
 196          * buf is filled with a full frame without any errors,
 197          * it will be moved to full list.




  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_USB_USBVC_VAR_H
  27 #define _SYS_USB_USBVC_VAR_H
  28 
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 #include <sys/list.h>
  35 #include <sys/sysmacros.h>
  36 #include <sys/usb/usba/usbai_private.h>
  37 #include <sys/videodev2.h>
  38 #include <sys/usb/clients/video/usbvc/usbvc.h>
  39 
  40 typedef struct usbvc_state usbvc_state_t;
  41 
  42 /*
  43  * Power Management support
  44  */
  45 typedef struct usbvc_power  {
  46 
  47         void            *usbvc_state;   /* points back to usbvc_state */
  48         uint8_t         usbvc_pwr_states; /* bit mask of device pwr states */
  49         int             usbvc_pm_busy;
  50 
  51         /* Wakeup and power transistion capabilites of an interface */
  52         uint8_t         usbvc_pm_capabilities;
  53 
  54         /* flag to indicate if driver is about to raise power level */
  55         boolean_t       usbvc_raise_power;


 157 
 158 /* For serialization. */
 159 #define USBVC_SER_NOSIG B_FALSE
 160 #define USBVC_SER_SIG           B_TRUE
 161 
 162 /*
 163  * Masks for debug printing
 164  */
 165 #define PRINT_MASK_ATTA         0x00000001
 166 #define PRINT_MASK_OPEN         0x00000002
 167 #define PRINT_MASK_CLOSE        0x00000004
 168 #define PRINT_MASK_READ         0x00000008
 169 #define PRINT_MASK_IOCTL        0x00000010
 170 #define PRINT_MASK_PM   0x00000020
 171 #define PRINT_MASK_CB   0x00000040
 172 #define PRINT_MASK_HOTPLUG      0x00000080
 173 #define PRINT_MASK_DEVCTRL      0x00000100
 174 #define PRINT_MASK_DEVMAP       0x00000200
 175 #define PRINT_MASK_ALL          0xFFFFFFFF
 176 


 177 #define USBVC_MAX_PKTS 40
 178 
 179 #define USBVC_DEFAULT_READ_BUF_NUM 3
 180 #define USBVC_MAX_READ_BUF_NUM 40
 181 #define USBVC_MAX_MAP_BUF_NUM 40
 182 
 183 /* According to UVC specs, the frame interval is in 100ns unit */
 184 #define USBVC_FRAME_INTERVAL_DENOMINATOR        10000000
 185 
 186 /* Only D3...D0 are writable, Table 4-6, UVC Spec */
 187 #define USBVC_POWER_MODE_MASK   0xf0;
 188 
 189 enum usbvc_buf_status {
 190         USBVC_BUF_INIT          = 0,  /* Allocated, to be queued */
 191             USBVC_BUF_MAPPED    = 1,  /* For map I/O only. Memory is mapped. */
 192             USBVC_BUF_EMPTY             = 2, /* not initialized, to be filled */
 193 
 194         /*
 195          * buf is filled with a full frame without any errors,
 196          * it will be moved to full list.