Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cyg/hal/bcm33xx_regs.h>
- #include <cyg/kernel/kapi.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netinet/ip.h>
- #include <inttypes.h>
- #include "hwaccess.h"
- #include "forth.h"
- #include "ficl.h"
- #include "shell.h"
- #include "desTable.h"
- // bloody hell
- #define GLOBAL_CTRL_STATUS 0xfffe3000 // 8
- #define IRQ_PEND 0xfffe3002 // 16
- // bit 6 DS Data DMA??
- // bit 5 DS Msg DMA?? (one right, but not sure which!!!)
- #define IRQ_DS_DATA_DMA_ERROR (1 << 6)
- #define IRQ_DS_MSG_DMA_ERROR (1 << 5)
- #define IRQ_DS_MSG_DMA (1 << 1) // packet RX'd
- #define IRQ_DS_DATA_DMA (1 << 0) // packet RX'd
- #define IRQ_MASK 0xfffe3004 // 16
- #define DS_DEVICE_ID 0xfffe300a // 16
- #define SOMETHING 0x3024
- // Hardware downstream data filter table UBR925-K.BIN 0x8036d02c
- #define DS_PID 0xfffe3060 // 16
- #define DP_ENABLE (1 << 15)
- #define DP_MODE_SEL (1 << 14) // 1=DOCSIS 0=????
- #define DP_UNKNOWN13 (1 << 13)
- #define DP_PID(n) ((n) & 0x1fff)
- #define DS_UNKNOWN3063 0xfffe3063
- #define DS_MAC_DA_MC 0xfffe3064 // 32
- #define DS_MAC_DA_FILTER_CTRL 0xfffe3068 // 16 FIXME(affects MSG queue)
- #define DMDFC_ENABLE (1 << 15) // enable RX of UCD, no
- #define DMDFC_PROMISC (1 << 3) // enable promiscuous mode
- #define DMDFC_UNKNOWN5 (1 << 5)
- #define DMDFC_UNKNOWN7 (1 << 7)
- #define DS_MAC_FILTER_CTRL 0xfffe3069 // 8 FIXME
- #define DS_MAC_MSG_PROTO_VER_BYTE1 0xfffe306a // 8
- #define DS_MAC_MSG_PROTO_VER_BYTE2 0xfffe306b // 8
- #define DS_REG_RANG_REQ_SID 0xfffe306e // 8 (read only???)
- // Thank you Cisco!!!!
- #define DS_DES_CTRL 0xfffe3080 // 8
- #define DS_DES_UNENCRYPTED_LENGTH 0xfffe3081 // 8 # of initial bytes to be unencrypted defult 0x0c
- #define DS_DES_SID_ENABLE 0xfffe3084 // 16 # 1=enable SID matching?
- #define DS_DES_SID_TABLE(n) (0xfffe3086 + (n * 4)) // 16, SIDS to be encrypted
- #define DS_DES_SV 0xfffe30a6 // 8 ???
- DES security version register; the range of the version field in the BPI extended headers that will be accepted by the hardware; high byte is upper limit low byte is lower limit. The Cisco UBR945 will accept versions 0 to 15.
- #define US_DES_CTRL 0xfffe30a7 // 8
- // Timing Recovery Circuit
- #define TRC_LOOP_ENABLE 0xfffe3100 // 8
- #define TRC_MINISLOT_DIVISOR 0xfffe3101 // 8
- #define TRC_K0_CTRL 0xfffe3102 // 8
- #define TRC_K1_CTRL 0xfffe3103 // 8
- #define TRC_ACQ_THRESHOLD 0xfffe3104 // 8
- #define TRC_ERR_THRESHOLD 0xfffe3105 // 8
- #define TRC_TIMEOUT_THRESHOLD 0xfffe3106 // 8
- #define TRC_NCO_BIAS 0xfffe3108 // 16
- #define TRC_RANGING_OFFSET 0xfffe310c // 16 OK
- #define TRC_TS_ERR 0xfffe3110 // 8
- #define TRC_SYNC_VALID 0xfffe3111 // 8
- #define TRC_TIMEOUT_ERR 0xfffe3112 // 8
- #define TRC_DELTA_F 0xfffe3114 // 16
- #define TRC_MINISLOT_COUNT 0xfffe3118 // 32
- #define SPI_DYNAMIC_CTRL // 8
- #define SPI_STATIC_CTR // 8 0x9f
- #define SPI_AUTONOMOUS // 8 0x01
- #define SPI_IRQ_ACK // 8
- #define SPI_CMD // 8
- #define SPI_ADDR // 8
- #define SPI_DATA // 7 * 8
- #define US_RANGE_FIFO 0xfffe3140 // 8
- #define US_CTRL_STATUS 0xfffe3141 // 8 us_ctrl_status
- #define US_BYTES_PER_MINISLOT_EXP 0xfffe3149
- #define US_MINISLOTS_PER_REQ 0xfffe314a // 8
- #define US_MAX_RE_REQ 0xfffe314b // 16
- // MAC MIB Counters
- #define DM_DATA_FIFO_OVERRUNS 0xfffe3181
- #define DM_HCS_ERRORS 0xfffe3182
- #define DM_MAC_MSG_CRC_ERRORS 0xfffe3184
- #define DM_MAC_MSG_OVERRUNS 0xfffe3186
- #define DM_DS_DATA_OVERRUNS 0xfffe3188
- #define DM_US_UNDERFLOWS 0xfffe318a
- #define DM_US_RANGE_REQS 0xfffe318c
- #define DM_DS_MAP_REJECTS 0xfffe318e
- #define DM_DS_MPEG_XPORT_ERRORS 0xfffe3190
- #define DM_DS_QUAL_SYNCS 0xfffe3194
- #define DM_DS_QUAL_MAPS 0xfffe3198
- #define DM_DS_QUAL_UCD_COUNT 0xfffe319c
- #define DM_DS_MAC_HDR_COUNT 0xfffe31a0
- #define DM_DS_DATA_PKT_COUNT 0xfffe31a4
- #define DM_DS_MAC_MSG_COUNT 0xfffe31a8
- #define DM_US_TX_BYTE_COUNT 0xfffe31ac
- #define DM_DS_MAX_MSG_BYTE_COUNT 0xfffe31b0
- // Downstream DMA (wrong, not the same in BCM3345)
- //#define DS_DATA_BD_BASE 0xfffe3200 // 32 OK
- //#define DS_DATA_DMA_INDEX 0xfffe3204 // 16 OK
- //#define DS_DATA_DMA_CTRL 0xfffe3206 // 8 OK
- //#define DS_MSG_BD_BASE 0xfffe2210 // 32 OK
- //#define DS_MSG_DMA_INDEX 0xfffe2214 // 16 OK
- //#define DS_MSG_DMA_CTRL 0xfffe2216 // 8 OK
- // Downstream DMA guessed names and addresses for BCM3345
- #define DS_DATA_DMA_CTRL 0xfffe3200 // 8
- #define DS_DATA_DMA_INDEX 0xfffe3203
- #define DS_DATA_BD_BASE 0xfffe3204 // not sure if it's really PD
- #define DS_DATA_PD_BASE 0xfffe3208 // not sure if it's really PD
- #define DS_DATA_TRIGGER 0xfffe320c // 8
- #define DS_MSG_DMA_CTRL 0xfffe3210 // 8
- #define DS_MSG_DMA_INDEX 0xfffe3213
- #define DS_MSG_BD_BASE 0xfffe3214 // not sure if it's really PD
- #define DS_MSG_PD_BASE 0xfffe3218 // not sure if it's really PD
- #define DS_MSG_TRIGGER 0xfffe321c // 8
- // Upstream DMA
- #define US_PD_BASE 0xfffe3220 // 32 OK
- #define US_BD_BASE 0xfffe3224 // 32 OK
- #define US_SID_TABLE(n) (0xfffe3228 + (n * 0x20))
- #define US_QUEUE_SID 0xfffe3228 // 16
- #define US_DMA_CTRL 0xfffe322a // 8
- #define US_DMA_TX_START 0xfffe322c // 8
- #define MAP_PARSER_SIDS(n) (0xfffe32a2 + ((n) * 2))) // 4 entries, 16bi
- #define DS_DATA_DA_FILTER_CTRL 0xfffe3500 // 8
- #define DS_DATA_DA_EN 0xfffe3502 // 16
- #define DS_DATA_DA_MC 0xfffe3504 // 32
- #define DS_DATA_FILTER_TABLE(n) (0xfffe3508 + ((n) * 4)) // 16 entries, 32bi
- // Burst Control
- #define BCB_REQUST 0xfffe3603
- #define BCB_REQUEST_BANK 0xfffe360e
- #define BCB_REQUEST_DATA_BANK 0xfffe360f
- #define BCB_INIT_MAINT_BANK 0xfffe3610
- #define BCB_STN_MAINT_BANK 0xfffe3611
- #define BCB_SHORT_GRANT_BANK 0xfffe3612
- #define BCB_LONG_GRANT_BANK 0xfffe3613
- #define BCB_SHORT_DATA_GRANT 0xfffe3614
- #define BCB_LONG_DATA_GRANT 0xfffe3615
- #define BCB_REQ_OVERHEAD_BYTES 0xfffe3616
- #define BCB_REQ_CODEWORD_BYTES 0xfffe3617
- #define BCB_INIT_MAINT_OVERHEAD_BYTES 0xfffe361a
- #define BCB_INIT_MAINT_CODEWORD_BYTES 0xfffe361b
- #define BCB_STN_MAINT_OVERHEAD_BYTES 0xfffe361c
- #define BCB_STN_MAINT_CODEWORD_BYTES 0xfffe361d
- #define BCB_SHORT_GRANT_OVERHEAD_BYTES 0xfffe361e
- #define BCB_SHORT_GRANT_CODEWORD_BYTES 0xfffe361f
- #define BCB_LONG_GRANT_OVERHEAD_BYTES 0xfffe3620
- #define BCB_LONG_GRANT_CODEWORD_BYTES 0xfffe3621
- // Upstream MAC Registers
- #define UM_USCTL 0xfffe3601
- #define UM_MTXCTL 0xfffe3602
- #define UM_BSIGCTRL 0xfffe3603
- #define UM_TCKPMS 0xfffe3604
- #define UM_BPMSEXP 0xfffe3605
- #define UM_MSPERREQ 0xfffe3606
- #define UM_MAXREREQ 0xfffe3607
- struct BcmDescriptor {
- uint32_t lenStatus;
- uint32_t address;
- };
- volatile struct BcmDescriptor *dsData1;
- volatile struct BcmDescriptor *dsData2;
- volatile struct BcmDescriptor *dsMsg1;
- volatile struct BcmDescriptor *dsMsg2;
- // EnetBCM3310.c
- // FFFE3068 something to do with the CPE table
- // BCM3300 upstream registers
- // FFFE3040
- // FFFE3046
- // FFFE3068
- // FFFE3000 - BCM3350 MAC Base Address
- // FFFE300A - BCM3350 ID Register
- // FFFE300C - BCM3350 Chip Register
- // BCM3350 Id register
- // FFFE3500 - Downstream Phy control register (1 byte)
- // FFFE3500 (i.e. bit 3 enables Promiscuous Mode !!!!) 0x08 - or with this to enable promiscuous mode, yes
- // FFFE3502
- // FFFE3508
- FILE *mpegOut;
- void hexdump(uint8_t *buffer, int len)
- {
- int lineAddr;
- for(lineAddr = 0; lineAddr < len; lineAddr += 16) {
- int bytePos;
- fprintf(mpegOut, "%08x: ", lineAddr);
- for(bytePos = 0; bytePos < 16; bytePos++) {
- if((lineAddr + bytePos) < len)
- fprintf(mpegOut, "%02x ", buffer[lineAddr + bytePos]);
- else
- fprintf(mpegOut, " ");
- if(bytePos == 7)
- fprintf(mpegOut, " ");
- }
- fprintf(mpegOut, " |");
- for(bytePos = 0; bytePos < 16; bytePos++) {
- uint8_t chr = buffer[lineAddr + bytePos];
- chr = (chr < 32) ? '.' : chr;
- chr = (chr >= 127) ? '.' : chr;
- fprintf(mpegOut, "%c", (char) chr);
- if(bytePos == 7)
- fprintf(mpegOut, " ");
- }
- fprintf(mpegOut, "| \n");
- }
- fflush(mpegOut); // FIXME
- }
- // PD status byte bits
- #define PD_OWN (1 << 7)
- #define PD_WRAP (1 << 5)
- #define PD_OVERFLOW (1 << 4)
- #define PD_OVERRUN (1 << 3)
- #define PD_PHS (1 << 2)
- #define PD_SEQ (1 << 1)
- #define PD_CRC_ERROR (1 << 0)
- #define BD_OWN (1 << 31)
- #define BD_WRAP (1 << 29)
- #define BD_LAST (1 << 27)
- #define BD_FIRST (1 << 26)
- struct DmaDescriptor {
- uint32_t lenStatus;
- uint32_t addr;
- };
- struct eth_driver_sg {
- CYG_ADDRESS buf;
- CYG_ADDRWORD len;
- };
- //volatile uint8_t vlanHeader[4];
- int mpegSock;
- int mpegSockInit()
- {
- int sock;
- int rv;
- sock = socket(AF_INET, SOCK_DGRAM, 0);
- if(sock == -1) {
- fprintf(mpegOut, "socket() failed: %s\n", strerror(errno));
- return -1;
- }
- struct sockaddr_in sa;
- memset(&sa, 0, sizeof(sa));
- sa.sin_family = AF_INET;
- sa.sin_port = htons(8000);
- sa.sin_addr.s_addr = inet_addr("239.255.32.1");
- rv = connect(sock, (struct sockaddr *) &sa, sizeof(sa));
- if(rv == -1) {
- fprintf(mpegOut, "connect() failed: %s\n", strerror(errno));
- return -1;
- }
- int ttl = 32;
- rv = setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
- if(rv == -1) {
- fprintf(mpegOut, "setsockopt() failed: %s\n", strerror(errno));
- return -1;
- }
- return sock;
- }
- volatile cyg_uint16 dsIrqStatus;
- cyg_sem_t dsIrqSemaphore;
- // DSR called when a DOCSIS / (MPEG, hopefully) downstream packet arrives
- static void snifferDsr(void *data)
- {
- cyg_uint16 status;
- status = REG16(IRQ_PEND);
- if(status)
- cyg_semaphore_post(&dsIrqSemaphore);
- }
- void snifferIrqInit()
- {
- cyg_semaphore_init(&dsIrqSemaphore, 0);
- hal_map_periph_interrupt(CMAC_IRQ_BIT, snifferDsr, (void *) 0);
- hal_enable_periph_interrupt(CMAC_IRQ_BIT);
- REG16(IRQ_PEND) = 0xffff;
- REG16(IRQ_MASK) = 0xffff;
- }
- int numDescriptors = 256;
- volatile uint8_t *dmaBuffer[4];
- volatile struct DmaDescriptor *dmaDesc[4];
- void snifferInit()
- {
- int n;
- // create a socket for TXing the MPEG-2 TS data
- mpegSock = mpegSockInit();
- if(mpegSock == -1)
- return; // it failed!
- // Now to test the DOCSIS MAC
- // dmaBuf 0 - 512 bytes apart
- // dmaBuf 1 - 1576 bytes apart
- // dmaBuf 2 - 512 bytes apart
- // dmaBuf 3 - 1576 bytes apart
- for(n = 0; n < 4; n++) {
- void *ptr;
- int bufferSize = numDescriptors * 2048;
- ptr = malloc(bufferSize);
- if(ptr == NULL) {
- fprintf(mpegOut, "buffer malloc() failed\n");
- return;
- }
- dmaBuffer[n] = (uint8_t *) UNCACHED_ADDR(ptr);
- memset(dmaBuffer[n], 0, bufferSize);
- }
- for(n = 0; n < 4; n++) {
- void *ptr;
- int descSize = numDescriptors * sizeof(struct DmaDescriptor) * 2;
- ptr = malloc(descSize);
- if(ptr == NULL) {
- fprintf(mpegOut, "buffer malloc() failed\n");
- return;
- }
- dmaDesc[n] = (uint8_t *) UNCACHED_ADDR(ptr);
- memset(dmaDesc[n], 0, descSize);
- }
- snifferIrqInit(); // enable DOCSIS / MPEG Interrupts
- printf("MPEG/DOCSIS Sniffer Initialisation Complete!\n");
- }
- void snifferThreadEntry()
- {
- int n;
- int rxDataIndex;
- int rxMsgIndex;
- rxDataIndex = rxMsgIndex = 0;
- // now fill the descriptor buffers
- for(n = 0; n < numDescriptors; n++) {
- int i;
- for(i = 0; i < 4; i++) {
- struct DmaDescriptor *desc = &dmaDesc[i][n];
- desc->lenStatus = BD_OWN | BD_LAST | BD_FIRST;
- if( n == (numDescriptors - 1))
- desc->lenStatus |= BD_WRAP;
- desc->addr = PHYS_ADDR(dmaBuffer[i] + n * 0x800);
- }
- }
- REG16(DS_PID) = 0;
- REG8(DS_DATA_DMA_CTRL) = 0x57;
- REG32(DS_DATA_BD_BASE) = PHYS_ADDR(dmaDesc[0]);
- REG32(DS_DATA_PD_BASE) = PHYS_ADDR(dmaDesc[1]);
- REG8(DS_MSG_DMA_CTRL) = 0x57;
- REG32(DS_MSG_BD_BASE) = PHYS_ADDR(dmaDesc[2]);
- REG32(DS_MSG_PD_BASE) = PHYS_ADDR(dmaDesc[3]);
- REG8(0xfffe3201) = 2; // was 2, bitmask =3
- REG8(0xfffe3211) = 2; // was 2, bitmask =3
- REG8(0xfffe3202) = 0x0; // was 0
- REG8(0xfffe3212) = 0x0; // was 0
- REG8(DS_DATA_DMA_INDEX) = 0;
- REG8(DS_MSG_DMA_INDEX) = 0;
- REG8(DS_DATA_DMA_CTRL) |= (1 << 7); // Enable RX
- REG8(DS_MSG_DMA_CTRL) |= (1 << 7); // Enable RX
- REG8(DS_DATA_TRIGGER) = 0x01;
- REG8(DS_MSG_TRIGGER) = 0x01;
- // select the PID for downstream data RX
- // why can't I get at the TS directly!!!
- cyg_thread_delay(10);
- REG16(DS_PID) = DP_ENABLE | DP_MODE_SEL | DP_PID(8190);
- // REG16(DS_MAC_DA_FILTER_CTRL) = 0xff00 | DMDFC_PROMISC;
- for(;;) {
- struct DmaDescriptor *desc;
- struct DmaDescriptor *macDesc;
- cyg_uint16 status;
- // Wait for an incoming interrupt
- cyg_semaphore_wait(&dsIrqSemaphore);
- // Check what's pending
- status = REG16(IRQ_PEND);
- REG16(IRQ_PEND) = status;
- // re-enable the peripheral interrupt
- hal_enable_periph_interrupt(CMAC_IRQ_BIT);
- if(status & IRQ_DS_DATA_DMA) {
- while(!((macDesc = &dmaDesc[0][rxDataIndex])->lenStatus & (1 << 31))) {
- desc = &dmaDesc[1][rxDataIndex];
- int len = desc->lenStatus & 0xfff;
- uint32_t status;
- send(mpegSock, (void *) UNCACHED_ADDR(desc->addr), len, 0);
- status = BD_OWN | BD_LAST | BD_FIRST;
- if(rxDataIndex == (numDescriptors - 1))
- status |= BD_WRAP;
- desc->lenStatus = status;
- status = BD_OWN | BD_LAST | BD_FIRST;
- if(rxDataIndex == (numDescriptors - 1))
- status |= BD_WRAP;
- macDesc->lenStatus = status;
- rxDataIndex = (rxDataIndex + 1) & 0xff;
- }
- }
- if(status & IRQ_DS_MSG_DMA) {
- while(!((macDesc = &dmaDesc[2][rxMsgIndex])->lenStatus & (1 << 31))) {
- desc = &dmaDesc[3][rxMsgIndex];
- int len = desc->lenStatus & 0xfff;
- uint32_t status;
- send(mpegSock, (void *) UNCACHED_ADDR(desc->addr), len, 0);
- status = BD_OWN | BD_LAST | BD_FIRST | 0x7ff;
- if(rxMsgIndex == (numDescriptors - 1))
- status |= BD_WRAP;
- desc->lenStatus = status;
- status = BD_OWN | BD_LAST | BD_FIRST | 0x7ff;
- if(rxMsgIndex == (numDescriptors - 1))
- status |= BD_WRAP;
- macDesc->lenStatus = status;
- rxMsgIndex = (rxMsgIndex + 1) & 0xff;
- }
- }
- // if(status & 0xfffc)
- // fprintf(mpegOut, "Got unknown IRQ, status=0x%04x\n", status);
- // fprintf(mpegOut, "rxDataIndex=%d rxMsgIndex=%d\n", rxDataIndex, rxMsgIndex);
- }
- }
- static char snifferStack[16384];
- static cyg_handle_t snifferThread_h;
- static cyg_thread snifferThread;
- void docsisSnifferStart()
- {
- cyg_thread_create(2, snifferThreadEntry, (cyg_addrword_t) 0,
- "Sniffer", snifferStack, sizeof(snifferStack),
- &snifferThread_h, &snifferThread);
- cyg_thread_resume(snifferThread_h);
- }
- void prim_ss(ficlVm *vm)
- {
- struct ShellPrivate *priv = (struct ShellPrivate *) vm->priv;
- mpegOut = priv->io;
- // snifferThreadEntry();
- docsisSnifferStart();
- }
- static struct word_def dsMacWords[] = {
- // { "dmt", prim_dmt, FICL_WORD_DEFAULT },
- { "ss", prim_ss, FICL_WORD_DEFAULT },
- { NULL, NULL, 0 }
- };
- void dsMacInit()
- {
- printf("Initialising DOCSIS MAC...\n");
- printf("Reset MAC\n");
- REG8(GLOBAL_CTRL_STATUS) = 0xff;
- cyg_thread_delay(1);
- REG8(GLOBAL_CTRL_STATUS) = 0x00;
- cyg_thread_delay(1);
- REG16(0xfffe3008) = 0x000f;
- printf("Configure DS Data Filters\n");
- // REG16(DS_PID) = 0xc000 | 8190; // 0xc000 normal DOCSIS operation
- REG16(DS_PID) = 0xc000 | 8190; // 0x8000 something special !!!
- REG8(DS_MAC_FILTER_CTRL) = 0x41; // 0x40
- REG8(DS_MAC_MSG_PROTO_VER_BYTE1) = 0xff; // 0xff
- REG8(DS_MAC_MSG_PROTO_VER_BYTE2) = 0x00; // 0x00
- // Configure DES
- REG8(DS_DES_SID_ENABLE) = 0x80;
- REG8(DS_DES_UNENCRYPTED_LENGTH) =0x0c;
- REG16(DS_DES_SV) = 0x0f00; // accept all BPI versions 0-15
- REG8(DS_DES_CTRL) = 0x0e; // 0x2e enables SES
- REG8(DS_DATA_DA_FILTER_CTRL) = 0x3f; // 0x3f
- REG8(0xfffe306c) = 0x02;
- REG16(DS_DATA_DA_EN) = 1; // 0x01
- #if 0
- // Init some extra regs...
- REG8(0xfffe3074) = 0x0d;
- // Initialise DES
- int idx;
- for(idx = 0; idx < 128; idx++)
- REG32(0xfffe3300 + idx * 4) = desTable[idx];
- REG32(0xfffe3080) = 0x2e0c0000;
- REG32(0xfffe3084) = 0x00010b40;
- REG32(0xfffe30a4) = 0x0000f024;
- REG32(0xfffe3230) = 0x000000c0;
- REG32(0xfffe3230) = 0x00000b40;
- REG32(0xfffe32a0) = 0x00010001;
- REG32(0xfffe32b0) = 0x00695e08;
- #endif
- #if 1
- printf("Configure Timing Recovery...\n");
- REG8(TRC_LOOP_ENABLE) = 0;
- REG8(TRC_MINISLOT_DIVISOR) = 3;
- REG8(TRC_K0_CTRL) = 6;
- REG8(TRC_K1_CTRL) = 7;
- REG8(TRC_ACQ_THRESHOLD) = 1;
- REG8(TRC_ERR_THRESHOLD) = 4;
- REG8(TRC_TIMEOUT_THRESHOLD) = 0xff;
- REG16(TRC_NCO_BIAS) = 0x51eb;
- REG16(TRC_RANGING_OFFSET) = 0x851e;
- REG32(TRC_MINISLOT_COUNT) = 0x02de3cc3;
- REG8(TRC_LOOP_ENABLE) = 1;
- #endif
- // REG8(DS_DATA_DMA_CTRL
- #if 0
- printf("Configure Downstream DMA...\n");
- REG32(0xfffe3200) = 0x17020000;
- // REG32(0xfffe3204) = 0x007f0008;
- // REG32(0xfffe3208) = 0x007f0008;
- REG32(0xfffe3210) = 0x17020000;
- // REG32(0xfffe3214) = 0x006a5608;
- // REG32(0xfffe3218) = 0x006a3508;
- // REG32(0xfffe3238) = 0x007f9008;
- // REG32(0xfffe323c) = 0x007f7e08;
- REG32(0xfffe3240) = 0x00020000;
- // REG32(0xfffe32b0) = 0x00695e08;
- // REG32(0xfffe3500) = 0x3f000001; // 0xfffe3500 byte bit 3 set for promisc
- REG32(0xfffe3588) = 0x023f3f00;
- REG32(0xfffe3600) = 0x00000011;
- #endif
- #if 0
- // Setup the calibration table (approximate)
- int index;
- for(index = 0; index < 256; index++) {
- int value;
- if(index < 6) {
- value = 0;
- } else {
- value = 0x17 + (index - 6) * 8;
- }
- REG16(0xfffe3800 + (index * 2)) = value;
- }
- #endif
- forthRegisterWords(dsMacWords);
- cyg_thread_delay(10);
- printf("DOCSIS MAC Initialisation complete\n");
- snifferInit();
- cyg_thread_delay(10);
- docsisSnifferStart();
- }
Advertisement
Add Comment
Please, Sign In to add comment