Skip to content

Commit

Permalink
More win fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
haata committed Oct 12, 2023
1 parent 09db753 commit 9192710
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 47 deletions.
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
4 changes: 2 additions & 2 deletions src/WinPortFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,7 +14,7 @@
// * Neither the name of the <organization> 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
Expand Down
4 changes: 2 additions & 2 deletions src/WinPortFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,7 +14,7 @@
// * Neither the name of the <organization> 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
Expand Down
6 changes: 3 additions & 3 deletions src/WinSerialPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,7 +14,7 @@
// * Neither the name of the <organization> 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
Expand Down Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/WinSerialPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,7 +14,7 @@
// * Neither the name of the <organization> 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
Expand Down Expand Up @@ -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; };
Expand Down
36 changes: 0 additions & 36 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,43 +115,7 @@ pub mod bossa {
pub fn new_samba() -> UniquePtr<Samba>;

fn connect(self: Pin<&mut Samba>, port: UniquePtr<SerialPort>, 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;
}
}

0 comments on commit 9192710

Please sign in to comment.