Ignore:
Timestamp:
Sep 21, 2018, 10:21:42 PM (6 years ago)
Author:
nicolas.van.phan@…
Message:

TTY MUX 4 : Multiplex TTY character sending

Now, when a thread wants to write to a tty,
when the dev_txt_write() or dev_txt_sync_write() are called,
they all call soclib_mtty_aux() with a channel number.
The soclib_mtty_aux() function will write the string char by char,
with each char preceded by the channel number, so that the receiving end
knows to which tty a character is addressed to.

N.B. dev_txt_write() makes *synchronous* writes for the moment
because unlike the vci_tty_tsar, the vci_multi_tty doesn't raise
interrupt except when a new char is received, so we can't use the
interrupt mechanism for writes.

N.B. Now, the TTY DEV threads all write to the same register (WRITE),
but when a thread sends a 2-byte (tty dest. nb. + char), the two must be
send consecutively, without another thread sending a byte in between.
Consequently, a lock has been added to guarantee this atomicity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r536 r539  
    8888chdev_t              txt0_chdev                              CONFIG_CACHE_LINE_ALIGNED;
    8989
     90// This variable defines the TXT0 lock for writing characters to MTY0
     91__attribute__((section(".kdata")))
     92spinlock_t           txt0_lock                               CONFIG_CACHE_LINE_ALIGNED;
     93
    9094// This variables define the kernel process0 descriptor
    9195__attribute__((section(".kdata")))
     
    282286    dev_tbl = info->int_dev;
    283287
     288    // Initialize spinlock for writing to MTY0
     289    spinlock_init(&txt0_lock);
     290   
    284291    // Loop on internal peripherals of cluster (0,0) to find MTY0
    285292    for ( i = 0; i < dev_nr; i++ )
Note: See TracChangeset for help on using the changeset viewer.