Changeset 74864ac in mainline for uspace/srv/hw/netif/dp8390/dp8390.h


Ignore:
Timestamp:
2011-01-06T15:28:51Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0777f4c5
Parents:
fc23ef6
Message:

cstyle & clutter removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/dp8390.h

    rfc23ef6 r74864ac  
    1111
    1212#include <net/packet.h>
    13 
    1413#include "dp8390_port.h"
    1514
    16 /** Input/output size.
    17  */
    18 #define DP8390_IO_SIZE  0x020
     15/** Input/output size */
     16#define DP8390_IO_SIZE  0x0020
    1917
    2018/* National Semiconductor DP8390 Network Interface Controller. */
     
    166164#define RSR_DFR         0x80    /* In later manuals: Deferring       */
    167165
    168 /** Type definition of the receive header.
    169  */
    170 typedef struct dp_rcvhdr
    171 {
    172         /** Copy of rsr.
    173          */
    174         u8_t dr_status;
    175         /** Pointer to next packet.
    176          */
    177         u8_t dr_next;
    178         /** Receive Byte Count Low.
    179          */
    180         u8_t dr_rbcl;
    181         /** Receive Byte Count High.
    182          */
    183         u8_t dr_rbch;
     166/** Type definition of the receive header
     167 *
     168 */
     169typedef struct dp_rcvhdr {
     170        /** Copy of rsr */
     171        uint8_t dr_status;
     172       
     173        /** Pointer to next packet */
     174        uint8_t dr_next;
     175       
     176        /** Receive Byte Count Low */
     177        uint8_t dr_rbcl;
     178       
     179        /** Receive Byte Count High */
     180        uint8_t dr_rbch;
    184181} dp_rcvhdr_t;
    185182
    186 /** Page size.
    187  */
    188 #define DP_PAGESIZE     256
    189 
    190 /* Some macros to simplify accessing the dp8390 */
     183/** Page size */
     184#define DP_PAGESIZE  256
     185
    191186/** Reads 1 byte from the zero page register.
    192187 *  @param[in] dep The network interface structure.
     
    194189 *  @returns The read value.
    195190 */
    196 #define inb_reg0(dep, reg)              (inb(dep->de_dp8390_port+reg))
     191#define inb_reg0(dep, reg)  (inb(dep->de_dp8390_port+reg))
    197192
    198193/** Writes 1 byte zero page register.
     
    201196 *  @param[in] data The value to be written.
    202197 */
    203 #define outb_reg0(dep, reg, data)       (outb(dep->de_dp8390_port+reg, data))
     198#define outb_reg0(dep, reg, data)  (outb(dep->de_dp8390_port+reg, data))
    204199
    205200/** Reads 1 byte from the first page register.
     
    208203 *  @returns The read value.
    209204 */
    210 #define inb_reg1(dep, reg)              (inb(dep->de_dp8390_port+reg))
     205#define inb_reg1(dep, reg)  (inb(dep->de_dp8390_port+reg))
    211206
    212207/** Writes 1 byte first page register.
     
    215210 *  @param[in] data The value to be written.
    216211 */
    217 #define outb_reg1(dep, reg, data)       (outb(dep->de_dp8390_port+reg, data))
     212#define outb_reg1(dep, reg, data)  (outb(dep->de_dp8390_port+reg, data))
    218213
    219214/* Software interface to the dp8390 driver */
     
    222217struct iovec_dat;
    223218
    224 _PROTOTYPE(typedef void (*dp_initf_t), (struct dpeth *dep)              );
    225 _PROTOTYPE(typedef void (*dp_stopf_t), (struct dpeth *dep)              );
    226 _PROTOTYPE(typedef void (*dp_user2nicf_t), (struct dpeth *dep,
    227                         struct iovec_dat *iovp, vir_bytes offset,
    228                         int nic_addr, vir_bytes count) );
    229 _PROTOTYPE(typedef void (*dp_nic2userf_t), (struct dpeth *dep,
    230                         int nic_addr, struct iovec_dat *iovp,
    231                         vir_bytes offset, vir_bytes count) );
    232 _PROTOTYPE(typedef void (*dp_getblock_t), (struct dpeth *dep,
    233                 int page, size_t offset, size_t size, void *dst)        );
     219typedef void (*dp_initf_t)(struct dpeth *dep);
     220typedef void (*dp_stopf_t)(struct dpeth *dep);
     221typedef void (*dp_user2nicf_t)(struct dpeth *dep, struct iovec_dat *iovp, vir_bytes offset, int nic_addr, vir_bytes count);
     222typedef void (*dp_nic2userf_t)(struct dpeth *dep, int nic_addr, struct iovec_dat *iovp, vir_bytes offset, vir_bytes count);
     223typedef void (*dp_getblock_t)(struct dpeth *dep, int page, size_t offset, size_t size, void *dst);
    234224
    235225#define IOVEC_NR  1
    236226
    237 typedef struct iovec_dat
    238 {
     227typedef struct iovec_dat {
    239228  iovec_t iod_iovec[IOVEC_NR];
    240229  int iod_iovec_s;
    241   // no direct process access
    242230  int iod_proc_nr;
    243231  vir_bytes iod_iovec_addr;
    244232} iovec_dat_t;
    245 /*
    246 typedef struct iovec_dat_s
    247 {
    248   iovec_s_t iod_iovec[IOVEC_NR];
    249   int iod_iovec_s;
    250   int iod_proc_nr;
    251   cp_grant_id_t iod_grant;
    252   vir_bytes iod_iovec_offset;
    253 } iovec_dat_s_t;
    254 */
    255 #define SENDQ_NR        1       /* Maximum size of the send queue */
    256 #define SENDQ_PAGES     6       /* 6 * DP_PAGESIZE >= 1514 bytes */
     233
     234#define SENDQ_NR     1  /* Maximum size of the send queue */
     235#define SENDQ_PAGES  6  /* 6 * DP_PAGESIZE >= 1514 bytes */
    257236
    258237/** Maximum number of waiting packets to be sent or received.
     
    260239#define MAX_PACKETS  4
    261240
    262 typedef struct dpeth
    263 {
    264         /** Outgoing packets queue.
    265          */
     241typedef struct dpeth {
     242        /** Outgoing packets queue */
    266243        packet_t *packet_queue;
    267244       
    268         /** Outgoing packets count.
    269          */
     245        /** Outgoing packets count */
    270246        int packet_count;
    271247       
    272         /** Received packets queue.
    273          */
     248        /** Received packets queue */
    274249        packet_t *received_queue;
    275250       
    276         /** Received packets count.
    277          */
     251        /** Received packets count */
    278252        int received_count;
    279 
    280         /* The de_base_port field is the starting point of the probe.
     253       
     254        /*
     255         * The de_base_port field is the starting point of the probe.
    281256         * The conf routine also fills de_linmem and de_irq. If the probe
    282257         * routine knows the irq and/or memory address because they are
     
    293268        char de_name[sizeof("dp8390#n")];
    294269       
    295         /* The initf function fills the following fields. Only cards that do
     270        /*
     271         * The initf function fills the following fields. Only cards that do
    296272         * programmed I/O fill in the de_pata_port field.
    297273         * In addition, the init routine has to fill in the sendq data
     
    309285        /* Do it yourself send queue */
    310286        struct sendq {
    311                 int sq_filled;          /* this buffer contains a packet */
    312                 int sq_size;            /* with this size */
    313                 int sq_sendpage;        /* starting page of the buffer */
     287                int sq_filled;    /* this buffer contains a packet */
     288                int sq_size;      /* with this size */
     289                int sq_sendpage;  /* starting page of the buffer */
    314290        } de_sendq[SENDQ_NR];
    315291       
    316292        int de_sendq_nr;
    317         int de_sendq_head;              /* Enqueue at the head */
    318         int de_sendq_tail;              /* Dequeue at the tail */
     293        int de_sendq_head;  /* Enqueue at the head */
     294        int de_sendq_tail;  /* Dequeue at the tail */
    319295       
    320296        /* Fields for internal use by the dp8390 driver. */
     
    333309} dpeth_t;
    334310
    335 #define DEI_DEFAULT     0x8000
    336 
    337 #define DEF_EMPTY       0x000
    338 #define DEF_PACK_SEND   0x001
    339 #define DEF_PACK_RECV   0x002
    340 #define DEF_SEND_AVAIL  0x004
    341 #define DEF_READING     0x010
    342 #define DEF_PROMISC     0x040
    343 #define DEF_MULTI       0x080
    344 #define DEF_BROAD       0x100
    345 #define DEF_ENABLED     0x200
    346 #define DEF_STOPPED     0x400
    347 
    348 #define DEM_DISABLED    0x0
    349 #define DEM_SINK        0x1
    350 #define DEM_ENABLED     0x2
     311#define DEI_DEFAULT  0x8000
     312
     313#define DEF_EMPTY       0x000
     314#define DEF_PACK_SEND   0x001
     315#define DEF_PACK_RECV   0x002
     316#define DEF_SEND_AVAIL  0x004
     317#define DEF_READING     0x010
     318#define DEF_PROMISC     0x040
     319#define DEF_MULTI       0x080
     320#define DEF_BROAD       0x100
     321#define DEF_ENABLED     0x200
     322#define DEF_STOPPED     0x400
     323
     324#define DEM_DISABLED  0x0
     325#define DEM_SINK      0x1
     326#define DEM_ENABLED   0x2
    351327
    352328#endif
Note: See TracChangeset for help on using the changeset viewer.