pub fn handle_interrupt(&self) {
        let regs = unsafe { &*self.regs };
        // disable interrupts
        self.disable_interrupts();

        match self.index.get() {
            // fetch more data need 4 bytes because the capsule requires that
            e @ 0...3 => {
                // 3 lines below to change data in Cell, perhaps it can be done more nicely
                let mut rn = self.randomness.get();
                // 1 byte randomness
                let r = regs.value.get();
                //  e = 0 -> byte 1 LSB
                //  e = 1 -> byte 2
                //  e = 2 -> byte 3
                //  e = 3 -> byte 4 MSB
                rn |= r << 8 * e;
                self.randomness.set(rn);

                self.index.set(e + 1);
                self.start_rng()
            }
            // fetched 4 bytes of data send to the capsule
            4 => {
                self.client.get().map(|client| {
                    let result = client.randomness_available(&mut TrngIter(self));
                    if Continue::Done != result {
                        // need more randomness i.e generate more randomness
                        self.start_rng();
                    }
                });
            }
            // This should never happen if the logic is correct
            // Restart randomness generation if the condition occurs
            _ => {
                self.index.set(0);
                self.randomness.set(0);
            }
        }
    }
// only VALRDY register can trigger the interrupt
only VALRDY register can trigger the interrupt
only VALRDY register can trigger the interrupt
pub fn handle_interrupt(&self) {
        let regs = unsafe { &*self.regs };
        // disable interrupts
        self.disable_interrupts();
        match self.index.get() {
            // fetch more data need 4 bytes because the capsule requires that
            e @ 0...3 => {
                // 3 lines below to change data in Cell, perhaps it can be done more nicely
                let mut rn = self.randomness.get();
                // 1 byte randomness
                let r = regs.value.get();
                //  e = 0 -> byte 1 LSB
                //  e = 1 -> byte 2
                //  e = 2 -> byte 3
                //  e = 3 -> byte 4 MSB
                rn |= r << 8 * e;
                self.randomness.set(rn);
                self.index.set(e + 1);
                self.start_rng()
            }
            // fetched 4 bytes of data send to the capsule
            4 => {
                self.client.get().map(|client| {
                    let result = client.randomness_available(&mut TrngIter(self));
                    if Continue::Done != result {
                        // need more randomness i.e generate more randomness
                        self.start_rng();
                    }
                });
            }
            // This should never happen if the logic is correct
            // Restart randomness generation if the condition occurs
            _ => {
                self.index.set(0);
                self.randomness.set(0);
            }
        }
    }
pub fn handle_interrupt ( & self ) { let regs = unsafe { & * self . regs } ; // disable interrupts self . disable_interrupts ( ) ; match self . index . get ( ) { // fetch more data need 4 bytes because the capsule requires that e @ 0 ... 3 => { // 3 lines below to change data in Cell, perhaps it can be done more nicely let mut rn = self . randomness . get ( ) ; // 1 byte randomness let r = regs . value . get ( ) ; //  e = 0 -> byte 1 LSB //  e = 1 -> byte 2 //  e = 2 -> byte 3 //  e = 3 -> byte 4 MSB rn |= r << 8 * e ; self . randomness . set ( rn ) ; self . index . set ( e + 1 ) ; self . start_rng ( ) } // fetched 4 bytes of data send to the capsule 4 => { self . client . get ( ) . map ( | client | { let result = client . randomness_available ( & mut TrngIter ( self ) ) ; if Continue :: Done != result { // need more randomness i.e generate more randomness self . start_rng ( ) ; } } ) ; } // This should never happen if the logic is correct // Restart randomness generation if the condition occurs _ => { self . index . set ( 0 ) ; self . randomness . set ( 0 ) ; } } }
only VALRDY register can trigger the interrupt
only VALRDY register can trigger the interrupt
&self
&self