static bool cmd_switch_to_keycodes() { tty_print(TTY_CONSOLE, "Entering keycode mode. Hit Alt-Tab to exit.\n"); switch_mode(&mode_keycode); return false; }
size_t tty_write(uint64_t source, struct vfs_obj *file, uint8_t *buffer, size_t size, uint64_t offset) { size_t i; for (i = 0; i < size; i++) { tty_print(buffer[i]); } tty_flip(); return size; }
static bool cmd_display_help() { tty_print(TTY_CONSOLE, "Available commands:\n"); for (int i = 0; i < arrsize(commands); i++) { if (commands[i].help == NULL) continue; tty_printf(TTY_CONSOLE, " %-8s %s\n", commands[i].str, commands[i].help); } return true; }
void tty_event(uint64_t source, uint64_t value) { char c; static bool ctrl = false; if (value & 0x00400000) { if (value == 0x00C00001) { ctrl = false; } return; } if (value & 0x00800000) { if (value == 0x00800001) { ctrl = true; } return; } c = value; if (tolower(c) == 'c' && ctrl) { kill(-getpid(), SIGINT); tty_print('^'); tty_print('C'); tty_print('\n'); tty_buffer('\n'); return; } tty_buffer(c); if (isprint(c) && tty->mode & MODE_ECHO) { tty_print(c); tty_flip(); } }
void screensaver() { c[1] = 0; while(1) { for (j=0;j<10;j++) { for (i=1;i<25;i++) { disp[j][i] = disp[j][i-1]; } } for (j=0;j<10;j++) { i = uniform(3)+1; switch (i) { case 1: disp[j][0] = uniform(2)+48; break; case 2: disp[j][0] = ' '; break; case 3: disp[j][0] = ' '; break; } } for (i=0;i<25;i++) { for (j=0;j<10;j++) { tty_gotoxy(scr_handle,(j+1)*(6+uniform(4)),i); c[0] = disp[j][i] + uniform(1); tty_print(scr_handle,c); } //delay(2); } delay(3); } delay(1); }
static bool cmd_display_pcie() { const struct acpi_mcfg_addr *addr = acpi_next_mcfg_addr(NULL); if (addr == NULL) { tty_print(TTY_CONSOLE, "No PCIe configuration.\n"); return true; } while (addr != NULL) { tty_printf(TTY_CONSOLE, "PCIe addr=0x%08x grp=%-2u bus=%02x..%02x\n", addr->base, addr->seg_group, addr->bus_start, addr->bus_end); addr = acpi_next_mcfg_addr(addr); } return true; }
static bool cmd_display_apic() { const struct acpi_madt *madt = acpi_madt(); if (madt == NULL) { tty_print(TTY_CONSOLE, "No ACPI MADT detected.\n"); return true; } tty_printf(TTY_CONSOLE, "Local APIC addr: %#x\n", madt->ptr_local_apic); const struct acpi_madt_local_apic *local = NULL; while ((local = acpi_next_local_apic(local)) != NULL) { tty_printf(TTY_CONSOLE, "Local APIC id %u: %s\n", local->apicid, (local->flags & 1) ? "Usable" : "Unusable"); } const struct acpi_madt_io_apic *io = NULL; while ((io = acpi_next_io_apic(io)) != NULL) { tty_printf(TTY_CONSOLE, "I/O APIC id %u: Addr=%#x Base=%u\n", io->apicid, io->ptr_io_apic, io->interrupt_base); } const struct acpi_madt_iso *iso = NULL; while ((iso = acpi_next_iso(iso)) != NULL) { tty_printf(TTY_CONSOLE, "ISO irq=%-2u int=%-2u flags=0x%04x\n", iso->source, iso->interrupt, iso->flags); } return true; }
int main() { tty_print(msg, 0x07); return 0; }
static void command_prompt() { tty_print(TTY_CONSOLE, "> "); }