Changeset 74864ac in mainline


Ignore:
Timestamp:
2011-01-06T15:28:51Z (13 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

Location:
uspace/srv/hw/netif/dp8390
Files:
5 edited

Legend:

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

    rfc23ef6 r74864ac  
    4646#define CR_EXTRA  CR_STA
    4747
    48 _PROTOTYPE(static void dp_init, (dpeth_t *dep)                          );
    49 _PROTOTYPE(static void dp_reinit, (dpeth_t *dep)                        );
    50 _PROTOTYPE(static void dp_reset, (dpeth_t *dep)                 );
    51 _PROTOTYPE(static void dp_recv, (dpeth_t *dep)                          );
    52 _PROTOTYPE(static void dp_send, (dpeth_t *dep)                          );
    53 _PROTOTYPE(static void dp_pio8_getblock, (dpeth_t *dep, int page,
    54                                 size_t offset, size_t size, void *dst)  );
    55 _PROTOTYPE(static void dp_pio16_getblock, (dpeth_t *dep, int page,
    56                                 size_t offset, size_t size, void *dst)  );
    57 _PROTOTYPE(static int dp_pkt2user, (dpeth_t *dep, int page,
    58                                                         int length) );
    59 _PROTOTYPE(static void dp_pio8_user2nic, (dpeth_t *dep,
    60                                 iovec_dat_t *iovp, vir_bytes offset,
    61                                 int nic_addr, vir_bytes count) );
    62 _PROTOTYPE(static void dp_pio16_user2nic, (dpeth_t *dep,
    63                                 iovec_dat_t *iovp, vir_bytes offset,
    64                                 int nic_addr, vir_bytes count) );
    65 _PROTOTYPE(static void dp_pio8_nic2user, (dpeth_t *dep, int nic_addr,
    66                 iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)   );
    67 _PROTOTYPE(static void dp_pio16_nic2user, (dpeth_t *dep, int nic_addr,
    68                 iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)   );
    69 _PROTOTYPE(static void dp_next_iovec, (iovec_dat_t *iovp)               );
    70 _PROTOTYPE(static void conf_hw, (dpeth_t *dep)                          );
    71 _PROTOTYPE(static void reply, (dpeth_t *dep, int err, int may_block)    );
    72 _PROTOTYPE(static void get_userdata, (int user_proc,
    73                 vir_bytes user_addr, vir_bytes count, void *loc_addr)   );
    74 _PROTOTYPE(static void insb, (port_t port, void *buf, size_t size)                              );
    75 _PROTOTYPE(static void insw, (port_t port, void *buf, size_t size)                              );
     48static void dp_init(dpeth_t *dep);
     49static void dp_reinit(dpeth_t *dep);
     50static void dp_reset(dpeth_t *dep);
     51static void dp_recv(dpeth_t *dep);
     52static void dp_send(dpeth_t *dep);
     53static void dp_pio8_getblock(dpeth_t *dep, int page, size_t offset, size_t size, void *dst);
     54static void dp_pio16_getblock(dpeth_t *dep, int page, size_t offset, size_t size, void *dst);
     55static int dp_pkt2user(dpeth_t *dep, int page, int length);
     56static void dp_pio8_user2nic(dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count);
     57static void dp_pio16_user2nic(dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count);
     58static void dp_pio8_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count);
     59static void dp_pio16_nic2user(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count);
     60static void dp_next_iovec(iovec_dat_t *iovp);
     61static void conf_hw(dpeth_t *dep);
     62static void reply(dpeth_t *dep, int err, int may_block);
     63static void get_userdata(int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr);
     64static void insb(port_t port, void *buf, size_t size);
     65static void insw(port_t port, void *buf, size_t size);
    7666
    7767int do_probe(dpeth_t *dep)
     
    226216        count = mp->DL_COUNT;
    227217        if (port < 0 || port >= DE_PORT_NR)
    228                 panic("", "dp8390: illegal port", port);
     218                fprintf(stderr, "dp8390: illegal port\n");
    229219        dep= &de_table[port];
    230220        dep->de_client= mp->DL_PROC;
     
    233223                assert(!from_int);
    234224//              dep->de_flags |= DEF_PACK_SEND;
    235                 reply(dep, EOK, FALSE);
     225                reply(dep, EOK, false);
    236226//              return;
    237227                return EOK;
     
    243233        if ((dep->packet_queue) && (!from_int)) {
    244234//      if (dep->de_flags &DEF_SEND_AVAIL){
    245 //              panic("", "dp8390: send already in progress", NO_NUM);
     235//              fprintf(stderr, "dp8390: send already in progress\n");
    246236                return queue_packet(dep, packet);
    247237        }
     
    250240//      if (dep->de_sendq[sendq_head].sq_filled) {
    251241//              if (from_int)
    252 //                      panic("", "dp8390: should not be sending\n", NO_NUM);
     242//                      fprintf(stderr, "dp8390: should not be sending\n");
    253243//              dep->de_sendmsg= *mp;
    254244//              dep->de_flags |= DEF_SEND_AVAIL;
    255 //              reply(dep, EOK, FALSE);
     245//              reply(dep, EOK, false);
    256246//              return;
    257247//              return queue_packet(dep, packet);
     
    287277       
    288278        if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) {
    289                 panic("", "dp8390: invalid packet size", size);
     279                fprintf(stderr, "dp8390: invalid packet size\n");
    290280                return EINVAL;
    291281        }
     
    294284            dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
    295285            size);
    296         dep->de_sendq[sendq_head].sq_filled= TRUE;
     286        dep->de_sendq[sendq_head].sq_filled= true;
    297287        if (dep->de_sendq_tail == sendq_head) {
    298288                outb_reg0(dep, DP_TPSR, dep->de_sendq[sendq_head].sq_sendpage);
     
    318308                return EOK;
    319309       
    320         reply(dep, EOK, FALSE);
     310        reply(dep, EOK, false);
    321311       
    322312        assert(dep->de_mode == DEM_ENABLED);
     
    499489
    500490        if (!(dep->de_flags &DEF_ENABLED))
    501                 panic("", "dp8390: got premature interrupt", NO_NUM);
     491                fprintf(stderr, "dp8390: got premature interrupt\n");
    502492
    503493        for(;;)
     
    645635        vir_bytes length;
    646636        int packet_processed, r;
    647         u16_t eth_type;
    648 
    649         packet_processed = FALSE;
     637        uint16_t eth_type;
     638
     639        packet_processed = false;
    650640        pageno = inb_reg0(dep, DP_BNRY) + 1;
    651641        if (pageno == dep->de_stoppage) pageno = dep->de_startpage;
     
    714704                                return;
    715705
    716                         packet_processed = TRUE;
     706                        packet_processed = true;
    717707                        dep->de_stat.ets_packetR++;
    718708                }
     
    741731                packet = dep->packet_queue;
    742732                dep->packet_queue = pq_detach(packet);
    743                 do_pwrite(dep, packet, TRUE);
     733                do_pwrite(dep, packet, true);
    744734                netif_pq_release(packet_get_id(packet));
    745735                -- dep->packet_count;
     
    750740/*      switch(dep->de_sendmsg.m_type)
    751741        {
    752         case DL_WRITE:  do_vwrite(&dep->de_sendmsg, TRUE, FALSE);       break;
    753         case DL_WRITEV: do_vwrite(&dep->de_sendmsg, TRUE, TRUE);        break;
    754         case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE);  break;
     742        case DL_WRITE:  do_vwrite(&dep->de_sendmsg, true, false);       break;
     743        case DL_WRITEV: do_vwrite(&dep->de_sendmsg, true, true);        break;
     744        case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, true);  break;
    755745        default:
    756                 panic("", "dp8390: wrong type", dep->de_sendmsg.m_type);
     746                fprintf(stderr, "dp8390: wrong type\n");
    757747                break;
    758748        }
     
    914904        }
    915905        if (i == 100)
    916         {
    917                 panic("", "dp8390: remote dma failed to complete", NO_NUM);
    918         }
     906                fprintf(stderr, "dp8390: remote dma failed to complete\n");
    919907}
    920908
     
    933921        int i, r, user_proc;
    934922        vir_bytes bytes;
    935         //u8_t two_bytes[2];
    936         u16_t two_bytes;
     923        //uint8_t two_bytes[2];
     924        uint16_t two_bytes;
    937925        int odd_byte;
    938926
     
    973961                        r= sys_vircopy(user_proc, D, vir_user,
    974962                        //      SELF, D, (vir_bytes)&two_bytes[1], 1);
    975                                 SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[1]), 1);
     963                                SELF, D, (vir_bytes)&(((uint8_t *)&two_bytes)[1]), 1);
    976964                        if (r != EOK)
    977                         {
    978                                 panic("DP8390",
    979                                         "dp_pio16_user2nic: sys_vircopy failed",
    980                                         r);
    981                         }
    982                         //outw(dep->de_data_port, *(u16_t *)two_bytes);
     965                                fprintf(stderr, "DP8390: dp_pio16_user2nic: sys_vircopy failed\n");
     966                       
     967                        //outw(dep->de_data_port, *(uint16_t *)two_bytes);
    983968                        outw(dep->de_data_port, two_bytes);
    984969                        count--;
     
    1005990                        r= sys_vircopy(user_proc, D, vir_user,
    1006991                        //      SELF, D, (vir_bytes)&two_bytes[0], 1);
    1007                                 SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[0]), 1);
     992                                SELF, D, (vir_bytes)&(((uint8_t *)&two_bytes)[0]), 1);
    1008993                        if (r != EOK)
    1009                         {
    1010                                 panic("DP8390",
    1011                                         "dp_pio16_user2nic: sys_vircopy failed",
    1012                                         r);
    1013                         }
     994                                fprintf(stderr, "DP8390: dp_pio16_user2nic: sys_vircopy failed\n");
     995                       
    1014996                        count--;
    1015997                        offset++;
     
    10221004
    10231005        if (odd_byte)
    1024                 //outw(dep->de_data_port, *(u16_t *)two_bytes);
     1006                //outw(dep->de_data_port, *(uint16_t *)two_bytes);
    10251007                outw(dep->de_data_port, two_bytes);
    10261008
     
    10311013        }
    10321014        if (i == 100)
    1033         {
    1034                 panic("", "dp8390: remote dma failed to complete", NO_NUM);
    1035         }
     1015                fprintf(stderr, "dp8390: remote dma failed to complete\n");
    10361016}
    10371017
     
    10981078        int i, r, user_proc;
    10991079        vir_bytes bytes;
    1100         //u8_t two_bytes[2];
    1101         u16_t two_bytes;
     1080        //uint8_t two_bytes[2];
     1081        uint16_t two_bytes;
    11021082        int odd_byte;
    11031083
     
    11361116                {
    11371117                        //r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1],
    1138                         r= sys_vircopy(SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[1]),
     1118                        r= sys_vircopy(SELF, D, (vir_bytes)&(((uint8_t *)&two_bytes)[1]),
    11391119                                user_proc, D, vir_user,  1);
    11401120                        if (r != EOK)
    1141                         {
    1142                                 panic("DP8390",
    1143                                         "dp_pio16_nic2user: sys_vircopy failed",
    1144                                         r);
    1145                         }
     1121                                fprintf(stderr, "DP8390: dp_pio16_nic2user: sys_vircopy failed\n");
     1122                       
    11461123                        count--;
    11471124                        offset++;
     
    11651142                {
    11661143                        assert(bytes == 1);
    1167                         //*(u16_t *)two_bytes= inw(dep->de_data_port);
     1144                        //*(uint16_t *)two_bytes= inw(dep->de_data_port);
    11681145                        two_bytes= inw(dep->de_data_port);
    11691146                        //r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0],
    1170                         r= sys_vircopy(SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[0]),
     1147                        r= sys_vircopy(SELF, D, (vir_bytes)&(((uint8_t *)&two_bytes)[0]),
    11711148                                user_proc, D, vir_user,  1);
    11721149                        if (r != EOK)
    1173                         {
    1174                                 panic("DP8390",
    1175                                         "dp_pio16_nic2user: sys_vircopy failed",
    1176                                         r);
    1177                         }
     1150                                fprintf(stderr, "DP8390: dp_pio16_nic2user: sys_vircopy failed\n");
     1151                       
    11781152                        count--;
    11791153                        offset++;
     
    12711245
    12721246        if (r < 0)
    1273                 panic("", "dp8390: send failed:", r);
     1247                fprintf(stderr, "dp8390: send failed\n");
    12741248       
    12751249*/      dep->de_read_s = 0;
     
    12911265                SELF, D, (vir_bytes)loc_addr, count);
    12921266        if (r != EOK)
    1293                 panic("DP8390", "get_userdata: sys_vircopy failed", r);
     1267                fprintf(stderr, "DP8390: get_userdata: sys_vircopy failed\n");
    12941268}
    12951269
  • 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
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    rfc23ef6 r74864ac  
    261261        do{
    262262                next = pq_detach(packet);
    263                 if(do_pwrite(dep, packet, FALSE) != EBUSY){
     263                if(do_pwrite(dep, packet, false) != EBUSY){
    264264                        netif_pq_release(packet_get_id(packet));
    265265                }
  • uspace/srv/hw/netif/dp8390/dp8390_port.h

    rfc23ef6 r74864ac  
    4444#include <sys/types.h>
    4545
    46 /** Macro for difining functions.
    47  *  @param[in] function The function type and name definition.
    48  *  @param[in] params The function parameters definition.
    49  */
    50 #define _PROTOTYPE(function, params) function params
    51 
    52 /** Type definition of the unsigned byte.
    53  */
    54 typedef uint8_t u8_t;
    55 
    56 /** Type definition of the unsigned short.
    57  */
    58 typedef uint16_t u16_t;
    59 
    6046/** Compares two memory blocks.
    6147 *  @param[in] first The first memory block.
     
    6652 *  @returns 1 if the second is greater than the first.
    6753 */
    68 #define memcmp(first, second, size)     bcmp((char *) (first), (char *) (second), (size))
     54#define memcmp(first, second, size)  bcmp((char *) (first), (char *) (second), (size))
    6955
    7056/** Reads 1 byte.
     
    7258 *  @returns The read value.
    7359 */
    74 #define inb(port)       pio_read_8((ioport8_t *) (port))
     60#define inb(port)  pio_read_8((ioport8_t *) (port))
    7561
    7662/** Reads 1 word (2 bytes).
     
    7864 *  @returns The read value.
    7965 */
    80 #define inw(port)       pio_read_16((ioport16_t *) (port))
     66#define inw(port)  pio_read_16((ioport16_t *) (port))
    8167
    8268/** Writes 1 byte.
     
    8470 *  @param[in] value The value to be written.
    8571 */
    86 #define outb(port, value)       pio_write_8((ioport8_t *) (port), (value))
     72#define outb(port, value)  pio_write_8((ioport8_t *) (port), (value))
    8773
    8874/** Writes 1 word (2 bytes).
     
    9076 *  @param[in] value The value to be written.
    9177 */
    92 #define outw(port, value)       pio_write_16((ioport16_t *) (port), (value))
    93 
    94 /** Prints out the driver critical error.
    95  *  Does not call the system panic().
    96  */
    97 #define panic(...)      printf("%s%s%d", __VA_ARGS__)
     78#define outw(port, value)  pio_write_16((ioport16_t *) (port), (value))
    9879
    9980/** Copies a memory block.
     
    141122#define do_vir_outsw(port, proc, src, bytes)    outsw((port), (void *)(src), (bytes))
    142123
    143 /* com.h */
    144124/* Bits in 'DL_MODE' field of DL requests. */
    145 #  define DL_NOMODE             0x0
    146 #  define DL_PROMISC_REQ        0x2
    147 #  define DL_MULTI_REQ          0x4
    148 #  define DL_BROAD_REQ          0x8
    149 
    150 /* const.h */
    151 /** True value.
    152  */
    153 #define TRUE               1    /* used for turning integers into Booleans */
    154 
    155 /** False value.
    156  */
    157 #define FALSE              0    /* used for turning integers into Booleans */
    158 
    159 /** No number value.
    160  */
    161 #define NO_NUM        0x8000    /* used as numerical argument to panic() */
    162 
    163 /* devio.h */
    164 //typedef u16_t port_t;
     125#define DL_NOMODE       0x0
     126#define DL_PROMISC_REQ  0x2
     127#define DL_MULTI_REQ    0x4
     128#define DL_BROAD_REQ    0x8
     129
    165130/** Type definition of a port.
    166131 */
    167132typedef long port_t;
    168133
    169 /* dl_eth.h */
    170134/** Ethernet statistics.
    171135 */
    172 typedef struct eth_stat
    173 {
     136typedef struct eth_stat {
    174137        /** Number of receive errors.
    175138         */
     
    242205        /** Address data.
    243206         */
    244         u8_t ea_addr[6];
     207        uint8_t ea_addr[6];
    245208} ether_addr_t;
    246209
  • uspace/srv/hw/netif/dp8390/ne2000.c

    rfc23ef6 r74864ac  
    1616#define N  100
    1717
    18 typedef int (*testf_t)(dpeth_t *dep, int pos, u8_t *pat);
     18typedef int (*testf_t)(dpeth_t *dep, int pos, uint8_t *pat);
    1919
    2020/** Data patterns */
    21 u8_t pat0[] = {0x00, 0x00, 0x00, 0x00};
    22 u8_t pat1[] = {0xFF, 0xFF, 0xFF, 0xFF};
    23 u8_t pat2[] = {0xA5, 0x5A, 0x69, 0x96};
    24 u8_t pat3[] = {0x96, 0x69, 0x5A, 0xA5};
     21uint8_t pat0[] = {0x00, 0x00, 0x00, 0x00};
     22uint8_t pat1[] = {0xFF, 0xFF, 0xFF, 0xFF};
     23uint8_t pat2[] = {0xA5, 0x5A, 0x69, 0x96};
     24uint8_t pat3[] = {0x96, 0x69, 0x5A, 0xA5};
    2525
    2626/** Tests 8 bit NE2000 network interface.
     
    2929 *  @param[in] pat The data pattern to be written.
    3030 *  @returns True on success.
    31  *  @returns FALSE otherwise.
    32  */
    33 static int test_8(dpeth_t *dep, int pos, u8_t *pat);
     31 *  @returns false otherwise.
     32 */
     33static int test_8(dpeth_t *dep, int pos, uint8_t *pat);
    3434
    3535/** Tests 16 bit NE2000 network interface.
     
    3838 *  @param[in] pat The data pattern to be written.
    3939 *  @returns True on success.
    40  *  @returns FALSE otherwise.
    41  */
    42 static int test_16(dpeth_t *dep, int pos, u8_t *pat);
     40 *  @returns false otherwise.
     41 */
     42static int test_16(dpeth_t *dep, int pos, uint8_t *pat);
    4343
    4444/** Stops the NE2000 network interface.
     
    178178}
    179179
    180 static int test_8(dpeth_t *dep, int pos, u8_t *pat)
    181 {
    182         u8_t buf[4];
     180static int test_8(dpeth_t *dep, int pos, uint8_t *pat)
     181{
     182        uint8_t buf[4];
    183183        int i;
    184184       
     
    217217}
    218218
    219 static int test_16(dpeth_t *dep, int pos, u8_t *pat)
    220 {
    221         u8_t buf[4];
     219static int test_16(dpeth_t *dep, int pos, uint8_t *pat)
     220{
     221        uint8_t buf[4];
    222222        int i;
    223223       
     
    232232       
    233233        for (i = 0; i < 4; i += 2)
    234                 outw_ne(dep, NE_DATA, *(u16_t *)(pat + i));
     234                outw_ne(dep, NE_DATA, *(uint16_t *)(pat + i));
    235235       
    236236        for (i = 0; i < N; i++) {
     
    251251       
    252252        for (i = 0; i < 4; i += 2)
    253                 *(u16_t *)(buf + i) = inw_ne(dep, NE_DATA);
     253                *(uint16_t *)(buf + i) = inw_ne(dep, NE_DATA);
    254254       
    255255        return (memcmp(buf, pat, 4) == 0);
Note: See TracChangeset for help on using the changeset viewer.