Print this page
2976 remove useless offsetof() macros


  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_AC_H
  27 #define _SYS_USB_AC_H
  28 
  29 
  30 
  31 #ifdef __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 #include <sys/sunldi.h>

  36 #include <sys/usb/usba/usbai_private.h>
  37 
  38 
  39 int usb_ac_open(dev_info_t *);
  40 void usb_ac_close(dev_info_t *);
  41 
  42 
  43 /* structure for each unit described by descriptors */
  44 typedef struct usb_ac_unit_list {
  45         uint_t          acu_type;
  46         void            *acu_descriptor;
  47         size_t          acu_descr_length;
  48 } usb_ac_unit_list_t;
  49 
  50 #define USB_AC_ID_NONE                  0
  51 
  52 #define USB_AC_FIND_ONE                 0
  53 #define USB_AC_FIND_ALL                 1
  54 #define USB_AC_MAX_DEPTH                8
  55 


 312 #define USB_AC_STATE_PLUMBED            1
 313 #define USB_AC_STATE_PLUMBED_RESTORING  2
 314 
 315 /* Default pipe states */
 316 #define USB_AC_DEF_CLOSED               0
 317 #define USB_AC_DEF_OPENED               1
 318 
 319 #define USB_AC_BUFFER_SIZE              256     /* descriptor buffer size */
 320 
 321 
 322 /*
 323  * delay before restoring state
 324  */
 325 #define USB_AC_RESTORE_DELAY            drv_usectohz(1000000)
 326 
 327 /* value for acp_driver */
 328 #define USB_AS_PLUMBED  1
 329 #define USB_AH_PLUMBED  2
 330 #define UNKNOWN_PLUMBED 3
 331 
 332 /* other useful macros */
 333 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
 334 
 335 
 336 
 337 
 338 
 339 
 340 #define AF_REGISTERED   0x1
 341 #define AD_SETUP        0x10
 342 
 343 
 344 int usb_audio_attach(usb_ac_state_t *);
 345 /*
 346  * framework gain range
 347  */
 348 #define AUDIO_CTRL_STEREO_VAL(l, r)     (((l) & 0xff) | (((r) & 0xff) << 8))
 349 #define AUDIO_CTRL_STEREO_LEFT(v)       ((uint8_t)((v) & 0xff))
 350 #define AUDIO_CTRL_STEREO_RIGHT(v)      ((uint8_t)(((v) >> 8) & 0xff))
 351 
 352 
 353 #define AF_MAX_GAIN     100
 354 #define AF_MIN_GAIN     0
 355 
 356 
 357 
 358 int usb_ac_get_audio(void *, void *, int);
 359 


  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_AC_H
  27 #define _SYS_USB_AC_H
  28 
  29 
  30 
  31 #ifdef __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 #include <sys/sunldi.h>
  36 #include <sys/sysmacros.h>
  37 #include <sys/usb/usba/usbai_private.h>
  38 
  39 
  40 int usb_ac_open(dev_info_t *);
  41 void usb_ac_close(dev_info_t *);
  42 
  43 
  44 /* structure for each unit described by descriptors */
  45 typedef struct usb_ac_unit_list {
  46         uint_t          acu_type;
  47         void            *acu_descriptor;
  48         size_t          acu_descr_length;
  49 } usb_ac_unit_list_t;
  50 
  51 #define USB_AC_ID_NONE                  0
  52 
  53 #define USB_AC_FIND_ONE                 0
  54 #define USB_AC_FIND_ALL                 1
  55 #define USB_AC_MAX_DEPTH                8
  56 


 313 #define USB_AC_STATE_PLUMBED            1
 314 #define USB_AC_STATE_PLUMBED_RESTORING  2
 315 
 316 /* Default pipe states */
 317 #define USB_AC_DEF_CLOSED               0
 318 #define USB_AC_DEF_OPENED               1
 319 
 320 #define USB_AC_BUFFER_SIZE              256     /* descriptor buffer size */
 321 
 322 
 323 /*
 324  * delay before restoring state
 325  */
 326 #define USB_AC_RESTORE_DELAY            drv_usectohz(1000000)
 327 
 328 /* value for acp_driver */
 329 #define USB_AS_PLUMBED  1
 330 #define USB_AH_PLUMBED  2
 331 #define UNKNOWN_PLUMBED 3
 332 








 333 #define AF_REGISTERED   0x1
 334 #define AD_SETUP        0x10
 335 
 336 
 337 int usb_audio_attach(usb_ac_state_t *);
 338 /*
 339  * framework gain range
 340  */
 341 #define AUDIO_CTRL_STEREO_VAL(l, r)     (((l) & 0xff) | (((r) & 0xff) << 8))
 342 #define AUDIO_CTRL_STEREO_LEFT(v)       ((uint8_t)((v) & 0xff))
 343 #define AUDIO_CTRL_STEREO_RIGHT(v)      ((uint8_t)(((v) >> 8) & 0xff))
 344 
 345 
 346 #define AF_MAX_GAIN     100
 347 #define AF_MIN_GAIN     0
 348 
 349 
 350 
 351 int usb_ac_get_audio(void *, void *, int);
 352