paul@13 | 1 | /* |
paul@13 | 2 | * Test a Vcon interface. |
paul@13 | 3 | * |
paul@31 | 4 | * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@13 | 5 | * |
paul@13 | 6 | * This program is free software; you can redistribute it and/or |
paul@13 | 7 | * modify it under the terms of the GNU General Public License as |
paul@13 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@13 | 9 | * the License, or (at your option) any later version. |
paul@13 | 10 | * |
paul@13 | 11 | * This program is distributed in the hope that it will be useful, |
paul@13 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@13 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@13 | 14 | * GNU General Public License for more details. |
paul@13 | 15 | * |
paul@13 | 16 | * You should have received a copy of the GNU General Public License |
paul@13 | 17 | * along with this program; if not, write to the Free Software |
paul@13 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@13 | 19 | * Boston, MA 02110-1301, USA |
paul@13 | 20 | */ |
paul@13 | 21 | |
paul@13 | 22 | #include <l4/re/env> |
paul@13 | 23 | #include <l4/sys/vcon> |
paul@13 | 24 | #include <l4/util/util.h> |
paul@13 | 25 | |
paul@13 | 26 | #include <string.h> |
paul@13 | 27 | |
paul@13 | 28 | static const char *buffer = "Hello world!"; |
paul@13 | 29 | |
paul@13 | 30 | int main(int argc, char *argv[]) |
paul@13 | 31 | { |
paul@13 | 32 | const char *cap = argc < 2 ? "term" : argv[1]; |
paul@13 | 33 | |
paul@13 | 34 | /* Obtain a reference to the virtual console. */ |
paul@13 | 35 | |
paul@13 | 36 | L4::Cap<L4::Vcon> vcon = L4Re::Env::env()->get_cap<L4::Vcon>(cap); |
paul@13 | 37 | if (!vcon.is_valid()) return 1; |
paul@13 | 38 | |
paul@13 | 39 | while (1) |
paul@13 | 40 | { |
paul@13 | 41 | vcon->write(buffer, strlen(buffer)); |
paul@13 | 42 | l4_sleep(1000); |
paul@13 | 43 | } |
paul@13 | 44 | |
paul@13 | 45 | return 0; |
paul@13 | 46 | } |