Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Problem in accessing LAN91C111 registers

Altera_Forum
Honored Contributor II
1,000 Views

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); 

}
0 Kudos
0 Replies
Reply