Skip to content

Commit

Permalink
Merge #1958
Browse files Browse the repository at this point in the history
1958: Remove core::intrinsics::math r=ppannuto a=bradjc

Part of #1654.

This math is old, and probably shouldn't be in the kernel. The only thing using it is a capsule for an obsolete chip. There was some discussion about this somewhere, and I think the conclusion was we don't really need a capsule for a sensor that is not on any boards and is an obsolete part.



### Testing Strategy

travis


### TODO or Help Wanted

n/a


### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Brad Campbell <bradjc5@gmail.com>
  • Loading branch information
bors[bot] and bradjc committed Jun 19, 2020
2 parents 5fc9260 + bafa089 commit ef9c656
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 375 deletions.
1 change: 0 additions & 1 deletion capsules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ These implement a driver to setup and read various physical sensors.
- **[LPS25HB](src/lps25hb.rs)**: Pressure sensor.
- **[MLX90614](src/mlx90614.rs)**: Infrared temperature sensor.
- **[SI7021](src/si7021.rs)**: Temperature and humidity sensor.
- **[TMP006](src/tmp006.rs)**: Infrared temperature sensor.
- **[TSL2561](src/tsl2561.rs)**: Light sensor.

These drivers provide support for various ICs.
Expand Down
1 change: 0 additions & 1 deletion capsules/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ pub mod si7021;
pub mod spi;
pub mod st7735;
pub mod temperature;
pub mod tmp006;
pub mod tsl2561;
pub mod usb;
pub mod virtual_alarm;
Expand Down
346 changes: 0 additions & 346 deletions capsules/src/tmp006.rs

This file was deleted.

27 changes: 0 additions & 27 deletions kernel/src/common/math.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
//! Helper functions for common mathematical operations.

use core::convert::{From, Into};
use core::intrinsics as int;

// wrappers for unsafe core::intrinsics math functions
// core::intrinsics functions can be found at
// https://doc.rust-lang.org/core/intrinsics/
// add additional wrappers as needed

/// Provide `sqrtf32` with the unsafe hidden.
pub fn sqrtf32(num: f32) -> f32 {
unsafe { int::sqrtf32(num) }
}

// errno from stdlib for use in Rust

extern "C" {
fn __errno() -> &'static mut i32;
}

/// Return errno value and zero it out.
pub fn get_errno() -> i32 {
unsafe {
let errnoaddr = __errno();
let ret = *errnoaddr;
*errnoaddr = 0;
ret
}
}

/// Get closest power of two greater than the given number.
pub fn closest_power_of_two(mut num: u32) -> u32 {
Expand Down

0 comments on commit ef9c656

Please sign in to comment.