|
Last change
on this file since d7f7a4a was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago |
|
Replace some license headers with SPDX identifier
Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.
|
-
Property mode
set to
100644
|
|
File size:
776 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2005 Jakub Jermar
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #include <arch/ski.h>
|
|---|
| 8 | #include <stdbool.h>
|
|---|
| 9 | #include <stddef.h>
|
|---|
| 10 |
|
|---|
| 11 | #define SKI_INIT_CONSOLE 20
|
|---|
| 12 | #define SKI_PUTCHAR 31
|
|---|
| 13 |
|
|---|
| 14 | static void ski_console_init(void)
|
|---|
| 15 | {
|
|---|
| 16 | static bool initialized = false;
|
|---|
| 17 |
|
|---|
| 18 | if (initialized)
|
|---|
| 19 | return;
|
|---|
| 20 |
|
|---|
| 21 | asm volatile (
|
|---|
| 22 | "mov r15 = %[cmd]\n"
|
|---|
| 23 | "break 0x80000\n"
|
|---|
| 24 | :
|
|---|
| 25 | : [cmd] "i" (SKI_INIT_CONSOLE)
|
|---|
| 26 | : "r15", "r8"
|
|---|
| 27 | );
|
|---|
| 28 |
|
|---|
| 29 | initialized = true;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | void ski_putchar(char ch)
|
|---|
| 33 | {
|
|---|
| 34 | ski_console_init();
|
|---|
| 35 |
|
|---|
| 36 | if (ch == '\n')
|
|---|
| 37 | ski_putchar('\r');
|
|---|
| 38 |
|
|---|
| 39 | asm volatile (
|
|---|
| 40 | "mov r15 = %[cmd]\n"
|
|---|
| 41 | "mov r32 = %[ch]\n" /* r32 is in0 */
|
|---|
| 42 | "break 0x80000\n" /* modifies r8 */
|
|---|
| 43 | :
|
|---|
| 44 | : [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch)
|
|---|
| 45 | : "r15", "in0", "r8"
|
|---|
| 46 | );
|
|---|
| 47 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.