Print this page
3373 gcc >= 4.5 concerns about offsetof()


  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_ECPPVAR_H
  28 #define _SYS_ECPPVAR_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include <sys/note.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 struct ecppunit;
  39 
  40 /*
  41  * Hardware-abstraction structure
  42  */
  43 struct ecpp_hw {
  44         int     (*map_regs)(struct ecppunit *);         /* map registers */
  45         void    (*unmap_regs)(struct ecppunit *);       /* unmap registers */
  46         int     (*config_chip)(struct ecppunit *);      /* configure SuperIO */
  47         void    (*config_mode)(struct ecppunit *);      /* config new mode */
  48         void    (*mask_intr)(struct ecppunit *);        /* mask interrupts */
  49         void    (*unmask_intr)(struct ecppunit *);      /* unmask interrupts */
  50         int     (*dma_start)(struct ecppunit *);        /* start DMA transfer */
  51         int     (*dma_stop)(struct ecppunit *, size_t *); /* stop DMA xfer */


 496 #define GET_DMAC_BCR(pp)        ddi_get32(pp->uh.ebus.d_handle, \
 497                                 ((uint32_t *)&pp->uh.ebus.dmac->bcr))
 498 
 499 #define DMAC_RESET_TIMEOUT      10000   /* in usec */
 500 
 501 /*
 502  * Macros to distinguish between PIO and DMA Compatibility mode
 503  */
 504 #define COMPAT_PIO(pp) (((pp)->io_mode == ECPP_PIO) &&               \
 505                     ((pp)->current_mode == ECPP_CENTRONICS ||        \
 506                     (pp)->current_mode == ECPP_COMPAT_MODE))
 507 
 508 #define COMPAT_DMA(pp) (((pp)->io_mode == ECPP_DMA) &&               \
 509                     ((pp)->current_mode == ECPP_CENTRONICS ||        \
 510                     (pp)->current_mode == ECPP_COMPAT_MODE))
 511 
 512 /*
 513  * Other useful macros
 514  */
 515 #define NELEM(a)        (sizeof (a) / sizeof (*(a)))



 516 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))

 517 
 518 #ifdef  __cplusplus
 519 }
 520 #endif
 521 
 522 #endif  /* _SYS_ECPPVAR_H */


  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_ECPPVAR_H
  28 #define _SYS_ECPPVAR_H
  29 


  30 #include <sys/note.h>
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 struct ecppunit;
  37 
  38 /*
  39  * Hardware-abstraction structure
  40  */
  41 struct ecpp_hw {
  42         int     (*map_regs)(struct ecppunit *);         /* map registers */
  43         void    (*unmap_regs)(struct ecppunit *);       /* unmap registers */
  44         int     (*config_chip)(struct ecppunit *);      /* configure SuperIO */
  45         void    (*config_mode)(struct ecppunit *);      /* config new mode */
  46         void    (*mask_intr)(struct ecppunit *);        /* mask interrupts */
  47         void    (*unmask_intr)(struct ecppunit *);      /* unmask interrupts */
  48         int     (*dma_start)(struct ecppunit *);        /* start DMA transfer */
  49         int     (*dma_stop)(struct ecppunit *, size_t *); /* stop DMA xfer */


 494 #define GET_DMAC_BCR(pp)        ddi_get32(pp->uh.ebus.d_handle, \
 495                                 ((uint32_t *)&pp->uh.ebus.dmac->bcr))
 496 
 497 #define DMAC_RESET_TIMEOUT      10000   /* in usec */
 498 
 499 /*
 500  * Macros to distinguish between PIO and DMA Compatibility mode
 501  */
 502 #define COMPAT_PIO(pp) (((pp)->io_mode == ECPP_PIO) &&               \
 503                     ((pp)->current_mode == ECPP_CENTRONICS ||        \
 504                     (pp)->current_mode == ECPP_COMPAT_MODE))
 505 
 506 #define COMPAT_DMA(pp) (((pp)->io_mode == ECPP_DMA) &&               \
 507                     ((pp)->current_mode == ECPP_CENTRONICS ||        \
 508                     (pp)->current_mode == ECPP_COMPAT_MODE))
 509 
 510 /*
 511  * Other useful macros
 512  */
 513 #define NELEM(a)        (sizeof (a) / sizeof (*(a)))
 514 #if defined(__GNUC__)
 515 #define offsetof(s, m)  __builtin_offsetof(s, m)
 516 #else
 517 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
 518 #endif
 519 
 520 #ifdef  __cplusplus
 521 }
 522 #endif
 523 
 524 #endif  /* _SYS_ECPPVAR_H */