Changeset 973be64e in mainline for generic


Ignore:
Timestamp:
2005-12-10T00:19:57Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fcfac420
Parents:
705b4149
Message:

Added generic exc_register/exc_dispatch functions,
copied from ia32 architecture. Currently only mips32 uses them.

The chardev_t can now be both input & output device (was
needed for serial driver).

Broken other architectures - ia64, sparc, powerpc will not compile.

Mips32 supports input on all msim, gxemul, indy(tested emulation
in gxemul, loses characters), simics. Simics serial line
is done using polling, I was unable to make it produce
an interrupt when the key was pressed.

Location:
generic
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • generic/include/console/chardev.h

    r705b4149 r973be64e  
    3737#define CHARDEV_BUFLEN 512
    3838
     39struct chardev;
     40
    3941/* Character device operations interface. */
    4042struct chardev_operations {
    41         void (* suspend)(void);         /**< Suspend pushing characters. */
    42         void (* resume)(void);          /**< Resume pushing characters. */
     43        void (* suspend)(struct chardev *);/**< Suspend pushing characters. */
     44        void (* resume)(struct chardev *); /**< Resume pushing characters. */
     45        /** Write character to stream */
     46        void (* write)(struct chardev *, char c);
    4347};
    4448
     
    4751/** Character input device. */
    4852struct chardev {
     53        char *name;
     54       
    4955        waitq_t wq;
    5056        spinlock_t lock;                /**< Protects everything below. */
    5157        __u8 buffer[CHARDEV_BUFLEN];
    5258        count_t counter;
     59        chardev_operations_t *op;       /**< Implementation of chardev operations. */
    5360        index_t index;
    54         chardev_operations_t *op;       /**< Implementation of chardev operations. */
     61        void *data;
    5562};
    5663
    57 extern void chardev_initialize(chardev_t *chardev, chardev_operations_t *op);
     64extern void chardev_initialize(char *name,
     65                               chardev_t *chardev,
     66                               chardev_operations_t *op);
    5867void chardev_push_character(chardev_t *chardev, __u8 ch);
    5968
  • generic/include/console/console.h

    r705b4149 r973be64e  
    3434
    3535extern chardev_t *stdin;
     36extern chardev_t *stdout;
    3637
    3738extern __u8 getc(chardev_t *chardev);
    3839extern count_t gets(chardev_t *chardev, char *buf, size_t buflen);
     40extern void putchar(char c);
    3941
    4042#endif /* __CHARDEV_H__ */
  • generic/include/print.h

    r705b4149 r973be64e  
    3737#define INT64   8
    3838
    39 extern void putchar(const char c);
    4039extern void printf(const char *fmt, ...);
    4140
  • generic/src/console/chardev.c

    r705b4149 r973be64e  
    3737 * @param op Implementation of character device operations.
    3838 */
    39 void chardev_initialize(chardev_t *chardev, chardev_operations_t *op)
     39void chardev_initialize(char *name,chardev_t *chardev,
     40                        chardev_operations_t *op)
    4041{
     42        chardev->name = name;
     43
    4144        waitq_initialize(&chardev->wq);
    4245        spinlock_initialize(&chardev->lock, "chardev");
     
    5760        if (chardev->counter == CHARDEV_BUFLEN - 1) {
    5861                /* buffer full => disable device interrupt */
    59                 chardev->op->suspend();
     62                chardev->op->suspend(chardev);
    6063        }
    6164
  • generic/src/console/console.c

    r705b4149 r973be64e  
    3838/** Standard input character device. */
    3939chardev_t *stdin = NULL;
     40chardev_t *stdout = NULL;
    4041
    4142/** Get string from character device.
     
    8586        interrupts_restore(ipl);
    8687
    87         chardev->op->resume();
     88        chardev->op->resume(chardev);
    8889
    8990        return ch;
    9091}
     92
     93void putchar(char c)
     94{
     95        stdout->op->write(stdout, c);
     96}
Note: See TracChangeset for help on using the changeset viewer.