⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 horizon.h

📁 讲述linux的初始化过程
💻 H
📖 第 1 页 / 共 2 页
字号:
#define RX_CHANNEL_MASK                       0x03FF// UNUSED                                     0x3C00#define FLUSH_CHANNEL                         0x4000#define RX_CHANNEL_UPDATE_IN_PROGRESS         0x8000/* Receive queue entry */#define RX_Q_ENTRY_LENGTH_MASK            0x0000FFFF#define RX_Q_ENTRY_CHANNEL_SHIFT          16#define SIMONS_DODGEY_MARKER              0x08000000#define RX_CONGESTION_EXPERIENCED         0x10000000#define RX_CRC_10_OK                      0x20000000#define RX_CRC_32_OK                      0x40000000#define RX_COMPLETE_FRAME                 0x80000000/*  Offsets and constants for use with the buffer memory         *//* Buffer pointers and channel types */#define BUFFER_PTR_MASK                   0x0000FFFF#define RX_INT_THRESHOLD_MULT             0x00010000#define RX_INT_THRESHOLD_MASK             0x07FF#define INT_EVERY_N_CELLS                 0x08000000#define CONGESTION_EXPERIENCED            0x10000000#define FIRST_CELL_OF_AAL5_FRAME          0x20000000#define CHANNEL_TYPE_AAL5                 0x00000000#define CHANNEL_TYPE_RAW_CELLS            0x40000000#define CHANNEL_TYPE_AAL3_4               0x80000000/* Buffer status stuff */#define BUFF_STATUS_MASK                  0x00030000#define BUFF_STATUS_EMPTY                 0x00000000#define BUFF_STATUS_CELL_AV               0x00010000#define BUFF_STATUS_LAST_CELL_AV          0x00020000/* Transmit channel stuff *//* Receive channel stuff */#define RX_CHANNEL_DISABLED               0x00000000#define RX_CHANNEL_IDLE                   0x00000001/*  General things */#define INITIAL_CRC                       0xFFFFFFFF// A Horizon u32, a byte! Really nasty. Horizon pointers are (32 bit)// word addresses and so standard C pointer operations break (as they// assume byte addresses); so we pretend that Horizon words (and word// pointers) are bytes (and byte pointers) for the purposes of having// a memory map that works.typedef u8 HDW;typedef struct cell_buf {  HDW payload[12];  HDW next;  HDW cell_count;               // AAL5 rx bufs  HDW res;  union {    HDW partial_crc;            // AAL5 rx bufs    HDW cell_header;            // RAW     bufs  } u;} cell_buf;typedef struct tx_ch_desc {  HDW rd_buf_type;  HDW wr_buf_type;  HDW partial_crc;  HDW cell_header;} tx_ch_desc;typedef struct rx_ch_desc {  HDW wr_buf_type;  HDW rd_buf_type;} rx_ch_desc;typedef struct rx_q_entry {  HDW entry;} rx_q_entry;#define TX_CHANS 8#define RX_CHANS 1024#define RX_QS 1024#define MAX_VCS RX_CHANS/* Horizon buffer memory map */// TX Channel Descriptors         2// TX Initial Buffers             8 // TX_CHANS#define BUFN1_SIZE              118 // (126 - TX_CHANS)//      RX/TX Start/End Buffers   4#define BUFN2_SIZE              124//      RX Queue Entries         64#define BUFN3_SIZE              192//      RX Channel Descriptors  128#define BUFN4_SIZE             1408//      TOTAL cell_buff chunks 2048//    cell_buf             bufs[2048];//    HDW                  dws[32768];typedef struct MEMMAP {  tx_ch_desc  tx_descs[TX_CHANS];     //  8 *    4 =    32 , 0x0020  cell_buf    inittxbufs[TX_CHANS];   // these are really  cell_buf    bufn1[BUFN1_SIZE];      // part of this pool  cell_buf    txfreebufstart;  cell_buf    txfreebufend;  cell_buf    rxfreebufstart;  cell_buf    rxfreebufend;           // 8+118+1+1+1+1+124 = 254  cell_buf    bufn2[BUFN2_SIZE];      // 16 *  254 =  4064 , 0x1000  rx_q_entry  rx_q_entries[RX_QS];    //  1 * 1024 =  1024 , 0x1400  cell_buf    bufn3[BUFN3_SIZE];      // 16 *  192 =  3072 , 0x2000  rx_ch_desc  rx_descs[MAX_VCS];      //  2 * 1024 =  2048 , 0x2800  cell_buf    bufn4[BUFN4_SIZE];      // 16 * 1408 = 22528 , 0x8000} MEMMAP;#define memmap ((MEMMAP *)0)/* end horizon specific bits */typedef enum {  aal0,  aal34,  aal5} hrz_aal;typedef enum {  tx_busy,  rx_busy,  ultra} hrz_flags;// a single struct pointed to by atm_vcc->dev_datatypedef struct {  unsigned int        tx_rate;  unsigned int        rx_rate;  u16                 channel;  u16                 tx_xbr_bits;  u16                 tx_pcr_bits;#if 0  u16                 tx_scr_bits;  u16                 tx_bucket_bits;#endif  hrz_aal             aal;} hrz_vcc;struct hrz_dev {    u32                 iobase;  u32 *               membase;  struct sk_buff *    rx_skb;     // skb being RXed  unsigned int        rx_bytes;   // bytes remaining to RX within region  void *              rx_addr;    // addr to send bytes to (for PIO)  unsigned int        rx_channel; // channel that the skb is going out on  struct sk_buff *    tx_skb;     // skb being TXed  unsigned int        tx_bytes;   // bytes remaining to TX within region  void *              tx_addr;    // addr to send bytes from (for PIO)  struct iovec *      tx_iovec;   // remaining regions  unsigned int        tx_regions; // number of remaining regions  spinlock_t          mem_lock;#if LINUX_VERSION_CODE >= 0x20303  wait_queue_head_t   tx_queue;#else  struct wait_queue * tx_queue;#endif  u8                  irq;  u8                  flags;  u8                  tx_last;  u8                  tx_idle;  rx_q_entry *        rx_q_reset;  rx_q_entry *        rx_q_entry;  rx_q_entry *        rx_q_wrap;  struct atm_dev *    atm_dev;  u32                 last_vc;    int                 noof_spare_buffers;  u16                 spare_buffers[SPARE_BUFFER_POOL_SIZE];  u16                 tx_channel_record[TX_CHANS];  // this is what we follow when we get incoming data  u32              txer[MAX_VCS/32];  struct atm_vcc * rxer[MAX_VCS];  // cell rate allocation  spinlock_t       rate_lock;  unsigned int     rx_avail;  unsigned int     tx_avail;    // dev stats  unsigned long    tx_cell_count;  unsigned long    rx_cell_count;  unsigned long    hec_error_count;  unsigned long    unassigned_cell_count;  struct pci_dev * pci_dev;  struct hrz_dev * prev;};typedef struct hrz_dev hrz_dev;/* macros for use later */#define BUF_PTR(cbptr) ((cbptr) - (cell_buf *) 0)#define INTERESTING_INTERRUPTS \  (RX_DATA_AV | RX_DISABLED | TX_BUS_MASTER_COMPLETE | RX_BUS_MASTER_COMPLETE)// 190 cells by default (192 TX buffers - 2 elbow room, see docs)#define TX_AAL5_LIMIT (190*ATM_CELL_PAYLOAD-ATM_AAL5_TRAILER) // 9112// Have enough RX buffers (unless we allow other buffer splits)#define RX_AAL5_LIMIT ATM_MAX_AAL5_PDU/* multi-statement macro protector */#define DW(x) do{ x } while(0)#define HRZ_DEV(atm_dev) ((hrz_dev *) (atm_dev)->dev_data)#define HRZ_VCC(atm_vcc) ((hrz_vcc *) (atm_vcc)->dev_data)/* Turn the LEDs on and off                                                 */// The LEDs bits are upside down in that setting the bit in the debug// register will turn the appropriate LED off.#define YELLOW_LED    DEBUG_BIT_0#define GREEN_LED     DEBUG_BIT_1#define YELLOW_LED_OE DEBUG_BIT_0_OE#define GREEN_LED_OE  DEBUG_BIT_1_OE#define GREEN_LED_OFF(dev)                      \  wr_regl (dev, CONTROL_0_REG, rd_regl (dev, CONTROL_0_REG) | GREEN_LED)#define GREEN_LED_ON(dev)                       \  wr_regl (dev, CONTROL_0_REG, rd_regl (dev, CONTROL_0_REG) &~ GREEN_LED)#define YELLOW_LED_OFF(dev)                     \  wr_regl (dev, CONTROL_0_REG, rd_regl (dev, CONTROL_0_REG) | YELLOW_LED)#define YELLOW_LED_ON(dev)                      \  wr_regl (dev, CONTROL_0_REG, rd_regl (dev, CONTROL_0_REG) &~ YELLOW_LED)typedef enum {  round_up,  round_down,  round_nearest} rounding;#endif /* DRIVER_ATM_HORIZON_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -