Changeset c8bf88d in mainline for kernel/arch/ppc32/src/drivers/cuda.c


Ignore:
Timestamp:
2009-04-03T15:52:14Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a7b1071
Parents:
2398ee9
Message:

represent special keystrokes (cursor arrows, page up/down, delete, etc.) as appropriate Unicode characters
do not parse ANSI control sequences in kconsole, but in serial line driver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/drivers/cuda.c

    r2398ee9 rc8bf88d  
    4242#include <stdarg.h>
    4343#include <ddi/device.h>
     44#include <string.h>
    4445
    4546#define CUDA_IRQ 10
    46 #define SPECIAL         '?'
    47 
    48 #define PACKET_ADB  0x00
    49 #define PACKET_CUDA 0x01
    50 
    51 #define CUDA_POWERDOWN  0x0a
    52 #define CUDA_RESET              0x11
    53 
    54 #define RS 0x200
    55 #define B (0 * RS)
    56 #define A (1 * RS)
    57 #define SR (10 * RS)
    58 #define ACR (11 * RS)
    59 
    60 #define SR_OUT 0x10
    61 #define TACK 0x10
    62 #define TIP 0x20
    63 
     47
     48#define PACKET_ADB   0x00
     49#define PACKET_CUDA  0x01
     50
     51#define CUDA_POWERDOWN  0x0a
     52#define CUDA_RESET      0x11
     53
     54#define RS   0x200
     55#define B    (0 * RS)
     56#define A    (1 * RS)
     57#define SR   (10 * RS)
     58#define ACR  (11 * RS)
     59
     60#define SR_OUT  0x10
     61#define TACK    0x10
     62#define TIP     0x20
     63
     64#define SCANCODES  128
    6465
    6566static volatile uint8_t *cuda = NULL;
    66 static irq_t cuda_irq;          /**< Cuda's IRQ. */
    67 
    68 static char lchars[0x80] = {
    69         'a',
    70         's',
    71         'd',
    72         'f',
    73         'h',
    74         'g',
    75         'z',
    76         'x',
    77         'c',
    78         'v',
    79         SPECIAL,
    80         'b',
    81         'q',
    82         'w',
    83         'e',
    84         'r',
    85         'y',
    86         't',
    87         '1',
    88         '2',
    89         '3',
    90         '4',
    91         '6',
    92         '5',
    93         '=',
    94         '9',
    95         '7',
    96         '-',
    97         '8',
    98         '0',
    99         ']',
    100         'o',
    101         'u',
    102         '[',
    103         'i',
    104         'p',
    105         '\n',    /* Enter */
    106         'l',
    107         'j',
    108         '\'',
    109         'k',
    110         ';',
    111         '\\',
    112         ',',
    113         '/',
    114         'n',
    115         'm',
    116         '.',
    117         '\t',    /* Tab */
    118         ' ',
    119         '`',
    120         '\b',    /* Backspace */
    121         SPECIAL,
    122         SPECIAL, /* Escape */
    123         SPECIAL, /* Ctrl */
    124         SPECIAL, /* Alt */
    125         SPECIAL, /* Shift */
    126         SPECIAL, /* Caps-Lock */
    127         SPECIAL, /* RAlt */
    128         SPECIAL, /* Left */
    129         SPECIAL, /* Right */
    130         SPECIAL, /* Down */
    131         SPECIAL, /* Up */
    132         SPECIAL,
    133         SPECIAL,
    134         '.',     /* Keypad . */
    135         SPECIAL,
    136         '*',     /* Keypad * */
    137         SPECIAL,
    138         '+',     /* Keypad + */
    139         SPECIAL,
    140         SPECIAL, /* NumLock */
    141         SPECIAL,
    142         SPECIAL,
    143         SPECIAL,
    144         '/',     /* Keypad / */
    145         '\n',    /* Keypad Enter */
    146         SPECIAL,
    147         '-',     /* Keypad - */
    148         SPECIAL,
    149         SPECIAL,
    150         SPECIAL,
    151         '0',     /* Keypad 0 */
    152         '1',     /* Keypad 1 */
    153         '2',     /* Keypad 2 */
    154         '3',     /* Keypad 3 */
    155         '4',     /* Keypad 4 */
    156         '5',     /* Keypad 5 */
    157         '6',     /* Keypad 6 */
    158         '7',     /* Keypad 7 */
    159         SPECIAL,
    160         '8',     /* Keypad 8 */
    161         '9',     /* Keypad 9 */
    162         SPECIAL,
    163         SPECIAL,
    164         SPECIAL,
    165         SPECIAL, /* F5 */
    166         SPECIAL, /* F6 */
    167         SPECIAL, /* F7 */
    168         SPECIAL, /* F3 */
    169         SPECIAL, /* F8 */
    170         SPECIAL, /* F9 */
    171         SPECIAL,
    172         SPECIAL, /* F11 */
    173         SPECIAL,
    174         SPECIAL, /* F13 */
    175         SPECIAL,
    176         SPECIAL, /* ScrollLock */
    177         SPECIAL,
    178         SPECIAL, /* F10 */
    179         SPECIAL,
    180         SPECIAL, /* F12 */
    181         SPECIAL,
    182         SPECIAL, /* Pause */
    183         SPECIAL, /* Insert */
    184         SPECIAL, /* Home */
    185         SPECIAL, /* PageUp */
    186         SPECIAL, /* Delete */
    187         SPECIAL, /* F4 */
    188         SPECIAL, /* End */
    189         SPECIAL, /* F2 */
    190         SPECIAL, /* PageDown */
    191         SPECIAL  /* F1 */
     67static irq_t cuda_irq;                 /**< Cuda's IRQ. */
     68
     69static wchar_t lchars[SCANCODES] = {
     70        'a', 's', 'd', 'f', 'h', 'g', 'z', 'x', 'c', 'v',
     71        U_SPECIAL,
     72        'b', 'q', 'w', 'e', 'r', 'y', 't', '1', '2', '3', '4', '6', '5',
     73        '=', '9', '7', '-', '8', '0', ']', 'o', 'u', '[', 'i', 'p',
     74        '\n',           /* Enter */
     75        'l', 'j', '\'', 'k', ';', '\\', ',', '/', 'n', 'm', '.',
     76        '\t',           /* Tab */
     77        ' ', '`',
     78        '\b',           /* Backspace */
     79        U_SPECIAL,
     80        U_ESCAPE,       /* Escape */
     81        U_SPECIAL,      /* Ctrl */
     82        U_SPECIAL,      /* Alt */
     83        U_SPECIAL,      /* Shift */
     84        U_SPECIAL,      /* CapsLock */
     85        U_SPECIAL,      /* Right Alt */
     86        U_LEFT_ARROW,   /* Left */
     87        U_RIGHT_ARROW,  /* Right */
     88        U_DOWN_ARROW,   /* Down */
     89        U_UP_ARROW,     /* Up */
     90        U_SPECIAL,
     91        U_SPECIAL,
     92        '.',            /* Keypad . */
     93        U_SPECIAL,
     94        '*',            /* Keypad * */
     95        U_SPECIAL,
     96        '+',            /* Keypad + */
     97        U_SPECIAL,
     98        U_SPECIAL,      /* NumLock */
     99        U_SPECIAL,
     100        U_SPECIAL,
     101        U_SPECIAL,
     102        '/',            /* Keypad / */
     103        '\n',           /* Keypad Enter */
     104        U_SPECIAL,
     105        '-',            /* Keypad - */
     106        U_SPECIAL,
     107        U_SPECIAL,
     108        U_SPECIAL,
     109        '0',            /* Keypad 0 */
     110        '1',            /* Keypad 1 */
     111        '2',            /* Keypad 2 */
     112        '3',            /* Keypad 3 */
     113        '4',            /* Keypad 4 */
     114        '5',            /* Keypad 5 */
     115        '6',            /* Keypad 6 */
     116        '7',            /* Keypad 7 */
     117        U_SPECIAL,
     118        '8',            /* Keypad 8 */
     119        '9',            /* Keypad 9 */
     120        U_SPECIAL,
     121        U_SPECIAL,
     122        U_SPECIAL,
     123        U_SPECIAL,      /* F5 */
     124        U_SPECIAL,      /* F6 */
     125        U_SPECIAL,      /* F7 */
     126        U_SPECIAL,      /* F3 */
     127        U_SPECIAL,      /* F8 */
     128        U_SPECIAL,      /* F9 */
     129        U_SPECIAL,
     130        U_SPECIAL,      /* F11 */
     131        U_SPECIAL,
     132        U_SPECIAL,      /* F13 */
     133        U_SPECIAL,
     134        U_SPECIAL,      /* ScrollLock */
     135        U_SPECIAL,
     136        U_SPECIAL,      /* F10 */
     137        U_SPECIAL,
     138        U_SPECIAL,      /* F12 */
     139        U_SPECIAL,
     140        U_SPECIAL,      /* Pause */
     141        U_SPECIAL,      /* Insert */
     142        U_HOME_ARROW,   /* Home */
     143        U_PAGE_UP,      /* Page Up */
     144        U_DELETE,       /* Delete */
     145        U_SPECIAL,      /* F4 */
     146        U_END_ARROW,    /* End */
     147        U_SPECIAL,      /* F2 */
     148        U_PAGE_DOWN,    /* Page Down */
     149        U_SPECIAL       /* F1 */
    192150};
    193 
    194151
    195152static void receive_packet(uint8_t *kind, index_t count, uint8_t data[])
     
    204161        cuda[B] = cuda[B] | TIP;
    205162}
    206 
    207163
    208164static indev_t kbrd;
     
    210166        .poll = NULL
    211167};
    212 
    213168
    214169int cuda_get_scancode(void)
     
    264219}
    265220
    266 
    267221static void send_packet(const uint8_t kind, count_t count, ...)
    268222{
     
    288242}
    289243
    290 
    291244void cpu_halt(void) {
    292245        asm volatile (
Note: See TracChangeset for help on using the changeset viewer.