Changeset 08fed0a in mainline


Ignore:
Timestamp:
2009-03-12T19:16:36Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
29295cd
Parents:
91ea7c4
Message:

Update the SGCN driver to match the latest character I/O changes.

Location:
kernel/arch/sparc64
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/drivers/sgcn.h

    r91ea7c4 r08fed0a  
    119119void sgcn_grab(void);
    120120void sgcn_release(void);
    121 void sgcn_init(chardev_t *);
     121indev_t *sgcnin_init(void);
     122void sgcnout_init(void);
    122123
    123124#endif
  • kernel/arch/sparc64/src/console.c

    r91ea7c4 r08fed0a  
    9797static void serengeti_init(void)
    9898{
    99 #ifdef CONFIG_SRLN
    100         srln_init(stdin);
    101         sgcn_init(&srlnin);
     99#ifdef CONFIG_SGCN_KBD
     100        indev_t *kbrdin;
     101        kbrdin = sgcnin_init();
     102        if (kbrdin)
     103                srlnin_init(kbrdin);
     104#endif
     105#ifdef CONFIG_SGCN_PRN
     106        sgcnout_init();
    102107#endif
    103108}
  • kernel/arch/sparc64/src/drivers/sgcn.c

    r91ea7c4 r08fed0a  
    131131
    132132/* functions referenced from definitions of I/O operations structures */
    133 static void sgcn_noop(chardev_t *);
    134 static void sgcn_putchar(chardev_t *, const char, bool);
    135 static char sgcn_key_read(chardev_t *);
    136 
    137 /** character device operations */
    138 static chardev_operations_t sgcn_ops = {
    139         .suspend = sgcn_noop,
    140         .resume = sgcn_noop,
    141         .read = sgcn_key_read,
     133static void sgcn_putchar(outdev_t *, const char, bool);
     134
     135/** SGCN output device operations */
     136static outdev_operations_t sgcnout_ops = {
    142137        .write = sgcn_putchar
    143138};
    144139
    145 /** SGCN character device */
    146 chardev_t sgcn_io;
    147 
    148 /** Address of the chardev, which is connected to SGCN. */
    149 static chardev_t *sgcnout;
     140/** SGCN input device operations */
     141static indev_operations_t sgcnin_ops = {
     142        .poll = NULL
     143};
     144
     145static indev_t sgcnin;          /**< SGCN input device. */
     146static outdev_t sgcnout;        /**< SGCN output device. */
    150147
    151148/**
     
    204201static void sgcn_buffer_begin_init(void)
    205202{
     203        static bool initialized;
     204       
     205        if (initialized)
     206                return;
     207
    206208        init_sram_begin();
    207209               
     
    220222        sysinfo_set_item_val("sram.buffer.offset", NULL,
    221223            SRAM_TOC->keys[i].offset);
    222 }
    223 
    224 /**
    225  * Default suspend/resume operation for the input device.
    226  */
    227 static void sgcn_noop(chardev_t *d)
    228 {
     224       
     225        initialized = true;
    229226}
    230227
     
    272269 * written straight away.
    273270 */
    274 static void sgcn_putchar(struct chardev * cd, const char c, bool silent)
     271static void sgcn_putchar(outdev_t *od, const char c, bool silent)
    275272{
    276273        if (!silent) {
     
    286283
    287284/**
    288  * Called when actively reading the character. Not implemented yet.
    289  */
    290 static char sgcn_key_read(chardev_t *d)
    291 {
    292         return (char) 0;
    293 }
    294 
    295 /**
    296285 * Grabs the input for kernel.
    297286 */
     
    338327                *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin;
    339328                       
    340                 if (sgcnout)
    341                         chardev_push_character(sgcnout, c);     
     329                indev_push_character(&sgcnin, c);       
    342330        }       
    343331
     
    358346
    359347/**
    360  * A public function which initializes I/O from/to Serengeti console
    361  * and sets it as a default input/output.
    362  */
    363 void sgcn_init(chardev_t *devout)
     348 * A public function which initializes input from the Serengeti console.
     349 */
     350indev_t *sgcnin_init(void)
    364351{
    365352        sgcn_buffer_begin_init();
     
    369356        sysinfo_set_item_val("kbd", NULL, true);
    370357        sysinfo_set_item_val("kbd.type", NULL, KBD_SGCN);
    371         sysinfo_set_item_val("fb.kind", NULL, 4);
    372358
    373359        thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
     
    376362        thread_ready(t);
    377363       
    378         chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops);
    379         stdout = &sgcn_io;
    380 
    381         sgcnout = devout;
     364        indev_initialize("sgcnin", &sgcnin, &sgcnin_ops);
     365
     366        return &sgcnin;
     367}
     368
     369/**
     370 * A public function which initializes output to the Serengeti console.
     371 */
     372void sgcnout_init(void)
     373{
     374        sgcn_buffer_begin_init();
     375
     376        sysinfo_set_item_val("fb.kind", NULL, 4);
     377
     378        outdev_initialize("sgcnout", &sgcnout, &sgcnout_ops);   
     379        stdout = &sgcnout;
    382380}
    383381
Note: See TracChangeset for help on using the changeset viewer.