From 9192710a5c3217b63cda985952a0a246e4ab669f Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Wed, 11 Oct 2023 22:15:36 -0700 Subject: [PATCH] More win fixes --- build.rs | 3 +++ src/WinPortFactory.cpp | 4 ++-- src/WinPortFactory.h | 4 ++-- src/WinSerialPort.cpp | 6 +++--- src/WinSerialPort.h | 8 ++++---- src/lib.rs | 36 ------------------------------------ 6 files changed, 14 insertions(+), 47 deletions(-) diff --git a/build.rs b/build.rs index 04d117f4..7860c9ac 100644 --- a/build.rs +++ b/build.rs @@ -67,7 +67,10 @@ fn main() { for rs in rs_files { println!("cargo:rerun-if-changed={}", rs); } + + // Extra includes needed for msvc environments #[cfg(target_env = "msvc")] build.include("src/msvc"); + build.flag_if_supported("-std=c++14").compile("bossa"); } diff --git a/src/WinPortFactory.cpp b/src/WinPortFactory.cpp index 978eb7c0..2ec26322 100644 --- a/src/WinPortFactory.cpp +++ b/src/WinPortFactory.cpp @@ -3,7 +3,7 @@ // // Copyright (c) 2011-2018, ShumaTech // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ // * Neither the name of the nor the // names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/src/WinPortFactory.h b/src/WinPortFactory.h index 912d065f..43f1fff7 100644 --- a/src/WinPortFactory.h +++ b/src/WinPortFactory.h @@ -3,7 +3,7 @@ // // Copyright (c) 2011-2018, ShumaTech // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ // * Neither the name of the nor the // names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/src/WinSerialPort.cpp b/src/WinSerialPort.cpp index ba00de36..a839ded1 100644 --- a/src/WinSerialPort.cpp +++ b/src/WinSerialPort.cpp @@ -3,7 +3,7 @@ // // Copyright (c) 2011-2018, ShumaTech // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ // * Neither the name of the nor the // names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -70,7 +70,7 @@ printLastError() #endif bool -WinSerialPort::open(int baud, int data, SerialPort::Parity parity, SerialPort::StopBit stop) +WinSerialPort::open(int baud, int data, Parity parity, StopBit stop) { DCB dcbSerialParams; diff --git a/src/WinSerialPort.h b/src/WinSerialPort.h index 2627ef07..2485823f 100644 --- a/src/WinSerialPort.h +++ b/src/WinSerialPort.h @@ -3,7 +3,7 @@ // // Copyright (c) 2011-2018, ShumaTech // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ // * Neither the name of the nor the // names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -42,8 +42,8 @@ class WinSerialPort : public SerialPort bool open(int baud = 115200, int data = 8, - SerialPort::Parity parity = SerialPort::ParityNone, - SerialPort::StopBit stop = SerialPort::StopBitOne); + Parity parity = ParityNone, + StopBit stop = StopBitOne); void close(); bool isUsb() { return _isUsb; }; diff --git a/src/lib.rs b/src/lib.rs index 5206d35e..59b1a882 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -115,43 +115,7 @@ pub mod bossa { pub fn new_samba() -> UniquePtr; fn connect(self: Pin<&mut Samba>, port: UniquePtr, bps: i32) -> bool; - fn disconnect(self: Pin<&mut Samba>); - - fn writeByte(self: Pin<&mut Samba>, addr: u32, value: u8); - fn readByte(self: Pin<&mut Samba>, addr: u32) -> u8; - - fn writeWord(self: Pin<&mut Samba>, addr: u32, value: u32); - fn readWord(self: Pin<&mut Samba>, addr: u32) -> u32; - - /// # Safety - unsafe fn write(self: Pin<&mut Samba>, addr: u32, buffer: *const u8, size: i32); - /// # Safety - unsafe fn read(self: Pin<&mut Samba>, addr: u32, buffer: *mut u8, size: i32); - - fn go(self: Pin<&mut Samba>, addr: u32); - - fn version(self: Pin<&mut Samba>) -> &CxxString; - - /// # Safety - unsafe fn chipId(self: Pin<&mut Samba>, chipId: &mut u32, extChipId: &mut u32); fn setDebug(self: Pin<&mut Samba>, debug: bool); - - fn getSerialPort(self: Pin<&mut Samba>) -> &SerialPort; - - fn reset(self: Pin<&mut Samba>); - - // Extended SAM-BA functions - fn canChipErase(self: Pin<&mut Samba>) -> bool; - fn chipErase(self: Pin<&mut Samba>, start_addr: u32); - - fn canWriteBuffer(self: Pin<&mut Samba>) -> bool; - fn writeBuffer(self: Pin<&mut Samba>, src_addr: u32, dst_addr: u32, size: u32); - fn writeBufferSize(self: Pin<&mut Samba>) -> u32; - - fn canChecksumBuffer(self: Pin<&mut Samba>) -> bool; - fn checksumBuffer(self: Pin<&mut Samba>, start_addr: u32, size: u32) -> u16; - fn checksumBufferSize(self: Pin<&mut Samba>) -> u32; - fn checksumCalc(self: Pin<&mut Samba>, c: u8, crc: u16) -> u16; } }