From d045b0687c13a2eb6fda970ee73314ba33c43e07 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 10 Nov 2012 18:48:53 +0100 Subject: digital/ucoolib/ucoolib/arch: add arch_init --- digital/ucoolib/ucoolib/arch/Module | 2 +- digital/ucoolib/ucoolib/arch/arch.hh | 35 +++++++++++++++++++++++ digital/ucoolib/ucoolib/arch/arch.host.cc | 33 ++++++++++++++++++++++ digital/ucoolib/ucoolib/arch/arch.stm32.cc | 36 ++++++++++++++++++++++++ digital/ucoolib/ucoolib/hal/usb/test/test_usb.cc | 5 ++-- 5 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 digital/ucoolib/ucoolib/arch/arch.hh create mode 100644 digital/ucoolib/ucoolib/arch/arch.host.cc create mode 100644 digital/ucoolib/ucoolib/arch/arch.stm32.cc (limited to 'digital') diff --git a/digital/ucoolib/ucoolib/arch/Module b/digital/ucoolib/ucoolib/arch/Module index 06db976b..f07eefca 100644 --- a/digital/ucoolib/ucoolib/arch/Module +++ b/digital/ucoolib/ucoolib/arch/Module @@ -1 +1 @@ -arch_SOURCES := syscalls.newlib.c syscalls_cc.cc +arch_SOURCES := arch.host.cc arch.stm32.cc syscalls.newlib.c syscalls_cc.cc diff --git a/digital/ucoolib/ucoolib/arch/arch.hh b/digital/ucoolib/ucoolib/arch/arch.hh new file mode 100644 index 00000000..dbbeb51f --- /dev/null +++ b/digital/ucoolib/ucoolib/arch/arch.hh @@ -0,0 +1,35 @@ +#ifndef ucoolib_arch_arch_hh +#define ucoolib_arch_arch_hh +// ucoolib - Microcontroller object oriented library. {{{ +// +// Copyright (C) 2012 Nicolas Schodet +// +// APBTeam: +// Web: http://apbteam.org/ +// Email: team AT apbteam DOT org +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} + +namespace ucoo { + +/// Initialise arch, take program arguments. +void +arch_init (int argc, const char **argv); + +} // namespace ucoo + +#endif // ucoolib_arch_arch_hh diff --git a/digital/ucoolib/ucoolib/arch/arch.host.cc b/digital/ucoolib/ucoolib/arch/arch.host.cc new file mode 100644 index 00000000..17013f2f --- /dev/null +++ b/digital/ucoolib/ucoolib/arch/arch.host.cc @@ -0,0 +1,33 @@ +// ucoolib - Microcontroller object oriented library. {{{ +// +// Copyright (C) 2012 Nicolas Schodet +// +// APBTeam: +// Web: http://apbteam.org/ +// Email: team AT apbteam DOT org +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} +#include "ucoolib/arch/arch.hh" + +namespace ucoo { + +void +arch_init (int argc, const char **argv) +{ +} + +} // namespace ucoo diff --git a/digital/ucoolib/ucoolib/arch/arch.stm32.cc b/digital/ucoolib/ucoolib/arch/arch.stm32.cc new file mode 100644 index 00000000..35004a72 --- /dev/null +++ b/digital/ucoolib/ucoolib/arch/arch.stm32.cc @@ -0,0 +1,36 @@ +// ucoolib - Microcontroller object oriented library. {{{ +// +// Copyright (C) 2012 Nicolas Schodet +// +// APBTeam: +// Web: http://apbteam.org/ +// Email: team AT apbteam DOT org +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} +#include "ucoolib/arch/arch.hh" + +#include + +namespace ucoo { + +void +arch_init (int argc, const char **argv) +{ + rcc_clock_setup_hse_3v3 (&hse_8mhz_3v3[CLOCK_3V3_120MHZ]); +} + +} // namespace ucoo diff --git a/digital/ucoolib/ucoolib/hal/usb/test/test_usb.cc b/digital/ucoolib/ucoolib/hal/usb/test/test_usb.cc index 72c4745e..5ddb87d9 100644 --- a/digital/ucoolib/ucoolib/hal/usb/test/test_usb.cc +++ b/digital/ucoolib/ucoolib/hal/usb/test/test_usb.cc @@ -22,14 +22,15 @@ // // }}} #include "ucoolib/hal/usb/usb.hh" +#include "ucoolib/arch/arch.hh" #include #include int -main () +main (int argc, const char **argv) { - rcc_clock_setup_hse_3v3 (&hse_8mhz_3v3[CLOCK_3V3_120MHZ]); + ucoo::arch_init (argc, argv); rcc_peripheral_enable_clock (&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN); ucoo::UsbStreamControl usc ("APBTeam", "USB test"); ucoo::UsbStream us[] = { -- cgit v1.2.3