www.pudn.com > writemac.rar > rwmac.c
/* * Copyright 2003 by Spectrum Digital Incorporated. * All rights reserved. Property of Spectrum Digital Incorporated. */ /* * ======== test.c ======== * * This test program performs a confidence test on severl of the DM642 EVM * board components. The following tests are performed: * * Index Description * 1 LEDs * 2 SPDIF/APLL/VCXO * 3 Synchronous Bus * 4 SDRAM * 5 Flash ID * 6 Flash (entire contents) * 7 I2C EEPROM * 8 UARTA Loopback * 9 UARTB Loopback * 10 PCI EEPROM */ /* * DSP/BIOS is configured using the DSP/BIOS configuration tool. Settings * for this example are stored in a configuration file called test.cdb. At * compile time, Code Composer will auto-generate DSP/BIOS related files * based on these settings. A header file called testcfg.h contains the * results of the autogeneration and must be included for proper operation. * The name of the file is taken from test.cdb and adding cfg.h. */ #include "rwmaccfg.h" /* * The POST uses the Chip Support Library for basic definitions as well as * McBSP manipulation. Programs that use the CSL must include the * appropriate header files. */ #include#include #include #include #include #include #include #include #include #include #include /* * The DM642 EVM Board Support Library is divided into several modules, each * of which has its own include file. The file dm643.h must be included * in every program that uses the BSL. This example also includes * dm643_aic23.h, dm643_led.h and dm643_flash.h because it uses * their respective BSL modules. */ #include "dm643.h" #include "dm643_led.h" //#include "dm643_aic23.h" #include "dm643_flash.h" //#include "dm643_eeprom.h" #include "dm643_uart.h" //#include "dm643_apll.h" //#include "dm643_pci.h" /* Length of sine wave table */ #define SINE_TABLE_SIZE 48 /* Number of elements for DMA and McBSP loopback tests */ #define N 16 /* Define source and destination arrays for DMA and loopback tests */ Uint16 src[N], dst[N], buffer[256]; //Int16 TEST_syncbus() //{ // return MEM_walking(dm643_SYNC_BASE); //} volatile Uint32 sleepCount = 0; void sleepIsr() { sleepCount++; } main() { Uint8 i; Uint8 MacAddr[30]; Uint8 MacAddrint[6]={0x08, //0 0x00, //1 0x28, //2 0x55, //3 0xbc, //4 0x8a //5 }; /* Call BSL init */ DM643_init(); /* Set initial LED state */ // dm643_LED_init(); /* Run the tests sequentially */ // TEST_execute(TEST_led, "LEDs", 1, 0); // TEST_execute(TEST_audioclks, "SPDIF/APLL/VCXO", 2, 0); // TEST_execute(TEST_syncbus, "Sync Bus", 3, 0); // TEST_execute(TEST_extMem, "SDRAM", 4, 0); // TEST_execute(TEST_flashID, "Flash ID", 5, 1); // TEST_execute(TEST_flashall, "Flash", 6, 0); // TEST_execute(TEST_eeprom, "I2C EEPROM", 7, 0); // TEST_execute(TEST_uartA, "UARTA", 8, 0); // TEST_execute(TEST_uartB, "UARTB", 9, 0); // TEST_execute(TEST_pciregs, "PCI EEPROM", 10, 1); /* Success */ printf("\n*** All tests PASS ***\n"); /* Disable interrupts */ IRQ_globalDisable(); DM643_EEPROM_write((Uint32)MacAddrint, 0x00007F00, 8); //dm643_EEPROM_read(0x00007F00, (Uint32)MacAddr, 20); DM643_EEPROM_read(0x00007F00, (Uint32)MacAddr, 8); printf("Using MAC Address: %02x-%02x-%02x-%02x-%02x-%02x\n", MacAddr[0], MacAddr[1], MacAddr[2], MacAddr[3], MacAddr[4], MacAddr[5]); for(i=0;i<6;i++) { printf("%x\n", MacAddr[i]); } /* Software breakpoint */ asm(" .long 0x10000000"); }