pub use crate::gpio::Instance;
pub use crate::gpio::{RegisterBlock, ResetValues};
pub use crate::gpio::{DR, DR_CLEAR, DR_SET, DR_TOGGLE, EDGE_SEL, GDIR, ICR1, ICR2, IMR, ISR, PSR};

/// Access functions for the GPIO1 peripheral instance
#[cfg(any(feature = "imxrt1010", feature = "imxrt1060"))]
pub mod GPIO1 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x401b8000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO1
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO1_TAKEN: bool = false;

    /// Safe access to GPIO1
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO1_TAKEN {
                None
            } else {
                GPIO1_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO1
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO1_TAKEN && inst.addr == INSTANCE.addr {
                GPIO1_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO1
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO1_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO1
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1010", feature = "imxrt1060"))]
pub const GPIO1: *const RegisterBlock = 0x401b8000 as *const _;

/// Access functions for the GPIO2 peripheral instance
#[cfg(any(feature = "imxrt1010", feature = "imxrt1060"))]
pub mod GPIO2 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x401bc000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO2
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO2_TAKEN: bool = false;

    /// Safe access to GPIO2
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO2_TAKEN {
                None
            } else {
                GPIO2_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO2
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO2_TAKEN && inst.addr == INSTANCE.addr {
                GPIO2_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO2
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO2_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO2
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO2: *const RegisterBlock = 0x401bc000 as *const _;
#[cfg(any(feature = "imxrt1010"))]
pub const GPIO2: *const RegisterBlock = 0x42000000 as *const _;

/// Access functions for the GPIO3 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO3 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x401c0000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO3
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO3_TAKEN: bool = false;

    /// Safe access to GPIO3
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO3_TAKEN {
                None
            } else {
                GPIO3_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO3
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO3_TAKEN && inst.addr == INSTANCE.addr {
                GPIO3_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO3
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO3_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO3
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO3: *const RegisterBlock = 0x401c0000 as *const _;

/// Access functions for the GPIO4 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO4 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x401c4000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO4
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO4_TAKEN: bool = false;

    /// Safe access to GPIO4
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO4_TAKEN {
                None
            } else {
                GPIO4_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO4
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO4_TAKEN && inst.addr == INSTANCE.addr {
                GPIO4_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO4
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO4_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO4
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO4: *const RegisterBlock = 0x401c4000 as *const _;

/// Access functions for the GPIO5 peripheral instance
#[cfg(any(feature = "imxrt1010", feature = "imxrt1060"))]
pub mod GPIO5 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x400c0000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO5
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO5_TAKEN: bool = false;

    /// Safe access to GPIO5
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO5_TAKEN {
                None
            } else {
                GPIO5_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO5
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO5_TAKEN && inst.addr == INSTANCE.addr {
                GPIO5_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO5
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO5_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO5
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1010", feature = "imxrt1060"))]
pub const GPIO5: *const RegisterBlock = 0x400c0000 as *const _;

/// Access functions for the GPIO6 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO6 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x42000000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO6
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO6_TAKEN: bool = false;

    /// Safe access to GPIO6
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO6_TAKEN {
                None
            } else {
                GPIO6_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO6
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO6_TAKEN && inst.addr == INSTANCE.addr {
                GPIO6_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO6
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO6_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO6
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO6: *const RegisterBlock = 0x42000000 as *const _;

/// Access functions for the GPIO7 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO7 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x42004000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO7
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO7_TAKEN: bool = false;

    /// Safe access to GPIO7
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO7_TAKEN {
                None
            } else {
                GPIO7_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO7
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO7_TAKEN && inst.addr == INSTANCE.addr {
                GPIO7_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO7
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO7_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO7
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO7: *const RegisterBlock = 0x42004000 as *const _;

/// Access functions for the GPIO8 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO8 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x42008000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO8
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO8_TAKEN: bool = false;

    /// Safe access to GPIO8
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO8_TAKEN {
                None
            } else {
                GPIO8_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO8
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO8_TAKEN && inst.addr == INSTANCE.addr {
                GPIO8_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO8
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO8_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO8
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO8: *const RegisterBlock = 0x42008000 as *const _;

/// Access functions for the GPIO9 peripheral instance
#[cfg(any(feature = "imxrt1060"))]
pub mod GPIO9 {
    use super::Instance;
    use super::ResetValues;
    const INSTANCE: Instance = Instance {
        addr: 0x4200c000,
        _marker: ::core::marker::PhantomData,
    };

    /// Reset values for each field in GPIO9
    pub const reset: ResetValues = ResetValues {
        DR: 0x00000000,
        GDIR: 0x00000000,
        PSR: 0x00000000,
        ICR1: 0x00000000,
        ICR2: 0x00000000,
        IMR: 0x00000000,
        ISR: 0x00000000,
        EDGE_SEL: 0x00000000,
        DR_SET: 0x00000000,
        DR_CLEAR: 0x00000000,
        DR_TOGGLE: 0x00000000,
    };
    #[allow(renamed_and_removed_lints)]
    #[allow(private_no_mangle_statics)]
    #[no_mangle]
    static mut GPIO9_TAKEN: bool = false;

    /// Safe access to GPIO9
    ///
    /// This function returns `Some(Instance)` if this instance is not
    /// currently taken, and `None` if it is. This ensures that if you
    /// do get `Some(Instance)`, you are ensured unique access to
    /// the peripheral and there cannot be data races (unless other
    /// code uses `unsafe`, of course). You can then pass the
    /// `Instance` around to other functions as required. When you're
    /// done with it, you can call `release(instance)` to return it.
    ///
    /// `Instance` itself dereferences to a `RegisterBlock`, which
    /// provides access to the peripheral's registers    
    #[inline]
    pub fn take() -> Option<Instance> {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO9_TAKEN {
                None
            } else {
                GPIO9_TAKEN = true;
                Some(INSTANCE)
            }
        })
    }

    /// Release exclusive access to GPIO9
    ///
    /// This function allows you to return an `Instance` so that it
    /// is available to `take()` again. This function will panic if
    /// you return a different `Instance` or if this instance is not
    /// already taken    
    #[inline]
    pub fn release(inst: Instance) {
        cortex_m::interrupt::free(|_| unsafe {
            if GPIO9_TAKEN && inst.addr == INSTANCE.addr {
                GPIO9_TAKEN = false;
            } else {
                panic!("Released a peripheral which was not taken");
            }
        });
    }

    /// Unsafely steal GPIO9
    ///
    /// This function is similar to take() but forcibly takes the
    /// Instance, marking it as taken irregardless of its previous
    /// state    
    #[inline]
    pub unsafe fn steal() -> Instance {
        GPIO9_TAKEN = true;
        INSTANCE
    }
}

/// Raw pointer to GPIO9
///
/// Dereferencing this is unsafe because you are not ensured unique
/// access to the peripheral, so you may encounter data races with
/// other users of this peripheral. It is up to you to ensure you
/// will not cause data races.
///
/// This constant is provided for ease of use in unsafe code: you can
/// simply call for example `write_reg!(gpio, GPIOA, ODR, 1);`.
#[cfg(any(feature = "imxrt1060"))]
pub const GPIO9: *const RegisterBlock = 0x4200c000 as *const _;
