0

Scenario : Client is sending a data and the server is receving the data from client via ethernet layer (udp). When the server receives a data from the client on the ip layer (kernel). It interrupts the kernel and kernel as to execute the data by the client, so I want to create a interrupt service function to catch the interrupt from the network service card.

could someone help me how to go about it ?

user3458454
  • 291
  • 1
  • 4
  • 20
  • Which part is real-time? – Shahbaz Mar 25 '14 at 12:13
  • server is real time operating system – user3458454 Mar 25 '14 at 12:14
  • It may be useful to say what real-time operating system it is! – Shahbaz Mar 25 '14 at 12:16
  • real time linux or qnx real time operating system – user3458454 Mar 25 '14 at 12:17
  • so you want to read network data directly from the ethernet card instead of relying on the built-in drivers to do it for you? – Alnitak Mar 25 '14 at 12:19
  • Network card will interrupt the linux or qnx kernel. I have to handle this interrupt - could you tell me how ?? I already created a ethernet interface and it is receving the data but when server receives the data from the client the server client should stop what it is doing and start execute this. – user3458454 Mar 25 '14 at 12:25
  • Well, set a semaphore in the interrupt-handler and request a reschedule on exit. The server client thread waits on the semaphore. Something like that, anyway. Linux drivers have a well-defined structure, don't they? – Martin James Mar 25 '14 at 12:47
  • I am using rt linux and someone can give me a small example for this ? – user3458454 Mar 25 '14 at 13:10
  • @user3458454 I doubt it because interrupt handlers, loading vectors and configuring interrupt-controllers is hardware-specific. – Martin James Mar 25 '14 at 13:13
  • I am using x86 target. – user3458454 Mar 25 '14 at 13:18
  • Since you want the code to be run on both QNX and RTLinux (you meant RTLinux by real-time Linux, right?) you have to write in standard POSIX and be very careful, since for QNX it would be compiled as a user-space application and on RTLinux it's a kernel module. That said, you should be looking on how (and if, since I'm not sure) you can install an ISR through the POSIX API. – Shahbaz Mar 25 '14 at 13:27
  • QNX and RT linux is a microkernel - isnt it ?? – user3458454 Mar 25 '14 at 13:39
  • Yes, but to write code using RTLinux you need to code in kernel space and with kernel modules. With QNX, you can't write kernel modules (the kernel is not open) and you have real-time in user-space. I may be mistaken, but that was my understanding. – Shahbaz Mar 25 '14 at 15:01
  • Read [Advanced Linux Programming](http://advancedlinuxprogramming.com/) notably about `SIGIO` and [poll(2)](http://man7.org/linux/man-pages/man2/poll.2.html) – Basile Starynkevitch Mar 25 '14 at 18:20
  • @BasileStarynkevitch: Is it possible to use poll ?? my requirement is that I am receiving a data from client on ethernet layer and network interface card interrupts the hardware- I should have the interrupt service routine to handle this. – user3458454 Mar 26 '14 at 08:39

1 Answers1

0

Like Alnitak above, I question that you really want to bypass the networking services of your operating system(s), which are real-time after all. So, I suggest you follow Basile Starynkevitch's advice and use poll, select or even just recv from a task with adequate scheduling policy and priority.

Armali
  • 18,255
  • 14
  • 57
  • 171