I tried the rt_com package 0.3.1 with 2.0.36 rtlinux kernel.
There are two problems with the com driver, that I donīt understand.
Here is my module, whic his using the rt_com driver and following two
problems.
the module using rt_com:
/********************************************************************/
void fun(int t) {
  char szReadBuffer[ BUFFER_SIZE],
    szWriteBuffer[ BUFFER_SIZE];
    int iRead;
        while( __fRun){
          // read in from the fifo and write it to the serial com.
          iRead= rtf_get(0, szWriteBuffer, BUFFER_SIZE);
          if ( iRead> 0 && iRead<= BUFFER_SIZE) {
            printk( KERN_WARNING "Write %d Bytes\n", iRead);
            rt_com_write( 0, szWriteBuffer, iRead);
            printk( KERN_WARNING "Came back from rt_com_write.\n");
          }
          else{
            if (iRead!= 0){
              printk( KERN_WARNING "rtf_get, rc=%d.\n", iRead);
            }
          }
          // read in from serial com and write it to the fifo.
          iRead=rt_com_read( 0, szReadBuffer, BUFFER_SIZE);
          if (iRead>0 && iRead<= BUFFER_SIZE){
            rtf_put( 1, szReadBuffer, iRead);         
          }
          else{
            if ( iRead!= 0){
              printk( KERN_WARNING "rt_com_read rc=%d.\n", iRead);
            }
          }

          rt_task_wait();

        }
}


int init_module(void)
{
 
  RTIME now = rt_get_time();
  __fRun= true;
  if (rtf_create(0, 4000)==-1)
    {
    printk( KERN_WARNING "Could not create fifo 0\n");
    return -1;  
    }
  if (rtf_create(1, 4000)==-1)
    {
    printk( KERN_WARNING "Could not create fifo 1\n");
    return -1;  
    }
  // setup the com port baud rate
  rt_com_setup( 0, 19200, RT_COM_PARITY_NONE, 1, 8);
  /* this task will be setting the bit */
  rt_task_init(&mytask, fun, 0xffff, 3000, 4);

  rt_task_make_periodic(&mytask, now + 3000, 1000);
  return 0;
}


void cleanup_module(void)
{

  rt_task_delete(&mytask);
  rt_com_setup( 0, 0, RT_COM_PARITY_NONE, 1, 8);
  rtf_destroy(0);
  rtf_destroy( 1);
        
}
/***************************************************************/

the printk statement in rt_com.c:

        do {
                /* get available data from port */
                sta = inb(B+RT_COM_LSR);
                while(sta & DATA_READY) {
                        data = inb(B+RT_COM_RXB);
                        rt_com_irq_put(p,data);
                        sta = inb(B+RT_COM_LSR);
                };
                /* if possible, put data to port */

                sta = inb(B+RT_COM_MSR);
                if(sta & 0x20) {
                        /* Data Set Ready */
---->               printk(KERN_WARNING "mark 1\n");
                        if( rt_com_irq_get( p, &data ) ) {
                                /* data in output buffer */
/*******************************************************************/

1. I can receive via rt_com_read from the serial line but not write.
As far as I can see the irq handler comes never to the point of the 
printk statement, but before the if statement two lines above.
What is wrong ?

2. After Iīve loaded and unloaded the above module, which is using the
rt_com driver, it isnīt possible anymore to unload the rt_com driver and
I have to reboot.

Thanks,

Bernd Potzkai
[EMAIL PROTECTED]
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to