1 /* 2 * Copyright (c) 2013 Corey Tabaka 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #pragma once 9 10 #include <lk/compiler.h> 11 #include <stdint.h> 12 13 #define REG_APROM 0x00 14 #define REG_RDP 0x10 15 #define REG_RAP 0x14 16 #define REG_RESET 0x18 17 #define REG_BDP 0x1c 18 19 #define CSR0_INIT 0x0001 20 #define CSR0_STRT 0x0002 21 #define CSR0_STOP 0x0004 22 #define CSR0_TDMD 0x0008 23 #define CSR0_TXON 0x0010 24 #define CSR0_RXON 0x0020 25 #define CSR0_IENA 0x0040 26 #define CSR0_INTR 0x0080 27 #define CSR0_IDON 0x0100 28 #define CSR0_TINT 0x0200 29 #define CSR0_RINT 0x0400 30 #define CSR0_MERR 0x0800 31 #define CSR0_MISS 0x1000 32 #define CSR0_CERR 0x2000 33 #define CSR0_BABL 0x4000 34 #define CSR0_ERR 0x8000 35 36 #define CSR4_DMAPLUS 0x4000 37 38 #define DESC_SIZE (4*sizeof(uint32_t)) 39 40 struct init_block_32 { 41 uint16_t mode; 42 43 uint16_t reserved_0 : 4; 44 uint16_t rlen : 4; 45 uint16_t reserved_1 : 4; 46 uint16_t tlen : 4; 47 48 uint8_t padr[6]; 49 50 uint16_t reserved_2; 51 52 uint64_t ladr; 53 uint32_t rdra; 54 uint32_t tdra; 55 } __PACKED; 56 57 struct td_style3 { 58 uint32_t trc : 4; 59 uint32_t reserved_1 : 8; 60 uint32_t tdr : 14; 61 uint32_t rtry : 1; 62 uint32_t lcar : 1; 63 uint32_t lcol : 1; 64 uint32_t exdef : 1; 65 uint32_t uflo : 1; 66 uint32_t buff : 1; 67 68 uint32_t bcnt : 12; 69 uint32_t ones : 4; 70 uint32_t reserved_0 : 7; 71 uint32_t bpe : 1; 72 uint32_t enp : 1; 73 uint32_t stp : 1; 74 uint32_t def : 1; 75 uint32_t one : 1; 76 uint32_t more_ltinit : 1; 77 uint32_t add_no_fcs : 1; 78 uint32_t err : 1; 79 uint32_t own : 1; 80 81 uint32_t tbadr; 82 83 uint32_t reserved_2; 84 } __PACKED; 85 86 struct rd_style3 { 87 uint16_t mcnt : 12; 88 uint16_t zeros : 4; 89 90 uint8_t rpc; 91 uint8_t rcc; 92 93 uint32_t bcnt : 12; 94 uint32_t ones : 4; 95 uint32_t reserved_0 : 4; 96 uint32_t bam : 1; 97 uint32_t lafm : 1; 98 uint32_t pam : 1; 99 uint32_t bpe : 1; 100 uint32_t enp : 1; 101 uint32_t stp : 1; 102 uint32_t buff : 1; 103 uint32_t crc : 1; 104 uint32_t oflo : 1; 105 uint32_t fram : 1; 106 uint32_t err : 1; 107 uint32_t own : 1; 108 109 uint32_t rbadr; 110 111 uint32_t reserved_1; 112 } __PACKED; 113 114