forked from Mirrors/opensbi
sbi: Add ecall helpers
Define sbi_ecall_console_puts() using sbi_ecall_console_putchar() renamed as sbi_ecall_console_putc() and remove the hardcoded version of the same funtion in the test payload code. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
This commit is contained in:

committed by
Anup Patel

parent
42283461d3
commit
b5be19f9e5
@@ -14,17 +14,9 @@ do { \
|
|||||||
__asm__ __volatile__ ("wfi" ::: "memory"); \
|
__asm__ __volatile__ ("wfi" ::: "memory"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void sbi_puts(const char *str)
|
|
||||||
{
|
|
||||||
while (*str) {
|
|
||||||
SBI_ECALL_1(SBI_ECALL_CONSOLE_PUTCHAR, *str);
|
|
||||||
str++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_main(unsigned long a0, unsigned long a1)
|
void test_main(unsigned long a0, unsigned long a1)
|
||||||
{
|
{
|
||||||
sbi_puts("\nTest payload running\n");
|
sbi_ecall_console_puts("\nTest payload running\n");
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
wfi();
|
wfi();
|
||||||
|
@@ -36,4 +36,13 @@
|
|||||||
#define SBI_ECALL_1(__num, __a0) SBI_ECALL(__num, __a0, 0, 0)
|
#define SBI_ECALL_1(__num, __a0) SBI_ECALL(__num, __a0, 0, 0)
|
||||||
#define SBI_ECALL_2(__num, __a0, __a1) SBI_ECALL(__num, __a0, __a1, 0)
|
#define SBI_ECALL_2(__num, __a0, __a1) SBI_ECALL(__num, __a0, __a1, 0)
|
||||||
|
|
||||||
|
#define sbi_ecall_console_putc(c) \
|
||||||
|
SBI_ECALL_1(SBI_ECALL_CONSOLE_PUTCHAR, (c));
|
||||||
|
|
||||||
|
static inline void sbi_ecall_console_puts(const char *str)
|
||||||
|
{
|
||||||
|
while (str && *str)
|
||||||
|
sbi_ecall_console_putc(*str++);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user