Re: pthread_suspend_np() and interrupt : system block

V C R <[email protected]> Tue, 12 Apr 2005 07:06:15 +0530
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
Hi

Could you post the code somewhere I could have a look at it ? I
remember coming up against something like this much earlier and maybe
I could help.

Regards

VC

On Apr 11, 2005 8:11 PM, pm.boyer <[email protected]> wrote:
> Thank you for your reply,
> but i must explain you more exactly my software.
> 
> I use only one rt-thread, which is blocked (and all the system with) when
> it enter in the pthread_suspend_np().
> 
> ( I want to use a rt-driver inside RTLinux. )
> 
> This rt-thread use a driver to send data to a PCI sound card.
> ( the sound card is Sound Blaster PCI 128 and i have modified a linux
>      driver (es1371.c) by changing some linux call by rt-linux call ( like
>      request_irq() by rtl_request_irq() ...)
> 
> Exactly i have two modules : one for the rt-driver ( with init_module(),
> cleanup_module() and open(), close(), read(), write(), ioctl() functions to
> access the audio card ), and one where in the init_module i open the audio
> device and create a rt-thread that send audio-buffers whith the write function
> to the audio card whith the write function of the driver ).
> 
> The driver use a DMA ring-buffer to send/receive data to the PCI audio card,
> and an interrupt handler is installed and used by the audio card to inform
> the driver after access to the DMA buffer.
> 
> The write function in the driver, write data (to send to the card) in the DMA
> ring-buffer, and when the buffer is full, it call phtread_suspend_np() to wait
> the card read the data from the ring-buffer through the PCI bus, when some data
> are read and then space freed, the card throw an interrupt, and in the interrupt
> handler the rt-thread is awakened, and then the rt-thread can continue to write
> the next data to the ring-buffer.....( normally ! because this don't work )
> 
> This don't work. When the rt-thread enter in the pthread_suspend_np() function
> all the system (Linux and RTLinux) block, there is no interrupt fired to wakeup
> the thread, my keyboard no respond, system die.
> But if i replace the pthread_suspend_np() function by usleep() function, all
> work good, all seems ok ( no blocking ).
> 
> I have looked into the pthread_suspend_np() and usleep() functions, and i have
> saw that they use rtl_schedule() functions too. I have put some rtl_printf()
> into the rtl_schedule(), and to see which is the caller, i have rtl_printf-ed
> the priority of the calling thread. (my rt-thread have priority = 4 ).
> And i have saw that, some time a thread (?) whith a priority = -1 calls
> rtl_schedule().
> When i use usleep(), in place of pthread_suspend_np(), during the call of
> usleep, into the rtl_schedule my thread whith priority 4 is replaced with
> a thread with priority -1, but all seems ok and work good, my calling thread
> leave usleep normally at the end of sleeping time (10ms).
> But when i use pthread_suspend_np(), in the first call of rtl_schedule(), my
> thread is replaced by thread of priority -1, but leave normally the rtl_schedule
> function, then another call to rtl_schedule is done whith priority -1, executed
> normally, ----> but after it has left the rtl_schedule function : all block !
> system die. !!!!!!
> 
> Is some body can understand some thing, can help me ?
> 
> Tanks.
> 
> PS : i use RTLinux 3.2-pre1 whith linux kernel 2.4.19.
>
_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/