Forum Discussion
Altera_Forum
Honored Contributor
17 years agoGot it, I wish I got it 4 weeks ago, but I am still elated. This is sloppy and I haven't fine tuned it; but calling DM9000_Init() in the ISR keeps the program running. Here is some sample code:
# include "basic_io.h"# include "test.h"# include "LCD.h"# include "DM9000A.C" # define DE2_8_7Segs_BASE 0x01901028 unsigned int aaa,rx_len,i,packet_num; unsigned char RXT[68]; void ethernet_interrupts() { packet_num++; aaa=ReceivePacket (RXT,&rx_len); DM9000_init(); } int main(void) { unsigned int Success; unsigned char TXT[] = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x01,0x60,0x6E,0x11,0x02,0x0F, 0x08,0x00,0x11,0x22,0x33,0x44, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x55,0x66,0x77,0x88,0x99,0xAA, 0x00,0x00,0x00,0x20 }; //Initialize the LCD. LCD_Init(); //Test the LCD. //LCD_Test(); Success = DM9000_init(); LCD_Show_Text(""); if (Success == DMFE_SUCCESS) { //Tell the user if the DM9000A initialize or failed. LCD_Show_Text("DM9000A"); LCD_Line2(); LCD_Show_Text("Initialized."); alt_irq_register( DM9000A_IRQ, NULL, (void*)ethernet_interrupts ); } else { LCD_Show_Text("DM9000 Failed."); } //printf("Device initialization complete."); packet_num=0; //Main loop. while (Success == 0) { Success = TransmitPacket(TXT,0x40); msleep(500); outport(DE2_8_7SEGS_BASE ,packet_num); } LCD_Show_Text("TX Failed."); return 0; } //-------------------------------------------------------------------------