1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
use crate::{ raw, peripherals::{ syscon, }, typestates::{ init_state, } }; crate::wrap_stateful_peripheral!(Casper, CASPER); impl<State> Casper<State> { pub fn enabled( mut self, syscon: &mut syscon::Syscon, ) -> Casper<init_state::Enabled> { syscon.enable_clock(&mut self.raw); syscon.reset(&mut self.raw); Casper { raw: self.raw, _state: init_state::Enabled(()), } } pub fn disabled( mut self, syscon: &mut syscon::Syscon, ) -> Casper<init_state::Disabled> { syscon.disable_clock(&mut self.raw); Casper { raw: self.raw, _state: init_state::Disabled, } } } pub enum Operations { /// Walking 1 or more of J loop, doing r=a*b using 64x64=128 Mul6464NoSum = 0x01, /// Walking 1 or more of J loop, doing c,r=r+a*b using 64x64=128, but assume inner j loop Mul6464Sum = 0x02, /// Walking 1 or more of J loop, doing c,r=r+a*b using 64x64=128, but sum all of w. Mul6464FullSum = 0x03, /// Walking 1 or more of J loop, doing c,r[-1]=r+a*b using 64x64=128, but skip 1st write Mul6464Reduce = 0x04, /// Walking add with off_AB, and in/out off_RES doing c,r=r+a+c using 64+64=65 Add64 = 0x08, /// Walking subtract with off_AB, and in/out off_RES doing r=r-a uding 64-64=64, /// with last borrow implicit if any Sub64 = 0x09, /// Walking add to self with off_RES doing c,r=r+r+c using 64+64=65 Double64 = 0x0A, /// Walking XOR with off_AB, and in/out off_RES doing r=r^a using 64^64=64 Xor64 = 0x0B, /// Walking shift left doing r1,r=(b*D)|r1, where D is 2^amt and is loaded /// by app (off_CD not used) ShiftLeft32 = 0x10, /// Walking shift right doing r,r1=(b*D)|r1, where D is 2^(32-amt) and is loaded /// by app (off_CD not used) and off_RES starts at MSW ShiftRight32 = 0x11, /// Copy from ABoff to resoff, 64b at a time Copy = 0x14, /// Copy and mask from ABoff to resoff, 64b at a time Remask = 0x15, /// Compare two arrays, running all the way to the end Compare = 0x16, /// Compare two arrays, stopping on 1st !=^ CompareFast = 0x17, }