Skip to content

Commit

Permalink
[app] H618 support cli
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzukiTsuru committed Dec 27, 2023
1 parent 567c32d commit 090d186
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
4 changes: 3 additions & 1 deletion board/longanpi-3h/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ set(APP_COMMON_SOURCE

add_subdirectory(hello_world)

add_subdirectory(init_dram)
add_subdirectory(init_dram)

add_subdirectory(cli_test)
5 changes: 5 additions & 0 deletions board/longanpi-3h/cli_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

add_syterkit_app(cli_test
main.c
)
41 changes: 41 additions & 0 deletions board/longanpi-3h/cli_test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* SPDX-License-Identifier: Apache-2.0 */

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>

#include <log.h>

#include <common.h>

#include <cli.h>
#include <cli_shell.h>
#include <cli_termesc.h>

extern sunxi_serial_t uart_dbg;

msh_declare_command(helloworld);

msh_define_help(helloworld, "display helloworld", "Usage: helloworld\n");
int cmd_helloworld(int argc, const char **argv) {
printk(LOG_LEVEL_MUTE, "Hello World!\n");
return 0;
}

const msh_command_entry commands[] = {
msh_define_command(helloworld),
msh_command_end,
};

int main(void) {
sunxi_serial_init(&uart_dbg);

sunxi_clk_init();

printk(LOG_LEVEL_INFO, "Hello World!\n");

syterkit_shell_attach(commands);

return 0;
}
3 changes: 3 additions & 0 deletions src/drivers/sun50iw9/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

add_library(chip_drivers-obj OBJECT
sys-clk.c
sys-dram.c
sys-sid.c
sys-wdt.c
)
16 changes: 16 additions & 0 deletions src/drivers/sun50iw9/sys-wdt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* SPDX-License-Identifier: Apache-2.0 */

#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>

#include <log.h>

#include <reg-ncat.h>

void sys_reset() {
write32(SUNXI_WDOG_BASE + 0x08, (0x16aa << 16) | (0x1 << 0));
}

0 comments on commit 090d186

Please sign in to comment.