From b239309dcadd809fd5ed4874064aced8f71557d0 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 17 Jun 2019 21:49:15 +0200 Subject: [PATCH] common: Add the usb_serial module. Its init() function calls into the USB serial C code. --- SConscript.libcommon | 1 + src/common/lib.rs | 1 + src/common/usb_serial.rs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/common/usb_serial.rs diff --git a/SConscript.libcommon b/SConscript.libcommon index 69f317c..3003797 100644 --- a/SConscript.libcommon +++ b/SConscript.libcommon @@ -6,6 +6,7 @@ source_files_rs = [ 'src/common/register.rs', 'src/common/nvic.rs', 'src/common/clock.rs', + 'src/common/usb_serial.rs', ] source_files_c = [ diff --git a/src/common/lib.rs b/src/common/lib.rs index ac388b4..c262abd 100644 --- a/src/common/lib.rs +++ b/src/common/lib.rs @@ -29,6 +29,7 @@ pub mod register; pub mod nvic; pub mod clock; +pub mod usb_serial; #[lang="eh_personality"] extern fn eh_personality() { diff --git a/src/common/usb_serial.rs b/src/common/usb_serial.rs new file mode 100644 index 0000000..f08f679 --- /dev/null +++ b/src/common/usb_serial.rs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 Tilman Sauerbeck (tilman at code-monkey de) + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +extern { + fn USB_VcomInit(); +} + +pub unsafe fn init() { + USB_VcomInit(); +} -- 2.30.2