Board.KolibriOS.org

Official KolibriOS board
It is currently Thu Feb 27, 2020 11:46 am

All times are UTC+03:00




Post new topic  Reply to topic  [ 9 posts ] 
Author Message
 Post subject: My little idea
PostPosted: Mon Dec 27, 2010 4:00 am 
Offline

Joined: Mon Dec 27, 2010 3:40 am
Posts: 5
Hi

I'm a rusty asm coder ( nowadays sysadmin on a datacenter :( ). Ok, i have been programming in asm a long time ago but i'm beginning a new challenge.

First - Give thanks to all of you for making this possible. KoOS is really incredible. Like a dream. Thanks. Thank you so much.

Second - I've got some documentation and i think i could try to make the e100/1000 driver. Now i have de DOS drivers, linux e100 stable sources e1000 stable sources etc... (anyone can get it on internet)

Does anyone could help me about network driver coding requirements or a "start point"?

Third - I have an old handy PC... well... this one -> http://aleasoft.iespana.es/dot.html and i will feel very happy when it works fully KoOS

Fourth - I'm Spanish! (well... really Galician) - Sorry about my english. OK, OK, maybe I could help to do the spanish translation.

Thank you again.

Happy 2011


Top
   
 Post subject: Re: My little idea
PostPosted: Mon Dec 27, 2010 11:14 am 
Offline
Mentor
User avatar

Joined: Mon Oct 19, 2009 10:58 am
Posts: 460
Hi, InterNick!

I think you should read this. And try contact hidnplayr - he needs your help, we need your code! :wink:

Network subsystem has a lot of work to do. It is really good 'little idea' to improve it.

Happy 2011,
and sorry for my English too


Top
   
 Post subject: Re: My little idea
PostPosted: Mon Dec 27, 2010 11:57 am 
Offline
Mentor
User avatar

Joined: Tue Jan 15, 2008 11:27 am
Posts: 753
Hi, InterNick!
May be this could be helpful for you...
http://wiki.kolibrios.org/wiki/Writing_ ... _KolibriOS


Top
   
 Post subject: Re: My little idea
PostPosted: Mon Dec 27, 2010 12:04 pm 
Offline
User avatar

Joined: Fri Jun 27, 2008 3:22 pm
Posts: 988
Hi InterNick!

Quote:
Second - I've got some documentation and i think i could try to make the e100/1000 driver. Now i have de DOS drivers, linux e100 stable sources e1000 stable sources etc... (anyone can get it on internet)

Does anyone could help me about network driver coding requirements or a "start point"?


Currently all net drivers are built in KolibriOS kernel. You can take a look at them for example here.
Many of these drivers were done with the help of etherboot drivers source, which you can find here(see "src\drivers\net\e1000" directory or "src\drivers\net\e1000e"). So I suggest you also to write driver with the help of etherboot driver source.
For the first you have to find your card PCI VID and DID and find which module (e1000_82540, e1000_82541, e1000_82542 or e1000_82543) in that directory is for your card (see pci_device_id structure at the bottom of a module). The other files in that directory are common to all e1000 cards.
Second - I assume that you can read in C language so you can understand that code.
You have to understand the stucture of that driver. So how to do it? I use my own method of "Call tree" and suggest it to you, but of cause you can use any method you like.

"Call tree" method.
For the first get a pen and a piece of paper.
Step 1. File structure.
You have to write names of all modules that belong your driver on paper and give every module a unical Latin capital symbol, i.e.
Code:
A. e1000.c
B. e1000.h
C.  e1000_82540.c
D.  e1000_api.c
E. e1000_api.h
F. e1000_defines.h
G. e1000_hw.h
H. e1000_mac.c
I. e1000_mac.h
J. e1000_main.c
K. e1000_manage.c
L. e1000_manage.h
M. e1000_nvm.c
N. e1000_nvm.h
O. e1000_osdep.h
P. e1000_phy.c
Q. e1000_phy.h
R. e1000_regs.h

Choose among these modules that have functions' and macroses' definitions and enumerate all functions and macroses (its names) that module contain. Be carefull and don't skip any function or macros !
Example:
Code:
C.  e1000_82540.c
1.  e1000_init_phy_params_82540
2.  e1000_init_nvm_params_82540
3.  e1000_init_mac_params_82540
4.  e1000_init_function_pointers_82540
5.  e1000_reset_hw_82540
6.  e1000_init_hw_82540
7.  e1000_setup_copper_link_82540
8.  e1000_setup_fiber_serdes_link_82540
9.  e1000_adjust_serdes_amplitude_82540
10. e1000_set_vco_speed_82540
11. e1000_set_phy_mode_82540
12. e1000_power_down_phy_copper_82540
13. e1000_clear_hw_cntrs_82540
14. e1000_read_mac_addr_82540


After you enumerate all function/macros definitions in all modules (that contain it) you can go to step 2.

Step 2. Call tree
Final step where you have to build a tree of function/macros calls.
We start to build tree from the root which is the entry point of the driver. In this case e1000_probe in e1000_main.c.

Level 0

e1000_probe
|- alloc_etherdev
|- netdev_init
|- pci_set_drvdata
|- netdev_priv
|- pci_bar_start
|- pci_bar_size
|- adjust_pci_device
|- ioremap
|- e1000_sw_init
|- e1000_init_mac_params
|- e1000_init_nvm_params
|- e1000_init_phy_params
|- e1000_reset_hw
|- e1000_validate_nvm_checksum
|- e1000_read_mac_addr
|- e1000_reset
|- netdev_link_up
|- register_netdev
|- e1000_check_reset_block
|- e1000_phy_hw_reset
|- iounmap
|- netdev_put

Place function names into subtree in order.
Place every function name only once in the current function subtree even if a function called several times whithin this function.

Level 1 would contain all function that were called in Level 0. For every such function you have to build its own tree.
After you complete Level 1, you go to Level 2 where you build subtrees of all functions that are called on Level 1, and were not already build on previous levels then to Level 3 and so on until you reach the bottom (or heap) of the tree. Leafs of the tree are the most simple and base functions. Of cause you don't need to include into your tree standard functions such as memcpy, alloc etc. You also don't have to build subtree of functions that are external to your driver, but if you don't understand what they do you have to take a look at them later.

After your "Call tree" build complete, you can filter functions that are not used at all, wrappers etc. You also can change function names in the Call tree to their "code names" i.e. instead of e1000_reset_hw_82540 write C5, instead of e1000_probe write J24 etc.

This method helps to understand abstraction layers of any code easier.

Also note that in the future new network stack will be integrated into the KolibriOS official brunch.


Top
   
 Post subject: Re: My little idea
PostPosted: Mon Dec 27, 2010 2:24 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
The site you linked to tries to download a trojan horse, do you know that?!

The intel eepro100 (8255xx) card is already supported in current KolibriOS. (I'm working on the new driver)
The eepro1000 (8254xx) is quite a big driver in linux, havent looked at the sources recently but it might have somethign to do with a lot of offload engines etc.
(Things that arent strictly nescessary)
So you can decide to port the etherboot driver to the current kernel (wich might be less work now, and the code can be re-used to port it to net branch later)
Or you could decide to write it for the new stack right away.

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: My little idea
PostPosted: Tue Dec 28, 2010 1:39 am 
Offline

Joined: Mon Dec 27, 2010 3:40 am
Posts: 5
Woah!!!!

thank you sooo much!!! hidnplayr sorry, i didn't know about the trojan horse in that site (sorry, i'm not antivirus friendly)

Thanks to all of you. I'm planning my work and i have about 48 hours / month (6 days * 8 hours) to spend in this project. To enjoy this project.

:) it's an honour to see your replies in my first post


Top
   
 Post subject: Re: My little idea
PostPosted: Tue Dec 28, 2010 1:56 am 
Offline

Joined: Mon Dec 27, 2010 3:40 am
Posts: 5
ehmm...

i registered an account in the redmine but it doesn't send me an email...

you will be laughing now ( :) )

if anyone could help... my email internick.internick@gmail.com

Thanks


Top
   
 Post subject: Re: My little idea
PostPosted: Tue Dec 28, 2010 2:03 am 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
It's hand activated (moderated) IIRC

Is your 'little idea' finished already? ;)

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: My little idea
PostPosted: Tue Dec 28, 2010 2:17 am 
Offline

Joined: Mon Dec 27, 2010 3:40 am
Posts: 5
finished? not at all! i'm a koos newbie, remember :) i'm taking a look now to your new stack and thinking "wow! where i should start!?"

...

Ok. The holidays are over.

Let's go to read, read, read and then let's try it!

Thank you again

Happy new year


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 9 posts ] 

All times are UTC+03:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited