Forum Discussion
Altera_Forum
Honored Contributor
21 years agoOpencores MAC 10/100 Driver
Hi Everyone
Please feel free to use these files and/or comment on them. I've written them as a driver for the opencores mac solution. I have been using them with the lwip web server example that comes with the nios II installation and they seems to work. I've attached a zip file with three files in it: OpenCores_Ethernet_MAC_regs.h - contains the definitions of the registers inside the opencores MAC component. OpenCores_Ethernet_MAC.c and the matching h file is the actual driver. I've used these files in conjuction with files that come with the Nios installation, which I can't post here for obvious reasons. What I did was to make a copy of the altera_avalon_lan91c111 directory, name it accordingly and replace the file in the HAL\inc and HAL\src as well as the regs file in the inc directory with the file I've attached. I hope this helps someone. Nir24 Replies
- Altera_Forum
Honored Contributor
I think i have my PHY file almost completed, but I have one last problem that I can't solve. How do I determine the Physical address of my PHY? I looked on my data sheet but all i can find is data on the 5 pins that control it saying that it supports 32 address (2^5). Is there set default for all these devices, or is this an arbitrary number since I only have 1 PHY device and 1 MAC device?
//edit: I found on an ST data sheet (I'm using a TDK) that the register values are obtained on power on/reset by latching the address pins. Is this standard for all PHYs? Thanks, Jon - Altera_Forum
Honored Contributor
Sorry for that.
Here it is - Altera_Forum
Honored Contributor
Hi Manish
You should find it under your installation path, but in case you don't here is the one I have. Nir - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by nir@May 11 2005, 05:38 PM helloregarding question number 1, you are right and the mentioned h file should be included.
regarding question number 2: i have not tested this code with ucos, so i can't say if it works and how.
nir --- Quote End --- From where do we get alt_ethernet_dev.h?
- Altera_Forum
Honored Contributor
Hello
Regarding question number 1, you are right and the mentioned h file should be included. Regarding question number 2: I have not tested this code with ucos, so I can't say if it works and how. Nir - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by nir@Jan 4 2005, 04:49 PM hi everyoneplease feel free to use these files and/or comment on them. i've written them as a driver for the opencores mac solution. i have been using them with the lwip web server example that comes with the nios ii installation and they seems to work.
i've attached a zip file with three files in it:
opencores_ethernet_mac_regs.h - contains the definitions of the registers inside the opencores mac component.
opencores_ethernet_mac.c and the matching h file is the actual driver.
i've used these files in conjuction with files that come with the nios installation, which i can't post here for obvious reasons. what i did was to make a copy of the altera_avalon_lan91c111 directory, name it accordingly and replace the file in the hal\inc and hal\src as well as the regs file in the inc directory with the file i've attached. i hope this helps someone.
nir --- Quote End --- Hi Nir, I have few things to ask you for Opencores Ethernet Hal Driver 1) In case of ucosII is not there I think you one more file is missing that is "alt_ethernet_dev.h". This is defined in file "OpenCores_Ethernet_MAC.h" Here is the code excerpt from file "OpenCores_Ethernet_MAC.h" # ifndef __ucosii__ # include <stdlib.h># include <stdio.h># include "alt_types.h"# include "system.h"# include "alt_ethernet_dev.h" . . . . 2) In case of ucosII is there, I couldn't understand from dev structure is initialized. in following macro. Also how routines for initializing Ethernet Ip and Recive Data from interface are initialized if this dev structure is not initialized? # else # define OPENCORES_ETHERNET_MAC_INIT(name, dev) # define OPENCORES_ETHERNET_MAC_INSTANCE(name, dev) # endif /* __ucosii__ */
- Altera_Forum
Honored Contributor
I will try it.
Thank you very much. - Altera_Forum
Honored Contributor
Hi
The driver I've written works with the ST PHY chip called ST100P. If you want it to work with your device, you'll need to create a file similiar to the ST100P.h file for you device, in which you should define the device's registers. YOu also need to make sure you perform any required changes to make Opencores_Ethernet_Mac.c configure the phy chip correctly (look in read_phy, write_phy and configure_phy functions as in any ither function you think may need a change. I hope this helps. Nir - Altera_Forum
Honored Contributor
Hi nir,
The PHY on my Mtx.board is TDK 78Q2120-64T. LiangYi. - Altera_Forum
Honored Contributor
Hi LiangYi
What kind of PHY chip do you have on the Mtx board ? Nir