Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 69b68d1f in mainline


Ignore:
Timestamp:
2009-11-08T20:05:48Z (12 years ago)
Author:
Pavel Rimsky <pavel@…>
Branches:
lfn, master
Children:
70a1c59
Parents:
74cbac7
Message:

Kernel input driver implemented, now the kconsole is usable.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r74cbac7 r69b68d1f  
    428428
    429429% Serial line input module
    430 ! [CONFIG_DSRLNIN=y|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&MACHINE=serengeti&CONFIG_SGCN_KBD=y)] CONFIG_SRLN (y)
     430! [CONFIG_DSRLNIN=y|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&MACHINE=serengeti&CONFIG_SGCN_KBD=y)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
    431431
    432432% EGA support
  • kernel/arch/sparc64/include/drivers/niagara.h

    r74cbac7 r69b68d1f  
    3636#define KERN_sparc64_NIAGARA_H
    3737
     38#include <proc/thread.h>
     39#include <console/chardev.h>
     40
     41typedef struct {
     42        thread_t *thread;
     43        indev_t *srlnin;
     44} niagara_instance_t;
     45
    3846char niagara_getc(void);
    3947void niagara_grab(void);
    4048void niagara_release(void);
    41 void niagara_init(void);
    42 void niagara_poll(void);
     49niagara_instance_t *niagarain_init(void);
    4350
    4451#endif
  • kernel/arch/sparc64/src/drivers/niagara.c

    r74cbac7 r69b68d1f  
    4141#include <ddi/device.h>
    4242#include <arch/asm.h>
     43#include <arch.h>
    4344#include <mm/slab.h>
    4445#include <arch/drivers/kbd.h>
     
    4647#include <sysinfo/sysinfo.h>
    4748#include <ipc/irq.h>
     49#include <print.h>
     50#include <proc/thread.h>
     51#include <console/console.h>
     52#include <genarch/srln/srln.h>
     53
     54#define POLL_INTERVAL  10000
    4855
    4956/**
     
    5562 */
    5663#define FICTIONAL_INR           1
     64
     65
     66static niagara_instance_t *instance = NULL;
    5767
    5868/* functions referenced from definitions of I/O operations structures */
     
    7888 * the mapped buffer. The shared buffer definition follows.
    7989 */
     90/*
    8091#define OUTPUT_BUFFER_SIZE      ((PAGE_SIZE) - 2 * 8)
    8192static volatile struct {
     
    8798        __attribute__ ((aligned(PAGE_SIZE)))
    8899        output_buffer;
     100*/
    89101
    90102#if 0
     
    197209}
    198210
     211#endif
     212
    199213/**
    200214 * Function regularly called by the keyboard polling thread. Asks the
     
    202216 * and sends it to the upper layers of HelenOS.
    203217 */
    204 void niagara_poll(void)
    205 {
     218static void niagara_poll(niagara_instance_t *instance)
     219{
     220        /*
    206221        while (output_buffer.read_ptr != output_buffer.write_ptr) {
    207222                do_putchar(output_buffer.data[output_buffer.read_ptr]);
     
    209224                        ((output_buffer.read_ptr) + 1) % OUTPUT_BUFFER_SIZE;
    210225        }
     226        */
    211227
    212228        uint64_t c;
    213229
    214230        if (__hypercall_fast_ret1(0, 0, 0, 0, 0, CONS_GETCHAR, &c) == EOK) {
     231                indev_push_character(instance->srlnin, c);
     232                #if 0
    215233                ipl_t ipl = interrupts_disable();
    216234                spinlock_lock(&niagara_irq.lock);
     
    235253                                chardev_push_character(&niagara_io, '\n');
    236254                }
    237         }
    238 
    239 }
    240 
    241 #endif
     255                #endif
     256        }
     257
     258}
     259
     260/**
     261 * Polling thread function.
     262 */
     263static void kniagarapoll(void *instance) {
     264        while (true) {
     265                //MH
     266                //if (!silent)
     267                        niagara_poll(instance);
     268               
     269                thread_usleep(POLL_INTERVAL);
     270        }
     271}
    242272
    243273/**
     
    245275 * input/output is used.
    246276 */
    247 void niagara_init(void)
    248 {
     277static void niagara_init(void)
     278{
     279        if (instance)
     280                return;
     281       
     282        instance = malloc(sizeof(niagara_instance_t), FRAME_ATOMIC);
     283       
     284        if (instance) {
     285                instance->thread = thread_create(kniagarapoll, instance, TASK, 0,
     286                        "kniagarapoll", true);
     287               
     288                if (!instance->thread) {
     289                        free(instance);
     290                        instance = NULL;
     291                        return;
     292                }
     293        }
     294
     295        instance->srlnin = NULL;
     296
    249297        #if 0
    250298        kbd_type = KBD_SUN4V;
     
    269317         * niagara fb driver can communicate with kernel using a shared buffer.
    270318         */
    271         output_buffer.read_ptr = 0;
    272         output_buffer.write_ptr = 0;
     319        //output_buffer.read_ptr = 0;
     320        //output_buffer.write_ptr = 0;
    273321
    274322        #if 0
     
    296344}
    297345
     346/**
     347 * A public function which initializes input from the Niagara console.
     348 */
     349niagara_instance_t *niagarain_init(void)
     350{
     351        niagara_init();
     352
     353        // TODO - move to console init
     354        if (instance) {
     355                srln_instance_t *srln_instance = srln_init();
     356                if (srln_instance) {
     357                        indev_t *sink = stdin_wire();
     358                        indev_t *srln = srln_wire(srln_instance, sink);
     359
     360                        // wire std. input to niagara
     361                        instance->srlnin = srln;
     362                        thread_ready(instance->thread);
     363                }
     364        }
     365        return instance;
     366}
     367
    298368/** @}
    299369 */
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    r74cbac7 r69b68d1f  
    9090                irq_init(1 << 11, 128);
    9191        }
    92         niagara_init();
    9392}
    9493
     
    105104        //MH
    106105        //standalone_sparc64_console_init();
     106        niagarain_init();
    107107}
    108108
Note: See TracChangeset for help on using the changeset viewer.