Changeset ed88c8e in mainline for kernel


Ignore:
Timestamp:
2018-05-29T13:25:07Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fc0b2a8
Parents:
a57fa32
git-author:
Jiri Svoboda <jiri@…> (2018-05-28 17:24:17)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-29 13:25:07)
Message:

fputc, putchar vs. fputwc, putwchar.

Location:
kernel
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/src/abs32le.c

    ra57fa32 red88c8e  
    136136}
    137137
    138 void early_putchar(wchar_t ch)
     138void early_putwchar(wchar_t ch)
    139139{
    140140}
  • kernel/arch/amd64/src/asm.S

    ra57fa32 red88c8e  
    412412 *
    413413 */
    414 FUNCTION_BEGIN(early_putchar)
     414FUNCTION_BEGIN(early_putwchar)
    415415#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    416416
     
    443443        /* Sanity check for the cursor on screen */
    444444        cmp $2000, %ax
    445         jb early_putchar_cursor_ok
     445        jb early_putwchar_cursor_ok
    446446
    447447                movw $1998, %ax
    448448
    449         early_putchar_cursor_ok:
     449        early_putwchar_cursor_ok:
    450450
    451451        movw %ax, %bx
     
    456456
    457457        cmp $0x0a, %al
    458         jne early_putchar_backspace
     458        jne early_putwchar_backspace
    459459
    460460                /* Interpret newline */
     
    470470                subw %dx, %bx
    471471
    472                 jmp early_putchar_skip
    473 
    474         early_putchar_backspace:
     472                jmp early_putwchar_skip
     473
     474        early_putwchar_backspace:
    475475
    476476                cmp $0x08, %al
    477                 jne early_putchar_print
     477                jne early_putwchar_print
    478478
    479479                /* Interpret backspace */
    480480
    481481                cmp $0x0000, %bx
    482                 je early_putchar_skip
     482                je early_putwchar_skip
    483483
    484484                dec %bx
    485                 jmp early_putchar_skip
    486 
    487         early_putchar_print:
     485                jmp early_putwchar_skip
     486
     487        early_putwchar_print:
    488488
    489489                /* Print character */
     
    493493                inc %bx
    494494
    495         early_putchar_skip:
     495        early_putwchar_skip:
    496496
    497497        /* Sanity check for the cursor on the last line */
    498498        cmp $2000, %bx
    499         jb early_putchar_no_scroll
     499        jb early_putwchar_no_scroll
    500500
    501501                /* Scroll the screen (24 rows) */
     
    513513                movw $1920, %bx
    514514
    515         early_putchar_no_scroll:
     515        early_putwchar_no_scroll:
    516516
    517517        /* Write bits 8 - 15 of the cursor address */
     
    540540
    541541        ret
    542 FUNCTION_END(early_putchar)
     542FUNCTION_END(early_putwchar)
  • kernel/arch/arm32/src/asm.S

    ra57fa32 red88c8e  
    9898        ldmia sp!, {r4, r5, pc}
    9999
    100 FUNCTION_BEGIN(early_putchar)
     100FUNCTION_BEGIN(early_putwchar)
    101101        mov pc, lr
    102 FUNCTION_END(early_putchar)
     102FUNCTION_END(early_putwchar)
  • kernel/arch/ia32/src/asm.S

    ra57fa32 red88c8e  
    451451 *
    452452 */
    453 FUNCTION_BEGIN(early_putchar)
     453FUNCTION_BEGIN(early_putwchar)
    454454
    455455#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    484484        /* Sanity check for the cursor on screen */
    485485        cmp $2000, %ax
    486         jb early_putchar_cursor_ok
     486        jb early_putwchar_cursor_ok
    487487
    488488                movw $1998, %ax
    489489
    490         early_putchar_cursor_ok:
     490        early_putwchar_cursor_ok:
    491491
    492492        movw %ax, %bx
     
    497497
    498498        cmp $0x0a, %al
    499         jne early_putchar_backspace
     499        jne early_putwchar_backspace
    500500
    501501                /* Interpret newline */
     
    511511                subw %dx, %bx
    512512
    513                 jmp early_putchar_skip
    514 
    515         early_putchar_backspace:
     513                jmp early_putwchar_skip
     514
     515        early_putwchar_backspace:
    516516
    517517                cmp $0x08, %al
    518                 jne early_putchar_print
     518                jne early_putwchar_print
    519519
    520520                /* Interpret backspace */
    521521
    522522                cmp $0x0000, %bx
    523                 je early_putchar_skip
     523                je early_putwchar_skip
    524524
    525525                dec %bx
    526                 jmp early_putchar_skip
    527 
    528         early_putchar_print:
     526                jmp early_putwchar_skip
     527
     528        early_putwchar_print:
    529529
    530530                /* Print character */
     
    534534                inc %bx
    535535
    536         early_putchar_skip:
     536        early_putwchar_skip:
    537537
    538538        /* Sanity check for the cursor on the last line */
    539539        cmp $2000, %bx
    540         jb early_putchar_no_scroll
     540        jb early_putwchar_no_scroll
    541541
    542542                /* Scroll the screen (24 rows) */
     
    554554                movw $1920, %bx
    555555
    556         early_putchar_no_scroll:
     556        early_putwchar_no_scroll:
    557557
    558558        /* Write bits 8 - 15 of the cursor address */
     
    583583
    584584        ret
    585 FUNCTION_END(early_putchar)
    586 
     585FUNCTION_END(early_putwchar)
     586
  • kernel/arch/ia64/src/asm.S

    ra57fa32 red88c8e  
    191191FUNCTION_END(switch_to_userspace)
    192192
    193 FUNCTION_BEGIN(early_putchar)
     193FUNCTION_BEGIN(early_putwchar)
    194194        br.ret.sptk.many b0
    195 FUNCTION_END(early_putchar)
     195FUNCTION_END(early_putwchar)
  • kernel/arch/ia64/src/drivers/ski.c

    ra57fa32 red88c8e  
    5858};
    5959
    60 static void ski_putchar(outdev_t *, const wchar_t);
     60static void ski_putwchar(outdev_t *, const wchar_t);
    6161
    6262static outdev_operations_t skidev_ops = {
    63         .write = ski_putchar,
     63        .write = ski_putwchar,
    6464        .redraw = NULL,
    6565        .scroll_up = NULL,
     
    166166}
    167167
    168 static void ski_do_putchar(const wchar_t ch)
     168static void ski_do_putchar(char ch)
    169169{
    170170        asm volatile (
     
    187187 *
    188188 */
    189 static void ski_putchar(outdev_t *dev, const wchar_t ch)
     189static void ski_putwchar(outdev_t *dev, wchar_t ch)
    190190{
    191191        // TODO FIXME:
     
    198198
    199199                        ski_do_putchar(ch);
    200                 } else
    201                         ski_do_putchar(U_SPECIAL);
     200                } else {
     201                        ski_do_putchar('?');
     202                }
    202203        }
    203204}
  • kernel/arch/mips32/src/asm.S

    ra57fa32 red88c8e  
    296296FUNCTION_END(fpu_context_restore)
    297297
    298 FUNCTION_BEGIN(early_putchar)
     298FUNCTION_BEGIN(early_putwchar)
    299299        j $ra
    300300        nop
    301 FUNCTION_END(early_putchar)
     301FUNCTION_END(early_putwchar)
  • kernel/arch/mips32/src/mach/malta/malta.c

    ra57fa32 red88c8e  
    8181    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
    8282
    83 static void yamon_putchar(outdev_t *dev, const wchar_t wch)
     83static void yamon_putwchar(outdev_t *dev, const wchar_t wch)
    8484{
    8585
     
    9191static outdev_t yamon_outdev;
    9292static outdev_operations_t yamon_outdev_ops = {
    93         .write = yamon_putchar,
     93        .write = yamon_putwchar,
    9494        .redraw = NULL,
    9595        .scroll_up = NULL,
  • kernel/arch/ppc32/src/asm.S

    ra57fa32 red88c8e  
    265265        blr
    266266
    267 FUNCTION_BEGIN(early_putchar)
     267FUNCTION_BEGIN(early_putwchar)
    268268        blr
    269 FUNCTION_END(early_putchar)
     269FUNCTION_END(early_putwchar)
  • kernel/arch/riscv64/include/arch/drivers/ucb.h

    ra57fa32 red88c8e  
    4242extern void htif_init(volatile uint64_t *, volatile uint64_t *);
    4343extern outdev_t *htifout_init(void);
    44 extern void htif_putchar(outdev_t *, const wchar_t);
     44extern void htif_putwchar(outdev_t *, const wchar_t);
    4545
    4646#endif
  • kernel/arch/riscv64/src/asm.S

    ra57fa32 red88c8e  
    3535FUNCTION_END(asm_delay_loop)
    3636
    37 FUNCTION_BEGIN(early_putchar)
     37FUNCTION_BEGIN(early_putwchar)
    3838        ret
    39 FUNCTION_END(early_putchar)
     39FUNCTION_END(early_putwchar)
    4040
    4141FUNCTION_BEGIN(cpu_halt)
  • kernel/arch/riscv64/src/drivers/ucb.c

    ra57fa32 red88c8e  
    4242
    4343static outdev_operations_t htifdev_ops = {
    44         .write = htif_putchar,
     44        .write = htif_putwchar,
    4545        .redraw = NULL,
    4646        .scroll_up = NULL,
     
    8585}
    8686
    87 void htif_putchar(outdev_t *dev, const wchar_t ch)
     87void htif_putwchar(outdev_t *dev, const wchar_t ch)
    8888{
    8989        if (ascii_check(ch))
  • kernel/arch/sparc64/src/asm.S

    ra57fa32 red88c8e  
    189189        mov %g0, %o0  /* return 0 on failure */
    190190
    191 FUNCTION_BEGIN(early_putchar)
     191FUNCTION_BEGIN(early_putwchar)
    192192        retl
    193193        nop
    194 FUNCTION_END(early_putchar)
     194FUNCTION_END(early_putwchar)
  • kernel/arch/sparc64/src/drivers/niagara.c

    ra57fa32 red88c8e  
    5858static niagara_instance_t *instance = NULL;
    5959
    60 static void niagara_putchar(outdev_t *, const wchar_t);
     60static void niagara_putwchar(outdev_t *, const wchar_t);
    6161
    6262/** Character device operations */
    6363static outdev_operations_t niagara_ops = {
    64         .write = niagara_putchar,
     64        .write = niagara_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
     
    9696
    9797/** Write a single character to the standard output. */
    98 static inline void do_putchar(const char c)
     98static inline void do_putchar(char c)
    9999{
    100100        /* Repeat until the buffer is non-full */
     
    104104
    105105/** Write a single character to the standard output. */
    106 static void niagara_putchar(outdev_t *dev, const wchar_t ch)
     106static void niagara_putwchar(outdev_t *dev, wchar_t ch)
    107107{
    108108        if ((!outbuf_parea.mapped) || (console_override)) {
    109                 do_putchar(ch);
    110                 if (ch == '\n')
    111                         do_putchar('\r');
     109                if (ascii_check(ch)) {
     110                        do_putchar(ch);
     111                        if (ch == '\n')
     112                                do_putchar('\r');
     113                } else {
     114                        do_putchar('?');
     115                }
    112116        }
    113117}
  • kernel/genarch/src/drivers/dsrln/dsrlnout.c

    ra57fa32 red88c8e  
    4949} dsrlnout_instance_t;
    5050
    51 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch)
     51static void dsrlnout_putwchar(outdev_t *dev, const wchar_t ch)
    5252{
    5353        dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
     
    6262
    6363static outdev_operations_t dsrlndev_ops = {
    64         .write = dsrlnout_putchar,
     64        .write = dsrlnout_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
  • kernel/genarch/src/drivers/ega/ega.c

    ra57fa32 red88c8e  
    7272} ega_instance_t;
    7373
    74 static void ega_putchar(outdev_t *, wchar_t);
     74static void ega_putwchar(outdev_t *, wchar_t);
    7575static void ega_redraw(outdev_t *);
    7676
    7777static outdev_operations_t egadev_ops = {
    78         .write = ega_putchar,
     78        .write = ega_putwchar,
    7979        .redraw = ega_redraw,
    8080        .scroll_up = NULL,
     
    516516}
    517517
    518 static void ega_display_char(ega_instance_t *instance, wchar_t ch)
     518static void ega_display_wchar(ega_instance_t *instance, wchar_t ch)
    519519{
    520520        uint16_t index = ega_oem_glyph(ch);
     
    539539}
    540540
    541 static void ega_putchar(outdev_t *dev, wchar_t ch)
     541static void ega_putwchar(outdev_t *dev, wchar_t ch)
    542542{
    543543        ega_instance_t *instance = (ega_instance_t *) dev->data;
     
    559559                break;
    560560        default:
    561                 ega_display_char(instance, ch);
     561                ega_display_wchar(instance, ch);
    562562                instance->cursor++;
    563563                break;
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    ra57fa32 red88c8e  
    9292}
    9393
    94 static void ns16550_putchar(outdev_t *dev, wchar_t ch)
     94static void ns16550_putwchar(outdev_t *dev, wchar_t ch)
    9595{
    9696        ns16550_instance_t *instance = (ns16550_instance_t *) dev->data;
     
    105105
    106106static outdev_operations_t ns16550_ops = {
    107         .write = ns16550_putchar,
     107        .write = ns16550_putwchar,
    108108        .redraw = NULL
    109109};
  • kernel/genarch/src/drivers/omap/uart.c

    ra57fa32 red88c8e  
    4949}
    5050
    51 static void omap_uart_putchar(outdev_t *dev, wchar_t ch)
     51static void omap_uart_putwchar(outdev_t *dev, wchar_t ch)
    5252{
    5353        omap_uart_t *uart = dev->data;
     
    6262
    6363static outdev_operations_t omap_uart_ops = {
    64         .write = omap_uart_putchar,
     64        .write = omap_uart_putwchar,
    6565        .redraw = NULL,
    6666        .scroll_up = NULL,
  • kernel/genarch/src/drivers/pl011/pl011.c

    ra57fa32 red88c8e  
    5656}
    5757
    58 static void pl011_uart_putchar(outdev_t *dev, wchar_t ch)
     58static void pl011_uart_putwchar(outdev_t *dev, wchar_t ch)
    5959{
    6060        pl011_uart_t *uart = dev->data;
     
    7070
    7171static outdev_operations_t pl011_uart_ops = {
    72         .write = pl011_uart_putchar,
     72        .write = pl011_uart_putwchar,
    7373        .redraw = NULL,
    7474        .scroll_up = NULL,
  • kernel/genarch/src/drivers/s3c24xx/uart.c

    ra57fa32 red88c8e  
    6161}
    6262
    63 static void s3c24xx_uart_putchar(outdev_t *dev, wchar_t ch)
     63static void s3c24xx_uart_putwchar(outdev_t *dev, wchar_t ch)
    6464{
    6565        s3c24xx_uart_t *uart =
     
    9494
    9595static outdev_operations_t s3c24xx_uart_ops = {
    96         .write = s3c24xx_uart_putchar,
     96        .write = s3c24xx_uart_putwchar,
    9797        .redraw = NULL,
    9898        .scroll_up = NULL,
  • kernel/genarch/src/fb/fb.c

    ra57fa32 red88c8e  
    122122} fb_instance_t;
    123123
    124 static void fb_putchar(outdev_t *, wchar_t);
     124static void fb_putwchar(outdev_t *, wchar_t);
    125125static void fb_redraw(outdev_t *);
    126126static void fb_scroll_up(outdev_t *);
     
    128128
    129129static outdev_operations_t fbdev_ops = {
    130         .write = fb_putchar,
     130        .write = fb_putwchar,
    131131        .redraw = fb_redraw,
    132132        .scroll_up = fb_scroll_up,
     
    410410 *
    411411 */
    412 static void fb_putchar(outdev_t *dev, wchar_t ch)
     412static void fb_putwchar(outdev_t *dev, wchar_t ch)
    413413{
    414414        fb_instance_t *instance = (fb_instance_t *) dev->data;
  • kernel/generic/include/console/console.h

    ra57fa32 red88c8e  
    5757extern outdev_t *stdout;
    5858
    59 extern void early_putchar(wchar_t);
     59extern void early_putwchar(wchar_t);
    6060
    6161extern indev_t *stdin_wire(void);
  • kernel/generic/include/putchar.h

    ra57fa32 red88c8e  
    3636#define KERN_PUTCHAR_H_
    3737
    38 extern void putchar(const wchar_t ch);
     38#include <stddef.h>
     39
     40extern void putwchar(wchar_t);
    3941
    4042#endif
  • kernel/generic/src/console/console.c

    ra57fa32 red88c8e  
    262262                        if (count > 0) {
    263263                                /* Space, backspace, space */
    264                                 putchar('\b');
    265                                 putchar(' ');
    266                                 putchar('\b');
     264                                putwchar('\b');
     265                                putwchar(' ');
     266                                putwchar('\b');
    267267
    268268                                count--;
     
    273273
    274274                if (chr_encode(ch, buf, &offset, buflen - 1) == EOK) {
    275                         putchar(ch);
     275                        putwchar(ch);
    276276                        count++;
    277277                        buf[offset] = 0;
     
    286286{
    287287        wchar_t ch = indev_pop_character(indev);
    288         putchar(ch);
     288        putwchar(ch);
    289289        return ch;
    290290}
     
    356356}
    357357
    358 void putchar(const wchar_t ch)
     358void putwchar(const wchar_t ch)
    359359{
    360360        bool ordy = ((stdout) && (stdout->op->write));
     
    373373                 * for possible future output.
    374374                 *
    375                  * The early_putchar() function is used to output
     375                 * The early_putwchar() function is used to output
    376376                 * the character for low-level debugging purposes.
    377377                 * Note that the early_putc() function might be
    378378                 * a no-op on certain hardware configurations.
    379379                 */
    380                 early_putchar(ch);
     380                early_putwchar(ch);
    381381        }
    382382
  • kernel/generic/src/console/kconsole.c

    ra57fa32 red88c8e  
    160160        size_t i;
    161161        for (i = 0; i < count; i++)
    162                 putchar(ch);
     162                putwchar(ch);
    163163}
    164164
     
    339339                if (ch == '\n') {
    340340                        /* Enter */
    341                         putchar(ch);
     341                        putwchar(ch);
    342342                        break;
    343343                }
     
    350350                        if (wstr_remove(current, position - 1)) {
    351351                                position--;
    352                                 putchar('\b');
     352                                putwchar('\b');
    353353                                printf("%ls ", current + position);
    354354                                print_cc('\b', wstr_length(current) - position + 1);
     
    363363                        for (; (current[position] != 0) && (!isspace(current[position]));
    364364                            position++)
    365                                 putchar(current[position]);
     365                                putwchar(current[position]);
    366366
    367367
     
    459459                        /* Left */
    460460                        if (position > 0) {
    461                                 putchar('\b');
     461                                putwchar('\b');
    462462                                position--;
    463463                        }
     
    468468                        /* Right */
    469469                        if (position < wstr_length(current)) {
    470                                 putchar(current[position]);
     470                                putwchar(current[position]);
    471471                                position++;
    472472                        }
  • kernel/generic/src/printf/vprintf.c

    ra57fa32 red88c8e  
    4747
    4848        while (offset < size) {
    49                 putchar(str_decode(str, &offset, size));
     49                putwchar(str_decode(str, &offset, size));
    5050                chars++;
    5151        }
     
    6060
    6161        while (offset < size) {
    62                 putchar(str[chars]);
     62                putwchar(str[chars]);
    6363                chars++;
    6464                offset += sizeof(wchar_t);
     
    7575
    7676        while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
    77                 putchar(uc);
     77                putwchar(uc);
    7878                chars++;
    7979        }
    8080
    81         putchar('\n');
     81        putwchar('\n');
    8282        return chars;
    8383}
Note: See TracChangeset for help on using the changeset viewer.