Print this page
2976 remove useless offsetof() macros


  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 */
  50         size_t  (*dma_getcnt)(struct ecppunit *);       /* get DMA counter */


 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 */


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


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

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