Subversion Repositories HelenOS

Rev

Rev 4723 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2009 Lukas Mejdrech
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup dp8390
  30.  *  @{
  31.  */
  32.  
  33. /** @file
  34.  *  \todo
  35.  */
  36.  
  37. #ifndef __NET_NETIF_DP8390_PORT_H__
  38. #define __NET_NETIF_DP8390_PORT_H__
  39.  
  40. #include <errno.h>
  41. #include <mem.h>
  42. #include <stdio.h>
  43. #include <libarch/ddi.h>
  44. #include <sys/types.h>
  45.  
  46. #define _PROTOTYPE( function, params ) function params
  47.  
  48. #define OK  EOK
  49.  
  50. typedef uint8_t u8_t;
  51. typedef uint16_t u16_t;
  52.  
  53. #define memcmp( first, second, size )   bcmp(( char * ) ( first ), ( char * ) ( second ), ( size ))
  54.  
  55. #define inb( port ) pio_read_8(( ioport8_t * ) ( port ))
  56. #define inw( port ) pio_read_16(( ioport16_t * ) ( port ))
  57. #define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value ))
  58. #define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value ))
  59.  
  60. #define panic( ... )    printf( "%s%s%d", __VA_ARGS__ )
  61.  
  62. #define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes )  ({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; })
  63. #define do_vir_insb( port, proc, src, bytes )   insb(( port ), ( void * )( src ), ( bytes ))
  64. #define do_vir_insw( port, proc, src, bytes )   insw(( port ), ( void * )( src ), ( bytes ))
  65. #define do_vir_outsb( port, proc, src, bytes )  outsb(( port ), ( void * )( src ), ( bytes ))
  66. #define do_vir_outsw( port, proc, src, bytes )  outsw(( port ), ( void * )( src ), ( bytes ))
  67.  
  68. /* com.h */
  69. /* Bits in 'DL_MODE' field of DL requests. */
  70. #  define DL_NOMODE     0x0
  71. #  define DL_PROMISC_REQ    0x2
  72. #  define DL_MULTI_REQ      0x4
  73. #  define DL_BROAD_REQ      0x8
  74.  
  75. /* const.h */
  76. #define TRUE               1    /* used for turning integers into Booleans */
  77. #define FALSE              0    /* used for turning integers into Booleans */
  78. #define NO_NUM        0x8000    /* used as numerical argument to panic() */
  79.  
  80. /* devio.h */
  81. //typedef u16_t port_t;
  82. typedef int port_t;
  83.  
  84. /* dl_eth.h */
  85. typedef struct eth_stat
  86. {
  87.   unsigned long ets_recvErr,    /* # receive errors */
  88.     ets_sendErr,        /* # send error */
  89.     ets_OVW,        /* # buffer overwrite warnings */
  90.     ets_CRCerr,     /* # crc errors of read */
  91.     ets_frameAll,       /* # frames not alligned (# bits % 8 != 0) */
  92.     ets_missedP,        /* # packets missed due to slow processing */
  93.     ets_packetR,        /* # packets received */
  94.     ets_packetT,        /* # packets transmitted */
  95.     ets_transDef,       /* # transmission defered (Tx was busy) */
  96.     ets_collision,      /* # collissions */
  97.     ets_transAb,        /* # Tx aborted due to excess collisions */
  98.     ets_carrSense,      /* # carrier sense lost */
  99.     ets_fifoUnder,      /* # FIFO underruns (processor too busy) */
  100.     ets_fifoOver,       /* # FIFO overruns (processor too busy) */
  101.     ets_CDheartbeat,    /* # times unable to transmit collision sig*/
  102.     ets_OWC;        /* # times out of window collision */
  103. } eth_stat_t;
  104.  
  105. /* errno.h */
  106. #define EGENERIC     EINVAL
  107.  
  108. /* ether.h */
  109. #define ETH_MIN_PACK_SIZE         60
  110. #define ETH_MAX_PACK_SIZE_TAGGED    1518
  111.  
  112. typedef struct ether_addr
  113. {
  114.     u8_t ea_addr[6];
  115. } ether_addr_t;
  116.  
  117. /* type.h */
  118. typedef unsigned long phys_bytes;   /* physical addr/length in bytes */
  119. typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
  120.  
  121. typedef struct {
  122.   vir_bytes iov_addr;       /* address of an I/O buffer */
  123.   vir_bytes iov_size;       /* sizeof an I/O buffer */
  124. } iovec_t;
  125.  
  126. #endif
  127.  
  128. /** @}
  129.  */
  130.