Changeset 247


Ignore:
Timestamp:
Jul 20, 2017, 1:04:15 PM (4 years ago)
Author:
max@…
Message:

Rename soclib_tty->txt_rs232.

Location:
trunk
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.x86

    r236 r247  
    2929
    3030# Objects to be linked for the soclib drivers library
    31 DRIVERS_OBJS = build/kernel/drivers/soclib_tty.o  \
    32                build/kernel/drivers/soclib_mmc.o  \
     31DRIVERS_OBJS = build/kernel/drivers/soclib_mmc.o  \
    3332               build/kernel/drivers/soclib_xcu.o  \
    3433               build/kernel/drivers/ioc_ata.o     \
    3534               build/kernel/drivers/pic_apic.o    \
     35               build/kernel/drivers/txt_rs232.o   \
    3636               build/kernel/drivers/soclib_nic.o  \
    3737               build/kernel/drivers/soclib_dma.o  \
  • trunk/hal/x86_64/core/hal_drivers.c

    r245 r247  
    2525#include <hal_internal.h>
    2626
    27 #include <soclib_tty.h>
    2827#include <soclib_xcu.h>
    2928#include <ioc_ata.h>
    3029#include <pic_apic.h>
     30#include <txt_rs232.h>
    3131
    3232void hal_drivers_txt_init(chdev_t *txt, uint32_t impl)
    3333{
    34         soclib_tty_init(txt);
     34        txt_rs232_init(txt);
    3535}
    3636
  • trunk/hal/x86_64/drivers/txt_rs232.c

    r244 r247  
    11/*
    2  * soclib_tty.c - soclib tty driver implementation.
     2 * txt_rs232.c - RS232 driver implementation
    33 *
    4  * Author  Alain Greiner (2016)
     4 * Copyright (c) 2017 Maxime Villard
    55 *
    6  * Copyright (c)  UPMC Sorbonne Universites
     6 * This file is part of ALMOS-MKH.
    77 *
    8  * This file is part of ALMOS-MKH..
    9  *
    10  * ALMOS-MKH. is free software; you can redistribute it and/or modify it
     8 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    119 * under the terms of the GNU General Public License as published by
    1210 * the Free Software Foundation; version 2.0 of the License.
    1311 *
    14  * ALMOS-MKH. is distributed in the hope that it will be useful, but
     12 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1513 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1614 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1816 *
    1917 * You should have received a copy of the GNU General Public License
    20  * along with ALMOS-MKH.; if not, write to the Free Software Foundation,
     18 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2119 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2220 */
     
    2422#include <dev_txt.h>
    2523#include <chdev.h>
    26 #include <soclib_tty.h>
     24#include <txt_rs232.h>
    2725#include <remote_spinlock.h>
    2826#include <thread.h>
     
    3129#include <hal_internal.h> // XXX
    3230
    33 void soclib_tty_init( chdev_t * chdev )
     31void txt_rs232_init(chdev_t *chdev)
    3432{
    35         chdev->cmd = &soclib_tty_cmd;
    36         chdev->isr = &soclib_tty_isr;
     33        chdev->cmd = &txt_rs232_cmd;
     34        chdev->isr = &txt_rs232_isr;
    3735
    3836        // nothing to do
     
    4139// Pour le write: tout en sync, ça part direct sur le VGA/série
    4240// Pour le read: là on attend l'ISR
    43 void __attribute__ ((noinline)) soclib_tty_cmd( xptr_t th_xp )
     41void txt_rs232_cmd(xptr_t th_xp)
    4442{
    4543        // get client thread cluster and local pointer
     
    5553        chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    5654
    57         // get extended pointer on SOCLIB_TTY base segment
     55        // get extended pointer on base segment
    5856        xptr_t tty_xp = (xptr_t)hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) );
    5957
    60         // get SOCLIB_TTY base segment cluster and local pointer
     58        // get base segment cluster and local pointer
    6159        cxy_t      tty_cxy = GET_CXY( tty_xp );
    6260        uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp );
     
    9492}
    9593
    96 void __attribute__ ((noinline)) soclib_tty_isr( chdev_t * chdev )
     94void txt_rs232_isr(chdev_t *chdev)
    9795{
    9896        // Cette ISR est juste utile pour le clavier; on arrive ici quand une touche
    9997        // est pressée
    100         x86_panic("soclib_tty_isr not handled");
     98        x86_panic("txt_rs232_isr not handled");
    10199}
    102100
  • trunk/hal/x86_64/drivers/txt_rs232.h

    r239 r247  
    11/*
    2  * soclib_tty.c - soclib tty driver definition.
     2 * txt_rs232.c - RS232 driver definitions
    33 *
    4  * Author  Alain Greiner (2016)
    5  *
    6  * Copyright (c)  UPMC Sorbonne Universites
     4 * Copyright (c) 2017 Maxime Villard
    75 *
    86 * This file is part of ALMOS-MKH.
     
    1816 *
    1917 * You should have received a copy of the GNU General Public License
    20  * along with ALMOS-kernel; if not, write to the Free Software Foundation,
     18 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2119 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2220 */
     
    2422#include <dev_txt.h>
    2523#include <chdev.h>
    26 #include <spinlock.h>
    2724
     25void txt_rs232_init(chdev_t *chdev);
     26void txt_rs232_cmd(xptr_t thread_xp);
     27void txt_rs232_isr(chdev_t *chdev);
    2828
    29 /****************************************************************************************
    30  * This driver supports the soclib_multi_tty component.
    31  * It implements the generic TXT device API:
    32  * - transfer one single character from TTY to command "buffer" if to_mem is non-zero.
    33  * - transfer "count" characters from command "buffer" to TTY if "to_mem is zero.
    34  ***************************************************************************************/
    35 
    36 /****************************************************************************************
    37  *     SOCLIB_TTY registers offsets
    38  ***************************************************************************************/
    39 
    40 #define TTY_WRITE_REG          0
    41 #define TTY_STATUS_REG         1
    42 #define TTY_READ_REG           2
    43 #define TTY_CONFIG_REG         3
    44 
    45 #define TTY_SPAN               4       // number of registers per channel
    46 
    47 /****************************************************************************************
    48  * masks for TTY_STATUS_REG
    49  ***************************************************************************************/
    50 
    51 #define TTY_STATUS_RX_FULL     1       // TTY_READ_REG full if 1
    52 #define TTY_STATUS_TX_FULL     2       // TTY_WRITE_REG full if 1
    53 
    54 /****************************************************************************************
    55  * masks for TTY_CONFIG_REG
    56  ***************************************************************************************/
    57 
    58 #define TTY_CONFIG_RX_ENABLE   1       // TTY_RX IRQ enabled if 1
    59 #define TTY_CONFIG_TX_ENABLE   2       // TTY_TX IRQ enabled if 1
    60 
    61 /****************************************************************************************
    62  * This function masks both the TTY_RX and TTY_TX IRQs.
    63  * These IRQs are unmasked by the soclib_tty_cmd() function.
    64  ****************************************************************************************
    65  * @ chdev     : pointer on the TXT chdev descriptor.
    66  ***************************************************************************************/
    67 void soclib_tty_init( chdev_t * chdev );
    68 
    69 /****************************************************************************************
    70  * This function handles the command registered in the thread descriptor identified
    71  * by the <xp_thread> argument.
    72  * - For the TXT_READ and TXT_WRITE commands, it only unmask the proper TTY_RX / TTY_TX
    73  *   IRQ, and blocks the TXT device server thread on the THREAD_BLOCKED_DEV_ISR, as the
    74  *   data transfer is done by the ISR.
    75  * - For the TXT_SYNC_READ command, that should be only used by the kernel do display
    76  *   log or debug messages, it directly access the SOCLIB_TTY registers, using
    77  *   a busy waiting policy if required.
    78  ****************************************************************************************
    79  * @ thread_xp : extended pointer on client thread descriptor.
    80  ***************************************************************************************/
    81 void soclib_tty_cmd( xptr_t thread_xp );
    82 
    83 /****************************************************************************************
    84  * This ISR should be executed only for the TXT_READ and TXT_WRITE commands.
    85  * It gets the command arguments from the first client thread in the TXT chdev queue:
    86  * - if TXT_READ, it transfers one byte from the TTY_READ_REG to the command buffer.
    87  *   It simply returns for retry if TTY_READ_REG is empty.
    88  * - if TXT_WRITE, it tries to transfer several bytes from the command buffer to the
    89  *   TTY_WRITE_REG. If the TTY_WRITE_REG is full, it updates the "count" and "buffer"
    90  *   command arguments and returns for retry.
    91  * When the I/O operation is completed, it sets the status field in the command, unblocks
    92  * the server thread, and unblocks the client thread.
    93  ****************************************************************************************
    94  * @ chdev     : local pointer on TXT chdev descriptor.
    95  ***************************************************************************************/
    96 void soclib_tty_isr( chdev_t * chdev );
    97 
  • trunk/kernel/kern/kernel_init.c

    r246 r247  
    5454#include <printk.h>
    5555#include <vfs.h>
    56 #include <hal_drivers.h>
    5756#include <devfs.h>
    5857#include <mapper.h>
    59 #include <soclib_tty.h>
    6058
    6159#define KERNEL_INIT_SYNCHRO  0xA5A5B5B5
Note: See TracChangeset for help on using the changeset viewer.