Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8139/defs.h

    r5cd3d67 r321052f7  
    2929/** @file rtl8139_defs.h
    3030 *
    31  * Registers, bit positions and masks definition
    32  * of the RTL8139 network family cards
    33  */
    34 
    35 #ifndef RTL8139_DEFS_H_
    36 #define RTL8139_DEFS_H_
    37 
     31 *  Registers, bit positions and masks definition of the RTL8139 network family
     32 *  cards
     33 */
     34
     35#ifndef RTL8139_DEFS_H_INCLUDED_
     36#define RTL8139_DEFS_H_INCLUDED_
    3837#include <sys/types.h>
    3938#include <libarch/ddi.h>
    4039
    41 /** Size of RTL8139 registers address space */
    42 #define RTL8139_IO_SIZE  256
    43 
    44 /** Maximal transmitted frame length
    45  *
    46  * Maximal transmitted frame length in bytes
    47  * allowed according to the RTL8139 documentation
    48  * (see SIZE part of TSD documentation).
    49  *
    50  */
    51 #define RTL8139_FRAME_MAX_LENGTH  1792
     40
     41/** The size of RTL8139 registers address space */
     42#define RTL8139_IO_SIZE 256
     43
     44/** The maximal transmitted frame length in bytes allowed according to RTL8139
     45 *  documentation (see SIZE part of TSD documentation)
     46 */
     47#define RTL8139_FRAME_MAX_LENGTH 1792
     48
    5249
    5350/** HW version
    5451 *
    55  * As can be detected from HWVERID part of TCR
    56  * (Transmit Configuration Register).
    57  *
    58  */
    59 typedef enum {
     52 *  as can be detected from HWVERID part of TCR
     53 *  (Transmit Configuration Register)
     54 */
     55enum rtl8139_version_id {
    6056        RTL8139 = 0,          /**< RTL8139 */
    6157        RTL8139A,             /**< RTL8139A */
     
    7066        RTL8101,              /**< RTL8101 */
    7167        RTL8139_VER_COUNT     /**< Count of known RTL versions, the last value */
    72 } rtl8139_version_id_t;
     68};
     69
     70extern const char* model_names[RTL8139_VER_COUNT];
    7371
    7472/** Registers of RTL8139 family card offsets from the memory address base */
     
    7775        MAC0  = IDR0,    /**< Alias for IDR0 */
    7876
    79         // 0x06 - 0x07 reserved
     77        // 0x6 - 0x7 reserved
    8078
    8179        MAR0    = 0x08,  /**< Multicast mask registers 8 1b registers sequence */
     
    215213        pio_write_8(io_base + CR9346, RTL8139_REGS_LOCKED);
    216214}
    217 
    218215/** Allow to change Config0-4 and BMCR register  */
    219216static inline void rtl8139_regs_unlock(void *io_base)
     
    420417
    421418/** Maximal runt frame size + 1 */
    422 #define RTL8139_RUNT_MAX_SIZE  64
     419#define RTL8139_RUNT_MAX_SIZE 64
    423420
    424421/** Bits in frame header */
     
    473470
    474471/** Mapping of HW version -> version ID */
    475 struct rtl8139_hwver_map {
    476         uint32_t hwverid;             /**< HW version value in the register */
    477         rtl8139_version_id_t ver_id;  /**< appropriate version id */
     472struct rtl8139_hwver_map { 
     473        uint32_t hwverid;                /**< HW version value in the register */
     474        enum rtl8139_version_id ver_id;  /**< appropriate version id */
    478475};
    479476
    480477/** Mapping of HW version -> version ID */
    481478extern const struct rtl8139_hwver_map rtl8139_versions[RTL8139_VER_COUNT + 1];
    482 extern const char* model_names[RTL8139_VER_COUNT];
    483479
    484480/** Size in the frame header while copying from RxFIFO to Rx buffer */
    485 #define RTL8139_EARLY_SIZE  UINT16_C(0xfff0)
    486 
     481#define RTL8139_EARLY_SIZE UINT16_C(0xfff0)
    487482/** The only supported pause frame time value */
    488 #define RTL8139_PAUSE_VAL  UINT16_C(0xFFFF)
     483#define RTL8139_PAUSE_VAL UINT16_C(0xFFFF)
    489484
    490485/** Size of the frame header in front of the received frame */
    491 #define RTL_FRAME_HEADER_SIZE  4
     486#define RTL_FRAME_HEADER_SIZE 4
    492487
    493488/** 8k buffer */
Note: See TracChangeset for help on using the changeset viewer.