Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Problem in accessing LAN91C111 registers

Hi,

I have instantiated the LAN91C111 controller provided by Altera in my system.

I am trying to access the registers of LAN91C111 chip with macros provided by Altera.

I am not able to read the registers. I have pasted the C code which i used to access the registers. Please let me know if my C' code has some problem. Let me know if any initialization sequence is required for LAN91C111 to come up.

# include <stdio.h># include <io.h># include <string.h># include "system.h"# include "altera_avalon_lan91c111_regs.h"

int main(void)

{

int a,b,c;

// Select Bank1

IOWR_ALTERA_AVALON_LAN91C111_BSR(LAN91C111_LAN91C111_BASE,0x01);

IOWR_ALTERA_AVALON_LAN91C111_CR(LAN91C111_BASE,0xA0B1

a=IORD_ALTERA_AVALON_LAN91C111_CR(LAN91C111_BASE);

printf("Configuration Register = %x\n",a);

// Read Control Reg

b=IORD_ALTERA_AVALON_LAN91C111_CTR(LAN91C111_BASE);

printf("Control Register default = %x\n",a);

// Write 1214 in control register

IOWR_ALTERA_AVALON_LAN91C111_CTR(LAN91C111_BASE,0x1214);

b=IORD_ALTERA_AVALON_LAN91C111_CTR(LAN91C111_BASE);

printf("Control Register = %x\n",a);

return(0);

}
No RepliesBe the first to reply