text stringlengths 8 4.13M |
|---|
//! Tests auto-converted from "sass-spec/spec/libsass/debug-directive-nested"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/libsass/debug-directive-nested/function.hrx"
#[test]
fn function() {
assert_eq!(
rsass(
"@function c() {\
\n @warn test;\
\n @return d;\
\n}\
\n\
\na {\
\n b: {\
\n c: c();\
\n }\
\n}\
\n"
)
.unwrap(),
"a {\
\n b-c: d;\
\n}\
\n"
);
}
// From "sass-spec/spec/libsass/debug-directive-nested/inline.hrx"
#[test]
fn inline() {
assert_eq!(
rsass(
"a {\
\n b: {\
\n @debug test;\
\n c: d;\
\n }\
\n}\
\n"
)
.unwrap(),
"a {\
\n b-c: d;\
\n}\
\n"
);
}
// From "sass-spec/spec/libsass/debug-directive-nested/mixin.hrx"
#[test]
fn mixin() {
assert_eq!(
rsass(
"@mixin c() {\
\n @warn test;\
\n c: d;\
\n}\
\n\
\na {\
\n b: {\
\n @include c();\
\n }\
\n}\
\n"
)
.unwrap(),
"a {\
\n b-c: d;\
\n}\
\n"
);
}
|
//! Utilities for engine initialization.
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant};
use egui::TextureId;
use egui_winit_platform::{Platform, PlatformDescriptor};
use image::RgbaImage;
use thiserror::Error;
use ultraviolet::{Mat4, Vec3};
use winit::event::{Event, StartCause, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::Window;
use crate::{
config::Config,
graphics::{camera::CameraUBO, error::ImageRegisterError, Renderer, RendererCreationError},
window::{Event as MyEvent, Size},
};
pub type Result<T> = std::result::Result<T, AppCreationError>;
#[derive(Debug, Error)]
pub enum AppCreationError {
#[error("cannot create more than one application instance")]
Initialized,
#[error("graphics initialization error: {0}")]
Graphics(#[from] RendererCreationError),
}
/// Type which represents duration between two frames.
pub type DeltaTime = Duration;
/// General context of game engine.
///
/// Can be created using [`init`] function.
///
pub struct Application {
_config: Config,
renderer: Renderer,
egui: Option<Platform>,
event_loop: Option<EventLoop<()>>,
}
impl Application {
fn new(config: Config) -> Result<Self> {
let event_loop = EventLoop::with_user_event();
let renderer = Renderer::new(&config, &event_loop)?;
let window = renderer.window();
let size = window.inner_size();
let egui = Platform::new(PlatformDescriptor {
physical_width: size.width,
physical_height: size.height,
scale_factor: window.scale_factor(),
..Default::default()
});
Ok(Self {
renderer,
egui: Some(egui),
_config: config,
event_loop: Some(event_loop),
})
}
/// Returns underlying window of this application.
pub fn window(&self) -> &Window {
self.renderer.window()
}
pub fn register_ui_image(
&mut self,
image: &RgbaImage,
) -> std::result::Result<TextureId, ImageRegisterError> {
self.renderer.register_ui_image(image)
}
/// Starts execution of game engine.
pub fn run(mut self, mut callback: impl FnMut(MyEvent) + 'static) -> ! {
let event_loop = self.event_loop.take().unwrap();
let mut start_time = Instant::now();
event_loop.run(move |event, _, control_flow| {
// Have the closure take ownership of `self`.
// `event_loop.run` never returns, therefore we must do this to ensure
// the resources are properly cleaned up.
let _ = &self;
*control_flow = ControlFlow::Poll;
// Take `Platform` object from `self` to workaround about borrow checker.
let mut egui = self.egui.take().unwrap();
// Have this closure to early return if needed (for example if error is occurred).
// Closure is needed because `label_break_value` feature is unstable.
let action = || {
egui.handle_event(&event);
egui.update_time(start_time.elapsed().as_secs_f64());
let window = self.window();
match event {
Event::NewEvents(StartCause::Init) => {
start_time = Instant::now();
callback(MyEvent::Created);
window.set_visible(true);
}
Event::WindowEvent { event, window_id } if window_id == window.id() => {
match event {
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
WindowEvent::Resized(size) => {
if size.width == 0 || size.height == 0 {
callback(MyEvent::Resized(Size::default()));
return;
}
if let Err(error) = self.renderer.resize() {
log::error!("window resizing error: {}", error);
*control_flow = ControlFlow::Exit;
return;
}
let size = (size.width, size.height);
callback(MyEvent::Resized(size.into()));
}
WindowEvent::ScaleFactorChanged { new_inner_size, .. } => {
let size = *new_inner_size;
if size.width == 0 || size.height == 0 {
callback(MyEvent::Resized(Size::default()));
return;
}
if let Err(error) = self.renderer.resize() {
log::error!("window resizing error: {}", error);
*control_flow = ControlFlow::Exit;
return;
}
let size = (size.width, size.height);
callback(MyEvent::Resized(size.into()));
}
_ => (),
}
}
Event::MainEventsCleared => {
let size = window.inner_size();
if size.width == 0 || size.height == 0 {
return;
}
window.request_redraw();
}
Event::RedrawRequested(window_id) if window_id == window.id() => {
let size = window.inner_size();
if size.width == 0 || size.height == 0 {
return;
}
let frame_start = Instant::now();
egui.begin_frame();
let context = egui.context();
callback(MyEvent::UI(context.clone()));
let (_output, shapes) = egui.end_frame(Some(window));
let meshes = context.tessellate(shapes);
let texture = context.texture();
if let Err(error) = self.renderer.render(Some((meshes, texture))) {
log::error!("rendering error: {}", error);
*control_flow = ControlFlow::Exit;
return;
}
let delta_time = Instant::now().duration_since(frame_start);
callback(MyEvent::Update(delta_time));
let ubo = {
let duration = Instant::now().duration_since(start_time);
let elapsed = duration.as_millis() as f32;
use ultraviolet::projection::perspective_vk as perspective;
let projection = perspective(
45f32.to_radians(),
(size.width as f32) / (size.height as f32),
1.0,
10.0,
);
let model = Mat4::from_rotation_z(elapsed * 0.1f32.to_radians());
let view = Mat4::look_at(
Vec3::new(2.0, 2.0, 2.0),
Vec3::zero(),
Vec3::unit_z(),
);
CameraUBO::new(projection, model, view)
};
self.renderer.set_camera_ubo(ubo);
}
Event::LoopDestroyed => {
callback(MyEvent::Destroyed);
log::info!("closing this application");
}
_ => (),
}
};
action();
// Assign `Platform` object back to `self`.
self.egui = Some(egui);
})
}
}
/// Creates a unique [`Application`] instance.
/// If application instance was created earlier, function call will return an error.
///
/// # Errors
///
/// An error is returned if application instance have already been initialized.
///
/// # Panic
///
/// This function could panic if invoked **not on main thread**.
///
pub fn init(config: Config) -> Result<Application> {
static FLAG: AtomicBool = AtomicBool::new(false);
const UNINITIALIZED: bool = false;
const INITIALIZED: bool = true;
let initialized = FLAG
.compare_exchange(
UNINITIALIZED,
INITIALIZED,
Ordering::SeqCst,
Ordering::SeqCst,
)
.unwrap();
if initialized {
return Err(AppCreationError::Initialized);
}
Application::new(config)
}
|
#[doc = "Reader of register DDRCTRL_PCFGW_0"]
pub type R = crate::R<u32, super::DDRCTRL_PCFGW_0>;
#[doc = "Writer for register DDRCTRL_PCFGW_0"]
pub type W = crate::W<u32, super::DDRCTRL_PCFGW_0>;
#[doc = "Register DDRCTRL_PCFGW_0 `reset()`'s with value 0x4000"]
impl crate::ResetValue for super::DDRCTRL_PCFGW_0 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x4000
}
}
#[doc = "Reader of field `WR_PORT_PRIORITY`"]
pub type WR_PORT_PRIORITY_R = crate::R<u16, u16>;
#[doc = "Write proxy for field `WR_PORT_PRIORITY`"]
pub struct WR_PORT_PRIORITY_W<'a> {
w: &'a mut W,
}
impl<'a> WR_PORT_PRIORITY_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03ff) | ((value as u32) & 0x03ff);
self.w
}
}
#[doc = "Reader of field `WR_PORT_AGING_EN`"]
pub type WR_PORT_AGING_EN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `WR_PORT_AGING_EN`"]
pub struct WR_PORT_AGING_EN_W<'a> {
w: &'a mut W,
}
impl<'a> WR_PORT_AGING_EN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
self.w
}
}
#[doc = "Reader of field `WR_PORT_URGENT_EN`"]
pub type WR_PORT_URGENT_EN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `WR_PORT_URGENT_EN`"]
pub struct WR_PORT_URGENT_EN_W<'a> {
w: &'a mut W,
}
impl<'a> WR_PORT_URGENT_EN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
self.w
}
}
#[doc = "Reader of field `WR_PORT_PAGEMATCH_EN`"]
pub type WR_PORT_PAGEMATCH_EN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `WR_PORT_PAGEMATCH_EN`"]
pub struct WR_PORT_PAGEMATCH_EN_W<'a> {
w: &'a mut W,
}
impl<'a> WR_PORT_PAGEMATCH_EN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
self.w
}
}
impl R {
#[doc = "Bits 0:9 - WR_PORT_PRIORITY"]
#[inline(always)]
pub fn wr_port_priority(&self) -> WR_PORT_PRIORITY_R {
WR_PORT_PRIORITY_R::new((self.bits & 0x03ff) as u16)
}
#[doc = "Bit 12 - WR_PORT_AGING_EN"]
#[inline(always)]
pub fn wr_port_aging_en(&self) -> WR_PORT_AGING_EN_R {
WR_PORT_AGING_EN_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 13 - WR_PORT_URGENT_EN"]
#[inline(always)]
pub fn wr_port_urgent_en(&self) -> WR_PORT_URGENT_EN_R {
WR_PORT_URGENT_EN_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 14 - WR_PORT_PAGEMATCH_EN"]
#[inline(always)]
pub fn wr_port_pagematch_en(&self) -> WR_PORT_PAGEMATCH_EN_R {
WR_PORT_PAGEMATCH_EN_R::new(((self.bits >> 14) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:9 - WR_PORT_PRIORITY"]
#[inline(always)]
pub fn wr_port_priority(&mut self) -> WR_PORT_PRIORITY_W {
WR_PORT_PRIORITY_W { w: self }
}
#[doc = "Bit 12 - WR_PORT_AGING_EN"]
#[inline(always)]
pub fn wr_port_aging_en(&mut self) -> WR_PORT_AGING_EN_W {
WR_PORT_AGING_EN_W { w: self }
}
#[doc = "Bit 13 - WR_PORT_URGENT_EN"]
#[inline(always)]
pub fn wr_port_urgent_en(&mut self) -> WR_PORT_URGENT_EN_W {
WR_PORT_URGENT_EN_W { w: self }
}
#[doc = "Bit 14 - WR_PORT_PAGEMATCH_EN"]
#[inline(always)]
pub fn wr_port_pagematch_en(&mut self) -> WR_PORT_PAGEMATCH_EN_W {
WR_PORT_PAGEMATCH_EN_W { w: self }
}
}
|
pub const DESIRED_UPS: u32 = 60;
pub const GRAVITY: f32 = 0.28;
pub const ARROW_BASE_UMPH: f32 = 20.0;
pub const CHAR_MOV_SPEED: f32 = 3.0;
pub const ARROW_DRAG_MULT: f32 = 0.99;
|
use serde_json::json;
use sqlx::{Pool, Row, Sqlite};
use std::sync::Arc;
use super::model::{CompactTag, DBTag};
use crate::_utils::error::DataAccessError;
pub struct TagRepository {
main_sql_db: Arc<Pool<Sqlite>>,
}
impl TagRepository {
pub fn new(main_sql_db: Arc<Pool<Sqlite>>) -> Self {
Self { main_sql_db }
}
pub async fn get_many_compact_tags_by_names(
&self,
names: Vec<String>,
) -> Result<Vec<CompactTag>, DataAccessError> {
let conn = self.main_sql_db.acquire().await;
if conn.is_err() {
tracing::error!("Error while getting sql connection: {:?}", conn);
return Err(DataAccessError::InternalError);
}
let mut conn = conn.unwrap();
// @TODO-ZM: use sqlx::query!
let result = sqlx::query(
format!(
r#"
SELECT id, name, slug
FROM tag
WHERE name IN ({})
"#,
names
.iter()
.map(|name| format!("'{}'", name))
.collect::<Vec<String>>()
.join(",")
)
.as_str(),
)
.fetch_all(&mut *conn)
.await;
if result.is_err() {
tracing::error!(
"Error while getting many compact tags by names: {:?}",
result.err()
);
return Err(DataAccessError::InternalError);
}
let result = result.unwrap();
let mut compact_tags = vec![];
for row in result {
let json_tag = json!({
"id": row.get::<u32, _>("id"),
"name": row.get::<String, _>("name"),
"slug": row.get::<String, _>("slug"),
});
let compact_tag: CompactTag = serde_json::from_value(json_tag).unwrap();
compact_tags.push(compact_tag);
}
Ok(compact_tags)
}
pub async fn get_many_compact_tags_by_ids(
&self,
ids: &Vec<u32>,
) -> Result<Vec<CompactTag>, DataAccessError> {
let conn = self.main_sql_db.acquire().await;
if conn.is_err() {
tracing::error!("Error while getting sql connection: {:?}", conn);
return Err(DataAccessError::InternalError);
}
let mut conn = conn.unwrap();
// @TODO-ZM: use sqlx::query!
let result = sqlx::query(
format!(
r#"
SELECT id, name, slug
FROM tag
WHERE id IN ({})
"#,
ids
.iter()
.map(|id| id.to_string())
.collect::<Vec<String>>()
.join(",")
)
.as_str(),
)
.fetch_all(&mut *conn)
.await;
if result.is_err() {
tracing::error!(
"Error while getting many compact tags by ids: {:?}",
result.err()
);
return Err(DataAccessError::InternalError);
}
let result = result.unwrap();
let mut compact_tags = vec![];
for row in result {
let json_tag = json!({
"id": row.get::<u32, _>("id"),
"name": row.get::<String, _>("name"),
"slug": row.get::<String, _>("slug"),
});
let compact_tag: CompactTag = serde_json::from_value(json_tag).unwrap();
compact_tags.push(compact_tag);
}
Ok(compact_tags)
}
pub async fn create_one_tag(&self, tag: DBTag) -> Result<u32, DataAccessError> {
let conn = self.main_sql_db.acquire().await;
if conn.is_err() {
tracing::error!("Error while getting sql connection: {:?}", conn);
return Err(DataAccessError::InternalError);
}
let mut conn = conn.unwrap();
let db_result = sqlx::query(
r#"
INSERT INTO tag (name, slug, created_at)
VALUES ($1, $2, strftime('%Y-%m-%dT%H:%M:%S.%fZ', 'now'))
"#,
)
.bind(&tag.name)
.bind(&tag.slug)
.execute(&mut *conn)
.await;
if db_result.is_err() {
tracing::error!("Error while creating one account: {:?}", db_result);
return Err(DataAccessError::InternalError);
}
let id = db_result.unwrap().last_insert_rowid() as u32;
Ok(id)
}
}
|
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use fidl_stats::IfaceStats;
use future_util::GroupAvailableExt;
use futures::channel::{oneshot, mpsc};
use futures::prelude::*;
use parking_lot::Mutex;
use std::sync::Arc;
use zx;
// TODO(gbonik): get rid of the Mutex when FIDL APIs make it possible
// Mutex is a workaround for the fact that Responder.send() takes a &mut.
pub type StatsRef = Arc<Mutex<IfaceStats>>;
type Responder = oneshot::Sender<StatsRef>;
pub struct StatsScheduler {
queue: mpsc::UnboundedSender<Responder>
}
pub fn create_scheduler()
-> (StatsScheduler, impl Stream<Item = StatsRequest, Error = Never>)
{
let (sender, receiver) = mpsc::unbounded();
let scheduler = StatsScheduler{ queue: sender };
let req_stream = receiver.group_available().map(StatsRequest);
(scheduler, req_stream)
}
impl StatsScheduler {
pub fn get_stats(&self)
-> impl Future<Item = StatsRef, Error = zx::Status>
{
let (sender, receiver) = oneshot::channel();
// Ignore the error: if the other side is closed, `sender` will be immediately
// dropped, and `receiver` will be notified
self.queue.unbounded_send(sender).unwrap_or_else(|_| ());
receiver.map_err(|_| zx::Status::CANCELED)
}
}
pub struct StatsRequest(Vec<Responder>);
impl StatsRequest {
pub fn reply(self, stats: IfaceStats) {
let stats = Arc::new(Mutex::new(stats));
for responder in self.0 {
responder.send(stats.clone()).unwrap_or_else(|_| ());
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use async;
use fidl_stats::{Counter, DispatcherStats, IfaceStats, PacketCounter};
#[test]
fn schedule() {
let mut exec = async::Executor::new().expect("Failed to create an executor");
let (sched, req_stream) = create_scheduler();
let mut fut1 = sched.get_stats();
let mut fut2 = sched.get_stats();
let mut counter = 0;
let mut server = req_stream.for_each(move |req| {
counter += 100;
Ok(req.reply(fake_iface_stats(counter)))
});
exec.run_until_stalled(&mut server).expect("server future returned an error (a)");
let res1 = exec.run_until_stalled(&mut fut1).expect("request future 1 returned an error");
match res1 {
Async::Ready(r) => assert_eq!(fake_iface_stats(100), *r.lock()),
Async::Pending => panic!("request future 1 returned 'Pending'")
}
let res2 = exec.run_until_stalled(&mut fut2).expect("request future 2 returned an error");
match res2 {
Async::Ready(r) => assert_eq!(fake_iface_stats(100), *r.lock()),
Async::Pending => panic!("request future 2 returned 'Pending'")
}
let mut fut3 = sched.get_stats();
exec.run_until_stalled(&mut server).expect("server future returned an error (b)");
let res3 = exec.run_until_stalled(&mut fut3).expect("request future 3 returned an error");
match res3 {
Async::Ready(r) => assert_eq!(fake_iface_stats(200), *r.lock()),
Async::Pending => panic!("request future 3 returned 'Pending'")
}
}
#[test]
fn canceled_if_server_dropped_after_request() {
let mut exec = async::Executor::new().expect("Failed to create an executor");
let (sched, req_stream) = create_scheduler();
let mut fut = sched.get_stats();
::std::mem::drop(req_stream);
let res = exec.run_until_stalled(&mut fut).map(|_| ());
assert_eq!(Err(zx::Status::CANCELED), res);
}
#[test]
fn canceled_if_server_dropped_before_request() {
let mut exec = async::Executor::new().expect("Failed to create an executor");
let (sched, req_stream) = create_scheduler();
::std::mem::drop(req_stream);
let mut fut = sched.get_stats();
let res = exec.run_until_stalled(&mut fut).map(|_| ());
assert_eq!(Err(zx::Status::CANCELED), res);
}
fn fake_iface_stats(count: u64) -> IfaceStats {
IfaceStats {
dispatcher_stats: DispatcherStats {
any_packet: fake_packet_counter(count),
mgmt_frame: fake_packet_counter(count),
ctrl_frame: fake_packet_counter(count),
data_frame: fake_packet_counter(count),
},
mlme_stats: None,
}
}
fn fake_packet_counter(count: u64) -> PacketCounter {
PacketCounter {
in_: fake_counter(count),
out: fake_counter(count),
drop: fake_counter(count),
}
}
fn fake_counter(count: u64) -> Counter {
Counter {
count: count,
name: "foo".to_string(),
}
}
}
|
pub fn run() {
let mut hello = String::from("Hello");
hello.push(' ');
hello.push_str("World");
println!("Length: {}", hello.len());
println!("Capacity: {}", hello.capacity());
println!("{}", hello);
for word in hello.split_whitespace() {
println!("Split word : {}", word)
}
let mut word_with_capacity = String::with_capacity(10);
word_with_capacity.push('A');
word_with_capacity.push('B');
assert_eq!(10, word_with_capacity.capacity());
assert_eq!(2, word_with_capacity.len());
if word_with_capacity == "AB" {
println!("we have the test")
}
println!("{}", word_with_capacity);
}
|
mod common;
use actix_web::{test, web, App};
use drogue_cloud_authentication_service::{endpoints, service, WebData};
use drogue_cloud_service_api::auth::device::authn::{AuthenticationRequest, Credential};
use drogue_cloud_test_common::{client, db};
use rstest::rstest;
use serde_json::{json, Value};
use serial_test::serial;
fn device1_json() -> Value {
json!({"pass":{
"application": {
"metadata": {
"name": "app3",
"uid": "4cf9607e-c7ad-11eb-8d69-d45d6455d2cc",
"creationTimestamp": "2021-01-01T00:00:00Z",
"resourceVersion": "547531d4-c7ad-11eb-abee-d45d6455d2cc",
"generation": 0,
},
},
"device": {
"metadata": {
"application": "app3",
"name": "device1",
"uid": "4e185ea6-7c26-11eb-a319-d45d6455d211",
"creationTimestamp": "2020-01-01T00:00:00Z",
"resourceVersion": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
"generation": 0,
},
}
}})
}
fn device2_json() -> Value {
json!({"pass":{
"application": {
"metadata": {
"name": "app3",
"uid": "4cf9607e-c7ad-11eb-8d69-d45d6455d2cc",
"creationTimestamp": "2021-01-01T00:00:00Z",
"resourceVersion": "547531d4-c7ad-11eb-abee-d45d6455d2cc",
"generation": 0,
},
},
"device": {
"metadata": {
"application": "app3",
"name": "device2",
"uid": "8bcfeb78-c7ae-11eb-9535-d45d6455d2cc",
"creationTimestamp": "2020-01-01T00:00:00Z",
"resourceVersion": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
"generation": 0,
},
}
}})
}
fn device3_json() -> Value {
json!({"pass":{
"application": {
"metadata": {
"name": "app3",
"uid": "4cf9607e-c7ad-11eb-8d69-d45d6455d2cc",
"creationTimestamp": "2021-01-01T00:00:00Z",
"resourceVersion": "547531d4-c7ad-11eb-abee-d45d6455d2cc",
"generation": 0,
},
},
"device": {
"metadata": {
"application": "app3",
"name": "device3",
"uid": "91023af6-c7ae-11eb-9902-d45d6455d2cc",
"creationTimestamp": "2020-01-01T00:00:00Z",
"resourceVersion": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
"generation": 0,
},
}
}})
}
/// Test different passwords with different stored types.
#[rstest]
#[case("device1", "foo", device1_json())]
#[case("device2", "foo", json!("fail"))]
#[case("device3", "foo", json!("fail"))]
#[case("device1", "bar", json!("fail"))]
#[case("device2", "bar", device2_json())]
#[case("device3", "bar", json!("fail"))]
#[case("device1", "baz", json!("fail"))]
#[case("device2", "baz", json!("fail"))]
#[case("device3", "baz", device3_json())]
#[actix_rt::test]
#[serial]
async fn test_auth_password_with_hashes(
#[case] device: &str,
#[case] password: &str,
#[case] outcome: Value,
) {
test_auth!(AuthenticationRequest{
application: "app3".into(),
device: device.to_string(),
credential: Credential::Password(password.to_string()),
r#as: None,
} => outcome);
}
|
use amethyst::{prelude::*, window::ScreenDimensions};
use crate::resources::Context;
pub fn get_screen_size(world: &World) -> (f32, f32) {
// Setup camera in a way that our screen covers whole arena and (0, 0) is in the bottom left.
let dimensions = world.read_resource::<ScreenDimensions>();
let width = dimensions.width();
let height = dimensions.height();
(width, height)
}
pub fn get_scale(world: &World) -> f32 {
let ctx = world.read_resource::<Context>();
ctx.scale
}
pub fn get_tick_duration(world: &World) -> f64 {
let ctx = world.read_resource::<Context>();
ctx.tick_duration
}
|
mod images;
use lazy_static::lazy_static;
use regex::{Captures, Regex};
use std::borrow::Cow;
lazy_static! {
static ref BLOCK: Regex = Regex::new(
r#"(?xsm)
^
# Opening :::
:{3}
\s+
# Parsing id type
(?P<id>\w+)
\s*
$
# Content inside
(?P<content>.+?)
# Ending :::
^:::$
"#
)
.unwrap();
}
pub fn parse_fenced_blocks(s: &str) -> Cow<str> {
BLOCK.replace_all(s, |caps: &Captures| -> String {
parse_block(
caps.name("id").unwrap().as_str(),
caps.name("content").unwrap().as_str(),
)
})
}
fn parse_block(id: &str, content: &str) -> String {
let t = BlockType::new(id);
t.parse(content)
}
enum BlockType {
Flex,
Figure,
Gallery,
}
impl BlockType {
fn new(id: &str) -> Self {
match id {
"Flex" => BlockType::Flex,
"Figure" => BlockType::Figure,
"Gallery" => BlockType::Gallery,
_ => panic!("Unknown block type `{id}`"),
}
}
fn parse(&self, content: &str) -> String {
match self {
BlockType::Flex => images::parse_flex(content),
BlockType::Figure => images::parse_figure(content),
BlockType::Gallery => images::parse_gallery(content),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_parse_flex_simple() {
let s = r#"
::: Flex
/images/img1.jpg
/images/img2.jpg
:::"#;
assert_eq!(
parse_fenced_blocks(s),
r#"
<figure class="flex-50">
<a href="/images/img1.jpg"><img src="/images/img1.jpg" /></a>
<a href="/images/img2.jpg"><img src="/images/img2.jpg" /></a>
</figure>"#
);
}
#[test]
fn test_parse_flex_attrs() {
let s = r#"
::: Flex
/images/img1.jpg { height=100 }
/images/img2.jpg { height=100 }
:::"#;
assert_eq!(
parse_fenced_blocks(s),
r#"
<figure class="flex-50">
<a href="/images/img1.jpg"><img height="100" src="/images/img1.jpg" /></a>
<a href="/images/img2.jpg"><img height="100" src="/images/img2.jpg" /></a>
</figure>"#
);
}
#[test]
fn test_parse_flex_title() {
let s = r#"
::: Flex
/images/img1.jpg
/images/img2.jpg
My *title*
:::"#;
assert_eq!(
parse_fenced_blocks(s),
r#"
<figure class="flex-50">
<a href="/images/img1.jpg"><img src="/images/img1.jpg" /></a>
<a href="/images/img2.jpg"><img src="/images/img2.jpg" /></a>
<figcaption>My <em>title</em></figcaption>
</figure>"#
);
}
#[test]
fn test_parse_gallery() {
let s = r#"
::: Gallery
/images/img1.jpg
/images/img2.jpg
:::"#;
assert_eq!(
parse_fenced_blocks(s),
r#"
<figure class="gallery">
<a href="/images/img1.jpg"><img src="/images/img1.jpg" /></a>
<a href="/images/img2.jpg"><img src="/images/img2.jpg" /></a>
</figure>"#
);
}
}
|
#[doc = "Register `HASH_SR` reader"]
pub type R = crate::R<HASH_SR_SPEC>;
#[doc = "Register `HASH_SR` writer"]
pub type W = crate::W<HASH_SR_SPEC>;
#[doc = "Field `DINIS` reader - DINIS"]
pub type DINIS_R = crate::BitReader;
#[doc = "Field `DINIS` writer - DINIS"]
pub type DINIS_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DCIS` reader - DCIS"]
pub type DCIS_R = crate::BitReader;
#[doc = "Field `DCIS` writer - DCIS"]
pub type DCIS_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DMAS` reader - DMAS"]
pub type DMAS_R = crate::BitReader;
#[doc = "Field `BUSY` reader - BUSY"]
pub type BUSY_R = crate::BitReader;
impl R {
#[doc = "Bit 0 - DINIS"]
#[inline(always)]
pub fn dinis(&self) -> DINIS_R {
DINIS_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - DCIS"]
#[inline(always)]
pub fn dcis(&self) -> DCIS_R {
DCIS_R::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 2 - DMAS"]
#[inline(always)]
pub fn dmas(&self) -> DMAS_R {
DMAS_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 3 - BUSY"]
#[inline(always)]
pub fn busy(&self) -> BUSY_R {
BUSY_R::new(((self.bits >> 3) & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - DINIS"]
#[inline(always)]
#[must_use]
pub fn dinis(&mut self) -> DINIS_W<HASH_SR_SPEC, 0> {
DINIS_W::new(self)
}
#[doc = "Bit 1 - DCIS"]
#[inline(always)]
#[must_use]
pub fn dcis(&mut self) -> DCIS_W<HASH_SR_SPEC, 1> {
DCIS_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
}
#[doc = "HASH status register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`hash_sr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`hash_sr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct HASH_SR_SPEC;
impl crate::RegisterSpec for HASH_SR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`hash_sr::R`](R) reader structure"]
impl crate::Readable for HASH_SR_SPEC {}
#[doc = "`write(|w| ..)` method takes [`hash_sr::W`](W) writer structure"]
impl crate::Writable for HASH_SR_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets HASH_SR to value 0x01"]
impl crate::Resettable for HASH_SR_SPEC {
const RESET_VALUE: Self::Ux = 0x01;
}
|
extern crate midir;
use std::error::Error;
use std::io::{stdin, stdout, Write};
use midir::{Ignore, MidiIO, MidiInput, MidiOutput};
fn main() {
match run() {
Ok(_) => (),
Err(err) => println!("Error: {}", err),
}
}
#[cfg(not(target_arch = "wasm32"))] // conn_out is not `Send` in Web MIDI, which means it cannot be passed to connect
fn run() -> Result<(), Box<dyn Error>> {
let mut midi_in = MidiInput::new("midir forwarding input")?;
midi_in.ignore(Ignore::None);
let midi_out = MidiOutput::new("midir forwarding output")?;
let in_port = select_port(&midi_in, "input")?;
println!();
let out_port = select_port(&midi_out, "output")?;
println!("\nOpening connections");
let in_port_name = midi_in.port_name(&in_port)?;
let out_port_name = midi_out.port_name(&out_port)?;
let mut conn_out = midi_out.connect(&out_port, "midir-forward")?;
// _conn_in needs to be a named parameter, because it needs to be kept alive until the end of the scope
let _conn_in = midi_in.connect(
&in_port,
"midir-forward",
move |stamp, message, _| {
conn_out
.send(message)
.unwrap_or_else(|_| println!("Error when forwarding message ..."));
println!("{}: {:?} (len = {})", stamp, message, message.len());
},
(),
)?;
println!(
"Connections open, forwarding from '{}' to '{}' (press enter to exit) ...",
in_port_name, out_port_name
);
let mut input = String::new();
stdin().read_line(&mut input)?; // wait for next enter key press
println!("Closing connections");
Ok(())
}
fn select_port<T: MidiIO>(midi_io: &T, descr: &str) -> Result<T::Port, Box<dyn Error>> {
println!("Available {} ports:", descr);
let midi_ports = midi_io.ports();
for (i, p) in midi_ports.iter().enumerate() {
println!("{}: {}", i, midi_io.port_name(p)?);
}
print!("Please select {} port: ", descr);
stdout().flush()?;
let mut input = String::new();
stdin().read_line(&mut input)?;
let port = midi_ports
.get(input.trim().parse::<usize>()?)
.ok_or("Invalid port number")?;
Ok(port.clone())
}
#[cfg(target_arch = "wasm32")]
fn run() -> Result<(), Box<dyn Error>> {
println!("test_forward cannot run on Web MIDI");
Ok(())
}
|
use diesel::result::Error;
use tonic::Status;
use bcrypt::BcryptError;
pub fn sql_err_to_grpc_error(error: Error) -> Status {
match error {
Error::NotFound => Status::not_found("not found".to_string()),
_ => Status::internal(error.to_string()),
}
}
pub fn bcrypt_err_to_grpc_error(error: BcryptError) -> Status {
match error {
BcryptError::InvalidHash(_) => Status::permission_denied("invalid password".to_string()),
_ => Status::internal(error.to_string()),
}
}
|
mod token;
pub use token::*;
|
#[doc = "Register `LOCKR` reader"]
pub type R = crate::R<LOCKR_SPEC>;
#[doc = "Register `LOCKR` writer"]
pub type W = crate::W<LOCKR_SPEC>;
#[doc = "Field `LOCK` reader - Global security and privilege configuration registers (EXTI_SECCFGR and EXTI_PRIVCFGR) lock This bit is written once after reset."]
pub type LOCK_R = crate::BitReader;
#[doc = "Field `LOCK` writer - Global security and privilege configuration registers (EXTI_SECCFGR and EXTI_PRIVCFGR) lock This bit is written once after reset."]
pub type LOCK_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
impl R {
#[doc = "Bit 0 - Global security and privilege configuration registers (EXTI_SECCFGR and EXTI_PRIVCFGR) lock This bit is written once after reset."]
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new((self.bits & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - Global security and privilege configuration registers (EXTI_SECCFGR and EXTI_PRIVCFGR) lock This bit is written once after reset."]
#[inline(always)]
#[must_use]
pub fn lock(&mut self) -> LOCK_W<LOCKR_SPEC, 0> {
LOCK_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
}
#[doc = "EXTI lock register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`lockr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`lockr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct LOCKR_SPEC;
impl crate::RegisterSpec for LOCKR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`lockr::R`](R) reader structure"]
impl crate::Readable for LOCKR_SPEC {}
#[doc = "`write(|w| ..)` method takes [`lockr::W`](W) writer structure"]
impl crate::Writable for LOCKR_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets LOCKR to value 0"]
impl crate::Resettable for LOCKR_SPEC {
const RESET_VALUE: Self::Ux = 0;
}
|
use std::{
fmt::Debug,
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign},
};
use crate::ConvertTo;
#[derive(Debug, Default, Clone, Copy, PartialOrd, PartialEq)]
pub struct Pct<T>(pub T);
impl<T: Add> Add for Pct<T> {
type Output = Pct<T::Output>;
fn add(self, other: Self) -> Self::Output {
Pct(self.0 + other.0)
}
}
impl<T: AddAssign> AddAssign for Pct<T> {
fn add_assign(&mut self, other: Self) {
self.0 += other.0;
}
}
impl<T: Sub> Sub for Pct<T> {
type Output = Pct<T::Output>;
fn sub(self, other: Self) -> Self::Output {
Pct(self.0 - other.0)
}
}
impl<T: SubAssign> SubAssign for Pct<T> {
fn sub_assign(&mut self, other: Self) {
self.0 -= other.0;
}
}
impl<T: Mul> Mul for Pct<T> {
type Output = Pct<T::Output>;
fn mul(self, rhs: Self) -> Self::Output {
Pct(self.0 * rhs.0)
}
}
impl<T: MulAssign> MulAssign for Pct<T> {
fn mul_assign(&mut self, rhs: Self) {
self.0 *= rhs.0;
}
}
impl<T: Div> Div for Pct<T> {
type Output = Pct<T::Output>;
fn div(self, rhs: Self) -> Self::Output {
Pct(self.0 / rhs.0)
}
}
impl<T: DivAssign> DivAssign for Pct<T> {
fn div_assign(&mut self, rhs: Self) {
self.0 /= rhs.0;
}
}
impl<T> From<T> for Pct<T> {
fn from(v: T) -> Self {
Pct(v)
}
}
impl From<i32> for Pct<Real> {
fn from(v: i32) -> Self {
Pct(v as Real)
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ValueType {
Auto,
Px,
Pct(Real),
}
impl Default for ValueType {
fn default() -> Self {
ValueType::Auto
}
}
#[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Value<T>(pub T, pub ValueType);
impl<T: Debug + Default + Clone + Copy + PartialEq> Value<T> {
pub fn px(v: T) -> Self {
Value(v, ValueType::Px)
}
pub fn pct(pct: Real) -> Self {
Value(Default::default(), ValueType::Pct(pct))
}
pub fn auto() -> Self {
Value(Default::default(), ValueType::Auto)
}
pub fn val(&self) -> T {
self.0
}
pub fn set_val(&mut self, v: T) {
self.0 = v
}
pub fn set_by_auto(&mut self, source: T) -> bool {
if let Value(ref mut v, ValueType::Auto) = self {
*v = source;
true
} else {
false
}
}
}
impl Value<Real> {
pub fn set_by_pct(&mut self, source: Real) -> bool {
if let Value(ref mut v, ValueType::Pct(pct)) = self {
*v = *pct / 100.0 * source;
true
} else {
false
}
}
}
impl<T: Copy + Add<Output = T>> Add for Value<T> {
type Output = Self;
fn add(mut self, rhs: Self) -> Self::Output {
assert_eq!(self.1, rhs.1);
self.0 = self.0 + rhs.0;
self
}
}
impl<T: Copy + Sub<Output = T>> Sub for Value<T> {
type Output = Self;
fn sub(mut self, rhs: Self) -> Self::Output {
assert_eq!(self.1, rhs.1);
self.0 = self.0 - rhs.0;
self
}
}
pub type Real = f32;
pub type RealValue = Value<Real>;
impl From<Real> for RealValue {
fn from(v: Real) -> Self {
RealValue::px(v)
}
}
impl From<i32> for RealValue {
fn from(v: i32) -> Self {
RealValue::px(v as Real)
}
}
impl From<u32> for RealValue {
fn from(v: u32) -> Self {
RealValue::px(v as Real)
}
}
impl From<i64> for RealValue {
fn from(v: i64) -> Self {
RealValue::px(v as Real)
}
}
impl From<u64> for RealValue {
fn from(v: u64) -> Self {
RealValue::px(v as Real)
}
}
impl From<isize> for RealValue {
fn from(v: isize) -> Self {
RealValue::px(v as Real)
}
}
impl From<usize> for RealValue {
fn from(v: usize) -> Self {
RealValue::px(v as Real)
}
}
impl From<Pct<Real>> for RealValue {
fn from(v: Pct<Real>) -> Self {
RealValue::pct(v.0)
}
}
impl From<Pct<i32>> for RealValue {
fn from(v: Pct<i32>) -> Self {
RealValue::pct(v.0 as Real)
}
}
impl ConvertTo<Real> for i32 {
fn convert(self) -> Real {
self as Real
}
}
impl ConvertTo<Option<Real>> for i32 {
fn convert(self) -> Option<Real> {
Some(self as Real)
}
}
impl ConvertTo<RealValue> for Real {
fn convert(self) -> RealValue {
self.into()
}
}
impl ConvertTo<Option<RealValue>> for Real {
fn convert(self) -> Option<RealValue> {
Some(self.into())
}
}
impl ConvertTo<RealValue> for i32 {
fn convert(self) -> RealValue {
self.into()
}
}
impl ConvertTo<Option<RealValue>> for i32 {
fn convert(self) -> Option<RealValue> {
Some(self.into())
}
}
impl ConvertTo<RealValue> for Pct<Real> {
fn convert(self) -> RealValue {
self.into()
}
}
impl ConvertTo<Option<RealValue>> for Pct<Real> {
fn convert(self) -> Option<RealValue> {
Some(self.into())
}
}
impl ConvertTo<RealValue> for Pct<i32> {
fn convert(self) -> RealValue {
self.into()
}
}
impl ConvertTo<Option<RealValue>> for Pct<i32> {
fn convert(self) -> Option<RealValue> {
Some(self.into())
}
}
|
extern crate quick_xml;
use quick_xml::XmlWriter;
use quick_xml::error::Error as XmlError;
use std::collections::HashMap;
use extension::Extension;
use extension::remove_extension_values;
use toxml::{ToXml, XmlWriterExt};
/// The Dublin Core XML namespace.
pub static NAMESPACE: &'static str = "http://purl.org/dc/elements/1.1/";
/// A Dublin Core element extension.
#[derive(Debug, Default, Clone, PartialEq)]
pub struct DublinCoreExtension {
/// An entity responsible for making contributions to the resource.
pub contributor: Vec<String>,
/// The spatial or temporal topic of the resource, the spatial applicability of the resource,
/// or the jurisdiction under which the resource is relevant.
pub coverage: Vec<String>,
/// An entity primarily responsible for making the resource.
pub creator: Vec<String>,
/// A point or period of time associated with an event in the lifecycle of the resource.
pub date: Vec<String>,
/// An account of the resource.
pub description: Vec<String>,
/// The file format, physical medium, or dimensions of the resource.
pub format: Vec<String>,
/// An unambiguous reference to the resource within a given context.
pub identifier: Vec<String>,
/// A language of the resource.
pub language: Vec<String>,
/// An entity responsible for making the resource available.
pub publisher: Vec<String>,
/// A related resource.
pub relation: Vec<String>,
/// Information about rights held in and over the resource.
pub rights: Vec<String>,
/// A related resource from which the described resource is derived.
pub source: Vec<String>,
/// The topic of the resource.
pub subject: Vec<String>,
/// A name given to the resource.
pub title: Vec<String>,
/// The nature or genre of the resource.
pub resource_type: Vec<String>,
}
impl DublinCoreExtension {
/// Creates a DublinCoreExtension using the specified hashmap.
pub fn from_map(mut map: HashMap<String, Vec<Extension>>) -> Self {
let mut ext = DublinCoreExtension::default();
ext.contributor = remove_extension_values(&mut map, "contributor").unwrap_or_default();
ext.coverage = remove_extension_values(&mut map, "coverage").unwrap_or_default();
ext.creator = remove_extension_values(&mut map, "creator").unwrap_or_default();
ext.date = remove_extension_values(&mut map, "date").unwrap_or_default();
ext.description = remove_extension_values(&mut map, "description").unwrap_or_default();
ext.format = remove_extension_values(&mut map, "format").unwrap_or_default();
ext.identifier = remove_extension_values(&mut map, "identifier").unwrap_or_default();
ext.language = remove_extension_values(&mut map, "language").unwrap_or_default();
ext.publisher = remove_extension_values(&mut map, "publisher").unwrap_or_default();
ext.relation = remove_extension_values(&mut map, "relation").unwrap_or_default();
ext.rights = remove_extension_values(&mut map, "rights").unwrap_or_default();
ext.source = remove_extension_values(&mut map, "source").unwrap_or_default();
ext.subject = remove_extension_values(&mut map, "subject").unwrap_or_default();
ext.title = remove_extension_values(&mut map, "title").unwrap_or_default();
ext.resource_type = remove_extension_values(&mut map, "type").unwrap_or_default();
ext
}
}
impl ToXml for DublinCoreExtension {
fn to_xml<W: ::std::io::Write>(&self, writer: &mut XmlWriter<W>) -> Result<(), XmlError> {
try!(writer.write_text_elements(b"dc:contributor", &self.contributor));
try!(writer.write_text_elements(b"dc:coverage", &self.coverage));
try!(writer.write_text_elements(b"dc:creator", &self.creator));
try!(writer.write_text_elements(b"dc:date", &self.date));
try!(writer.write_text_elements(b"dc:description", &self.description));
try!(writer.write_text_elements(b"dc:format", &self.format));
try!(writer.write_text_elements(b"dc:identifier", &self.identifier));
try!(writer.write_text_elements(b"dc:language", &self.language));
try!(writer.write_text_elements(b"dc:publisher", &self.publisher));
try!(writer.write_text_elements(b"dc:relation", &self.relation));
try!(writer.write_text_elements(b"dc:rights", &self.rights));
try!(writer.write_text_elements(b"dc:source", &self.source));
try!(writer.write_text_elements(b"dc:subject", &self.subject));
try!(writer.write_text_elements(b"dc:title", &self.title));
writer.write_text_elements(b"dc:type", &self.resource_type)
}
}
|
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(feature = "force-soft")))] {
#[path = "./x86.rs"]
mod platform;
cfg_if! {
if #[cfg(all(target_feature = "sse2", target_feature = "pclmulqdq"))] {
pub use self::platform::Polyval;
} else {
mod generic;
mod dynamic;
pub use self::dynamic::Polyval;
}
}
} else if #[cfg(all(target_arch = "aarch64", not(feature = "force-soft")))] {
#[path = "./aarch64.rs"]
mod platform;
cfg_if! {
if #[cfg(target_feature = "pmull")] {
pub use self::platform::Polyval;
} else {
mod generic;
mod dynamic;
pub use self::dynamic::Polyval;
}
}
} else {
mod generic;
pub use self::generic::Polyval;
}
}
|
use nom::number::complete::{le_i16, le_f32};
use serde_derive::{Serialize};
use super::parserHeader::*;
#[derive(Debug, PartialEq, Serialize)]
pub struct CarMotionData {
pub m_worldPositionX: f32,
pub m_worldPositionY: f32,
pub m_worldPositionZ: f32,
pub m_worldVelocityX: f32,
pub m_worldVelocityY: f32,
pub m_worldVelocityZ: f32,
pub m_worldForwardDirX: i16,
pub m_worldForwardDirY: i16,
pub m_worldForwardDirZ: i16,
pub m_worldRightDirX: i16,
pub m_worldRightDirY: i16,
pub m_worldRightDirZ: i16,
pub m_gForceLateral: f32,
pub m_gForceLongitudinal: f32,
pub m_gForceVertical: f32,
pub m_yaw: f32,
pub m_pitch: f32,
pub m_roll: f32,
}
named!(pub parse_motion_data<&[u8], CarMotionData>,
do_parse!(
m_worldPositionX: le_f32 >>
m_worldPositionY: le_f32 >>
m_worldPositionZ: le_f32 >>
m_worldVelocityX: le_f32 >>
m_worldVelocityY: le_f32 >>
m_worldVelocityZ: le_f32 >>
m_worldForwardDirX: le_i16 >>
m_worldForwardDirY: le_i16 >>
m_worldForwardDirZ: le_i16 >>
m_worldRightDirX: le_i16 >>
m_worldRightDirY: le_i16 >>
m_worldRightDirZ: le_i16 >>
m_gForceLateral: le_f32 >>
m_gForceLongitudinal: le_f32 >>
m_gForceVertical: le_f32 >>
m_yaw: le_f32 >>
m_pitch: le_f32 >>
m_roll: le_f32 >>
(CarMotionData {
m_worldPositionX: m_worldPositionX,
m_worldPositionY: m_worldPositionY,
m_worldPositionZ: m_worldPositionZ,
m_worldVelocityX: m_worldVelocityX,
m_worldVelocityY: m_worldVelocityY,
m_worldVelocityZ: m_worldVelocityZ,
m_worldForwardDirX: m_worldForwardDirX,
m_worldForwardDirY: m_worldForwardDirY,
m_worldForwardDirZ: m_worldForwardDirZ,
m_worldRightDirX: m_worldRightDirX,
m_worldRightDirY: m_worldRightDirY,
m_worldRightDirZ: m_worldRightDirZ,
m_gForceLateral: m_gForceLateral,
m_gForceLongitudinal: m_gForceLongitudinal,
m_gForceVertical: m_gForceVertical,
m_yaw: m_yaw,
m_pitch: m_pitch,
m_roll: m_roll,
})
)
);
named!(pub parse_motion_datas<&[u8], Vec<CarMotionData>>,
count!(parse_motion_data, 20)
);
#[derive(Debug, PartialEq, Serialize)]
pub struct PacketMotionData {
pub m_header: PacketHeader,
pub m_carMotionData: Vec<CarMotionData>,
pub m_suspensionPosition: Vec<f32>,
pub m_suspensionVelocity: Vec<f32>,
pub m_suspensionAcceleration: Vec<f32>,
pub m_wheelSpeed: Vec<f32>,
pub m_wheelSlip: Vec<f32>,
pub m_localVelocityX: f32,
pub m_localVelocityY: f32,
pub m_localVelocityZ: f32,
pub m_angularVelocityX: f32,
pub m_angularVelocityY: f32,
pub m_angularVelocityZ: f32,
pub m_angularAccelerationX: f32,
pub m_angularAccelerationY: f32,
pub m_angularAccelerationZ: f32,
pub m_frontWheelsAngle: f32
}
named!(pub parse_motion_data_packet<&[u8], PacketMotionData>,
do_parse!(
m_header: parse_header >>
m_carMotionData: parse_motion_datas >>
m_suspensionPosition: count!(le_f32, 4) >>
m_suspensionVelocity: count!(le_f32, 4) >>
m_suspensionAcceleration: count!(le_f32, 4) >>
m_wheelSpeed: count!(le_f32, 4) >>
m_wheelSlip: count!(le_f32, 4) >>
m_localVelocityX: le_f32 >>
m_localVelocityY: le_f32 >>
m_localVelocityZ: le_f32 >>
m_angularVelocityX: le_f32 >>
m_angularVelocityY: le_f32 >>
m_angularVelocityZ: le_f32 >>
m_angularAccelerationX: le_f32 >>
m_angularAccelerationY: le_f32 >>
m_angularAccelerationZ: le_f32 >>
m_frontWheelsAngle: le_f32 >>
(PacketMotionData {
m_header: m_header,
m_carMotionData: m_carMotionData,
m_suspensionPosition: m_suspensionPosition,
m_suspensionVelocity: m_suspensionVelocity,
m_suspensionAcceleration: m_suspensionAcceleration,
m_wheelSpeed: m_wheelSpeed,
m_wheelSlip: m_wheelSlip,
m_localVelocityX: m_localVelocityX,
m_localVelocityY: m_localVelocityY,
m_localVelocityZ: m_localVelocityZ,
m_angularVelocityX: m_angularVelocityX,
m_angularVelocityY: m_angularVelocityY,
m_angularVelocityZ: m_angularVelocityZ,
m_angularAccelerationX: m_angularAccelerationX,
m_angularAccelerationY: m_angularAccelerationY,
m_angularAccelerationZ: m_angularAccelerationZ,
m_frontWheelsAngle: m_frontWheelsAngle
})
)
);
|
use observable_btree::{model::Types, BTree};
#[tokio::main]
async fn main() {
let btree = BTree::start(1000);
let ins = btree.insert("hello".to_string(), 5).await;
assert!(ins.unwrap().is_none());
let get_mut = btree
.get_mut(
"hello".to_string(),
5,
observable_btree::model::Operation::Add,
)
.await;
assert!(get_mut.unwrap());
let get = btree.get("hello".to_string()).await;
let get_int = get.unwrap().unwrap();
assert_eq!(get_int, Types::Integer(10));
let get_mut = btree
.get_mut(
"hello".to_string(),
4,
observable_btree::model::Operation::Replace,
)
.await;
assert!(get_mut.unwrap());
let get = btree.get("hello".to_string()).await;
let get_int = get.unwrap().unwrap();
assert_eq!(get_int, Types::Integer(4));
print!("Done!")
}
|
use super::*;
use crate::resources::ResourceType;
use crate::{requests, ReadonlyString};
use azure_core::HttpClient;
/// A client for Cosmos stored procedure resources.
#[derive(Debug, Clone)]
pub struct StoredProcedureClient {
collection_client: CollectionClient,
stored_procedure_name: ReadonlyString,
}
impl StoredProcedureClient {
pub(crate) fn new<S: Into<ReadonlyString>>(
collection_client: CollectionClient,
stored_procedure_name: S,
) -> Self {
Self {
collection_client,
stored_procedure_name: stored_procedure_name.into(),
}
}
/// Get a [`CosmosClient`]
pub fn cosmos_client(&self) -> &CosmosClient {
self.collection_client.cosmos_client()
}
/// Get a [`DatabaseClient`
pub fn database_client(&self) -> &DatabaseClient {
self.collection_client.database_client()
}
/// Get the [`CollectionClient`]
pub fn collection_client(&self) -> &CollectionClient {
&self.collection_client
}
/// Get the stored procedure's name
pub fn stored_procedure_name(&self) -> &str {
&self.stored_procedure_name
}
/// Create the stored procedure
pub fn create_stored_procedure(&self) -> requests::CreateStoredProcedureBuilder<'_, '_> {
requests::CreateStoredProcedureBuilder::new(self)
}
/// Replace the stored procedure
pub fn replace_stored_procedure(&self) -> requests::ReplaceStoredProcedureBuilder<'_, '_> {
requests::ReplaceStoredProcedureBuilder::new(self)
}
/// Execute the stored procedure
pub fn execute_stored_procedure(&self) -> requests::ExecuteStoredProcedureBuilder<'_, '_> {
requests::ExecuteStoredProcedureBuilder::new(self)
}
/// Delete the stored procedure
pub fn delete_stored_procedure(&self) -> requests::DeleteStoredProcedureBuilder<'_, '_> {
requests::DeleteStoredProcedureBuilder::new(self)
}
pub(crate) fn prepare_request(&self, method: http::Method) -> http::request::Builder {
self.cosmos_client().prepare_request(
&format!(
"dbs/{}/colls/{}/sprocs",
self.database_client().database_name(),
self.collection_client().collection_name(),
),
method,
ResourceType::StoredProcedures,
)
}
pub(crate) fn prepare_request_with_stored_procedure_name(
&self,
method: http::Method,
) -> http::request::Builder {
self.cosmos_client().prepare_request(
&format!(
"dbs/{}/colls/{}/sprocs/{}",
self.database_client().database_name(),
self.collection_client().collection_name(),
self.stored_procedure_name()
),
method,
ResourceType::StoredProcedures,
)
}
pub(crate) fn http_client(&self) -> &dyn HttpClient {
self.cosmos_client().http_client()
}
}
|
// #![feature(async_await, await_macro, futures_api)]
pub mod lzw {
use bitvec::{BigEndian, BitVec};
use indexmap::IndexSet;
use small_aes_rs::{AesCtx, Block, AES_BLOCKLEN};
use std::fs::File;
use std::io::{BufReader, BufWriter, Read, Write};
type Index = u32;
// Модуль генерации, проверки ключа шифрования
mod derive {
use ring::{digest, pbkdf2};
use small_aes_rs::AES_KEYLEN;
use std::num::NonZeroU32;
const KEY_LEN: usize = AES_KEYLEN;
type CypherKey = [u8; KEY_LEN];
// Алгоритм генерации псевдо-случайных чисел
static DIGEST_ALG: &'static digest::Algorithm = &digest::SHA256;
// Соль
const SALT: CypherKey = [
0xd6, 0x26, 0x98, 0xda, 0xf4, 0xdc, 0x50, 0x52, 0x24, 0xf2, 0x27, 0xd1, 0xfe, 0x39,
0x01, 0x8a,
];
pub fn derive_key(secret: &str) -> CypherKey {
// Ключ
let mut key = [0u8; KEY_LEN];
// Количество итераций
let iterations = NonZeroU32::new(100_000).unwrap();
// Генерируем ключ
pbkdf2::derive(DIGEST_ALG, iterations, &SALT, secret.as_bytes(), &mut key);
key
}
}
struct Compress {
// Словарь, для архивации
dictionary: IndexSet<Vec<u8>>,
// Текущее количество бит в максимальном значении словаря
bits_count: u8,
// Максимальное количество бит, т.е. размер словаря
max_bits_count: u8,
// Предыдущая строка
prev: Vec<u8>,
// Буфер из бит, для добавления в результирующий поток
bit_buf: BitVec<BigEndian, u8>,
}
struct Decompress {
// Словарь, для архивации
dictionary: Vec<Vec<u8>>,
bits_count: usize,
// Максимальное количество бит, т.е. размер словаря
max_bits_count: u8,
// Текущий считанный индекс кодового слова
index: usize,
// Прошлое кодовое слово
string: Vec<u8>,
// Буфер из бит, для добавления в результирующий поток
bit_buf: BitVec<BigEndian, u8>,
}
impl Default for Compress {
fn default() -> Compress {
// Инициализируем словарь из всех значений, которые можно хранить
// в одном байте (0..255)
// Выделяем памяти в словаре под 65536 значений (для размера словаря по-умолчанию в 16 бит)
let mut dictionary: IndexSet<Vec<u8>> =
IndexSet::with_capacity(u16::max_value() as usize);
for ch in u8::min_value()..=u8::max_value() {
dictionary.insert(vec![ch]);
}
Compress {
dictionary,
bits_count: 8,
max_bits_count: 16,
prev: Vec::with_capacity(64),
bit_buf: BitVec::with_capacity(32),
}
}
}
impl Default for Decompress {
fn default() -> Decompress {
// Инициализируем словарь из всех значений, которые можно хранить
// в одном байте (0..255)
// Выделяем памяти в словаре под 65536 значений (для размера словаря по-умолчанию в 16 бит)
let mut dictionary: Vec<Vec<u8>> = Vec::with_capacity(u16::max_value() as usize);
for ch in u8::min_value()..=u8::max_value() {
dictionary.push(vec![ch]);
}
Decompress {
dictionary,
bits_count: 8,
max_bits_count: 16,
index: 0,
string: Vec::new(),
bit_buf: BitVec::with_capacity(64),
}
}
}
impl Compress {
fn new(max_bits_count: u8) -> Self {
if max_bits_count > 32 || max_bits_count < 9 {
panic!("Недопустимый размер словаря! Разрешенный: 9 <= n <= 32");
}
Self {
max_bits_count,
..Default::default()
}
}
fn compress<R: Read, W: Write>(
&mut self,
reader: R,
writer: &mut W,
) -> std::io::Result<()> {
// Создаем буфер для reader, что ускорит чтение
let mut reader = BufReader::new(reader);
// Создаем буфер для writer, что ускорит запись
let mut writer = BufWriter::new(writer);
// Буфер для считываемого байта
let mut buf = [0u8; 1];
// Основной цикл алгоритма. Считываем по одному байту, пока не закончится файл
while reader.read(&mut buf)? != 0 {
// Текущий символ
let current: u8 = buf[0];
self.prev.push(current);
// Набор байт уже присутствует в словаре?
if !self.dictionary.contains(&self.prev) {
// Добавляем P в буфер
self.append_to_buf(self.prev[0..self.prev.len() - 1].to_vec());
// Меняем номер последнего ключа в словаре
self.add_element_count();
// P + C в словарь
self.dictionary.insert(self.prev.clone());
// P = C
self.prev.clear();
self.prev.push(current);
while let Some(byte) = pop_byte(&mut self.bit_buf) {
writer.write_all(&[byte])?;
}
}
}
Ok(())
}
/// Добавляет оставшиеся в буфере байты в заданный поток
fn last_bytes<W: Write>(&mut self, writer: &mut W) -> std::io::Result<()> {
// Добавляем в буфер оставшиеся байты
self.append_to_buf(self.prev.to_vec());
let last_bytes: Vec<u8> = self.bit_buf.as_slice().to_vec();
// Добавляем в файл последние байты, дополняя их нулями
writer.write_all(&last_bytes)?;
Ok(())
}
/// Добавляем в буфер кодовое значение из словаря, для дальнейшего добавления в файл
fn append_to_buf(&mut self, value: Vec<u8>) {
let (index, _) = self.dictionary.get_full(&value).expect(
"Ошибка при получении значения из словаря",
);
self.bit_buf
.append(&mut from_index(index as Index, self.bits_count));
}
// Увеличиваем счетчик словаря
fn add_element_count(&mut self) -> bool {
let bits_count = get_bits_count(self.dictionary.len() as Index) as u8;
// Сбрасываем словарь, если достигли максимального количества бит
if self.dictionary.len() + 1 == (1 << self.max_bits_count) as usize {
self.reset_dictionary();
true
} else {
self.bits_count = bits_count;
false
}
}
fn reset_dictionary(&mut self) {
// Инициализируем словарь из всех значений, которые можно хранить
// в одном байте (0..255)
self.dictionary.clear();
for ch in u8::min_value()..=u8::max_value() {
self.dictionary.insert(vec![ch]);
}
self.bits_count = 8;
}
}
impl Decompress {
fn new(max_bits_count: u8) -> Self {
if max_bits_count > 32 || max_bits_count < 9 {
panic!("Недопустимый размер словаря! Разрешенный: 9 <= n <= 32");
}
Self {
max_bits_count,
..Default::default()
}
}
fn decompress<R: Read, W: Write>(
&mut self,
reader: R,
writer: &mut W,
) -> std::io::Result<()> {
// Создаем буфер для reader, что ускорит чтение
let mut reader = BufReader::new(reader);
// Создаем буфер для writer, что ускорит запись
let mut writer = BufWriter::new(writer);
// Буфер для считываемого байта
let mut buf = [0u8; 1];
// Основной цикл алгоритма
loop {
// Считываем из буфера по байту, пока не достигнем нужного,
// для извлечения индекса, количества бит
while self.bit_buf.len() < self.bits_count {
if reader.read(&mut buf)? != buf.len() {
// Если встретили конец файла, завершаем работу алгоритма
return Ok(());
}
// Добавляем байт в буфер
self.bit_buf.append(&mut from_index(u32::from(buf[0]), 8));
}
// Извлекаем индекс
let index_tmp: Index = pop_first_bits(&mut self.bit_buf, self.bits_count as u8).expect(
"Ошибка в извлечении индекса из битового буфера"
);
// Меняем тип к usize, чтобы индексировать вектор
self.index = index_tmp as usize;
// Если индекс больше размера массива, значит файл некорректен
if self.index > self.dictionary.len() {
panic!("Неверный зашифрованный код");
// Если индекс равен размеру словаря, то кодового слова нет, добавим в словарь
} else if self.index == self.dictionary.len() {
self.string.push(self.string[0]);
// Если элемент с заданным индексом есть в словаре
} else if !self.string.is_empty() {
self.string.push(self.dictionary[self.index][0]);
}
// Добавление в словарь
if !self.string.is_empty() {
self.dictionary.push(self.string.clone());
}
let code = self.dictionary.get(self.index).expect(
"Ошибка в извлечении кодового слова из словаря"
);
// Записываем в файл
writer.write_all(&code[..])?;
self.string = code.to_vec();
// Сбрасываем словарь, если наполнили его
if self.dictionary.len() + 1 == 1 << self.max_bits_count as usize {
self.reset_dictionary();
// Для первого считываемого байта, возьмем количество бит от размера словаря минус 1
self.bits_count = get_bits_count((self.dictionary.len() - 1) as Index);
} else {
// Количество бит для считывания следующего индекса
self.bits_count = get_bits_count(self.dictionary.len() as Index);
}
}
}
fn reset_dictionary(&mut self) {
// Инициализируем словарь из всех значений, которые можно хранить
// в одном байте (0..255)
self.dictionary.clear();
for ch in u8::min_value()..=u8::max_value() {
self.dictionary.push(vec![ch]);
}
}
}
/// Получает количество бит числа, без лидирующих нулей
fn get_bits_count(length: Index) -> usize {
let bits_in_type = Index::from(0u8).count_zeros();
(bits_in_type - length.leading_zeros()) as usize
}
/// Преобразует value в BitVec длиной bits
fn from_index(value: Index, bits: u8) -> BitVec<BigEndian, u8> {
let mut bv: BitVec<BigEndian, u8> = BitVec::with_capacity(bits as usize);
for i in (0..bits).rev() {
// Добавляем i-ый бит в bv
bv.push(((1 << i) & value) != 0);
}
bv
}
/// Получает из BitVec байты (u8) для записи в файл
fn pop_byte(bv: &mut BitVec<BigEndian, u8>) -> Option<u8> {
if let Some(byte) = pop_first_bits(bv, 8) {
return Some(byte as u8);
}
None
}
/// Получает из BitVec число, состоящее из первых bits бит
fn pop_first_bits(bv: &mut BitVec<BigEndian, u8>, bits: u8) -> Option<Index> {
let bits = bits as usize;
// Если есть что получить из буфера
if bv.len() >= bits {
let bv2 = bv.split_off(bits);
let mut index: Index = 0;
// Преобразовываем BitVec в Index
for (i, j) in (0..bv.len()).rev().enumerate() {
index |= (bv[j] as Index) << i;
}
*bv = bv2;
return Some(index);
}
None
}
/// Запускает компрессию файла
pub fn compress(
source_file: &str,
result_file: &str,
max_bits_count: usize,
) -> std::io::Result<()> {
let mut lzw_struct = Compress::new(max_bits_count as u8);
let reader = File::open(source_file)?;
let mut writer = File::create(result_file)?;
// Сжимаем
lzw_struct.compress(reader, &mut writer)?;
// Обязательно вызываем last_bytes, переносим внутренний буфер в поток
lzw_struct.last_bytes(&mut writer)?;
Ok(())
}
/// Запускает декомпрессию файла
pub fn decompress(
source_file: &str,
result_file: &str,
max_bits_count: usize,
) -> std::io::Result<()> {
let mut lzw_struct = Decompress::new(max_bits_count as u8);
let reader = File::open(source_file)?;
let mut writer = File::create(result_file)?;
lzw_struct.decompress(reader, &mut writer)?;
Ok(())
}
/* Компрессия и декомпрессия с AES шифрованием */
/// Компрессия с применением AES шифрования
pub fn compress_aes(
source_file: &str,
result_file: &str,
max_bits_count: usize,
secret: &str,
) -> std::io::Result<()> {
// Инициализируем объекты
let mut lzw_struct = Compress::new(max_bits_count as u8);
let mut reader = BufReader::new(File::open(source_file)?);
let mut writer = File::create(result_file)?;
// Промежуточный буфер для чтения
let mut buf_read: Vec<u8> = vec![0u8; AES_BLOCKLEN];
// Промежуточный буфер для записи
// По наблюдением, не нужен более чем 50 байт
let mut buf_write: Vec<u8> = Vec::with_capacity(50);
// Объекты шифрования
let key = derive::derive_key(secret);
let iv: Block = rand::random();
// Инициализируем AES ключом и IV
let mut aes = AesCtx::with_iv(key, iv);
// Пишем вектор инициализации в файл
writer.write_all(&iv)?;
// Цикл компрессии с шифрованием
loop {
let bytes_read = reader.read(&mut buf_read)?;
if bytes_read == 0 {
break;
}
buf_read.truncate(bytes_read);
lzw_struct.compress(buf_read.as_slice(), &mut buf_write)?;
// Если в буфере набралось 128 бит (16 байт) для шифрования
while buf_write.len() >= AES_BLOCKLEN {
let buf_aes: Vec<u8> = buf_write.drain(0..AES_BLOCKLEN).collect();
aes.aes_cbc_encrypt_buffer(buf_aes.as_slice(), &mut writer)?;
}
}
// Получаем/шифруем остаток байт
lzw_struct.last_bytes(&mut buf_write)?;
aes.aes_cbc_encrypt_buffer(buf_write.as_slice(), &mut writer)?;
Ok(())
}
/// Декомпрессия с применением AES шифрования
pub fn decompress_aes(
source_file: &str,
result_file: &str,
max_bits_count: usize,
secret: &str,
) -> std::io::Result<()> {
// Инициализируем объекты
let mut lzw_struct = Decompress::new(max_bits_count as u8);
let mut reader = BufReader::new(File::open(source_file)?);
let mut writer = File::create(result_file)?;
// Промежуточный буфер для чтения
let mut buf_read: Vec<u8> = vec![0u8; AES_BLOCKLEN];
// Промежуточный буфер для записи
let mut buf_write: Vec<u8> = Vec::with_capacity(AES_BLOCKLEN);
// Считываем вектор инициализации из файла
let mut iv: Block = Default::default();
reader.read_exact(&mut iv)?;
// Получаем 128-битный ключ
let key = derive::derive_key(secret);
// Инициализируем AES ключом и IV
let mut aes = AesCtx::with_iv(key, iv);
// Читаем первый блок
if reader.read(&mut buf_read)? != AES_BLOCKLEN {
panic!("Файл поврежден!");
}
// Цикл декомпрессии с расшифровкой
while {
// Отправляем блок на расшифровку
aes.aes_cbc_decrypt_buffer(buf_read.as_slice(), &mut buf_write)?;
// Читаем очередной блок
let bytes_read = reader.read(&mut buf_read)?;
// Если достигли конца файла (EOF)
if bytes_read == 0 {
// То значит, что это последний блок
while buf_write.last().unwrap() == &0u8 {
// Удаляем замыкающие нули (в соответствии с "Zero padding")
buf_write.pop();
}
}
// Распаковываем блок
lzw_struct.decompress(buf_write.as_slice(), &mut writer)?;
buf_write.clear();
// Если что-то считано - продолжаем работу
bytes_read != 0
} {}
Ok(())
}
}
|
use winit::WindowEvent::*;
use winit::{self, ElementState};
use input::keyboard::KeyboardUpdate;
#[derive(Default, System)]
#[process(process)]
pub struct UpdateInput;
fn process(_: &mut UpdateInput, data: &mut ::DataHelper) {
data.services.keyboard.frame_start();
let mut ev_loop = data.services.graphics.events_loop.take().unwrap();
// Handle input
ev_loop.poll_events(|event| {
if let winit::Event::WindowEvent { event, .. } = event {
match event {
Closed => data.services.quit = true,
Focused(false) => {
info!("Focus lost");
data.services.keyboard.focus_lost();
}
KeyboardInput { input, .. } => match (input.virtual_keycode, input.state) {
(Some(vk), ElementState::Pressed) => {
data.services.keyboard.key_pressed(vk);
}
(Some(vk), ElementState::Released) => {
data.services.keyboard.key_released(vk);
}
_ => (),
},
_ => (),
}
}
});
data.services.graphics.events_loop = Some(ev_loop);
}
|
use std::{collections::HashMap, fs::File, io::Read, path::Path};
use crate::{NamespacedId, SerdeItem, SerdeItemStack, TagRegistry};
use generated::{Item, ItemStack};
use serde::{Deserialize, Serialize};
use smartstring::{Compact, SmartString};
/// A registry for keeping track of recipes.
#[derive(Clone, Debug, Default)]
pub struct RecipeRegistry {
pub blast: Vec<BlastingRecipe>,
pub camp: Vec<CampfireRecipe>,
pub shaped: Vec<ShapedRecipe>,
pub shapeless: Vec<ShapelessRecipe>,
pub smelt: Vec<SmeltingRecipe>,
pub smith: Vec<SmithingRecipe>,
pub smoke: Vec<SmokingRecipe>,
pub stone: Vec<StonecuttingRecipe>,
}
impl RecipeRegistry {
pub fn new() -> Self {
Self {
..Default::default()
}
}
pub fn from_dir(path: &Path) -> Result<Self, crate::RecipeLoadError> {
let mut this = Self::new();
this.add_from_dir(path)?;
Ok(this)
}
pub fn add_from_dir(&mut self, path: &Path) -> Result<(), crate::RecipeLoadError> {
for file in std::fs::read_dir(path)? {
let path = file?.path();
log::trace!("{}", path.to_string_lossy());
match Recipe::from_file(&path)? {
Recipe::Blasting(recipe) => self.blast.push(recipe),
Recipe::Campfire(recipe) => self.camp.push(recipe),
Recipe::Shaped(recipe) => self.shaped.push(recipe),
Recipe::Shapeless(recipe) => self.shapeless.push(recipe),
Recipe::Smelting(recipe) => self.smelt.push(recipe),
Recipe::Smithing(recipe) => self.smith.push(recipe),
Recipe::Smoking(recipe) => self.smoke.push(recipe),
Recipe::Stonecutting(recipe) => self.stone.push(recipe),
Recipe::Special => {}
}
}
Ok(())
}
pub fn match_blasting(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
self.blast
.iter()
.find_map(|r| r.match_self(item, tag_registry))
}
pub fn match_campfire_cooking(
&self,
item: Item,
tag_registry: &TagRegistry,
) -> Option<(Item, f32)> {
self.camp
.iter()
.find_map(|r| r.match_self(item, tag_registry))
}
pub fn match_shapeless<'a>(
&self,
items: impl Iterator<Item = &'a Item>,
tag_registry: &TagRegistry,
) -> Option<ItemStack> {
let items: Vec<Item> = items.copied().collect();
self.shapeless
.iter()
.find_map(|r| r.match_self(items.iter(), tag_registry))
}
pub fn match_smelting(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
self.smelt
.iter()
.find_map(|r| r.match_self(item, tag_registry))
}
pub fn match_smithing(
&self,
base: Item,
addition: Item,
tag_registry: &TagRegistry,
) -> Option<Item> {
self.smith
.iter()
.find_map(|r| r.match_self(base, addition, tag_registry))
}
pub fn match_smoking(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
self.smoke
.iter()
.find_map(|r| r.match_self(item, tag_registry))
}
pub fn match_stonecutting(&self, item: Item, tag_registry: &TagRegistry) -> Option<ItemStack> {
self.stone
.iter()
.find_map(|r| r.match_self(item, tag_registry))
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum Recipe {
#[serde(rename = "minecraft:blasting")]
Blasting(BlastingRecipe),
#[serde(rename = "minecraft:campfire_cooking")]
Campfire(CampfireRecipe),
#[serde(rename = "minecraft:crafting_shaped")]
Shaped(ShapedRecipe),
#[serde(rename = "minecraft:crafting_shapeless")]
Shapeless(ShapelessRecipe),
#[serde(rename = "minecraft:smelting")]
Smelting(SmeltingRecipe),
#[serde(rename = "minecraft:smithing")]
Smithing(SmithingRecipe),
#[serde(rename = "minecraft:smoking")]
Smoking(SmokingRecipe),
#[serde(rename = "minecraft:stonecutting")]
Stonecutting(StonecuttingRecipe),
#[serde(alias = "minecraft:crafting_special_armordye")]
#[serde(alias = "minecraft:crafting_special_bannerduplicate")]
#[serde(alias = "minecraft:crafting_special_bookcloning")]
#[serde(alias = "minecraft:crafting_special_firework_rocket")]
#[serde(alias = "minecraft:crafting_special_firework_star")]
#[serde(alias = "minecraft:crafting_special_firework_star_fade")]
#[serde(alias = "minecraft:crafting_special_mapcloning")]
#[serde(alias = "minecraft:crafting_special_mapextending")]
#[serde(alias = "minecraft:crafting_special_repairitem")]
#[serde(alias = "minecraft:crafting_special_shielddecoration")]
#[serde(alias = "minecraft:crafting_special_shulkerboxcoloring")]
#[serde(alias = "minecraft:crafting_special_tippedarrow")]
#[serde(alias = "minecraft:crafting_special_suspiciousstew")]
Special,
}
impl Recipe {
pub fn from_file(path: &Path) -> Result<Self, crate::RecipeLoadError> {
let mut s = String::new();
File::open(path)?.read_to_string(&mut s)?;
let k = serde_json::from_str(&s)?;
Ok(k)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct Single {
item: Option<NamespacedId>,
tag: Option<NamespacedId>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
enum Ingredient {
One(Single),
Array(Vec<Single>),
}
impl Single {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.item
.as_ref()
.map(|s| item.name() == s.name())
.unwrap_or(false)
| self
.tag
.as_ref()
.map(|s| tag_registry.check_item_tag(item, s))
.unwrap_or(false)
}
}
impl Ingredient {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
match self {
Ingredient::One(o) => o.matches(item, tag_registry),
Ingredient::Array(vec) => vec.iter().any(|o| o.matches(item, tag_registry)),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SmeltingRecipe {
group: Option<SmartString<Compact>>,
ingredient: Ingredient,
result: SerdeItem,
experience: f32,
#[serde(default = "default_smelting_time")]
cookingtime: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SmokingRecipe {
group: Option<SmartString<Compact>>,
ingredient: Ingredient,
result: SerdeItem,
experience: f32,
#[serde(default = "default_smoking_time")]
cookingtime: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BlastingRecipe {
group: Option<SmartString<Compact>>,
ingredient: Ingredient,
result: SerdeItem,
experience: f32,
#[serde(default = "default_blasting_time")]
cookingtime: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CampfireRecipe {
group: Option<SmartString<Compact>>,
ingredient: Ingredient,
result: SerdeItem,
experience: f32,
#[serde(default = "default_campfire_time")]
cookingtime: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShapelessRecipe {
group: Option<SmartString<Compact>>,
ingredients: Vec<Ingredient>,
result: SerdeItemStack,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShapedRecipe {
group: Option<SmartString<Compact>>,
pattern: Vec<SmartString<Compact>>,
key: HashMap<SmartString<Compact>, Ingredient>,
result: SerdeItemStack,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SmithingRecipe {
group: Option<SmartString<Compact>>,
base: Ingredient,
addition: Ingredient,
result: SerdeItemStack,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StonecuttingRecipe {
group: Option<SmartString<Compact>>,
ingredient: Ingredient,
result: SerdeItem,
count: u32,
}
impl SmeltingRecipe {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.ingredient.matches(item, tag_registry)
}
pub fn match_self(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
if self.matches(item, tag_registry) {
Some((self.result.into(), self.experience))
} else {
None
}
}
}
impl SmokingRecipe {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.ingredient.matches(item, tag_registry)
}
pub fn match_self(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
if self.matches(item, tag_registry) {
Some((self.result.into(), self.experience))
} else {
None
}
}
}
impl BlastingRecipe {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.ingredient.matches(item, tag_registry)
}
pub fn match_self(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
if self.matches(item, tag_registry) {
Some((self.result.into(), self.experience))
} else {
None
}
}
}
impl CampfireRecipe {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.ingredient.matches(item, tag_registry)
}
pub fn match_self(&self, item: Item, tag_registry: &TagRegistry) -> Option<(Item, f32)> {
if self.matches(item, tag_registry) {
Some((self.result.into(), self.experience))
} else {
None
}
}
}
impl ShapelessRecipe {
pub fn matches<'a>(
&self,
items: impl Iterator<Item = &'a Item>,
tag_registry: &TagRegistry,
) -> bool {
let mut counter = self.ingredients.clone();
for i in items {
match counter
.iter()
.enumerate()
.find(|(_, ing)| ing.matches(*i, tag_registry))
{
Some((index, _)) => {
counter.remove(index);
}
None => return false,
};
}
true
}
pub fn match_self<'a>(
&self,
items: impl Iterator<Item = &'a Item>,
tag_registry: &TagRegistry,
) -> Option<ItemStack> {
if self.matches(items, tag_registry) {
Some(self.result.into())
} else {
None
}
}
}
impl ShapedRecipe {
// TODO: Decide how to pass the crafting grid
}
impl SmithingRecipe {
pub fn matches(&self, base: Item, addition: Item, tag_registry: &TagRegistry) -> bool {
self.base.matches(base, tag_registry) && self.addition.matches(addition, tag_registry)
}
pub fn match_self(
&self,
base: Item,
addition: Item,
tag_registry: &TagRegistry,
) -> Option<Item> {
if self.matches(base, addition, tag_registry) {
Some(self.result.item.into())
} else {
None
}
}
}
impl StonecuttingRecipe {
pub fn matches(&self, item: Item, tag_registry: &TagRegistry) -> bool {
self.ingredient.matches(item, tag_registry)
}
pub fn match_self(&self, item: Item, tag_registry: &TagRegistry) -> Option<ItemStack> {
if self.matches(item, tag_registry) {
Some(ItemStack {
item: self.result.into(),
count: self.count,
damage: None,
})
} else {
None
}
}
}
pub fn default_smelting_time() -> u32 {
200
}
pub fn default_smoking_time() -> u32 {
100
}
pub fn default_blasting_time() -> u32 {
100
}
pub fn default_campfire_time() -> u32 {
100
}
|
use specs::prelude::*;
use specs_derive::Component;
// use crate::Image;
use crate::AtlasImage;
#[derive(Debug, Clone, Copy)]
pub struct AnimationFrame {
pub image: AtlasImage,
pub ticks: usize,
}
#[derive(Component, Debug, Clone)]
pub struct Animation {
frames: Vec<AnimationFrame>,
iterations: usize,
current_iteration: usize,
pub current_frame: usize,
frame_ticks: usize,
}
impl Animation {
pub fn new(
frames: Vec<AnimationFrame>,
iterations: usize,
current_frame: usize,
) -> Self {
assert!(frames.len() > 0);
Animation {
frames,
iterations,
current_iteration: 0,
current_frame,
frame_ticks: 0,
}
}
pub fn next_frame(&mut self) -> Option<AnimationFrame> {
let res = self.frames[self.current_frame];
self.frame_ticks += 1;
if self.frame_ticks >= res.ticks {
self.current_frame = (self.current_frame + 1) % self.frames.len();
if self.current_frame == 0 {
self.current_iteration += 1;
}
self.frame_ticks = 0;
}
if self.current_iteration >= self.iterations {
return None;
}
Some(res)
}
}
|
pub fn do_something () {
let x = foo();
let y = bar();
println!("x: {} , y: {}", x, y);
}
use std::sync::Arc;
fn foo() -> String {
"asdf".to_owned()
}
fn bar() -> Arc<String> {
Arc::new("super bar".to_owned())
} |
mod config;
use config::Config;
use hyper::{Client, Request, Body};
use hyper::http::request::Builder;
use hyper::client::HttpConnector;
use hyper_tls::HttpsConnector;
use std::time::Instant;
use std::error::Error;
use serde_json::{Value, Map};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let config: Config = std::fs::read_to_string("./config.json")?.parse()?;
let https = HttpsConnector::new();
let client = Client::builder().build::<_, Body>(https);
for request_number in 0..config.requests_to_send {
let body = match config.body.as_str() {
Some(body) => body,
None => "",
};
send_request(&client, request_number, &config.method, &config.uri, &config.headers, body.to_owned()).await?;
}
Ok(())
}
fn build_request(method: &str, uri: &str, headers: &Map<String, Value>) -> Builder {
let mut builder = Request::builder()
.method(method)
.uri(uri);
for (key, value) in headers {
let value = serde_json::to_string(value).expect("failed to read header value as string");
builder = builder.header(key.as_str(), value);
}
builder
}
async fn send_request(client: &Client<HttpsConnector<HttpConnector>>, request_number: u64, method: &str, uri: &str, headers: &Map<String, Value>, body: String) -> Result<(), Box<dyn Error>> {
let duration = Instant::now();
let builder = build_request(method, uri, headers);
let request = builder.body(Body::from(body))?;
let response = client.request(request).await?;
let elapsed = duration.elapsed();
let status = response.status();
println!("{}: {:#?} {}ms", request_number, status, elapsed.as_millis());
Ok(())
} |
use chiropterm::{Brush, Menu};
use crate::UI;
use super::{WidgetDimensions, Widget, WidgetMenu, Widgetlike};
pub struct AnyWidget {
implementation: Box<dyn AWidget>,
}
impl AnyWidget {
pub fn wrap<X: Widgetlike>(widget: Widget<X>) -> AnyWidget {
AnyWidget {
implementation: Box::new(widget)
}
}
pub fn estimate_dimensions(&self, ui: &UI, width: isize) -> WidgetDimensions {
self.implementation.poly_estimate_dimensions(ui, width)
}
pub fn draw<'frame, X: Widgetlike>(&self, brush: Brush, menu: WidgetMenu<'frame, X>) {
let ui = menu.ui;
let menu = menu.menu;
self.implementation.poly_draw(ui, brush, menu);
}
pub fn share(&self) -> AnyWidget {
return self.implementation.poly_share()
}
pub(crate) fn clear_layout_cache_if_needed(&self, ui: &UI) {
self.implementation.poly_clear_layout_cache_if_needed(ui)
}
}
trait AWidget: 'static {
fn poly_estimate_dimensions(&self, ui: &UI, width: isize) -> WidgetDimensions;
fn poly_draw<'frame>(&self, ui: UI, brush: Brush, menu: Menu<'frame>);
fn poly_clear_layout_cache_if_needed(&self, ui: &UI);
fn poly_share(&self) -> AnyWidget;
}
impl<T: Widgetlike> AWidget for Widget<T> {
fn poly_estimate_dimensions(&self, ui: &UI, width: isize) -> WidgetDimensions {
self.estimate_dimensions(ui, width)
}
fn poly_draw<'frame>(&self, ui: UI, brush: Brush, menu: Menu<'frame>) {
self.draw(ui, brush, menu)
}
fn poly_clear_layout_cache_if_needed(&self, ui: &UI) {
self.clear_layout_cache_if_needed(ui)
}
fn poly_share(&self) -> AnyWidget {
AnyWidget::wrap(self.share())
}
}
impl<T: Widgetlike> From<Widget<T>> for AnyWidget {
fn from(w: Widget<T>) -> Self {
AnyWidget::wrap(w)
}
} |
use stm32f4xx_hal::stm32::{Interrupt, NVIC};
use cortex_m::interrupt::Mutex;
use core::task::{Waker, Context, Poll};
use core::cell::Cell;
use core::sync::atomic::{AtomicBool, Ordering};
use core::future::Future;
use core::pin::Pin;
pub struct InterruptObject {
nr: Interrupt,
waker: Mutex<Cell<Option<Waker>>>,
taken: AtomicBool,
}
impl InterruptObject {
pub const fn new(nr: Interrupt) -> Self {
Self {
nr,
waker: Mutex::new(Cell::new(None)),
taken: AtomicBool::new(false),
}
}
pub fn handle_interrupt(&self) {
NVIC::mask(self.nr);
// We are already in the interrupt context, construct cs in a dirty way
let cs = unsafe { core::mem::transmute(()) };
if let Some(waker) = self.waker.borrow(&cs).take() {
waker.wake();
}
cortex_m::asm::sev();
}
fn arm(&self, waker: Waker) {
cortex_m::interrupt::free(|cs| {
self.waker.borrow(cs).set(Some(waker));
})
}
pub fn get_handle(&'static self) -> Option<InterruptHandle> {
if self.taken.swap(false, Ordering::SeqCst) {
None
} else {
Some(InterruptHandle { obj: self })
}
}
}
pub struct InterruptHandle {
obj: &'static InterruptObject,
}
impl InterruptHandle {
pub async fn wait(&mut self) {
self.await
}
pub fn unpend(&self) {
NVIC::unpend(self.obj.nr)
}
}
impl Future for InterruptHandle {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let obj = self.get_mut().obj;
if NVIC::is_pending(obj.nr) {
Poll::Ready(())
} else {
obj.arm(cx.waker().clone());
unsafe { NVIC::unmask(obj.nr) };
Poll::Pending
}
}
}
|
extern crate permutohedron;
use permutohedron::heap_recursive;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
fn parse_line(line: &str) -> (String, String, i32) {
let parts = line.split(' ').collect::<Vec<_>>();
let name = String::from(parts[0]);
let mut happiness = parts[3].parse::<i32>().unwrap();
if parts[2] == "lose" {
happiness = -happiness;
}
let mut next_to = String::from(parts[10]);
next_to.pop();
(name, next_to, happiness)
}
fn get_total_happiness(happiness: &HashMap<(String, String), i32>, arrangement: &Vec<String>) -> i32 {
let mut rotated = Vec::new();
for arr in arrangement.iter().skip(1) {
rotated.push(arr);
}
rotated.push(&arrangement[0]);
// let (mut head, mut tail) = arrangement.split_at(1);
// tail.append(head);
arrangement
.iter()
.zip(rotated)
.map(|seating| {
let happy1 = happiness.get(&(seating.0.to_string(), seating.1.to_string())).unwrap();
let happy2 = happiness.get(&(seating.1.to_string(), seating.0.to_string())).unwrap();
happy1 + happy2
})
.sum()
}
fn main() {
let file = File::open("input.txt").expect("file not found");
// let file = File::open("input_b.txt").expect("file not found"); // Swap input files for parts a/b
let mut reader = BufReader::new(file);
let mut contents = String::new();
reader.read_to_string(&mut contents).expect("could not read input file");
let mut happiness = HashMap::new();
let mut names = HashSet::new();
for line in contents.lines() {
let def = parse_line(&line);
happiness.insert((def.0.clone(), def.1.clone()), def.2);
names.insert(def.0.clone());
names.insert(def.1.clone());
}
// TODO: Gross. Better way?
let mut names_vec = Vec::new();
for name in names {
names_vec.push(name);
}
let mut max_total_happiness = 0;
heap_recursive(&mut names_vec, |arrangement| {
// // TODO: Gross. Can this be done with path more directly?
let mut this_arr = Vec::new();
for arr in arrangement.to_vec() {
this_arr.push(String::from(arr));
}
let happy = get_total_happiness(&happiness, &this_arr);
if happy > max_total_happiness {
max_total_happiness = happy;
}
});
println!("{}", max_total_happiness);
}
|
use crate::hitable::{HitRecord, Hitable};
use crate::ray::Ray;
use crate::hitable::_Hitable;
#[derive(Clone)]
pub struct HitableList {
pub hitables: Vec<Hitable>
}
impl _Hitable for HitableList {
// Note - this was implemented using fold, however the following runs around half the time.
fn hit(&self, r: &Ray, tmin: f64, tmax: f64) -> Option<HitRecord> {
let mut result = None;
let mut closest_so_far = tmax;
for hitable in self.hitables.iter() {
let hit = hitable.hit(r, tmin, closest_so_far);
if hit.is_some() {
result = hit;
result.map(|h| closest_so_far = h.t);
}
}
return result;
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::vec3::Vec3;
use crate::hitable::sphere::Sphere;
use crate::material::lambertian::Lambertian;
use crate::material::Material;
use crate::hitable::Hitable;
#[test]
fn test_hit_returns_hit_record_if_one_of_the_objects_intersects_the_ray() {
let sphere = Hitable::Sphere(Sphere {
centre: Vec3 { x: 0.0, y: 0.0, z: 0.0 },
radius: 1.0,
material: Material::Lambertian(Lambertian { albedo: Vec3 { x: 1.0, y: 1.0, z: 1.0 }}),
});
let ray = Ray {
origin: Vec3 { x: 2.0, y: 2.0, z: 2.0 },
direction: Vec3 { x: -2.0, y: -2.0, z: -2.0 },
};
let hitables = HitableList {
hitables: vec![sphere]
};
let hit = hitables.hit(&ray, 0.0, 1.0);
assert!(hit.is_some());
}
}
|
pub mod can_mcr {
pub mod dbf {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod reset {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod ttcm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod abom {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod awum {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod nart {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod rflm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod txfp {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod sleep {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006800u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
pub mod inrq {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006800u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006800u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006800u32 as *mut u32, reg);
}
}
}
}
pub mod can_msr {
pub mod rx {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod samp {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod rxm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod txm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod slaki {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod wkui {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod erri {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod slak {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006804u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
pub mod inak {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006804u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006804u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006804u32 as *mut u32, reg);
}
}
}
}
pub mod can_tsr {
pub mod low2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod low1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod low0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod tme2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod tme1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod tme0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod code {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 24) & 0x3
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFCFFFFFFu32;
reg |= (val & 0x3) << 24;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod abrq2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod terr2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod alst2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod txok2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod rqcp2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod abrq1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod terr1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod alst1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod txok1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod rqcp1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod abrq0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod terr0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod alst0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod txok0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006808u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
pub mod rqcp0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006808u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006808u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006808u32 as *mut u32, reg);
}
}
}
}
pub mod can_rf0r {
pub mod rfom0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000680Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000680Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x4000680Cu32 as *mut u32, reg);
}
}
}
pub mod fovr0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000680Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000680Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x4000680Cu32 as *mut u32, reg);
}
}
}
pub mod full0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000680Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000680Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x4000680Cu32 as *mut u32, reg);
}
}
}
pub mod fmp0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x4000680Cu32 as *const u32) & 0x3
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000680Cu32 as *const u32);
reg &= 0xFFFFFFFCu32;
reg |= val & 0x3;
core::ptr::write_volatile(0x4000680Cu32 as *mut u32, reg);
}
}
}
}
pub mod can_rf1r {
pub mod rfom1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006810u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006810u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006810u32 as *mut u32, reg);
}
}
}
pub mod fovr1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006810u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006810u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006810u32 as *mut u32, reg);
}
}
}
pub mod full1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006810u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006810u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006810u32 as *mut u32, reg);
}
}
}
pub mod fmp1 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006810u32 as *const u32) & 0x3
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006810u32 as *const u32);
reg &= 0xFFFFFFFCu32;
reg |= val & 0x3;
core::ptr::write_volatile(0x40006810u32 as *mut u32, reg);
}
}
}
}
pub mod can_ier {
pub mod slkie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod wkuie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod errie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod lecie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod bofie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod epvie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod ewgie {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod fovie1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod ffie1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod fmpie1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod fovie0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod ffie0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod fmpie0 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006814u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
pub mod tmeie {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006814u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006814u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006814u32 as *mut u32, reg);
}
}
}
}
pub mod can_esr {
pub mod rec {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006818u32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
pub mod tec {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006818u32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
pub mod lec {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006818u32 as *const u32) >> 4) & 0x7
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFFFFFF8Fu32;
reg |= (val & 0x7) << 4;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
pub mod boff {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006818u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
pub mod epvf {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006818u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
pub mod ewgf {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006818u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006818u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006818u32 as *mut u32, reg);
}
}
}
}
pub mod can_btr {
pub mod silm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000681Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
pub mod lbkm {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000681Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
pub mod sjw {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000681Cu32 as *const u32) >> 24) & 0x3
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0xFCFFFFFFu32;
reg |= (val & 0x3) << 24;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
pub mod ts2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000681Cu32 as *const u32) >> 20) & 0x7
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0xFF8FFFFFu32;
reg |= (val & 0x7) << 20;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
pub mod ts1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000681Cu32 as *const u32) >> 16) & 0xF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0xFFF0FFFFu32;
reg |= (val & 0xF) << 16;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
pub mod brp {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x4000681Cu32 as *const u32) & 0x3FF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000681Cu32 as *const u32);
reg &= 0xFFFFFC00u32;
reg |= val & 0x3FF;
core::ptr::write_volatile(0x4000681Cu32 as *mut u32, reg);
}
}
}
}
pub mod can_ti0r {
pub mod stid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006980u32 as *const u32) >> 21) & 0x7FF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006980u32 as *const u32);
reg &= 0x1FFFFFu32;
reg |= (val & 0x7FF) << 21;
core::ptr::write_volatile(0x40006980u32 as *mut u32, reg);
}
}
}
pub mod exid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006980u32 as *const u32) >> 3) & 0x3FFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006980u32 as *const u32);
reg &= 0xFFE00007u32;
reg |= (val & 0x3FFFF) << 3;
core::ptr::write_volatile(0x40006980u32 as *mut u32, reg);
}
}
}
pub mod ide {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006980u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006980u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006980u32 as *mut u32, reg);
}
}
}
pub mod rtr {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006980u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006980u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006980u32 as *mut u32, reg);
}
}
}
pub mod txrq {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006980u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006980u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006980u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdt0r {
pub mod time {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006984u32 as *const u32) >> 16) & 0xFFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006984u32 as *const u32);
reg &= 0xFFFFu32;
reg |= (val & 0xFFFF) << 16;
core::ptr::write_volatile(0x40006984u32 as *mut u32, reg);
}
}
}
pub mod tgt {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006984u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006984u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006984u32 as *mut u32, reg);
}
}
}
pub mod dlc {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006984u32 as *const u32) & 0xF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006984u32 as *const u32);
reg &= 0xFFFFFFF0u32;
reg |= val & 0xF;
core::ptr::write_volatile(0x40006984u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdl0r {
pub mod data3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006988u32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006988u32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x40006988u32 as *mut u32, reg);
}
}
}
pub mod data2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006988u32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006988u32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x40006988u32 as *mut u32, reg);
}
}
}
pub mod data1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006988u32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006988u32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x40006988u32 as *mut u32, reg);
}
}
}
pub mod data0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006988u32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006988u32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x40006988u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdh0r {
pub mod data7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000698Cu32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000698Cu32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x4000698Cu32 as *mut u32, reg);
}
}
}
pub mod data6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000698Cu32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000698Cu32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x4000698Cu32 as *mut u32, reg);
}
}
}
pub mod data5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000698Cu32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000698Cu32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x4000698Cu32 as *mut u32, reg);
}
}
}
pub mod data4 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x4000698Cu32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000698Cu32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x4000698Cu32 as *mut u32, reg);
}
}
}
}
pub mod can_ti1r {
pub mod stid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006990u32 as *const u32) >> 21) & 0x7FF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006990u32 as *const u32);
reg &= 0x1FFFFFu32;
reg |= (val & 0x7FF) << 21;
core::ptr::write_volatile(0x40006990u32 as *mut u32, reg);
}
}
}
pub mod exid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006990u32 as *const u32) >> 3) & 0x3FFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006990u32 as *const u32);
reg &= 0xFFE00007u32;
reg |= (val & 0x3FFFF) << 3;
core::ptr::write_volatile(0x40006990u32 as *mut u32, reg);
}
}
}
pub mod ide {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006990u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006990u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006990u32 as *mut u32, reg);
}
}
}
pub mod rtr {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006990u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006990u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006990u32 as *mut u32, reg);
}
}
}
pub mod txrq {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006990u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006990u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006990u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdt1r {
pub mod time {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006994u32 as *const u32) >> 16) & 0xFFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006994u32 as *const u32);
reg &= 0xFFFFu32;
reg |= (val & 0xFFFF) << 16;
core::ptr::write_volatile(0x40006994u32 as *mut u32, reg);
}
}
}
pub mod tgt {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006994u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006994u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006994u32 as *mut u32, reg);
}
}
}
pub mod dlc {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006994u32 as *const u32) & 0xF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006994u32 as *const u32);
reg &= 0xFFFFFFF0u32;
reg |= val & 0xF;
core::ptr::write_volatile(0x40006994u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdl1r {
pub mod data3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006998u32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006998u32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x40006998u32 as *mut u32, reg);
}
}
}
pub mod data2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006998u32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006998u32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x40006998u32 as *mut u32, reg);
}
}
}
pub mod data1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006998u32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006998u32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x40006998u32 as *mut u32, reg);
}
}
}
pub mod data0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006998u32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006998u32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x40006998u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdh1r {
pub mod data7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000699Cu32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000699Cu32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x4000699Cu32 as *mut u32, reg);
}
}
}
pub mod data6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000699Cu32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000699Cu32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x4000699Cu32 as *mut u32, reg);
}
}
}
pub mod data5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x4000699Cu32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000699Cu32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x4000699Cu32 as *mut u32, reg);
}
}
}
pub mod data4 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x4000699Cu32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x4000699Cu32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x4000699Cu32 as *mut u32, reg);
}
}
}
}
pub mod can_ti2r {
pub mod stid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A0u32 as *const u32) >> 21) & 0x7FF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A0u32 as *const u32);
reg &= 0x1FFFFFu32;
reg |= (val & 0x7FF) << 21;
core::ptr::write_volatile(0x400069A0u32 as *mut u32, reg);
}
}
}
pub mod exid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A0u32 as *const u32) >> 3) & 0x3FFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A0u32 as *const u32);
reg &= 0xFFE00007u32;
reg |= (val & 0x3FFFF) << 3;
core::ptr::write_volatile(0x400069A0u32 as *mut u32, reg);
}
}
}
pub mod ide {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A0u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A0u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x400069A0u32 as *mut u32, reg);
}
}
}
pub mod rtr {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A0u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A0u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x400069A0u32 as *mut u32, reg);
}
}
}
pub mod txrq {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069A0u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A0u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x400069A0u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdt2r {
pub mod time {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A4u32 as *const u32) >> 16) & 0xFFFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A4u32 as *const u32);
reg &= 0xFFFFu32;
reg |= (val & 0xFFFF) << 16;
core::ptr::write_volatile(0x400069A4u32 as *mut u32, reg);
}
}
}
pub mod tgt {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A4u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A4u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x400069A4u32 as *mut u32, reg);
}
}
}
pub mod dlc {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069A4u32 as *const u32) & 0xF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A4u32 as *const u32);
reg &= 0xFFFFFFF0u32;
reg |= val & 0xF;
core::ptr::write_volatile(0x400069A4u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdl2r {
pub mod data3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A8u32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A8u32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x400069A8u32 as *mut u32, reg);
}
}
}
pub mod data2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A8u32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A8u32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x400069A8u32 as *mut u32, reg);
}
}
}
pub mod data1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069A8u32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A8u32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x400069A8u32 as *mut u32, reg);
}
}
}
pub mod data0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069A8u32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069A8u32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x400069A8u32 as *mut u32, reg);
}
}
}
}
pub mod can_tdh2r {
pub mod data7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069ACu32 as *const u32) >> 24) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069ACu32 as *const u32);
reg &= 0xFFFFFFu32;
reg |= (val & 0xFF) << 24;
core::ptr::write_volatile(0x400069ACu32 as *mut u32, reg);
}
}
}
pub mod data6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069ACu32 as *const u32) >> 16) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069ACu32 as *const u32);
reg &= 0xFF00FFFFu32;
reg |= (val & 0xFF) << 16;
core::ptr::write_volatile(0x400069ACu32 as *mut u32, reg);
}
}
}
pub mod data5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069ACu32 as *const u32) >> 8) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069ACu32 as *const u32);
reg &= 0xFFFF00FFu32;
reg |= (val & 0xFF) << 8;
core::ptr::write_volatile(0x400069ACu32 as *mut u32, reg);
}
}
}
pub mod data4 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069ACu32 as *const u32) & 0xFF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x400069ACu32 as *const u32);
reg &= 0xFFFFFF00u32;
reg |= val & 0xFF;
core::ptr::write_volatile(0x400069ACu32 as *mut u32, reg);
}
}
}
}
pub mod can_ri0r {
pub mod stid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B0u32 as *const u32) >> 21) & 0x7FF
}
}
}
pub mod exid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B0u32 as *const u32) >> 3) & 0x3FFFF
}
}
}
pub mod ide {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B0u32 as *const u32) >> 2) & 0x1
}
}
}
pub mod rtr {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B0u32 as *const u32) >> 1) & 0x1
}
}
}
}
pub mod can_rdt0r {
pub mod time {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B4u32 as *const u32) >> 16) & 0xFFFF
}
}
}
pub mod fmi {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B4u32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod dlc {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069B4u32 as *const u32) & 0xF
}
}
}
}
pub mod can_rdl0r {
pub mod data3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B8u32 as *const u32) >> 24) & 0xFF
}
}
}
pub mod data2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B8u32 as *const u32) >> 16) & 0xFF
}
}
}
pub mod data1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069B8u32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod data0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069B8u32 as *const u32) & 0xFF
}
}
}
}
pub mod can_rdh0r {
pub mod data7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069BCu32 as *const u32) >> 24) & 0xFF
}
}
}
pub mod data6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069BCu32 as *const u32) >> 16) & 0xFF
}
}
}
pub mod data5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069BCu32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod data4 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069BCu32 as *const u32) & 0xFF
}
}
}
}
pub mod can_ri1r {
pub mod stid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C0u32 as *const u32) >> 21) & 0x7FF
}
}
}
pub mod exid {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C0u32 as *const u32) >> 3) & 0x3FFFF
}
}
}
pub mod ide {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C0u32 as *const u32) >> 2) & 0x1
}
}
}
pub mod rtr {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C0u32 as *const u32) >> 1) & 0x1
}
}
}
}
pub mod can_rdt1r {
pub mod time {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C4u32 as *const u32) >> 16) & 0xFFFF
}
}
}
pub mod fmi {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C4u32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod dlc {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069C4u32 as *const u32) & 0xF
}
}
}
}
pub mod can_rdl1r {
pub mod data3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C8u32 as *const u32) >> 24) & 0xFF
}
}
}
pub mod data2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C8u32 as *const u32) >> 16) & 0xFF
}
}
}
pub mod data1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069C8u32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod data0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069C8u32 as *const u32) & 0xFF
}
}
}
}
pub mod can_rdh1r {
pub mod data7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069CCu32 as *const u32) >> 24) & 0xFF
}
}
}
pub mod data6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069CCu32 as *const u32) >> 16) & 0xFF
}
}
}
pub mod data5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x400069CCu32 as *const u32) >> 8) & 0xFF
}
}
}
pub mod data4 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x400069CCu32 as *const u32) & 0xFF
}
}
}
}
pub mod can_fmr {
pub mod finit {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A00u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A00u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A00u32 as *mut u32, reg);
}
}
}
}
pub mod can_fm1r {
pub mod fbm0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A04u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
pub mod fbm13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A04u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A04u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A04u32 as *mut u32, reg);
}
}
}
}
pub mod can_fs1r {
pub mod fsc0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A0Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
pub mod fsc13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A0Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A0Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A0Cu32 as *mut u32, reg);
}
}
}
}
pub mod can_ffa1r {
pub mod ffa0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A14u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
pub mod ffa13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A14u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A14u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A14u32 as *mut u32, reg);
}
}
}
}
pub mod can_fa1r {
pub mod fact0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A1Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
pub mod fact13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A1Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A1Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A1Cu32 as *mut u32, reg);
}
}
}
}
pub mod f0r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A40u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A40u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A40u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A40u32 as *mut u32, reg);
}
}
}
}
pub mod f0r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A44u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A44u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A44u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A44u32 as *mut u32, reg);
}
}
}
}
pub mod f1r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A48u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A48u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A48u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A48u32 as *mut u32, reg);
}
}
}
}
pub mod f1r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A4Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A4Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A4Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A4Cu32 as *mut u32, reg);
}
}
}
}
pub mod f2r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A50u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A50u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A50u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A50u32 as *mut u32, reg);
}
}
}
}
pub mod f2r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A54u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A54u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A54u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A54u32 as *mut u32, reg);
}
}
}
}
pub mod f3r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A58u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A58u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A58u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A58u32 as *mut u32, reg);
}
}
}
}
pub mod f3r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A5Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A5Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A5Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A5Cu32 as *mut u32, reg);
}
}
}
}
pub mod f4r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A60u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A60u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A60u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A60u32 as *mut u32, reg);
}
}
}
}
pub mod f4r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A64u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A64u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A64u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A64u32 as *mut u32, reg);
}
}
}
}
pub mod f5r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A68u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A68u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A68u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A68u32 as *mut u32, reg);
}
}
}
}
pub mod f5r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A6Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A6Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A6Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A6Cu32 as *mut u32, reg);
}
}
}
}
pub mod f6r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A70u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A70u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A70u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A70u32 as *mut u32, reg);
}
}
}
}
pub mod f6r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A74u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A74u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A74u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A74u32 as *mut u32, reg);
}
}
}
}
pub mod f7r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A78u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A78u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A78u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A78u32 as *mut u32, reg);
}
}
}
}
pub mod f7r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A7Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A7Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A7Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A7Cu32 as *mut u32, reg);
}
}
}
}
pub mod f8r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A80u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A80u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A80u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A80u32 as *mut u32, reg);
}
}
}
}
pub mod f8r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A84u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A84u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A84u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A84u32 as *mut u32, reg);
}
}
}
}
pub mod f9r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A88u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A88u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A88u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A88u32 as *mut u32, reg);
}
}
}
}
pub mod f9r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A8Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A8Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A8Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A8Cu32 as *mut u32, reg);
}
}
}
}
pub mod f10r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A90u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A90u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A90u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A90u32 as *mut u32, reg);
}
}
}
}
pub mod f10r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A94u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A94u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A94u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A94u32 as *mut u32, reg);
}
}
}
}
pub mod f11r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A98u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A98u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A98u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A98u32 as *mut u32, reg);
}
}
}
}
pub mod f11r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006A9Cu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006A9Cu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006A9Cu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006A9Cu32 as *mut u32, reg);
}
}
}
}
pub mod f12r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006AA0u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA0u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA0u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006AA0u32 as *mut u32, reg);
}
}
}
}
pub mod f12r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006AA4u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA4u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA4u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006AA4u32 as *mut u32, reg);
}
}
}
}
pub mod f13r1 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006AA8u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AA8u32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AA8u32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006AA8u32 as *mut u32, reg);
}
}
}
}
pub mod f13r2 {
pub mod fb0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40006AACu32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFFEu32;
reg |= val & 0x1;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb1 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 1) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFFDu32;
reg |= (val & 0x1) << 1;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb2 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 2) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFFBu32;
reg |= (val & 0x1) << 2;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb3 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 3) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFF7u32;
reg |= (val & 0x1) << 3;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb4 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 4) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFEFu32;
reg |= (val & 0x1) << 4;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb5 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 5) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFDFu32;
reg |= (val & 0x1) << 5;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb6 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 6) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFFBFu32;
reg |= (val & 0x1) << 6;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb7 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 7) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFF7Fu32;
reg |= (val & 0x1) << 7;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb8 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 8) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFEFFu32;
reg |= (val & 0x1) << 8;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb9 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 9) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFDFFu32;
reg |= (val & 0x1) << 9;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb10 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 10) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFFBFFu32;
reg |= (val & 0x1) << 10;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb11 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 11) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFF7FFu32;
reg |= (val & 0x1) << 11;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb12 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 12) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFEFFFu32;
reg |= (val & 0x1) << 12;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb13 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 13) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFDFFFu32;
reg |= (val & 0x1) << 13;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb14 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 14) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFFBFFFu32;
reg |= (val & 0x1) << 14;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb15 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 15) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFF7FFFu32;
reg |= (val & 0x1) << 15;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb16 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 16) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFEFFFFu32;
reg |= (val & 0x1) << 16;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb17 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 17) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFDFFFFu32;
reg |= (val & 0x1) << 17;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb18 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 18) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFFBFFFFu32;
reg |= (val & 0x1) << 18;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb19 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 19) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFF7FFFFu32;
reg |= (val & 0x1) << 19;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb20 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 20) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFEFFFFFu32;
reg |= (val & 0x1) << 20;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb21 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 21) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFDFFFFFu32;
reg |= (val & 0x1) << 21;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb22 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 22) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFFBFFFFFu32;
reg |= (val & 0x1) << 22;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb23 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 23) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFF7FFFFFu32;
reg |= (val & 0x1) << 23;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb24 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 24) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFEFFFFFFu32;
reg |= (val & 0x1) << 24;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb25 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 25) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFDFFFFFFu32;
reg |= (val & 0x1) << 25;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb26 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 26) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xFBFFFFFFu32;
reg |= (val & 0x1) << 26;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb27 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 27) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xF7FFFFFFu32;
reg |= (val & 0x1) << 27;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb28 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 28) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xEFFFFFFFu32;
reg |= (val & 0x1) << 28;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb29 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 29) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xDFFFFFFFu32;
reg |= (val & 0x1) << 29;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb30 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 30) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0xBFFFFFFFu32;
reg |= (val & 0x1) << 30;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
pub mod fb31 {
pub fn get() -> u32 {
unsafe {
(core::ptr::read_volatile(0x40006AACu32 as *const u32) >> 31) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40006AACu32 as *const u32);
reg &= 0x7FFFFFFFu32;
reg |= (val & 0x1) << 31;
core::ptr::write_volatile(0x40006AACu32 as *mut u32, reg);
}
}
}
}
|
use crate::gpg;
use anyhow::Result as Fallible;
use anyhow::{format_err, Context};
use bytes::Bytes;
use futures::stream::{FuturesOrdered, StreamExt};
use lazy_static::lazy_static;
use reqwest::{Client, ClientBuilder};
use semver::Version;
use std::collections::HashSet;
use std::ops::Range;
use std::str::FromStr;
use std::time::Duration;
use url::Url;
use cincinnati::plugins::prelude_plugin_impl::TryFutureExt;
use cincinnati::Release;
// base url for signature storage - see https://github.com/openshift/cluster-update-keys/blob/master/stores/store-openshift-official-release-mirror
lazy_static! {
static ref BASE_URL: Url =
Url::parse("https://mirror.openshift.com/pub/openshift-v4/signatures/openshift/release/")
.expect("could not parse url");
}
// Signature file request timeout
static DEFAULT_TIMEOUT_SECS: u64 = 30;
// CVO has maxSignatureSearch = 10 in pkg/verify/verify.go
static MAX_SIGNATURES: u64 = 10;
// Skip some versions from 4.0 / 4.1 / 4.2 times
// https://issues.redhat.com/browse/ART-2397
static SKIP_VERSIONS: &[&str] = &[
"4.1.0-rc.3+amd64",
"4.1.0-rc.5+amd64",
"4.1.0-rc.4+amd64",
"4.1.0-rc.0+amd64",
"4.1.0-rc.8+amd64",
"4.1.37+amd64",
"4.2.11+amd64",
"4.3.0-rc.0+amd64",
"4.6.0-fc.3+s390x",
// 4.1.0+amd64 is signed with CI key
"4.1.0+amd64",
];
/// Extract payload value from Release if it is a Concrete release
fn payload_from_release(release: &Release) -> Fallible<String> {
match release {
Release::Concrete(c) => Ok(c.payload.clone()),
_ => Err(format_err!("not a concrete release")),
}
}
/// Fetch signature contents by building a URL for signature store
async fn fetch_url(client: &Client, sha: &str, i: u64) -> Fallible<Bytes> {
let url = BASE_URL
.join(format!("{}/", sha.replace(":", "=")).as_str())?
.join(format!("signature-{}", i).as_str())?;
let res = client
.get(url.clone())
.send()
.map_err(|e| format_err!(e.to_string()))
.await?;
let url_s = url.to_string();
let status = res.status();
match status.is_success() {
true => Ok(res.bytes().await?),
false => Err(format_err!("Error fetching {} - {}", url_s, status)),
}
}
/// Generate URLs for signature store and attempt to find a valid signature
async fn find_signatures_for_version(
client: &Client,
public_keys: &gpg::Keyring,
release: &Release,
) -> Fallible<()> {
let mut errors = vec![];
let payload = payload_from_release(release)?;
let digest = payload
.split("@")
.last()
.ok_or_else(|| format_err!("could not parse payload '{:?}'", payload))?;
let mut attempts = Range {
start: 1,
end: MAX_SIGNATURES,
};
loop {
if let Some(i) = attempts.next() {
match fetch_url(client, digest, i).await {
Ok(body) => match gpg::verify_signature(public_keys, body, digest).await {
Ok(_) => return Ok(()),
Err(e) => errors.push(e),
},
Err(e) => errors.push(e),
}
} else {
return Err(format_err!(
"Failed to find signatures for {} - {}: {:#?}",
release.version(),
payload,
errors
));
}
}
}
/// Iterate versions and return true if Release is included
fn is_release_in_versions(versions: &HashSet<Version>, release: &Release) -> bool {
// Check that release version is not in skip list
if SKIP_VERSIONS.contains(&release.version()) {
return false;
}
// Strip arch identifier
let stripped_version = release
.version()
.split("+")
.next()
.ok_or(release.version())
.unwrap();
let version = Version::from_str(stripped_version).unwrap();
versions.contains(&version)
}
pub async fn run(
releases: &Vec<Release>,
found_versions: &HashSet<semver::Version>,
) -> Fallible<()> {
println!("Checking release signatures");
// Initialize keyring
let public_keys = gpg::load_public_keys()?;
// Prepare http client
let client: Client = ClientBuilder::new()
.gzip(true)
.timeout(Duration::from_secs(DEFAULT_TIMEOUT_SECS))
.build()
.context("Building reqwest client")?;
// Filter scraped images - skip CI images
let tracked_versions: Vec<&cincinnati::Release> = releases
.into_iter()
.filter(|ref r| is_release_in_versions(found_versions, &r))
.collect::<Vec<&cincinnati::Release>>();
let results: Vec<Fallible<()>> = tracked_versions
//Attempt to find signatures for filtered releases
.into_iter()
.map(|ref r| find_signatures_for_version(&client, &public_keys, r))
.collect::<FuturesOrdered<_>>()
.collect::<Vec<Fallible<()>>>()
.await
// Filter to keep errors only
.into_iter()
.filter(|e| e.is_err())
.collect();
if results.is_empty() {
Ok(())
} else {
Err(format_err!("Signature check errors: {:#?}", results))
}
}
|
use crate::base::id;
use crate::base::NSUInteger;
use crate::base::BOOL;
bitflags! {
pub struct NSApplicationActivationOptions: NSUInteger {
#[allow(non_upper_case_globals)]
const AllWindows = 1;
#[allow(non_upper_case_globals)]
const IgnoringOtherApps = 1 << 1;
}
}
// https://developer.apple.com/documentation/appkit/nsrunningapplication
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct NSRunningApplication(id);
impl Default for NSRunningApplication {
fn default() -> Self {
Self::current()
}
}
impl NSRunningApplication {
pub fn current() -> Self {
Self(unsafe { msg_send!(class!(NSRunningApplication), currentApplication) })
}
pub fn activate(self, options: NSApplicationActivationOptions) -> BOOL {
unsafe { msg_send!(self.0, activateWithOptions: options.bits) }
}
}
|
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
pub fn part1(filename: &str) -> i32 {
let file = File::open(filename).expect("file not found");
let mut two_letters = 0;
let mut three_letters = 0;
let mut letters: HashMap<char, i32> = HashMap::new();
for line in BufReader::new(file).lines() {
for c in line.unwrap().chars() {
let count = letters.entry(c).or_insert(0);
*count += 1;
}
let mut found_two = false;
let mut found_three = false;
for val in letters.values() {
if *val == 2 {
found_two = true;
} else if *val == 3 {
found_three = true;
}
}
if found_two {
two_letters += 1;
}
if found_three {
three_letters += 1;
}
letters.clear();
}
two_letters * three_letters
}
pub fn part2(filename: &str) -> String {
// parse all lines into a vector of chars
let file = File::open(filename).expect("file not found");
let mut boxes: Vec<Vec<char>> = Vec::new();
for line in BufReader::new(file).lines() {
let mut box_chars: Vec<char> = Vec::new();
for c in line.unwrap().chars() {
box_chars.push(c);
}
boxes.push(box_chars);
}
// search for boxes that are the closest match (same letters in same position)
let box_count = boxes.len();
let char_count = boxes[0].len();
let mut box_1 = 0;
let mut box_2 = 0;
let mut max_diff = std::i32::MAX;
for index_1 in 0..(box_count - 1) {
for index_2 in (index_1 + 1)..box_count {
let mut diff = 0;
for i in 0..char_count {
if boxes[index_1][i] != boxes[index_2][i] {
diff += 1;
}
}
if diff < max_diff {
box_1 = index_1;
box_2 = index_2;
max_diff = diff;
}
}
}
let mut answer: Vec<char> = Vec::new();
for i in 0..char_count {
if boxes[box_1][i] == boxes[box_2][i] {
answer.push(boxes[box_1][i]);
}
}
answer.into_iter().collect()
}
|
#![recursion_limit="512"]
#![cfg_attr(not(test), allow(dead_code, unused_imports))]
#[macro_use]
extern crate cpp;
#[cfg(test)]
mod inner;
// Test that module resolution works correctly with inline modules.
#[cfg(test)]
mod nomod {
pub mod inner;
}
fn add_two(x: i32) -> i32 {
x + 2
}
cpp!{{
#define _USE_MATH_DEFINES
#include <math.h>
#include "src/header.h"
#include <map>
#include <iostream>
int callRust1(int x) {
return rust!(addTwoCallback [x : i32 as "int"] -> i32 as "int" { add_two(x) });
}
void *callRust2(void *ptr) {
int a = 3;
typedef int LocalInt;
typedef void * VoidStar;
return rust!(ptrCallback [ptr : *mut u32 as "void*", a : u32 as "LocalInt"]
-> *mut u32 as "VoidStar"
{ unsafe {*ptr += a}; return ptr; });
}
}}
cpp_class!(
/// Documentation comments
/** More /*comments*/ */
pub unsafe struct A as "A");
impl A {
fn new(a : i32, b: i32) -> Self {
unsafe {
return cpp!([a as "int", b as "int"] -> A as "A" {
return A(a, b);
});
}
}
fn set_values(&mut self, a : i32, b: i32) {
unsafe {
return cpp!([self as "A*", a as "int", b as "int"] {
self->setValues(a, b);
});
}
}
fn multiply(&self) -> i32 {
unsafe {
return cpp!([self as "const A*"] -> i32 as "int" {
return self->multiply();
});
}
}
}
cpp!{{
bool callRust3(const A &a, int val) {
A a2 = rust!(ACallback [a : A as "A", val : i32 as "int"] -> A as "A"
{
let mut a2 = a.clone();
a2.set_values(a.multiply(), val);
a2
});
return a2.a == a.a*a.b && a2.b == val;
}
int manyOtherTest() {
int val = 32;
int *v = &val;
// returns void
rust!(xx___1 [v : &mut i32 as "int*"] { *v = 43; } );
if (val != 43) return 1;
rust!(xx___2 [val : &mut i32 as "int&"] { assert!(*val == 43); *val = 54; } );
if (val != 54) return 2;
rust!(xx___3 [v : *mut i32 as "int*"] { unsafe {*v = 73;} } );
if (val != 73) return 3;
rust!(xx___4 [val : *mut i32 as "int&"] { unsafe { assert!(*val == 73); *val = 62; }} );
if (val != 62) return 4;
rust!(xx___5 [val : *const i32 as "const int&"] { unsafe { assert!(*val == 62); }} );
rust!(xx___6 [val : &i32 as "const int&"] { assert!(*val == 62); } );
rust!(xx___7 [val : i32 as "int"] { let v = val; assert!(v == 62); } );
// operations on doubles
double fval = 5.5;
double res = rust!(xx___8 [fval : f64 as "double"] -> f64 as "double" { fval * 1.2 + 9.9 } );
if (int((res - (5.5 * 1.2 + 9.9)) * 100000) != 0) return 5;
res = rust!(xx___9 [fval : &mut f64 as "double&"] -> f64 as "double" { *fval = *fval * 2.2; 8.8 } );
if (int((res - (8.8)) * 100000) != 0) return 9;
if (int((fval - (5.5 * 2.2)) * 100000) != 0) return 10;
// with a class
A a(3,4);
rust!(xx___10 [a : A as "A"] { let a2 = a.clone(); assert!(a2.multiply() == 12); } );
rust!(xx___11 [a : A as "A"] { let _a = a.clone(); return; } );
return 0;
}
}}
#[test]
fn captures() {
let x: i32 = 10;
let mut y: i32 = 20;
let z = unsafe {
cpp! {[x as "int", mut y as "int"] -> i64 as "long long int" {
y += 1;
return [&] { return x + y; }();
}}
};
assert_eq!(x, 10);
assert_eq!(y, 21);
assert_eq!(z, 31);
}
#[test]
fn no_captures() {
let x = unsafe {
cpp![[] -> i32 as "int" {
return 10;
}]
};
assert_eq!(x, 10);
}
#[test]
fn test_inner() {
let x = inner::inner();
assert_eq!(x, 10);
let y = inner::innerinner::innerinner();
assert_eq!(y, 10);
let y = inner::innerpath::explicit_path(10);
assert_eq!(y, 10);
}
#[test]
fn includes() {
unsafe {
let pi = cpp!([] -> f32 as "float" {
return M_PI;
});
assert!(pi - ::std::f32::consts::PI < 0.0000000001);
}
}
#[test]
fn plusplus() {
unsafe {
let mut x: i32 = 0;
cpp!([mut x as "int"] {
x++;
});
assert_eq!(x, 1);
}
}
#[test]
fn destructor() {
unsafe {
let a = cpp!([] -> A as "A" {
return A(5, 10);
});
let a1 = a.clone();
let first = cpp!([a as "A"] -> i32 as "int32_t" {
return a.a;
});
assert_eq!(first, 5);
let second = cpp!([a1 as "A"] -> i32 as "int32_t" {
return a1.b;
});
assert_eq!(second, 10);
}
}
#[test]
fn member_function() {
let mut a = A::new(2,3);
assert_eq!(a.multiply(), 2*3);
a.set_values(5,6);
assert_eq!(a.multiply(), 5*6);
}
cpp_class!(pub(crate) unsafe struct B as "B");
impl B {
fn new(a : i32, b: i32) -> Self {
unsafe {
return cpp!([a as "int", b as "int"] -> B as "B" {
B ret = { a, b };
return ret;
});
}
}
fn a(&mut self) -> &mut i32 {
unsafe {
return cpp!([self as "B*"] -> &mut i32 as "int*" {
return &self->a;
});
}
}
fn b(&mut self) -> &mut i32 {
unsafe {
return cpp!([self as "B*"] -> &mut i32 as "int*" {
return &self->b;
});
}
}
}
#[test]
fn simple_class() {
let mut b = B::new(12,34);
assert_eq!(*b.a(), 12);
assert_eq!(*b.b(), 34);
*b.a() = 45;
let mut b2 = b;
assert_eq!(*b2.a(), 45);
let mut b3 = B::default();
assert_eq!(*b3.a(), 0);
assert_eq!(*b3.b(), 0);
}
#[test]
fn move_only() {
cpp_class!(unsafe struct MoveOnly as "MoveOnly");
impl MoveOnly {
fn data(&self) -> &A {
unsafe {
return cpp!([self as "MoveOnly*"] -> &A as "A*" {
return &self->data;
});
}
}
}
let mo1 = MoveOnly::default();
assert_eq!(mo1.data().multiply(), 8*9);
let mut mo2 = mo1;
let mo3 = unsafe { cpp!([mut mo2 as "MoveOnly"] -> MoveOnly as "MoveOnly" {
mo2.data.a = 7;
return MoveOnly(3,2);
})};
assert_eq!(mo2.data().multiply(), 7*9);
assert_eq!(mo3.data().multiply(), 3*2);
}
#[test]
fn derive_eq() {
cpp!{{
struct WithOpEq {
static int val;
int value = val++;
friend bool operator==(const WithOpEq &a, const WithOpEq &b) { return a.value == b.value; }
};
int WithOpEq::val = 0;
}};
cpp_class!(#[derive(Eq, PartialEq)] unsafe struct WithOpEq as "WithOpEq");
let x1 = WithOpEq::default();
let x2 = WithOpEq::default();
assert!(!(x1 == x2));
assert!(x1 != x2);
let x3 = x1.clone();
assert!(x1 == x3);
assert!(!(x1 != x3));
}
#[test]
fn derive_ord() {
cpp!{{
struct Comp {
int value;
Comp(int i) : value(i) { }
friend bool operator<(const Comp &a, const Comp &b) { return a.value < b.value; }
friend bool operator==(const Comp &a, const Comp &b) { return a.value == b.value; }
};
}};
cpp_class!(#[derive(PartialEq, PartialOrd)] #[derive(Eq, Ord)] unsafe struct Comp as "Comp");
impl Comp {
fn new(i : u32) -> Comp { unsafe { cpp!([i as "int"] -> Comp as "Comp" { return i; }) } }
}
let x1 = Comp::new(1);
let x2 = Comp::new(2);
let x3 = Comp::new(3);
assert!(x1 < x2);
assert!(x2 > x1);
assert!(x3 > x1);
assert!(x3 >= x1);
assert!(x3 >= x3);
assert!(x2 <= x3);
assert!(x2 <= x2);
assert!(!(x1 > x2));
assert!(!(x2 < x1));
assert!(!(x3 <= x1));
assert!(!(x1 < x1));
assert!(!(x3 > x3));
assert!(!(x3 < x3));
assert!(!(x2 >= x3));
}
#[test]
fn test_nomod() {
assert_eq!(nomod::inner::nomod_inner(), 10);
}
#[test]
fn rust_submacro() {
let result = unsafe { cpp!([] -> i32 as "int" { return callRust1(45); }) };
assert_eq!(result, 47); // callRust1 adds 2
let mut val : u32 = 18;
{
let val_ref = &mut val;
let result = unsafe { cpp!([val_ref as "void*"] -> bool as "bool" {
return callRust2(val_ref) == val_ref;
}) };
assert_eq!(result, true);
}
assert_eq!(val, 21); // callRust2 does +=3
let result = unsafe { cpp!([]->bool as "bool" {
A a(5, 3);
return callRust3(a, 18);
})};
assert!(result);
let result = unsafe { cpp!([]->u32 as "int" {
return manyOtherTest();
})};
assert_eq!(result, 0);
}
pub trait MyTrait {
fn compute_value(&self, x : i32) -> i32;
}
cpp!{{
struct MyClass {
virtual int computeValue(int) const = 0;
};
int operate123(MyClass *callback) { return callback->computeValue(123); }
struct TraitPtr { void *a,*b; };
}}
cpp!{{
class MyClassImpl : public MyClass {
public:
TraitPtr m_trait;
int computeValue(int x) const /*override*/ {
return rust!(MCI_computeValue [m_trait : &MyTrait as "TraitPtr", x : i32 as "int"]
-> i32 as "int" {
m_trait.compute_value(x)
});
}
};
}}
struct MyTraitImpl {
x : i32
}
impl MyTrait for MyTraitImpl {
fn compute_value(&self, x: i32) -> i32 { self.x + x }
}
#[test]
fn rust_submacro_trait() {
let inst = MyTraitImpl{ x: 333 };
let inst_ptr : &MyTrait = &inst;
let i = unsafe { cpp!([inst_ptr as "TraitPtr"] -> u32 as "int" {
MyClassImpl mci;
mci.m_trait = inst_ptr;
return operate123(&mci);
})};
assert_eq!(i, 123 + 333);
}
#[test]
fn witin_macro() {
assert_eq!(unsafe { cpp!([] -> u32 as "int" { return 12; }) }, 12);
let s = format!("hello{}", unsafe { cpp!([] -> u32 as "int" { return 14; }) } );
assert_eq!(s, "hello14");
}
#[test]
fn with_unsafe() {
let x = 45;
assert_eq!(cpp!(unsafe [x as "int"] -> u32 as "int" { return x + 1; }), 46);
}
#[test]
fn rust_submacro_closure() {
let mut result = unsafe { cpp!([] -> i32 as "int" {
auto x = rust!(bbb []-> A as "A" { A::new(5,7) }).multiply();
auto y = []{ A a(3,2); return rust!(aaa [a : A as "A"] -> i32 as "int" { a.multiply() }); }();
return x + y;
})};
assert_eq!(result, 5*7+3*2);
unsafe { cpp!([mut result as "int"] {
A a(9,2);
rust!(ccc [a : A as "A", result : &mut i32 as "int&"] { *result = a.multiply(); });
})};
assert_eq!(result, 18);
}
|
use bitflags::bitflags;
use std::{
collections::{BTreeMap, VecDeque},
io, time,
};
bitflags! {
pub(crate) struct Available: u8 {
const READ = 0b00000001;
const WRITE = 0b00000010;
}
}
#[derive(Debug)]
/// 包含的状态都为被动打开(passive OPEN),也就是 server 端状态
/// 主动打开(active open)使用 nc/curl 来进行模拟测试,作为 client 端
enum State {
// Closed,
// Listen,
SynRcvd,
Estab,
FinWait1,
FinWait2,
TimeWait,
}
impl State {
// (RFC 793 Page 32) 在 RESET 的时候使用,目前未实现 RESET
fn is_synchronized(&self) -> bool {
match *self {
State::SynRcvd => false,
State::Estab | State::FinWait1 | State::FinWait2 | State::TimeWait => true,
}
}
}
// Transmission Control Block
pub struct Connection {
///
state: State,
///
send: SendSequenceSpace,
///
recv: RecvSequenceSpace,
///
ip: etherparse::Ipv4Header,
///
tcp: etherparse::TcpHeader,
///
timers: Timers,
///
pub(crate) incoming: VecDeque<u8>,
///
pub(crate) unacked: VecDeque<u8>,
///
pub(crate) closed: bool,
///
closed_at: Option<u32>,
}
struct Timers {
send_times: BTreeMap<u32, time::Instant>,
srtt: f64,
}
impl Connection {
pub(crate) fn is_rcv_closed(&self) -> bool {
eprintln!("ask if closed when in {:?}", self.state);
if let State::TimeWait = self.state {
// TODO: any state after rcvd FIN, so also CLOSE-WAIT, LAST-ACK, CLOSED, CLOSING
true
} else {
false
}
}
fn availability(&self) -> Available {
let mut a = Available::empty();
eprintln!(
"computing availability, where {:?}, {:?}",
self.is_rcv_closed(),
self.incoming.is_empty()
);
if self.is_rcv_closed() || !self.incoming.is_empty() {
a |= Available::READ;
}
// TODO: take into account self.state
// TODO: set Available::WRITE
a
}
}
/// State of Send Sequence Space (RFC 793 S3.2 Figure 4 Page 20)
/// ```
/// 1 2 3 4
/// ----------|----------|----------|----------
/// SND.UNA SND.NXT SND.UNA
/// +SND.WND
///
/// 1 - old sequence numbers which have been acknowledged
/// 2 - sequence numbers of unacknowledged data
/// 3 - sequence numbers allowed for new data transmission
/// 4 - future sequence numbers which are not yet allowed
/// ```
struct SendSequenceSpace {
/// send unacknowledged
una: u32,
/// send next
nxt: u32,
/// send window
wnd: u16,
/// send urgent pointer
up: bool,
/// segment sequence number used for last window update
wl1: u32,
/// segment acknowledgment number used for last window update
wl2: u32,
/// initial send sequence number
iss: u32,
}
/// State of Receive Sequence Space (RFC 793 S3.2 Figure 5 Page 20)
/// ```
/// 1 2 3
/// ----------|----------|----------
/// RCV.NXT RCV.NXT
/// +RCV.WND
///
/// 1 - old sequence numbers which have been acknowledged
/// 2 - sequence numbers allowed for new reception
/// 3 - future sequence numbers which are not yet allowed
/// ```
struct RecvSequenceSpace {
/// receive next
nxt: u32,
/// receive window
wnd: u16,
/// receive urgent pointer
up: bool,
/// initial receive sequence number
irs: u32,
}
impl Connection {
/// server 已启动,处于 Listen State,Client 发起连接,API 等同 Unix Socket 接口
///
/// Unix Socket 接口
///
/// 前置条件:Listen State
pub fn accept<'a>(
nic: &mut tun_tap::Iface,
iph: etherparse::Ipv4HeaderSlice<'a>,
tcph: etherparse::TcpHeaderSlice<'a>,
) -> io::Result<Option<Self>> {
// RFC 793 Page 65: Event processing - SEGMENT ARRIVES
// third check for a SYN
if !tcph.syn() {
// only expected SYN package
return Ok(None);
}
// RFC 793 Page 27 - Initial Sequence Number Selection
let iss = 0;
let wnd = 1024;
let mut c = Connection {
timers: Timers {
send_times: Default::default(),
srtt: time::Duration::from_secs(1 * 60).as_secs_f64(),
},
state: State::SynRcvd,
send: SendSequenceSpace {
// RFC 793 Page 66
// SND.NXT is set to ISS+1 and SND.UNA to ISS
// SND.NXT = ISS+1, 在 write 中判断为 SYN 时,进行 +1
iss,
una: iss,
nxt: iss,
wnd,
up: false,
wl1: 0,
wl2: 0,
},
recv: RecvSequenceSpace {
// RFC 793 Page 66
// Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ
nxt: tcph.sequence_number().wrapping_add(1),
wnd: tcph.window_size(),
irs: tcph.sequence_number(),
up: false,
},
// 看一下 etherparse crate 文档
ip: etherparse::Ipv4Header::new(
0,
64,
etherparse::IpTrafficClass::Tcp,
[
iph.destination()[0],
iph.destination()[1],
iph.destination()[2],
iph.destination()[3],
],
[
iph.source()[0],
iph.source()[1],
iph.source()[2],
iph.source()[3],
],
),
tcp: etherparse::TcpHeader::new(tcph.destination_port(), tcph.source_port(), iss, wnd),
incoming: Default::default(),
unacked: Default::default(),
closed: false,
closed_at: None,
};
// need to start establishing a connection
// 接收到 SYN
// 状态转移: LISTEN --> SYN-RECEIVED
// 发送 SYN + ACK
// RFC 793 Page 66
// ISS should be selected and a SYN segment sent of the form:
// <SEQ=ISS><ACK=RCV.NXT><CTL=SYN,ACK>
c.tcp.ack = true;
c.tcp.syn = true;
c.write(nic, c.send.nxt, 0)?;
Ok(Some(c))
}
/// 发送数据到对端,由于我们实现的是 Server,因此这里是 Server 往 Client 写
/// seq -- 发送端的序列号
/// limit -- 期望发送的字节长度,实际发送的数据 <= limit
fn write(&mut self, nic: &mut tun_tap::Iface, seq: u32, mut limit: usize) -> io::Result<usize> {
let mut buf = [0u8; 1500];
// RFC 793 Page 66
// if the state is Listen then, s SYN segment sent of the form:
// <SEQ=ISS><ACK=RCV.NXT><CTL=SYN,ACK>
self.tcp.sequence_number = seq;
self.tcp.acknowledgment_number = self.recv.nxt;
println!(
"write(ack: {}, seq: {}, limit: {}) syn {:?} fin {:?}",
self.recv.nxt - self.recv.irs,
seq,
limit,
self.tcp.syn,
self.tcp.fin,
);
// we want self.unacked[nunacked..]
// we need to special-case the two "virtual" bytes SYN and FIN
let mut offset = seq.wrapping_sub(self.send.una) as usize;
// TODO: close_at 是什么时候更新的呢?
if let Some(close_at) = self.closed_at {
if seq == close_at.wrapping_add(1) {
// trying to write the following FIN
offset = 0;
limit = 0;
}
}
println!(
"using offset {} base {} in {:?}",
offset,
self.send.una,
self.unacked.as_slices()
);
// 由于使用了 VecDeque,为环形缓冲区,因此需要将 head 和 tail 进行分别判断
// 看一看标准库 VecDeque 的 API 文档
let (mut head, mut tail) = self.unacked.as_slices();
if head.len() >= offset {
head = &head[offset..];
} else {
let skipped = head.len();
head = &[];
tail = &tail[(offset - skipped)..];
}
let max_data = std::cmp::min(limit, head.len() + tail.len());
let size = std::cmp::min(
buf.len(),
self.ip.header_len() as usize + self.tcp.header_len() as usize + max_data,
);
self.ip
.set_payload_len(size - self.ip.header_len() as usize);
// write out the headers and the payload
use std::io::Write;
let buf_len = buf.len();
let mut unwritten = &mut buf[..];
self.ip.write(&mut unwritten);
let ip_header_ends_at = buf_len - unwritten.len();
// postpone writing the tcp header because we need the payloads
// as one contiguous slice to calculate the tcp checksum
// 占位,保留 TCP header 的位置
unwritten = &mut unwritten[self.tcp.header_len() as usize..];
let tcp_header_ends_at = buf_len - unwritten.len();
// write out the payload
let payload_bytes = {
let mut written = 0;
let mut limit = max_data;
// first, write as much as we can from head
let p1l = std::cmp::min(limit, head.len());
written += unwritten.write(&head[..p1l])?;
limit -= written;
// then, write more (if we can) from tail
let p2l = std::cmp::min(limit, tail.len());
written += unwritten.write(&tail[..p2l])?;
written
};
let payload_ends_at = buf_len - unwritten.len();
// finally, we can calculate the tcp checksum and write out the tcp header
self.tcp.checksum = self
.tcp
.calc_checksum_ipv4(&self.ip, &buf[tcp_header_ends_at..payload_ends_at])
.expect("fail to compute checksum");
let mut tcp_header_buf = &mut buf[ip_header_ends_at..tcp_header_ends_at];
self.tcp.write(&mut tcp_header_buf);
let mut next_seq = seq.wrapping_add(payload_bytes as u32);
if self.tcp.syn {
next_seq = next_seq.wrapping_add(1);
self.tcp.syn = false;
}
if self.tcp.fin {
next_seq = next_seq.wrapping_add(1);
self.tcp.fin = false;
}
if wrapping_lt(self.send.nxt, next_seq) {
self.send.nxt = next_seq;
}
self.timers.send_times.insert(seq, time::Instant::now());
nic.send(&buf[..payload_ends_at])?;
Ok(payload_bytes)
}
fn send_rst(&mut self, nic: &mut tun_tap::Iface) -> io::Result<()> {
self.tcp.rst = true;
// TODO: fix sequence number here
// RFC 793 Page 35
// If the incoming segment has an ACK field, the reset takes its
// sequence number from the ACK field of the segment, otherwise the
// reset has sequence number zero and the ACK field is set to the sum
// of the sequence number and segment length of the incoming segment.
// The connection remains in the same state.
//
// TODO: handle synchronized RST
// RFC 793 Page 37
// 3. If the connection is in a synchronized state (ESTABLISHED,
// FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT),
// any unacceptable segment (out of window sequence number or
// unacceptible acknowledgment number) must elicit only an empty
// acknowledgment segment containing the current send-sequence number
// and an acknowledgment indicating the next sequence number expected
// to be received, and the connection remains in the same state.
self.tcp.sequence_number = 0;
self.tcp.acknowledgment_number = 0;
self.write(nic, self.send.nxt, 0)?;
Ok(())
}
// TODO: on_tick 要解决什么问题?
pub(crate) fn on_tick<'a>(&mut self, nic: &mut tun_tap::Iface) -> io::Result<()> {
// we have shutdown our write side and the other side acked, no need to (re)transmit anything
if let State::FinWait2 | State::TimeWait = self.state {
return Ok(());
}
// decide if it need to send something, send it
let nunacked = self
.closed_at
.unwrap_or(self.send.nxt)
.wrapping_sub(self.send.una);
let unsent = self.unacked.len() as u32 - nunacked;
let waited_for = self
.timers
.send_times
.range(self.send.una..)
.next()
.map(|t| t.1.elapsed());
// (RFC 793 Page 41) Retransmission Timeout
let should_retransmit = if let Some(waited_for) = waited_for {
waited_for > time::Duration::from_secs(1)
&& waited_for.as_secs_f64() > 1.5 * self.timers.srtt
} else {
false
};
if should_retransmit {
// we should retransmit things!
let resend = std::cmp::min(self.unacked.len() as u32, self.send.wnd as u32);
if resend < self.send.wnd as u32 && self.closed {
// can we include the FIN?
self.tcp.fin = true;
self.closed_at = Some(self.send.una.wrapping_add(self.unacked.len() as u32));
}
self.write(nic, self.send.una, resend as usize)?;
} else {
// we should send new data if we have new data and space in the window
if unsent == 0 && self.closed_at.is_some() {
return Ok(());
}
let allowed = self.send.wnd as u32 - nunacked;
if allowed == 0 {
return Ok(());
}
let send = std::cmp::min(unsent, allowed);
if send < allowed && self.closed && self.closed_at.is_none() {
// send the FIN
self.tcp.fin = true;
self.closed_at = Some(self.send.una.wrapping_add(self.unacked.len() as u32));
}
self.write(nic, self.send.nxt, send as usize)?;
}
// if FIN, enter FIN-WAIT-1
Ok(())
}
// RFC 793 Page 69
// SEGMENT ARRIVES, Otherwise, ...
pub(crate) fn on_packet<'a>(
&mut self,
nic: &mut tun_tap::Iface,
iph: etherparse::Ipv4HeaderSlice<'a>,
tcph: etherparse::TcpHeaderSlice<'a>,
data: &'a [u8],
) -> io::Result<Available> {
// first, check that sequence numbers are valid (RFC 793 S3.3 Page 25 - 26)
//
// valid segment check. okay if it acks at least one byte, which means that at least
// one of the following is true:
// - RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
// - RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND
//
// SEG.SEQ = first sequence number occupied by the incoming segment
let seqn = tcph.sequence_number();
// (RFC 793 Page 25)
// SEG.LEN = the number of octets occupied by the data in the segment (counting SYN and FIN)
let mut slen = data.len() as u32;
if tcph.fin() || tcph.syn() {
slen += 1;
}
// (RFC 793 Page 69, 变量定义在 Page 25)
//
// There are four cases for the acceptability test for an incoming
// segment:
//
// Segment Receive Test
// Length Window
// ------- ------- -------------------------------------------
//
// 0 0 SEG.SEQ = RCV.NXT
//
// 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
//
// >0 0 not acceptable
//
// >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
// or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND
// (RFC 793 Page 25)
// RCV.NXT+RCV.WND-1 = last sequence number expected on an incoming
// segment, and is the right or upper edge of the receive window
let wend = self.recv.nxt.wrapping_add(self.recv.wnd as u32);
let okay = if slen == 0 {
// zero-length segment has separate rules for acceptance
if self.recv.wnd == 0 {
if seqn == self.recv.nxt {
true
} else {
false
}
} else if is_between_wrapped(self.recv.nxt.wrapping_sub(1), seqn, wend) {
true
} else {
false
}
} else {
if self.recv.wnd == 0 {
false
} else if !is_between_wrapped(self.recv.nxt.wrapping_sub(1), seqn, wend)
&& !is_between_wrapped(
self.recv.nxt.wrapping_sub(1),
seqn.wrapping_add(slen).wrapping_sub(1),
wend,
)
{
false
} else {
true
}
};
if !okay {
eprintln!("NOT OKAY");
// RFC 793 Page 69, first check ... 后半部分
// If an incoming segment is not acceptable, an acknowledgment
// should be sent in reply (unless the RST bit is set, if so drop
// the segment and return):
//
// <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
//
// After sending the acknowledgment, drop the unacceptable segment
// and return.
self.write(nic, self.send.nxt, 0)?;
return Ok(self.availability());
}
// RFC 793 Page 72, fifth check the ACK field
// if the ACK bit is off drop the segment and return
if !tcph.ack() {
eprintln!("NOT ACK");
// RFC 793 Page 71, fourt check the SYN bit
//
// TODO: 按照 RFC 的说明,这里接收到 SYN 是一个 error,为什么这里还需要这样进行处理呢?
if tcph.syn() {
// got SYN part of initial handshake
assert!(data.is_empty());
self.recv.nxt = seqn.wrapping_add(1);
}
return Ok(self.availability());
}
let ackn = tcph.acknowledgment_number();
// RFC 793 Page 72, fifth check the ACK field
//
// SYN-RECEIVED STATE
// If SND.UNA =< SEG.ACK =< SND.NXT then enter ESTABLISHED state
// and continue processing.
if let State::SynRcvd = self.state {
if is_between_wrapped(
self.send.una.wrapping_sub(1),
ackn,
self.send.nxt.wrapping_add(1),
) {
// must have ACKed our SYN, since we detected at least one acked byte,
// and we have only sent only one byte (the SYN)
self.state = State::Estab;
} else {
// TODO: <SEQ=SEG.ACK><CTL=RST> Page 72
}
}
// ESTABLISHED STATE
// FIN-WAIT-1 STATE - In addition to the processing for the ESTABLISHED state
// FIN-WAIT-2 STATE
if let State::Estab | State::FinWait1 | State::FinWait2 = self.state {
// If SND.UNA < SEG.ACK =< SND.NXT then, set SND.UNA <- SEG.ACK.
if is_between_wrapped(self.send.una, ackn, self.send.nxt.wrapping_add(1)) {
println!(
"ack for {} (last: {}); prune in {:?}",
ackn, self.send.una, self.unacked
);
if !self.unacked.is_empty() {
// 删除已经 ack 的部分
let data_start = if self.send.una == self.send.iss {
// send.una hasn't been updated yet with ACK for our SYN, so data starts just beyond it
self.send.una.wrapping_add(1)
} else {
self.send.una
};
let acked_data_end =
std::cmp::min(ackn.wrapping_sub(data_start) as usize, self.unacked.len());
self.unacked.drain(..acked_data_end);
// TODO: 未理解这一部分内容
let una = self.send.una;
let srtt = &mut self.timers.srtt;
self.timers.send_times.retain(|&seq, sent| {
if is_between_wrapped(una, seq, ackn) {
*srtt = 0.8 * *srtt + (1.0 - 0.8) * sent.elapsed().as_secs_f64();
false
} else {
true
}
});
}
// update SND.UNA <- SEG.ACK
self.send.una = ackn;
}
// TODO: if self.unacked is empty, and wait flush, notify
// TODO: update window
}
if let State::FinWait1 = self.state {
if let Some(close_at) = self.closed_at {
if self.send.una == close_at.wrapping_add(1) {
// our FIN has been ACKed
// must have ACKed our FIN, since we detected at least one acked byte,
// and we have only sent only one byte (the FIN)
self.state = State::FinWait2;
}
}
}
// RFC 793 Page 72, seventh process the segment text
//
// ESTABLISHED STATE
// FIN-WAIT-1 STATE
// FIN-WAIT-2 STATE
if data.is_empty() {
if let State::Estab | State::FinWait1 | State::FinWait2 = self.state {
// Once in the ESTABLISHED state, it is possible to deliver segment
// tex to user RECEIVE buffers.
let mut unread_data_at = self.recv.nxt.wrapping_sub(seqn) as usize;
if unread_data_at > data.len() {
// we must have received a re-transmitted FIN that we have already seen,
// nxt points to beyond the FIN, but the FIN is not in data!
assert_eq!(unread_data_at, data.len() + 1);
unread_data_at = 0;
}
self.incoming.extend(&data[unread_data_at..]);
// Once the TCP takes responsibility for the data it advances
// RCV.NXT over the data accepted, and adjusts RCV.WND as
// apporopriate to the current buffer availability. The total of
// RCV.NXT and RCV.WND should not be reduced.
self.recv.nxt = seqn.wrapping_add(data.len() as u32);
// Send an acknowledgment of the form:
// <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
//
// TODO: maybe just tick to piggyback ack on data
// This acknowledgment should be piggybacked on a segment being
// transmitted if possible without incurring undue delay.
self.write(nic, self.send.nxt, 0)?;
}
}
// RFC 793 Page 75, eighth check the FIN bit
//
// If the FIN bit is set, signal the user "connection closing" and
// return any pending RECEIVEs with same message, advance RCV.NXT
// over the FIN, and send an acknowledgment for the FIN. Note that
// FIN implies PUSH for any segment text not yet delivered to the
// user.
if tcph.fin() {
// TODO: 测试的时候注意看一下这里,是否有其他的 state 进入
eprintln!("IS FIN (in {:?}) --", self.state);
match self.state {
State::FinWait2 => {
// we're done with the connection!
self.recv.nxt = self.recv.nxt.wrapping_add(1);
self.write(nic, self.send.nxt, 0)?;
self.state = State::TimeWait;
}
_ => unimplemented!(),
}
}
Ok(self.availability())
}
pub(crate) fn close(&mut self) -> io::Result<()> {
self.closed = true;
match self.state {
State::SynRcvd | State::Estab => {
self.state = State::FinWait1;
}
State::FinWait1 | State::FinWait2 => {}
_ => {
return Err(io::Error::new(
io::ErrorKind::NotConnected,
"already closing",
))
}
}
Ok(())
}
}
fn wrapping_lt(lhs: u32, rhs: u32) -> bool {
// From RFC1323 - window scaling:
// TCP determines if a data segment is "old" or "new" by testing
// whether its sequence number is within 2**31 bytes of the left edge
// of the window, and if it is not, discarding the data as "old". To
// insure that new data is never mistakenly considered old and vice-
// versa, the left edge of the sender's window has to be at most
// 2**31 away from the right edge of the receiver's window.
lhs.wrapping_sub(rhs) > 2 ^ 31
}
fn is_between_wrapped(start: u32, x: u32, end: u32) -> bool {
wrapping_lt(start, x) && wrapping_lt(x, end)
}
|
pub struct Iter<'a, T>{
next: Option<&'a Node<T>>,
}
impl<T> List<T> {
pub fn iter<'a>(&'a self) -> Iter<'a, T>{
Iter{
next: self.head.as_ref().map(|node| &**node)
}
}
}
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<Self::Item> {
self.next.map(|node|{
// node.next may be empty ?
self.next = node.next.as_ref().map(|node| &**node);
&node.elem
})
}
}
|
fn main() {
let mut valor: i32 = 10; // inmutabl
//valor = 20;
println!("El valor de la variable es: {}", valor);
let valor = 20; // shadowing
println!("El valor de al variable es: {}", valor);
let valor = false;
println!("El valor de la variable es: {}", valor);
}
|
use std::fs::File;
use std::io::Read;
use std::thread;
use std::time::Duration;
#[derive(Debug, Copy, Clone)]
enum Turn {
Rwd,
Lwd,
Fwd
}
#[derive(Debug, Copy, Clone)]
enum Dir {
U,
D,
L,
R
}
fn main() {
let mut file = File::open("input").unwrap();
let mut buf = String::new();
file.read_to_string(&mut buf).unwrap();
let input = buf.lines();
let mut carts: Vec<((usize,usize),Dir,Turn)> = Vec::new();
let grid = input.enumerate().map(|(y, line)| {
line.chars().enumerate().map(|(x, c)| {
match c {
'>' => { carts.push(((x,y), Dir::R, Turn::Lwd)); '#' }
'<' => { carts.push(((x,y), Dir::L, Turn::Lwd)); '#' }
'^' => { carts.push(((x,y), Dir::U, Turn::Lwd)); '#' }
'v' => { carts.push(((x,y), Dir::D, Turn::Lwd)); '#' }
_ => c
}
}).collect::<Vec<char>>()
}).collect::<Vec<Vec<char>>>();
loop {
let mut dead: Vec<usize> = Vec::new();
for i in 0..carts.len() {
let ((x, y), dir, mut turn) = carts[i];
let new_dir: Dir = match grid[y][x] {
'\\' => match dir {
Dir::U => Dir::L,
Dir::D => Dir::R,
Dir::L => Dir::U,
Dir::R => Dir::D,
}
'/' => match dir {
Dir::U => Dir::R,
Dir::D => Dir::L,
Dir::L => Dir::D,
Dir::R => Dir::U,
}
'+' => match turn {
Turn::Lwd => {
turn = Turn::Fwd;
match dir {
Dir::U => Dir::L,
Dir::D => Dir::R,
Dir::L => Dir::D,
Dir::R => Dir::U,
}
}
Turn::Fwd => {
turn = Turn::Rwd;
dir
}
Turn::Rwd => {
turn = Turn::Lwd;
match dir {
Dir::U => Dir::R,
Dir::D => Dir::L,
Dir::L => Dir::U,
Dir::R => Dir::D,
}
}
}
_ => dir
};
let (new_x,new_y) = match new_dir {
Dir::U => (x, y-1),
Dir::D => (x, y+1),
Dir::L => (x-1, y),
Dir::R => (x+1, y),
};
let collisions = carts
.iter()
.enumerate()
.filter(|(_, ((x,y),_,_))| *x == new_x && *y == new_y)
.map(|(i,_)| i)
.collect::<Vec<usize>>();
for cart in collisions {
if !dead.contains(&cart) {
dead.push(cart);
}
dead.push(i);
}
//print(&grid, &carts, None);
carts[i] = ((new_x, new_y), new_dir, turn);
}
dead.sort_by(|a,b| b.cmp(&a)); // Descending sort
for cart in dead {
carts.remove(cart);
}
carts.sort_by_key(|((x,_),_,_)| *x);
carts.sort_by_key(|((_,y),_,_)| *y);
if carts.len() == 1 {
println!("{:?}", carts);
break;
}
}
}
fn print(
grid: &Vec<Vec<char>>,
carts: &Vec<((usize,usize),Dir,Turn)>,
collision: Option<(usize,usize)>
) {
println!("");
thread::sleep(Duration::from_millis(500));
let mut tmp_grid = grid.clone();
for ((x,y), dir, _) in carts.iter() {
tmp_grid[*y][*x] = match dir {
Dir::U => '^',
Dir::D => 'v',
Dir::L => '<',
Dir::R => '>',
};
}
if let Some((x,y)) = collision {
tmp_grid[y][x] = 'X';
}
for row in tmp_grid.iter() {
for cell in row.iter() {
print!("{}", cell);
}
println!("");
}
}
|
use std::io::{self, prelude::*};
use std::error::Error;
use std::mem;
/*
n: 6
CAB ABC
g: 2
t: 0
*/
fn goodness_difference(s: &[u8], target: usize) -> usize {
let n = s.len();
assert!(target <= n / 2);
let goodness = (0..n / 2).filter(|&i| s[i] != s[n - i - 1]).count();
abs_diff(goodness, target)
}
fn abs_diff(mut a: usize, mut b: usize) -> usize {
if a > b {
mem::swap(&mut a, &mut b);
}
b - a
}
type Res<T> = Result<T, Box<dyn Error>>;
fn main() -> Res<()> {
run_tests(io::stdin().lock().lines())
}
/// Panics on malformed input.
fn run_tests(mut lines: impl Iterator<Item = io::Result<String>>) -> Res<()> {
let line = lines.next().unwrap()?;
let t = line.parse()?;
for test_no in 1..=t {
let (s, k) = read_test_input(&mut lines)?;
let ans = goodness_difference(&s.as_bytes(), k);
println!("Case #{}: {}", test_no, ans);
}
assert!(lines.next().is_none());
Ok(())
}
/// Panics on malformed input.
fn read_test_input(lines: &mut impl Iterator<Item = io::Result<String>>) -> Res<(String, usize)> {
let line = lines.next().unwrap()?;
let mut words = line.split_whitespace();
let n: usize = words.next().unwrap().parse()?;
let k: usize = words.next().unwrap().parse()?;
assert!(words.next().is_none());
let s = lines.next().unwrap()?;
assert_eq!(s.len(), n);
Ok((s, k))
}
|
#[derive(Debug, Clone)]
/// Response status.
///
/// It's intended to create `Status` from `web_sys::Response` - eg: `Status::from(&raw_response)`.
pub struct Status {
/// Code examples: 200, 404, ...
pub code: u16,
/// Text examples: "OK", "Not Found", ...
pub text: String,
pub category: StatusCategory,
}
#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Clone, PartialEq)]
pub enum StatusCategory {
/// Code 1xx
Informational,
/// Code 2xx
Success,
/// Code 3xx
Redirection,
/// Code 4xx
ClientError,
/// Code 5xx
ServerError,
/// Code < 100 || Code >= 600
Unknown,
}
#[allow(dead_code)]
impl Status {
/// Is response status category `ClientError` or `ServerError`? (Code 400-599)
pub const fn is_error(&self) -> bool {
matches!(
self.category,
StatusCategory::ClientError | StatusCategory::ServerError
)
}
/// Is response status category `Success`? (Code 200-299)
pub fn is_ok(&self) -> bool {
self.category == StatusCategory::Success
}
}
impl From<&web_sys::Response> for Status {
fn from(response: &web_sys::Response) -> Self {
let text = response.status_text();
match response.status() {
code @ 100..=199 => Status {
code,
text,
category: StatusCategory::Informational,
},
code @ 200..=299 => Status {
code,
text,
category: StatusCategory::Success,
},
code @ 300..=399 => Status {
code,
text,
category: StatusCategory::Redirection,
},
code @ 400..=499 => Status {
code,
text,
category: StatusCategory::ClientError,
},
code @ 500..=599 => Status {
code,
text,
category: StatusCategory::ServerError,
},
code => Status {
code,
text,
category: StatusCategory::Unknown,
},
}
}
}
|
use arrayvec::ArrayVec;
use std::ptr::NonNull;
type Arity = usize;
const ARITY: Arity = 4;
struct Pointer<Value> {
chunk: NonNull<Chunk<Value>>,
offset: usize,
}
enum Elem<Value> {
Sentinel,
Value(Value),
}
struct ChunkedArrayQueue<Value> {
front: Pointer<Value>,
back: Pointer<Value>,
}
struct Chunk<Value> {
values: ArrayVec<[Value; ARITY]>,
next: Pointer<Value>,
}
impl<Value> Pointer<Value> {
fn new(chunk: &Chunk<Value>) -> Self {
Self {
chunk: NonNull::from(chunk),
offset: 0,
}
}
fn set(self, other: Pointer<Value>) -> Pointer<Value> {
todo!()
}
fn cmp(self, other: Pointer<Value>) -> Pointer<Value> {
todo!()
}
}
impl<Value> Chunk<Value> {
fn new(next: NonNull<Chunk<Value>>) -> Self {
todo!()
// Self {
// values: ArrayVec::new(),
// next,
// }
}
}
impl<Value> ChunkedArrayQueue<Value> {
fn new() -> Self {
// let chunk = Box::new(Chunk::new());
// let front = Pointer::new(&chunk);
// let back = Pointer::new(&chunk);
// Self { front, back }
todo!()
}
fn push_back(&mut self, v: Value) {}
fn pop_front(&mut self) -> Value {
todo!()
}
fn next(&self, p: Pointer<Value>) {
todo!()
}
fn prev(&self, p: Pointer<Value>) {
todo!()
}
fn read(&self, p: Pointer<Value>) -> Value {
todo!()
}
fn write(&self, p: Pointer<Value>) -> Value {
todo!()
}
}
|
impl Solution {
pub fn longest_ones(a: Vec<i32>, k: i32) -> i32 {
let (mut ans,mut start,mut n) = (0,0,a.len());
let mut zeros = 0;
//遍历时usize,数组内index时usize
for end in 0..n{
if a[end] == 0{
zeros += 1;
}
while zeros > k{
if a[start] == 0{
zeros -= 1;
}
start += 1;
}
ans = ans.max(end - start + 1);
}
ans as i32
}
} |
use std::vec::Drain;
use flatbuffers_structs::{
flatbuffers::{self, FlatBufferBuilder},
net_protocol::{Handshake, Config, ConfigArgs, HandshakeArgs, Packet, PacketArgs, PacketContent},
};
use crate::events::Event;
pub struct Connection {
incoming_buffer: Vec<u8>,
outgoing_buffer: Vec<u8>,
}
impl Connection {
pub fn new() -> Self {
Self {
incoming_buffer: Vec::with_capacity(256),
outgoing_buffer: Vec::with_capacity(256),
}
}
pub fn events(&mut self) -> ConnectionEvents {
ConnectionEvents {
data: &mut self.incoming_buffer,
}
}
pub fn send_handshake(&mut self, handshake_args: HandshakeArgs) {
let mut builder = FlatBufferBuilder::new();
let handshake = Handshake::create(&mut builder, &handshake_args);
let packet = Packet::create(
&mut builder,
&PacketArgs {
content_type: PacketContent::Handshake,
content: Some(handshake.as_union_value()),
},
);
builder.finish_size_prefixed(packet, None);
self.outgoing_buffer
.extend_from_slice(builder.finished_data());
}
pub fn send_config(&mut self, config_args: ConfigArgs) {
let mut builder = FlatBufferBuilder::new();
let config = Config::create(&mut builder, &config_args);
let packet = Packet::create(
&mut builder,
&PacketArgs {
content_type: PacketContent::Config,
content: Some(config.as_union_value()),
},
);
builder.finish_size_prefixed(packet, None);
self.outgoing_buffer
.extend_from_slice(builder.finished_data());
}
pub fn send_heartbeat(&mut self) {
self.outgoing_buffer
.extend_from_slice(crate::HEARTBEAT_MAGIC);
}
pub fn receive_data(&mut self, data: &[u8]) {
self.incoming_buffer.extend_from_slice(data);
}
pub fn retrieve_out_data(&mut self) -> Drain<'_, u8> {
self.outgoing_buffer.drain(..)
}
}
pub struct ConnectionEvents<'a> {
data: &'a mut Vec<u8>,
}
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum ConnectionEventsError {
#[error("Invalid packet: {0}")]
InvalidPacket(flatbuffers::InvalidFlatbuffer),
}
impl<'a> Iterator for ConnectionEvents<'a> {
type Item = Result<Event, ConnectionEventsError>;
fn next(&mut self) -> Option<Self::Item> {
const OFFSET_SIZE: usize = std::mem::size_of::<flatbuffers::UOffsetT>();
const HEARTBEAT_SIZE: usize = crate::HEARTBEAT_MAGIC.len();
if self.data.len() < OFFSET_SIZE.min(HEARTBEAT_SIZE) {
return None;
}
if self.data.get(..HEARTBEAT_SIZE) == Some(crate::HEARTBEAT_MAGIC) {
self.data.drain(..HEARTBEAT_SIZE);
return Some(Ok(Event::HeartbeatReceived));
}
let size = flatbuffers::UOffsetT::from_le_bytes(
self.data.get(..OFFSET_SIZE).unwrap().try_into().unwrap(),
) as usize;
if size == 0 || self.data[OFFSET_SIZE - 1..].len() < size {
return None;
}
let buffer: Vec<_> = self.data.drain(..OFFSET_SIZE + size).collect();
let packet = match flatbuffers_structs::net_protocol::size_prefixed_root_as_packet(&buffer)
.map_err(ConnectionEventsError::InvalidPacket)
{
Ok(packet) => packet,
Err(e) => return Some(Err(e)),
};
match packet.content_type() {
PacketContent::Handshake => {
let handshake = packet.content_as_handshake()?;
Some(Ok(Event::HandshakeResponseReceived {
handshake: handshake.into(),
}))
}
PacketContent::Pad => {
let pad = packet.content_as_pad()?;
Some(Ok(Event::PadDataReceived {
data: pad.try_into().ok()?,
}))
}
_ => None,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::events;
use flatbuffers_structs::net_protocol::Endpoint;
fn create_handshake(args: HandshakeArgs) -> Vec<u8> {
let mut builder = FlatBufferBuilder::new();
let handshake = Handshake::create(&mut builder, &args);
let packet = Packet::create(
&mut builder,
&PacketArgs {
content_type: PacketContent::Handshake,
content: Some(handshake.as_union_value()),
},
);
builder.finish_size_prefixed(packet, None);
builder.finished_data().to_vec()
}
#[test]
fn test_connection_out_handshake_heartbeat() {
let mut connection = Connection::new();
connection.send_handshake(HandshakeArgs {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
});
connection.send_heartbeat();
let actual_buffer = connection.retrieve_out_data().collect::<Vec<_>>();
let expected_handshake = create_handshake(HandshakeArgs {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
});
assert_eq!(
actual_buffer,
[&expected_handshake, crate::HEARTBEAT_MAGIC].concat(),
"Handshake and heartbeat should be sent"
);
}
#[test]
fn test_connection_muliple_events_multiple_calls() {
let mut connection = Connection::new();
let handshake_client = create_handshake(HandshakeArgs {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
});
connection.receive_data(&handshake_client);
{
let mut events = connection.events();
assert_eq!(
events.next(),
Some(Ok(Event::HandshakeResponseReceived {
handshake: events::Handshake {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
}
})),
"HandshakeResponseReceived event should be emitted"
);
}
connection.receive_data(crate::HEARTBEAT_MAGIC);
let handshake_server = create_handshake(HandshakeArgs {
endpoint: Endpoint::Server,
port: 1234,
heartbeat_freq: 1000,
});
connection.receive_data(&handshake_server);
{
let mut events = connection.events();
assert_eq!(
events.next(),
Some(Ok(Event::HeartbeatReceived)),
"HeartbeatReceived event should be emitted"
);
assert_eq!(
events.next(),
Some(Ok(Event::HandshakeResponseReceived {
handshake: events::Handshake {
endpoint: Endpoint::Server,
port: 1234,
heartbeat_freq: 1000,
}
})),
"HandshakeResponseReceived event should be emitted"
);
assert_eq!(events.next(), None, "No more events should be emitted");
}
}
#[test]
fn test_connection_multiple_events_single_call() {
let mut connection = Connection::new();
let handshake_client = create_handshake(HandshakeArgs {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
});
let handshake_server = create_handshake(HandshakeArgs {
endpoint: Endpoint::Server,
port: 1234,
heartbeat_freq: 1000,
});
connection
.receive_data(&[&handshake_client, crate::HEARTBEAT_MAGIC, &handshake_server].concat());
let mut events = connection.events();
assert_eq!(
events.next(),
Some(Ok(Event::HandshakeResponseReceived {
handshake: events::Handshake {
endpoint: Endpoint::Client,
port: 1234,
heartbeat_freq: 1000,
}
})),
"HandshakeResponseReceived event should be emitted"
);
assert_eq!(
events.next(),
Some(Ok(Event::HeartbeatReceived)),
"HeartbeatReceived event should be emitted"
);
assert_eq!(
events.next(),
Some(Ok(Event::HandshakeResponseReceived {
handshake: events::Handshake {
endpoint: Endpoint::Server,
port: 1234,
heartbeat_freq: 1000,
}
})),
"HandshakeResponseReceived event should be emitted"
);
assert_eq!(events.next(), None, "No more events should be emitted");
}
}
|
#![feature(no_std, plugin)]
#![no_std]
#![plugin(arm_rt_macro)]
extern crate stm32;
extern crate rlibc;
use stm32::stm32l4x6::*;
#[entry_point]
fn main() -> ! {
// enable LED GPIOs (PB2 = red, PE8 = green)
RCC.ahb2enr.set_gpiob_en(true).set_gpioe_en(true);
// set LED pins to "output"
GPIOB.moder.set_mode(2, stm32::gpio::GPIO_moder_mode::Output);
GPIOE.moder.set_mode(8, stm32::gpio::GPIO_moder_mode::Output);
// enable TIM2
RCC.apb1enr1.set_tim2_en(true);
// configure TIM2. System clock at boot is 4 MHz and we haven't
// changed it, so setting prescaler to 3999 will yield a 1 ms tick.
// CEN bit switches the timer on.
TIM2.psc.set_psc(3999);
TIM2.cr1.set_cen(stm32::timer::GPTIM32_cr1_cen::Enable);
// apply configuration changes to TIM2
TIM2.egr.set_ug(true);
loop {
// Red on, Green off
GPIOB.bsrr.set_bs(2, true);
GPIOE.bsrr.set_br(8, true);
wait_ms(300);
// Green on, Red off
GPIOB.bsrr.set_br(2, true);
GPIOE.bsrr.set_bs(8, true);
wait_ms(300);
}
}
fn wait_ms(ms : u32) {
let start = TIM2.cnt.cnt();
while TIM2.cnt.cnt() - start < ms
{
// just spin
}
}
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
//! This crate adds [Compressor] and [Decompressor] wrappers around some common
//! compression libraries. Those wrappers implement [tokio_io::AsyncWrite] and
//! [tokio_io::AsyncRead] respectively so they might be used efficiently in an
//! asynchronous contexts.
#![deny(warnings, missing_docs, clippy::all, broken_intra_doc_links)]
mod compressor;
mod decompressor;
pub mod membuf;
pub mod metered;
mod raw;
mod retry;
#[cfg(test)]
mod test;
pub use crate::compressor::{Compressor, CompressorType};
pub use crate::decompressor::{Decompressor, DecompressorType};
pub use bzip2::Compression as Bzip2Compression;
pub use flate2::Compression as FlateCompression;
|
use failure::Error;
use graphql_client::*;
use log::*;
type DateTime = chrono::DateTime<chrono::Utc>;
type URI = String;
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/schema/schema.public.graphql",
query_path = "src/queries/oldest_pr.graphql",
response_derives = "Debug"
)]
struct OldestPullRequestQuery;
pub fn oldest_pr(
owner: &str,
name: &str,
token: String,
) -> Result<oldest_pull_request_query::ResponseData, Error> {
let query = OldestPullRequestQuery::build_query(oldest_pull_request_query::Variables {
owner: owner.to_string(),
name: name.to_string(),
});
let client = reqwest::Client::new();
let mut res = client
.post("https://api.github.com/graphql")
.bearer_auth(token)
.json(&query)
.send()?;
let response_body: Response<oldest_pull_request_query::ResponseData> = res.json()?;
info!("{:?}", response_body);
if let Some(errors) = response_body.errors {
println!("there are errors:");
for error in &errors {
println!("{:?}", error);
}
}
let response_data: oldest_pull_request_query::ResponseData =
response_body.data.expect("missing response data");
Ok(response_data)
}
|
pub mod global_message_handler;
pub use global_message_handler::{GlobalMessage, GlobalMessageDiscriminant, GlobalMessageHandler};
|
use poisson_diskus::bridson;
use std::time::Instant;
fn calc_distance(x0: &[f64], x1: &[f64], box_size: &[f64], inv_box: &[f64]) -> f64 {
x0.iter()
.zip(x1.iter())
.zip(box_size.iter().zip(inv_box.iter()))
.map(|((a, b), (size, inv_size))| {
let dx = b - a;
dx - size * (dx * inv_size).round()
})
.map(|v| v.powi(2))
.sum::<f64>()
.sqrt()
}
fn main() {
// let start = Instant::now();
let box_size = [100.0, 200.0];
let rmin = 0.5;
let num_attempts = 30;
let use_pbc = true;
let coords = bridson(&box_size, rmin, num_attempts, use_pbc).unwrap();
// let duration = start.elapsed();
// eprintln!(
// "generated {} points in {} seconds",
// coords.len(),
// duration.as_secs_f64()
// );
// let max_dist = 5.0 * rmin;
// let inv_box = box_size.iter().map(|v| 1.0 / v).collect::<Vec<_>>();
// let num_bins = 400;
// let dr = max_dist / num_bins as f64;
// let rs = (0..num_bins).map(|i| i as f64 * dr).collect::<Vec<_>>();
// let mut rdf = vec![0.0f64; num_bins];
// let start = Instant::now();
// 'outer: for i in 0..coords.len() {
// let x0 = &coords[i];
// for (&x, &size) in x0.iter().zip(box_size.iter()) {
// if x < rmin || x + rmin >= size {
// continue 'outer;
// }
// }
// for j in (i + 1)..coords.len() {
// let x1 = &coords[j];
// let distance = calc_distance(x0, x1, &box_size, &inv_box);
// let i = (distance / dr).round() as usize;
// if i < num_bins {
// rdf[i] += 1.0;
// }
// }
// }
// let duration = start.elapsed();
// eprintln!("calculated rdf in {} seconds", duration.as_secs_f64());
// for (r, v) in rs.iter().zip(rdf.iter()) {
// let area = std::f64::consts::PI * ((r + dr).powi(2) - r.powi(2));
// println!("{:12.9} {:12.9}", r + 0.5 * dr, v / area);
// }
}
|
use winparsingtools::{structs::Guid, utils::read_utf8_string};
use std::io::{Result, Read, Cursor};
use byteorder::{LittleEndian, ReadBytesExt};
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct TrackerDataBlock {
#[serde(skip_serializing)]
pub size: u32,
#[serde(skip_serializing)]
pub version: u32,
pub machine_id: String,
pub file_droid: Guid,
pub file_droid_birth: Guid,
pub volume_droid: Guid,
pub volume_droid_birth: Guid
}
impl TrackerDataBlock {
pub fn from_buffer(buf: &[u8]) -> Result<Self>{
Self::from_reader(&mut Cursor::new(buf))
}
pub fn from_reader<R: Read>(r: &mut R) -> Result<Self>{
let size = r.read_u32::<LittleEndian>()?;
let version = r.read_u32::<LittleEndian>()?;
let mut machine_id_bytes = [0;16];
r.read_exact(&mut machine_id_bytes)?;
let machine_id = read_utf8_string(&mut Cursor::new(machine_id_bytes), None)?;
let volume_droid = Guid::from_reader(r)?;
let file_droid = Guid::from_reader(r)?;
let volume_droid_birth = Guid::from_reader(r)?;
let file_droid_birth = Guid::from_reader(r)?;
Ok(Self {
size,
version,
machine_id,
file_droid,
volume_droid,
file_droid_birth,
volume_droid_birth
})
}
} |
use actix_files::{Files, NamedFile};
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
use actix_identity::{CookieIdentityPolicy, Identity, IdentityService};
use std::collections::HashMap;
use std::sync::Mutex;
use askama::Template;
use futures::Future;
use serde::{Deserialize, Serialize};
use r2d2_sqlite;
use r2d2_sqlite::SqliteConnectionManager;
mod db;
use db::Pool;
mod dto;
mod nim;
/// Launches our demo server.
pub fn main() {
// Read configuration file. This contains secrets and variable parameters.
let config = Config::read_configuration().unwrap();
let server_address = config.server_address();
// Initialize shared server state (Not used right now, carried allong from the tutorial for reference.)
let counter = web::Data::new(AppStateWithCounter {
counter: Mutex::new(0),
});
// Start N db executor actors (N = number of cores avail)
let manager = SqliteConnectionManager::file("./home/nim.db");
let pool = Pool::new(manager).unwrap();
HttpServer::new(move || {
App::new()
.data(pool.clone())
.wrap(IdentityService::new(
// <- create identity middleware
CookieIdentityPolicy::new(config.security.identity_cookie_secret.as_bytes()) // <- create cookie identity policy
.name("auth-cookie")
.secure(false),
))
// Register data that is shared between the server threads.
// Currently this is only some dummy information to mention the concept in the code.
.register_data(counter.clone()) // <- register the created data
.route("/count", web::get().to(count_page))
// We use the actix-files crate to serve static frontend content. Note that we use
// .show_files_listing() for development which is generally not a good idea for production.
.service(Files::new("/static", "./frontend/static").show_files_listing())
.route("/api/identity", web::get().to(identity))
.route("/api/login", web::post().to_async(login))
.route("/api/logout", web::get().to(logout))
.route("/api/game/create", web::post().to_async(create_game))
.route("/api/game/list", web::get().to_async(list_games))
.route("/api/game/{id}", web::get().to_async(game_details))
.route("/api/game/{id}/setup", web::post().to_async(game_setup))
.route("/api/dummy", web::get().to_async(dummy_example))
.route("/api/user/friends", web::get().to_async(friends_list))
// Serve the index page for all routes that do not match any earlier route.
// We do not want this to happen to /api/.. routes, so we return a 404 on those first.
.route("/api", web::get().to(api_error_page))
.route("/api/{tail:.*}", web::get().to(api_error_page))
.route("favicon.ico", web::get().to(favicon))
.route("/{tail:.*}", web::get().to(index_page))
})
.bind(server_address)
.unwrap()
.run()
.unwrap();
}
#[derive(Deserialize, Clone)]
struct Config {
ip: String,
port: u16,
security: SecurityConfig,
}
#[derive(Deserialize, Clone)]
struct SecurityConfig {
identity_cookie_secret: String,
hashing_iteration_count: u32,
}
impl Config {
fn server_address(&self) -> String {
format!("{}:{}", self.ip, self.port)
}
fn read_configuration() -> std::io::Result<Self> {
use std::fs::File;
use std::io::prelude::*;
let mut file = File::open("./home/config.toml")?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(toml::from_str(&contents).unwrap())
}
}
/// This is a placeholder for the "server state shared among threads" concept.
struct AppStateWithCounter {
counter: Mutex<i32>, // <- Mutex is necessary to mutate safely across threads
}
/// This is a placeholder for the "server state shared among threads" concept.
fn count_page(data: web::Data<AppStateWithCounter>) -> String {
let mut counter = data.counter.lock().unwrap(); // <- get counter's MutexGuard
*counter += 1; // <- access counter inside MutexGuard
format!("Request number: {}", counter) // <- response with count
}
/// Returns the favicon. The file is reloaded from disk each time it is requested.
fn favicon() -> NamedFile {
NamedFile::open("./frontend/favicon.ico").unwrap()
}
/// All /api routes that are not implemented by the server return a 404 response and a JSON object
/// with a short description of the error.
fn api_error_page(req: HttpRequest) -> HttpResponse {
if let Some(tail) = req.match_info().get("tail") {
if !tail.is_empty() {
HttpResponse::NotFound().json(
ComplicatedErrorResult::new("ApiNotDefined".to_owned())
.info("route".to_owned(), tail.to_owned()),
)
} else {
HttpResponse::NotFound().json(SimpleErrorResult::api_not_specified())
}
} else {
HttpResponse::NotFound().json(SimpleErrorResult::api_not_specified())
}
}
#[derive(Deserialize)]
struct LoginRequest {
username: String,
password: String,
}
#[derive(Serialize)]
struct LoginStatusInfo {
identity: Option<String>,
}
#[derive(Serialize)]
struct SimpleErrorResult {
error: String,
}
impl SimpleErrorResult {
fn login_failed() -> Self {
SimpleErrorResult {
error: "LoginFailed".to_owned(),
}
}
fn not_logged_in() -> Self {
SimpleErrorResult {
error: "NotLoggedIn".to_owned(),
}
}
fn api_not_specified() -> Self {
SimpleErrorResult {
error: "ApiNotSpecified".to_owned(),
}
}
}
#[derive(Serialize)]
struct ComplicatedErrorResult {
error: String,
parameter: HashMap<String, String>,
}
impl ComplicatedErrorResult {
fn new(error: String) -> Self {
Self {
error,
parameter: HashMap::new(),
}
}
fn info(mut self, key: String, value: String) -> Self {
self.parameter.insert(key, value);
self
}
}
fn identity(id: Identity) -> HttpResponse {
HttpResponse::Ok().json(LoginStatusInfo {
identity: id.identity(),
})
}
fn login(
id: Identity,
payload: web::Json<LoginRequest>,
db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = actix_web::Error> {
let username = payload.username.clone();
let result = db::check_password(payload.username.clone(), payload.password.clone(), &db);
result
.map_err(actix_web::Error::from)
.map(move |is_password_correct| {
if is_password_correct {
id.remember(username.clone());
HttpResponse::Ok().json(LoginStatusInfo {
identity: Some(username),
})
} else {
id.forget();
HttpResponse::Unauthorized().json(SimpleErrorResult::login_failed())
}
})
}
fn logout(id: Identity) -> HttpResponse {
id.forget();
identity(id)
}
#[derive(Template)]
#[template(path = "index.askama", escape = "html")]
struct HelloTemplate {
flags: LoginStatusInfo,
}
/// Returns the index.html page. The file is created by askama and may contain
/// information in the javascript that is passed via flags to elm.
fn index_page(id: Identity) -> HttpResponse {
let info = LoginStatusInfo {
identity: id.identity(),
};
let hello = HelloTemplate { flags: info };
let s = hello.render().unwrap();
HttpResponse::Ok().content_type("text/html").body(s)
}
/// CRUD for games
fn create_game(
id: Identity,
create_info: web::Json<dto::GameCreate>,
db: web::Data<Pool>,
) -> Box<dyn Future<Item = HttpResponse, Error = actix_web::Error>> {
if let Some(user) = id.identity() {
let result = db::create_game(user, create_info.clone(), &db);
return Box::new(
result
.map_err(actix_web::Error::from)
.map(move |result| HttpResponse::Ok().json(result)),
);
} else {
return Box::new(futures::future::ok(
HttpResponse::Unauthorized().json(SimpleErrorResult::not_logged_in()),
));
}
}
fn list_games(
id: Identity,
db: web::Data<Pool>,
) -> Box<dyn Future<Item = HttpResponse, Error = actix_web::Error>> {
if let Some(user) = id.identity() {
let result = db::games_by_user(user, &db);
// note that we need to box the result as the two different branches return
// a different type.
return Box::new(result.map_err(actix_web::Error::from).map(move |games| {
let result = games;
HttpResponse::Ok().json(result)
}));
} else {
return Box::new(futures::future::ok(
HttpResponse::Unauthorized().json(SimpleErrorResult::not_logged_in()),
));
}
}
fn game_details(
path: web::Path<(i64,)>,
// id: Identity,
db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = actix_web::Error> {
let game = db::game(path.0, &db);
// TODO: Implement private games that are only visible to members.
game.map_err(actix_web::Error::from)
.map(move |game| HttpResponse::Ok().json(game))
}
fn friends_list(
// id: Identity,
db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = actix_web::Error> {
// TODO: Until we implement "friendship", all users are your friends.
let users = db::all_users(&db);
users
.map_err(actix_web::Error::from)
.map(move |users| HttpResponse::Ok().json(users))
}
fn game_setup(
path: web::Path<(i64,)>,
setup_message: web::Json<dto::SetupMessage>,
id: Identity,
db: web::Data<Pool>,
) -> Box<dyn Future<Item = HttpResponse, Error = actix_web::Error>> {
use dto::SetupMessage::*;
println!("{:?}", setup_message);
if let Some(user) = id.identity() {
return match setup_message.clone() {
SetDescription(new_description) => Box::new(
db::update_description(user, path.0, new_description, &db)
.map_err(actix_web::Error::from)
.map(|()| HttpResponse::Ok().json(())),
),
UpdateMember(member) => Box::new(
db::update_member(user, path.0, member, &db)
.map_err(actix_web::Error::from)
.map(|()| HttpResponse::Ok().json(())),
),
};
} else {
return Box::new(futures::future::ok(
HttpResponse::Unauthorized().json(SimpleErrorResult::not_logged_in()),
));
}
}
/// This route is used during development if I want an easy way to view some
/// response in the browser.
fn dummy_example(// id: Identity,
// db: web::Data<Pool>,
) -> Box<dyn Future<Item = HttpResponse, Error = actix_web::Error>> {
let messages = vec![
dto::SetupMessage::SetDescription("Hello".to_owned()),
dto::SetupMessage::UpdateMember(dto::Member {
id: 99,
username: "Rolf".to_owned(),
role: dto::MemberRole::Watcher,
accepted: true,
}),
];
Box::new(futures::future::ok(HttpResponse::Ok().json(messages)))
}
|
use kvs::{KvStore, Result};
use structopt::StructOpt;
#[derive(StructOpt)]
enum Command {
#[structopt(name = "set")]
/// Set the value of a string key to a string
Set {
#[structopt(required = true)]
/// A string key
key: String,
#[structopt(required = true)]
/// The string value of the key
value: String,
},
#[structopt(name = "get")]
/// Get the string value of a given string key
Get {
#[structopt(required = true)]
/// A string key
key: String,
},
#[structopt(name = "rm")]
/// Remove the value of a given string key
Remove {
#[structopt(required = true)]
/// The key to be removed
key: String,
},
}
#[derive(StructOpt)]
#[structopt(raw(setting = "structopt::clap::AppSettings::DisableHelpSubcommand"))]
#[structopt(raw(setting = "structopt::clap::AppSettings::SubcommandRequiredElseHelp"))]
#[structopt(raw(setting = "structopt::clap::AppSettings::VersionlessSubcommands"))]
struct Opt {
#[structopt(subcommand)]
cmd: Command,
}
fn main() -> Result<()> {
let opt = Opt::from_args();
let mut store = KvStore::open("./")?;
match opt.cmd {
Command::Set { key, value } => store.set(key, value),
Command::Get { key } => {
let value = store
.get(key)?
.or_else(|| Some(String::from("Key not found")));
println!("{}", value.unwrap());
Ok(())
}
Command::Remove { key } => store.remove(key),
}
}
|
use std::convert::From;
use std::error::Error;
use std::fmt;
use std::io;
pub type ConnectionResult<T> = Result<T, ConnectionError>;
#[derive(Debug)]
pub enum ConnectionError {
IoError(io::Error),
ProtocolError,
NegotiationError,
KeyExchangeError,
KeyGenerationError,
IntegrityError,
}
impl fmt::Display for ConnectionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "connection error: {}", (self as &Error).description())
}
}
impl Error for ConnectionError {
fn description(&self) -> &str {
use self::ConnectionError::*;
match self
{
&IoError(_) => "io error",
&ProtocolError => "protocol error",
&NegotiationError => "negotiation error",
&KeyExchangeError => "key exchange error",
&KeyGenerationError => "key generation error",
&IntegrityError => "integrity error",
}
}
}
impl From<io::Error> for ConnectionError {
fn from(err: io::Error) -> ConnectionError {
ConnectionError::IoError(err)
}
}
|
// drawing sub modules
pub mod draw_features;
pub mod draw_shapes;
pub mod paint_brush;
|
use c2::{prelude::*, Circle, Poly};
use opencv::{core::*, imgproc::*, types::*};
use rand::Rng;
use crate::graphics::*;
#[derive(Debug)]
pub enum Player {
Left,
Right,
}
pub struct Game {
size: Size,
ball: Ball,
score: Score,
reset: bool,
single_player: bool,
graphics: Graphics,
}
impl Game {
pub fn new(size: Size, single_player: bool) -> Game {
Game {
ball: Ball::new(size),
score: Score::new(),
reset: false,
size: size,
single_player: single_player,
graphics: Graphics::init(size),
}
}
pub fn update(&mut self, shapes: &VectorOfRotatedRect) -> opencv::Result<()> {
if self.reset {
self.reset = false;
}
self.ball.translate();
self.ball.wall_collision(self.size, self.single_player);
self.ball.shape_collision(shapes)?;
if self.ball.x < 0 {
self.score.add_right();
self.reset = true;
}
if !self.single_player {
if self.ball.x + self.ball.radius > self.size.width {
self.score.add_left();
self.reset = true;
}
}
if self.reset {
self.ball.reset(self.size);
}
Ok(())
}
pub fn draw(&self, img: &mut Mat) -> opencv::Result<()> {
// reset solid background
img.set_to(&self.graphics.bg_color, &no_array()?)?;
// draw ball
circle(
img,
self.ball.get_center(),
self.ball.radius,
self.graphics.obj_color,
-1,
LINE_8,
0,
)?;
// draw score
if !self.single_player {
put_text(
img,
&self.score.left.to_string(),
self.graphics.score_pos_left,
self.graphics.font,
2.0,
self.graphics.score_color,
2,
LINE_8,
false,
)?;
}
put_text(
img,
&self.score.right.to_string(),
self.graphics.score_pos_right,
self.graphics.font,
2.0,
self.graphics.score_color,
2,
LINE_8,
false,
)?;
Ok(())
}
}
struct Ball {
x: i32,
y: i32,
vel_x: i32,
vel_y: i32,
radius: i32,
starting_side: Player,
}
impl Ball {
fn new(screen_size: Size) -> Ball {
let mut rng = rand::thread_rng();
Ball {
x: screen_size.width / 2,
y: screen_size.height / 2,
vel_x: rng.gen_range(20..30),
vel_y: rng.gen_range(20..30),
radius: 10,
starting_side: Player::Right,
}
}
pub fn translate(&mut self) {
self.x += self.vel_x;
self.y += self.vel_y;
}
pub fn reset(&mut self, screen: Size) {
let mut rng = rand::thread_rng();
self.x = screen.width / 2;
self.y = screen.height / 2;
self.vel_x = rng.gen_range(15..25);
self.vel_y = rng.gen_range(15..25);
match self.starting_side {
Player::Right => {
self.vel_x *= -1;
self.starting_side = Player::Left;
}
Player::Left => {
self.starting_side = Player::Right;
}
}
if rand::random() {
self.vel_y *= 1;
}
}
pub fn wall_collision(&mut self, screen: Size, single_player: bool) {
if self.y - self.radius <= 0 {
self.vel_y *= -1;
self.y += 1;
}
if self.y + self.radius >= screen.height {
self.vel_y *= -1;
self.y -= 1;
}
if single_player {
if self.x + self.radius >= screen.width {
self.vel_x *= -1;
self.x -= 1;
}
}
}
pub fn shape_collision(&mut self, shapes: &VectorOfRotatedRect) -> opencv::Result<()> {
let circle = Circle::new([self.x as f32, self.y as f32], self.radius as f32);
for index in 0..shapes.len() {
let shape = shapes.get(index)?;
let mut vertices: [Point2f; 4] = [
Point2f::new(0.0, 0.0),
Point2f::new(0.0, 0.0),
Point2f::new(0.0, 0.0),
Point2f::new(0.0, 0.0),
];
shape.points(&mut vertices)?;
let poly = Poly::from_slice(&[
[vertices[0].x, vertices[0].y],
[vertices[1].x, vertices[1].y],
[vertices[2].x, vertices[2].y],
[vertices[3].x, vertices[3].y],
]);
let collided = circle.collides_with(&poly);
if collided {
let manifold = circle.manifold(&poly);
let depth = manifold.depths()[0].round().abs() as i32;
self.x -= depth * self.vel_x.signum();
self.y -= depth * self.vel_y.signum();
let normal = manifold.normal();
let x = normal.x().round().abs() as i32;
let y = normal.y().round().abs() as i32;
if x == 0 && y == 1 {
self.vel_y *= -1;
} else if x == 1 && y == 0 {
self.vel_x *= -1;
} else {
self.vel_x *= -1;
self.vel_y *= -1;
}
}
}
Ok(())
}
pub fn get_center(&self) -> Point {
Point::new(self.x, self.y)
}
}
struct Score {
left: i32,
right: i32,
}
impl Score {
fn new() -> Score {
Score { left: 0, right: 0 }
}
fn add_left(&mut self) {
self.left += 1
}
fn add_right(&mut self) {
self.right += 1
}
}
|
extern crate url;
extern crate sha1;
// #![macro_use]
macro_rules! ensure {
($expr:expr, $err_result:expr) => (
if !($expr) { return $err_result; }
)
}
macro_rules! fail {
($expr:expr) => (
return Err(::std::convert::From::from($expr));
)
}
macro_rules! unwrap_or {
($expr:expr, $or:expr) => (
match $expr {
Some(x) => x,
None => { $or; }
}
)
}
mod types;
mod client;
mod connection;
mod parser;
mod cmd;
mod commands;
mod script;
mod slot;
mod cluster;
// public api
pub use parser::{parse_redis_value, Parser};
pub use client::Client;
pub use connection::{Connection, ConnectionInfo, PubSub, Msg, transaction};
pub use cmd::{cmd, Cmd, pipe, Pipeline, Iter, pack_command};
pub use commands::{Commands, PipelineCommands};
pub use script::{Script, ScriptInvocation};
pub use cluster::Cluster;
pub use slot::key_hash_slot;
#[doc(hidden)]
pub use types::{/* low level values */ Value, /* error and result types */ RedisError,
RedisResult, /* error kinds */ ErrorKind, /* utility types */ InfoDict,
NumericBehavior, /* conversion traits */ FromRedisValue, ToRedisArgs,
/* utility functions */ from_redis_value, no_connection_error,
make_extension_error};
|
mod server;
mod config;
use std::{env, net::TcpListener};
use crate::server::thread_pool::ThreadPool;
use crate::server::http_handler;
use crate::config::config::Config;
use std::sync::Arc;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 3 {
println!("Usage: cargo run $host $port!");
return
}
let host = &args[1];
let port = &args[2];
let config = match Config::new() {
Some(c) => c,
None => {
println!("Config file is incorrect!");
return;
}
};
let listener = match TcpListener::bind(format!("{}:{}", host, port)) {
Ok(t) => {
println!("Server listening {}:{}", host, port);
t
},
Err(e) => {
println!("Error occurred while binding tcp listener. \nError: {}", e.to_string());
return;
},
};
let pool = ThreadPool::new(config.thread_limit);
println!("Server is running with {} threads", config.thread_limit);
let guarded_root = Arc::new(config.document_root);
for conn in listener.incoming() {
let conn = match conn {
Ok(t) => t,
Err(e) => {
println!("Connection lost. \nError: {}", e.to_string());
continue;
}
};
let clone = guarded_root.clone();
pool.add_to_queue(|| {
http_handler::handle_request(conn, clone)
});
}
}
|
use crate::error::{ParseErrKind, RubyError};
use crate::util::*;
use super::*;
use std::path::PathBuf;
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq)]
pub struct Parser {
pub lexer: Lexer,
prev_loc: Loc,
context_stack: Vec<Context>,
pub ident_table: IdentifierTable,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ParseResult {
pub node: Node,
pub ident_table: IdentifierTable,
pub lvar_collector: LvarCollector,
pub source_info: SourceInfoRef,
}
impl ParseResult {
pub fn default(node: Node, ident_table:IdentifierTable, lvar_collector: LvarCollector, source_info: SourceInfoRef) -> Self {
ParseResult {
node,
ident_table,
lvar_collector,
source_info,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct LvarId(usize);
impl std::ops::Deref for LvarId {
type Target = usize;
fn deref(&self) -> &usize {
&self.0
}
}
impl std::hash::Hash for LvarId {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}
impl LvarId {
pub fn as_usize(&self) -> usize {
self.0
}
pub fn as_u32(&self) -> u32 {
self.0 as u32
}
pub fn from_usize(id: usize) -> Self {
LvarId(id)
}
pub fn from_u32(id: u32) -> Self {
LvarId(id as usize)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct LvarCollector {
id: usize,
table: HashMap<IdentId, LvarId>,
block: Option<LvarId>,
}
impl LvarCollector {
pub fn new() -> Self {
LvarCollector {
id: 0,
table: HashMap::new(),
block: None,
}
}
fn insert(&mut self, val: IdentId) -> LvarId {
match self.table.get(&val) {
Some(id) => *id,
None => {
let id = self.id;
self.table.insert(val, LvarId(id));
self.id += 1;
LvarId(id)
}
}
}
fn insert_new(&mut self, val: IdentId) -> Result<LvarId, ()> {
let id = self.id;
if self.table.insert(val, LvarId(id)).is_some() {
return Err(());
};
self.id += 1;
Ok(LvarId(id))
}
fn insert_block_param(&mut self, val: IdentId) -> Result<LvarId, ()> {
let lvar = self.insert_new(val)?;
self.block = Some(lvar);
Ok(lvar)
}
pub fn get(&self, val: &IdentId) -> Option<&LvarId> {
self.table.get(val)
}
pub fn get_name(&self, id:LvarId) -> Option<IdentId> {
for (k,v) in self.table.iter() {
if *v == id {
return Some(*k);
}
}
None
}
pub fn block_param(&self) -> Option<LvarId> {
self.block
}
pub fn len(&self) -> usize {
self.table.len()
}
pub fn table(&self) -> &HashMap<IdentId, LvarId> {
&self.table
}
pub fn block(&self) -> &Option<LvarId> {
&self.block
}
pub fn clone_table(&self) -> HashMap<IdentId, LvarId> {
self.table.clone()
}
}
#[derive(Debug, Clone, PartialEq)]
struct Context {
lvar: LvarCollector,
kind: ContextKind,
}
impl Context {
fn new_method() -> Self {
Context {
lvar: LvarCollector::new(),
kind: ContextKind::Method,
}
}
fn new_class(lvar_collector: Option<LvarCollector>) -> Self {
Context {
lvar: lvar_collector.unwrap_or(LvarCollector::new()),
kind: ContextKind::Class,
}
}
fn new_block() -> Self {
Context {
lvar: LvarCollector::new(),
kind: ContextKind::Block,
}
}
}
#[derive(Debug, Clone, PartialEq)]
enum ContextKind {
Class,
Method,
Block,
}
#[derive(Debug, Clone, PartialEq)]
struct ArgList {
args: Vec<Node>,
kw_args: Vec<(IdentId, Node)>,
block: Option<Box<Node>>,
}
impl Parser {
pub fn new() -> Self {
let lexer = Lexer::new();
Parser {
lexer,
prev_loc: Loc(0, 0),
context_stack: vec![],
ident_table: IdentifierTable::new(),
}
}
fn save_state(&mut self) {
self.lexer.save_state();
}
fn restore_state(&mut self) {
self.lexer.restore_state();
}
fn discard_state(&mut self) {
self.lexer.discard_state();
}
pub fn get_context_depth(&self) -> usize {
self.context_stack.len()
}
/*
fn context(&self) -> &Context {
self.context_stack.last().unwrap()
}
*/
fn context_mut(&mut self) -> &mut Context {
self.context_stack.last_mut().unwrap()
}
// If the identifier(IdentId) does not exist in the current scope,
// add the identifier as a local variable in the current context.
fn add_local_var_if_new(&mut self, id: IdentId) {
if !self.is_local_var(id) {
self.context_mut().lvar.insert(id);
}
}
// Add the identifier(IdentId) as a new parameter in the current context.
// If a parameter with the same name already exists, return error.
fn new_param(&mut self, id: IdentId, loc: Loc) -> Result<(), RubyError> {
let res = self.context_mut().lvar.insert_new(id);
if res.is_err() {
return Err(self.error_unexpected(loc, "Duplicated argument name."));
}
Ok(())
}
// Add the identifier(IdentId) as a new block parameter in the current context.
// If a parameter with the same name already exists, return error.
fn new_block_param(&mut self, id: IdentId, loc: Loc) -> Result<(), RubyError> {
let res = self.context_mut().lvar.insert_block_param(id);
if res.is_err() {
return Err(self.error_unexpected(loc, "Duplicated argument name."));
}
Ok(())
}
// Examine whether the identifier(IdentId) exists in the current scope.
// If exiets, return true.
fn is_local_var(&mut self, id: IdentId) -> bool {
let len = self.context_stack.len();
for i in 0..len {
let context = &self.context_stack[len - 1 - i];
if context.lvar.table.contains_key(&id) {
return true;
}
if context.kind != ContextKind::Block {
return false;
}
}
return false;
}
fn get_ident_id(&mut self, method: impl Into<String>) -> IdentId {
self.ident_table.get_ident_id(method)
}
/// Peek next token (skipping line terminators).
fn peek(&mut self) -> Result<Token, RubyError> {
self.lexer.peek_token_skip_lt()
}
/// Peek next token (no skipping line terminators).
fn peek_no_term(&mut self) -> Result<Token, RubyError> {
self.lexer.peek_token()
}
/// Examine the next token, and return true if it is a line terminator.
fn is_line_term(&mut self) -> Result<bool, RubyError> {
Ok(self.peek_no_term()?.is_line_term())
}
fn loc(&mut self) -> Loc {
self.peek_no_term().unwrap().loc()
}
fn prev_loc(&self) -> Loc {
self.prev_loc
}
/// Get next token (skipping line terminators).
/// Return RubyError if it was EOF.
fn get(&mut self) -> Result<Token, RubyError> {
loop {
let tok = self.lexer.get_token()?;
if tok.is_eof() {
return Err(self.error_eof(tok.loc()));
}
if !tok.is_line_term() {
self.prev_loc = tok.loc;
return Ok(tok);
}
}
}
/// Get next token (no skipping line terminators).
fn get_no_skip_line_term(&mut self) -> Result<Token, RubyError> {
let tok = self.lexer.get_token()?;
self.prev_loc = tok.loc;
Ok(tok)
}
/// If next token is an expected kind of Punctuator, get it and return true.
/// Otherwise, return false.
fn consume_punct(&mut self, expect: Punct) -> Result<bool, RubyError> {
match self.peek()?.kind {
TokenKind::Punct(punct) if punct == expect => {
self.get()?;
Ok(true)
}
_ => Ok(false),
}
}
fn consume_punct_no_term(&mut self, expect: Punct) -> Result<bool, RubyError> {
if TokenKind::Punct(expect) == self.peek_no_term()?.kind {
self.get()?;
Ok(true)
} else {
Ok(false)
}
}
/// If next token is an expected kind of Reserved keyeord, get it and return true.
/// Otherwise, return false.
fn consume_reserved(&mut self, expect: Reserved) -> Result<bool, RubyError> {
match self.peek()?.kind {
TokenKind::Reserved(reserved) if reserved == expect => {
self.get()?;
Ok(true)
}
_ => Ok(false),
}
}
fn consume_const(&mut self) -> Result<bool, RubyError> {
match self.peek()?.kind {
TokenKind::Const(_, _, _) => {
self.get()?;
Ok(true)
}
_ => Ok(false),
}
}
fn consume_reserved_no_skip_line_term(&mut self, expect: Reserved) -> Result<bool, RubyError> {
if TokenKind::Reserved(expect) == self.peek_no_term()?.kind {
self.get()?;
Ok(true)
} else {
Ok(false)
}
}
/// Get the next token if it is a line terminator or ';' or EOF, and return true,
/// Otherwise, return false.
fn consume_term(&mut self) -> Result<bool, RubyError> {
if !self.peek_no_term()?.is_term() {
return Ok(false);
};
while self.peek_no_term()?.is_term() {
if self.get_no_skip_line_term()?.is_eof() {
return Ok(true);
}
}
return Ok(true);
}
/// Get the next token and examine whether it is an expected Reserved.
/// If not, return RubyError.
fn expect_reserved(&mut self, expect: Reserved) -> Result<(), RubyError> {
match &self.get()?.kind {
TokenKind::Reserved(reserved) if *reserved == expect => Ok(()),
_ => Err(self.error_unexpected(self.prev_loc(), format!("Expect {:?}", expect))),
}
}
/// Get the next token and examine whether it is an expected Punct.
/// If not, return RubyError.
fn expect_punct(&mut self, expect: Punct) -> Result<(), RubyError> {
match &self.get()?.kind {
TokenKind::Punct(punct) if *punct == expect => Ok(()),
_ => Err(self.error_unexpected(self.prev_loc(), format!("Expect '{:?}'", expect))),
}
}
/// Get the next token and examine whether it is Ident.
/// Return IdentId of the Ident.
/// If not, return RubyError.
fn expect_ident(&mut self) -> Result<IdentId, RubyError> {
let name = match &self.get()?.kind {
TokenKind::Ident(s, _, _) => s.clone(),
_ => {
return Err(self.error_unexpected(self.prev_loc(), "Expect identifier."));
}
};
Ok(self.get_ident_id(name))
}
/// Get the next token and examine whether it is Const.
/// Return IdentId of the Const.
/// If not, return RubyError.
fn expect_const(&mut self) -> Result<IdentId, RubyError> {
let name = match &self.get()?.kind {
TokenKind::Const(s, _, _) => s.clone(),
_ => {
return Err(self.error_unexpected(self.prev_loc(), "Expect constant."));
}
};
Ok(self.get_ident_id(name))
}
fn token_as_symbol(&self, token: &Token) -> String {
match token.kind.clone() {
TokenKind::Ident(ident, _, _) => ident,
TokenKind::Const(ident, _, _) => ident,
TokenKind::InstanceVar(ident) => ident,
TokenKind::StringLit(ident) => ident,
TokenKind::Reserved(reserved) => {
self.lexer.get_string_from_reserved(reserved).to_string()
}
_ => unreachable!(),
}
}
fn error_unexpected(&self, loc: Loc, msg: impl Into<String>) -> RubyError {
RubyError::new_parse_err(
ParseErrKind::SyntaxError(msg.into()),
self.lexer.source_info,
0,
loc,
)
}
fn error_eof(&self, loc: Loc) -> RubyError {
RubyError::new_parse_err(ParseErrKind::UnexpectedEOF, self.lexer.source_info, 0, loc)
}
}
impl Parser {
pub fn parse_program(
mut self,
path: PathBuf,
program: &str,
) -> Result<ParseResult, RubyError> {
let (node, lvar) = self.parse_program_core(path, program, None)?;
let tok = self.peek()?;
if tok.is_eof() {
let result = ParseResult::default(node, self.ident_table, lvar, self.lexer.source_info);
Ok(result)
} else {
Err(self.error_unexpected(tok.loc(), "Expected end-of-input."))
}
}
pub fn parse_program_repl(
mut self,
path: PathBuf,
program: &str,
lvar_collector: Option<LvarCollector>,
) -> Result<ParseResult, RubyError> {
let (node, lvar) = match self.parse_program_core(path, program, lvar_collector) {
Ok((node, lvar)) => (node, lvar),
Err(mut err) => {
err.set_level(self.context_stack.len() - 1);
return Err(err);
}
};
let tok = self.peek()?;
if tok.is_eof() {
let result = ParseResult::default(node, self.ident_table, lvar, self.lexer.source_info);
Ok(result)
} else {
let mut err = self.error_unexpected(tok.loc(), "Expected end-of-input.");
err.set_level(0);
Err(err)
}
}
pub fn parse_program_core(
&mut self,
path: PathBuf,
program: &str,
lvar: Option<LvarCollector>,
) -> Result<(Node, LvarCollector), RubyError> {
self.lexer.init(path, program);
self.context_stack.push(Context::new_class(lvar));
let node = self.parse_comp_stmt()?;
let lvar = self.context_stack.pop().unwrap().lvar;
Ok((node, lvar))
}
pub fn parse_program_eval(
mut self,
path: PathBuf,
program: &str,
ext_lvar: LvarCollector,
) -> Result<ParseResult, RubyError> {
self.lexer.init(path, program);
self.context_stack.push(Context::new_class(Some(ext_lvar)));
self.context_stack.push(Context::new_block());
let node = self.parse_comp_stmt()?;
let lvar = self.context_stack.pop().unwrap().lvar;
self.context_stack.pop().unwrap();
let tok = self.peek()?;
if tok.is_eof() {
let result = ParseResult::default(node, self.ident_table, lvar, self.lexer.source_info);
Ok(result)
} else {
Err(self.error_unexpected(tok.loc(), "Expected end-of-input."))
}
}
fn parse_comp_stmt(&mut self) -> Result<Node, RubyError> {
// COMP_STMT : (STMT (TERM STMT)*)? (TERM+)?
self.peek()?;
let loc = self.loc();
let mut nodes = vec![];
loop {
if self.peek()?.check_stmt_end() {
return Ok(Node::new_comp_stmt(nodes, loc));
}
let node = self.parse_stmt()?;
//println!("node {:?}", node);
nodes.push(node);
if !self.consume_term()? {
break;
}
}
Ok(Node::new_comp_stmt(nodes, loc))
}
fn parse_stmt(&mut self) -> Result<Node, RubyError> {
let mut node = self.parse_expr()?;
loop {
if self.consume_reserved_no_skip_line_term(Reserved::If)? {
// STMT : STMT if EXPR
let loc = self.prev_loc();
let cond = self.parse_expr()?;
node = Node::new_if(cond, node, Node::new_comp_stmt(vec![], loc), loc);
} else if self.consume_reserved_no_skip_line_term(Reserved::Unless)? {
// STMT : STMT unless EXPR
let loc = self.prev_loc();
let cond = self.parse_expr()?;
node = Node::new_if(cond, Node::new_comp_stmt(vec![], loc), node, loc);
} else if self.consume_reserved_no_skip_line_term(Reserved::While)? {
// STMT : STMT while EXPR
let loc = self.prev_loc();
let cond = self.parse_expr()?;
let loc = loc.merge(self.prev_loc());
node = Node::new_while(cond, node, loc);
} else if self.consume_reserved_no_skip_line_term(Reserved::Until)? {
// STMT : STMT until EXPR
let loc = self.prev_loc();
let cond = Node::new_unop(UnOp::Not, self.parse_expr()?, loc);
let loc = loc.merge(self.prev_loc());
node = Node::new_while(cond, node, loc);
} else {
break;
}
}
// STMT : EXPR
Ok(node)
}
fn parse_expr(&mut self) -> Result<Node, RubyError> {
// EXPR : NOT
// | KEYWORD-AND
// | KEYWORD-OR
// NOT : ARG
// | UNPARENTHESIZED-METHOD
// | ! UNPARENTHESIZED-METHOD
// | KEYWORD-NOT
// UNPARENTHESIZED-METHOD :
// | FNAME ARGS
// | PRIMARY . FNAME ARGS
// | PRIMARY :: FNAME ARGS
// | return ARGS
// | break ARGS
// | next ARGS
// | COMMAND-WITH-DO-BLOCK [CHAIN-METHOD]*
// | COMMAND-WITH-DO-BLOCK [CHAIN-METHOD]* . FNAME ARGS
// | COMMAND-WITH-DO-BLOCK [CHAIN-METHOD]* :: FNAME ARGS
// CHAIN-METOD : . FNAME
// | :: FNAME
// | . FNAME( ARGS )
// | :: FNAME( ARGS )
// COMMAND-WITH-DO-BLOCK : FNAME ARGS DO-BLOCK
// | PRIMARY . FNAME ARGS DO-BLOCK [CHAIN-METHOD]* [ . FNAME ARGS]
let node = self.parse_arg()?;
if self.consume_punct_no_term(Punct::Comma)?
/*&& node.is_lvar()*/
{
// EXPR : MLHS `=' MRHS
return Ok(self.parse_mul_assign(node)?);
}
if node.is_operation() && self.is_command()? {
// FNAME ARGS
// FNAME ARGS DO-BLOCK
Ok(self.parse_command(node.as_method_name().unwrap(), node.loc())?)
} else if let Node {
// PRIMARY . FNAME ARGS
// PRIMARY . FNAME ARGS DO_BLOCK [CHAIN-METHOD]* [ . FNAME ARGS]
kind:
NodeKind::Send {
method,
receiver,
mut send_args,
completed: false,
..
},
loc,
} = node.clone()
{
if self.is_command()? {
send_args = self.parse_arglist()?;
} else {
send_args.block = self.parse_block()?
};
let node = Node::new_send(*receiver, method, send_args, true, loc);
Ok(node)
} else {
// EXPR : ARG
Ok(node)
}
}
fn parse_mul_assign(&mut self, node: Node) -> Result<Node, RubyError> {
// EXPR : MLHS `=' MRHS
let mut mlhs = vec![node];
loop {
if self.peek_no_term()?.kind == TokenKind::Punct(Punct::Assign) {
break;
}
let node = self.parse_function()?;
mlhs.push(node);
if !self.consume_punct_no_term(Punct::Comma)? {
break;
}
}
if !self.consume_punct_no_term(Punct::Assign)? {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expected '='."));
}
let mrhs = self.parse_arg_list(None)?;
for lhs in &mlhs {
self.check_lhs(lhs)?;
}
return Ok(Node::new_mul_assign(mlhs, mrhs));
}
fn parse_arg_list(
&mut self,
punct: impl Into<Option<Punct>>,
) -> Result<Vec<Node>, RubyError> {
let (flag, punct) = match punct.into() {
Some(punct) => (true, punct),
None => (false, Punct::Arrow /* dummy */),
};
let mut args = vec![];
loop {
if flag && self.consume_punct(punct)? {
return Ok(args);
}
if self.consume_punct(Punct::Mul)? {
// splat argument
let loc = self.prev_loc();
let array = self.parse_arg()?;
args.push(Node::new_splat(array, loc));
} else {
let node = self.parse_arg()?;
args.push(node);
}
if !self.consume_punct(Punct::Comma)? {
break;
}
}
if flag {
self.expect_punct(punct)?
};
Ok(args)
}
fn parse_command(&mut self, operation: IdentId, loc: Loc) -> Result<Node, RubyError> {
// FNAME ARGS
// FNAME ARGS DO-BLOCK
let send_args = self.parse_arglist()?;
Ok(Node::new_send(
Node::new_self(loc),
operation,
send_args,
true,
loc,
))
}
fn parse_arglist(&mut self) -> Result<SendArgs, RubyError> {
let first_arg = self.parse_arg()?;
if self.is_line_term()? {
return Ok(SendArgs{args:vec![first_arg], kw_args:vec![], block:None});
}
if first_arg.is_operation() && self.is_command()? {
let args =
vec![self.parse_command(first_arg.as_method_name().unwrap(), first_arg.loc())?];
return Ok(SendArgs{args, kw_args:vec![], block:None});
}
let mut args = vec![first_arg];
let mut kw_args = vec![];
let mut block = None;
if self.consume_punct_no_term(Punct::Comma)? {
let res = self.parse_argument_list(None)?;
let mut new_args = res.args;
kw_args = res.kw_args;
block = res.block;
args.append(&mut new_args);
}
match self.parse_block()? {
Some(actual_block) => {
if block.is_some() {return Err(self.error_unexpected(actual_block.loc(), "Both block arg and actual block given."))}
block = Some(actual_block);
}
None => {}
};
Ok(SendArgs{args, kw_args, block})
}
fn is_command(&mut self) -> Result<bool, RubyError> {
let tok = self.peek_no_term()?;
match tok.kind {
TokenKind::Ident(_, _, _)
| TokenKind::InstanceVar(_)
| TokenKind::GlobalVar(_)
| TokenKind::Const(_, _, _)
| TokenKind::NumLit(_)
| TokenKind::FloatLit(_)
| TokenKind::StringLit(_)
| TokenKind::OpenString(_) => Ok(true),
TokenKind::Punct(p) => match p {
Punct::LParen
| Punct::LBracket
| Punct::LBrace
| Punct::Colon
| Punct::Scope
| Punct::Plus
| Punct::Minus
| Punct::Arrow => Ok(true),
_ => Ok(false),
},
TokenKind::Reserved(r) => match r {
Reserved::False | Reserved::Nil | Reserved::True => Ok(true),
_ => Ok(false),
},
_ => Ok(false),
}
}
fn parse_arg(&mut self) -> Result<Node, RubyError> {
let node = self.parse_arg_assign()?;
Ok(node)
}
fn parse_arg_assign(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_ternary()?;
if self.is_line_term()? {
return Ok(lhs);
}
if self.consume_punct_no_term(Punct::Assign)? {
let mrhs = self.parse_arg_list(None)?;
self.check_lhs(&lhs)?;
Ok(Node::new_mul_assign(vec![lhs], mrhs))
} else if let TokenKind::Punct(Punct::AssignOp(op)) = self.peek_no_term()?.kind {
match op {
BinOp::LOr => {
self.get()?;
let rhs = self.parse_arg()?;
self.check_lhs(&lhs)?;
if let NodeKind::Ident(id) = lhs.kind {
lhs = Node::new_lvar(id, lhs.loc());
};
let node = Node::new_binop(
BinOp::LOr,
lhs.clone(),
Node::new_mul_assign(vec![lhs.clone()], vec![rhs]),
);
Ok(node)
}
_ => {
self.get()?;
let rhs = self.parse_arg()?;
self.check_lhs(&lhs)?;
Ok(Node::new_mul_assign(
vec![lhs.clone()],
vec![Node::new_binop(op, lhs, rhs)],
))
}
}
} else {
Ok(lhs)
}
}
fn check_lhs(&mut self, lhs: &Node) -> Result<(), RubyError> {
if let NodeKind::Ident(id) = lhs.kind {
self.add_local_var_if_new(id);
} else if let NodeKind::Const { toplevel: _, id: _ } = lhs.kind {
for c in self.context_stack.iter().rev() {
match c.kind {
ContextKind::Class => return Ok(()),
ContextKind::Method => return Err(self.error_unexpected(lhs.loc(), "Dynamic constant assignment.")),
ContextKind::Block => {}
}
}
};
Ok(())
}
fn parse_arg_ternary(&mut self) -> Result<Node, RubyError> {
let cond = self.parse_arg_range()?;
let loc = cond.loc();
if self.consume_punct_no_term(Punct::Question)? {
let then_ = self.parse_arg()?;
if !self.consume_punct_no_term(Punct::Colon)? {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expect ':'."));
};
let else_ = self.parse_arg()?;
let node = Node::new_if(cond, then_, else_, loc);
Ok(node)
} else {
Ok(cond)
}
}
fn parse_arg_range(&mut self) -> Result<Node, RubyError> {
let lhs = self.parse_arg_logical_or()?;
if self.is_line_term()? {
return Ok(lhs);
}
if self.consume_punct(Punct::Range2)? {
let rhs = self.parse_arg_logical_or()?;
let loc = lhs.loc().merge(rhs.loc());
Ok(Node::new_range(lhs, rhs, false, loc))
} else if self.consume_punct(Punct::Range3)? {
let rhs = self.parse_arg_logical_or()?;
let loc = lhs.loc().merge(rhs.loc());
Ok(Node::new_range(lhs, rhs, true, loc))
} else {
Ok(lhs)
}
}
fn parse_arg_logical_or(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_logical_and()?;
while self.consume_punct_no_term(Punct::LOr)? {
let rhs = self.parse_arg_logical_and()?;
lhs = Node::new_binop(BinOp::LOr, lhs, rhs);
}
Ok(lhs)
}
fn parse_arg_logical_and(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_eq()?;
while self.consume_punct_no_term(Punct::LAnd)? {
let rhs = self.parse_arg_eq()?;
lhs = Node::new_binop(BinOp::LAnd, lhs, rhs);
}
Ok(lhs)
}
// 4==4==4 => SyntaxError
fn parse_arg_eq(&mut self) -> Result<Node, RubyError> {
let lhs = self.parse_arg_comp()?;
// TODO: Support <==> === !~
if self.consume_punct_no_term(Punct::Eq)? {
let rhs = self.parse_arg_comp()?;
Ok(Node::new_binop(BinOp::Eq, lhs, rhs))
} else if self.consume_punct_no_term(Punct::Ne)? {
let rhs = self.parse_arg_comp()?;
Ok(Node::new_binop(BinOp::Ne, lhs, rhs))
} else if self.consume_punct_no_term(Punct::TEq)? {
let rhs = self.parse_arg_comp()?;
Ok(Node::new_binop(BinOp::TEq, lhs, rhs))
} else if self.consume_punct_no_term(Punct::Match)? {
let rhs = self.parse_arg_comp()?;
Ok(Node::new_binop(BinOp::Match, lhs, rhs))
} else {
Ok(lhs)
}
}
fn parse_arg_comp(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_bitor()?;
if self.is_line_term()? {
return Ok(lhs);
}
loop {
if self.consume_punct_no_term(Punct::Ge)? {
let rhs = self.parse_arg_bitor()?;
lhs = Node::new_binop(BinOp::Ge, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Gt)? {
let rhs = self.parse_arg_bitor()?;
lhs = Node::new_binop(BinOp::Gt, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Le)? {
let rhs = self.parse_arg_bitor()?;
lhs = Node::new_binop(BinOp::Le, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Lt)? {
let rhs = self.parse_arg_bitor()?;
lhs = Node::new_binop(BinOp::Lt, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Cmp)? {
let rhs = self.parse_arg_bitor()?;
lhs = Node::new_binop(BinOp::Cmp, lhs, rhs);
} else {
break;
}
}
Ok(lhs)
}
fn parse_arg_bitor(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_bitand()?;
loop {
if self.consume_punct_no_term(Punct::BitOr)? {
lhs = Node::new_binop(BinOp::BitOr, lhs, self.parse_arg_bitand()?);
} else if self.consume_punct_no_term(Punct::BitXor)? {
lhs = Node::new_binop(BinOp::BitXor, lhs, self.parse_arg_bitand()?);
} else {
break;
}
}
Ok(lhs)
}
fn parse_arg_bitand(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_shift()?;
loop {
if self.consume_punct_no_term(Punct::BitAnd)? {
lhs = Node::new_binop(BinOp::BitAnd, lhs, self.parse_arg_shift()?);
} else {
break;
}
}
Ok(lhs)
}
fn parse_arg_shift(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_add()?;
loop {
if self.consume_punct_no_term(Punct::Shl)? {
lhs = Node::new_binop(BinOp::Shl, lhs, self.parse_arg_add()?);
} else if self.consume_punct_no_term(Punct::Shr)? {
lhs = Node::new_binop(BinOp::Shr, lhs, self.parse_arg_add()?);
} else {
break;
}
}
Ok(lhs)
}
fn parse_arg_add(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_arg_mul()?;
loop {
if self.consume_punct_no_term(Punct::Plus)? {
let rhs = self.parse_arg_mul()?;
lhs = Node::new_binop(BinOp::Add, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Minus)? {
let rhs = self.parse_arg_mul()?;
lhs = Node::new_binop(BinOp::Sub, lhs, rhs);
} else {
break;
}
}
Ok(lhs)
}
fn parse_arg_mul(&mut self) -> Result<Node, RubyError> {
let mut lhs = self.parse_unary_minus()?;
if self.is_line_term()? {
return Ok(lhs);
}
loop {
if self.consume_punct_no_term(Punct::Mul)? {
let rhs = self.parse_unary_minus()?;
lhs = Node::new_binop(BinOp::Mul, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Div)? {
let rhs = self.parse_unary_minus()?;
lhs = Node::new_binop(BinOp::Div, lhs, rhs);
} else if self.consume_punct_no_term(Punct::Rem)? {
let rhs = self.parse_unary_minus()?;
lhs = Node::new_binop(BinOp::Rem, lhs, rhs);
} else {
break;
}
}
Ok(lhs)
}
fn parse_unary_minus(&mut self) -> Result<Node, RubyError> {
self.save_state();
if self.consume_punct(Punct::Minus)? {
let loc = self.prev_loc();
match self.peek()?.kind {
TokenKind::NumLit(_) | TokenKind::FloatLit(_) => {
self.restore_state();
let lhs = self.parse_exponent()?;
return Ok(lhs);
}
_ => self.discard_state(),
};
let lhs = self.parse_unary_minus()?;
let loc = loc.merge(lhs.loc());
let lhs = Node::new_binop(BinOp::Mul, lhs, Node::new_integer(-1, loc));
Ok(lhs)
} else {
self.discard_state();
let lhs = self.parse_exponent()?;
Ok(lhs)
}
}
fn parse_exponent(&mut self) -> Result<Node, RubyError> {
let lhs = self.parse_unary()?;
if self.consume_punct_no_term(Punct::DMul)? {
let rhs = self.parse_exponent()?;
Ok(Node::new_binop(BinOp::Exp, lhs, rhs))
} else {
Ok(lhs)
}
}
fn parse_unary(&mut self) -> Result<Node, RubyError> {
// TODO: Support unary '+'.
if self.consume_punct(Punct::BitNot)? {
let loc = self.prev_loc();
let lhs = self.parse_unary()?;
let lhs = Node::new_unop(UnOp::BitNot, lhs, loc);
Ok(lhs)
} else if self.consume_punct(Punct::Not)? {
let loc = self.prev_loc();
let lhs = self.parse_unary()?;
let lhs = Node::new_unop(UnOp::Not, lhs, loc);
Ok(lhs)
} else {
let lhs = self.parse_function()?;
Ok(lhs)
}
}
fn parse_function_args(&mut self, node: Node) -> Result<Node, RubyError> {
let loc = node.loc();
if self.consume_punct_no_term(Punct::LParen)? {
// PRIMARY-METHOD : FNAME ( ARGS ) BLOCK?
let ArgList{args, kw_args, mut block} = self.parse_argument_list(Punct::RParen)?;
match self.parse_block()? {
Some(actual_block) => {
if block.is_some() {return Err(self.error_unexpected(actual_block.loc(), "Both block arg and actual block given."))}
block = Some(actual_block);
}
None => {}
};
let send_args = SendArgs {args, kw_args, block};
Ok(Node::new_send(
Node::new_self(loc),
node.as_method_name().unwrap(),
send_args,
true,
loc,
))
} else if let Some(block) = self.parse_block()? {
// PRIMARY-METHOD : FNAME BLOCK
let send_args = SendArgs {args:vec![], kw_args:vec![], block: Some(block)};
Ok(Node::new_send(
Node::new_self(loc),
node.as_method_name().unwrap(),
send_args,
true,
loc,
))
} else {
Ok(node)
}
}
fn parse_function(&mut self) -> Result<Node, RubyError> {
if self.consume_reserved(Reserved::Yield)? {
let loc = self.prev_loc();
let tok = self.peek_no_term()?;
// TODO: This is not correct.
if tok.is_term()
|| tok.kind == TokenKind::Reserved(Reserved::Unless)
|| tok.kind == TokenKind::Reserved(Reserved::If)
|| tok.check_stmt_end()
{
return Ok(Node::new_yield(SendArgs::default(), loc));
};
let args = if self.consume_punct(Punct::LParen)? {
let args = self.parse_arglist()?;
self.expect_punct(Punct::RParen)?;
args
} else {
self.parse_arglist()?
};
return Ok(Node::new_yield(args, loc))
}
// <一次式メソッド呼び出し>
let mut node = self.parse_primary()?;
let loc = node.loc();
/*if node.is_operation() {
node = self.parse_function_args(node)?;
}*/
loop {
//let tok = self.peek()?;
node = if self.consume_punct(Punct::Dot)? {
// PRIMARY-METHOD :
// | PRIMARY . FNAME BLOCK => completed: true
// | PRIMARY . FNAME ( ARGS ) BLOCK? => completed: true
// | PRIMARY . FNAME => completed: false
let tok = self.get()?;
let id = match &tok.kind {
TokenKind::Ident(s, has_suffix, _) => {
let name = if *has_suffix {
//if self.consume_punct_no_term(Punct::Question)? {
// s.clone() + "?"
//} else if self.consume_punct_no_term(Punct::Not)? {
// s.clone() + "!"
//} else {
s.clone()
//}
} else {
s.clone()
};
self.get_ident_id(name)
}
TokenKind::Reserved(r) => {
let string = self.lexer.get_string_from_reserved(*r).to_owned();
self.get_ident_id(string)
}
TokenKind::Punct(p) => self.parse_op_definable(p)?,
_ => {
return Err(
self.error_unexpected(tok.loc(), "method name must be an identifier.")
)
}
};
let mut args = vec![];
let mut kw_args = vec![];
let mut block = None;
let mut completed = false;
if self.consume_punct_no_term(Punct::LParen)? {
let res = self.parse_argument_list(Punct::RParen)?;
args = res.args;
kw_args = res.kw_args;
block = res.block;
completed = true;
}
match self.parse_block()? {
Some(actual_block) => {
if block.is_some() {return Err(self.error_unexpected(actual_block.loc(), "Both block arg and actual block given."))}
block = Some(actual_block);
}
None => {}
};
if block.is_some() {
completed = true;
};
let node = match node.kind {
NodeKind::Ident(id) => {
Node::new_send_noarg(Node::new_self(loc), id, true, loc)
}
_ => node,
};
let send_args = SendArgs {args, kw_args, block};
Node::new_send(
node,
id,
send_args,
completed,
loc.merge(self.prev_loc()),
)
} else if self.consume_punct_no_term(Punct::Scope)? {
let id = self.expect_const()?;
Node::new_scope(node, id, self.prev_loc())
} else if node.is_operation() {
return Ok(node);
} else if self.consume_punct_no_term(Punct::LBracket)? {
let member_loc = self.prev_loc();
let mut args = self.parse_arg_list(Punct::RBracket)?;
let member_loc = member_loc.merge(self.prev_loc());
args.reverse();
Node::new_array_member(node, args, member_loc)
} else {
return Ok(node);
};
}
}
/// Parse argument list.
/// arg, *splat_arg, kw: kw_arg, &block <punct>
/// punct: punctuator for terminating arg list. Set None for unparenthesized argument list.
fn parse_argument_list(
&mut self,
punct: impl Into<Option<Punct>>,
) -> Result<ArgList, RubyError> {
let (flag, punct) = match punct.into() {
Some(punct) => (true, punct),
None => (false, Punct::Arrow /* dummy */),
};
let mut args = vec![];
let mut kw_args = vec![];
let mut block = None;
loop {
if flag && self.consume_punct(punct)? {
return Ok(ArgList {args, kw_args, block});
}
if self.consume_punct(Punct::Mul)? {
// splat argument
let loc = self.prev_loc();
let array = self.parse_arg()?;
args.push(Node::new_splat(array, loc));
} else if self.consume_punct(Punct::BitAnd)? {
// block argument
let arg = self.parse_arg()?;
block = Some(Box::new(arg));
} else {
let node = self.parse_arg()?;
match node.kind {
NodeKind::Ident(id, ..) | NodeKind::LocalVar(id) => {
if self.consume_punct_no_term(Punct::Colon)? {
kw_args.push((id, self.parse_arg()?));
} else {
args.push(node);
}
}
_ => {
args.push(node);
}
}
}
if !self.consume_punct(Punct::Comma)? {
break;
} else {
let loc = self.prev_loc();
if block.is_some() { return Err(self.error_unexpected(loc, "unexpected ','.")) };
}
}
if flag {
self.expect_punct(punct)?
};
Ok(ArgList {args, kw_args, block})
}
fn parse_block(&mut self) -> Result<Option<Box<Node>>, RubyError> {
let do_flag = if self.consume_reserved_no_skip_line_term(Reserved::Do)? {
true
} else {
if self.consume_punct_no_term(Punct::LBrace)? {
false
} else {
return Ok(None);
}
};
// BLOCK: do [`|' [BLOCK_VAR] `|'] COMPSTMT end
let loc = self.prev_loc();
self.context_stack.push(Context::new_block());
let params = if self.consume_punct(Punct::BitOr)? {
if self.consume_punct(Punct::BitOr)? {
vec![]
} else {
let params = self.parse_params(TokenKind::Punct(Punct::BitOr))?;
self.consume_punct(Punct::BitOr)?;
params
}
} else {
self.consume_punct(Punct::LOr)?;
vec![]
};
let body = self.parse_comp_stmt()?;
if do_flag {
self.expect_reserved(Reserved::End)?;
} else {
self.expect_punct(Punct::RBrace)?;
};
let lvar = self.context_stack.pop().unwrap().lvar;
let loc = loc.merge(self.prev_loc());
let node = Node::new_proc(params, body, lvar, loc);
Ok(Some(Box::new(node)))
}
fn parse_primary(&mut self) -> Result<Node, RubyError> {
let tok = self.get()?;
let loc = tok.loc();
match &tok.kind {
TokenKind::Ident(name, has_suffix, trailing_space) => {
let id = self.get_ident_id(name);
if *has_suffix {
if self.peek_no_term()?.kind == TokenKind::Punct(Punct::LParen) {
let node = Node::new_identifier(id, loc);
return Ok(self.parse_function_args(node)?);
}
};
if self.is_local_var(id) {
Ok(Node::new_lvar(id, loc))
} else {
// FUNCTION or COMMAND or LHS for assignment
let node = Node::new_identifier(id, loc);
match self.peek_no_term()?.kind {
// Assignment
TokenKind::Punct(Punct::AssignOp(_))
| TokenKind::Punct(Punct::Assign)
// Multiple assignment
| TokenKind::Punct(Punct::Comma) => return Ok(node),
TokenKind::Punct(Punct::LBrace)
| TokenKind::Reserved(Reserved::Do) => return Ok(self.parse_function_args(node)?),
_ => {}
};
if *trailing_space && self.is_command_()?{
Ok(self.parse_command(id, loc)?)
} else {
Ok(node)
}
}
}
TokenKind::InstanceVar(name) => {
let id = self.get_ident_id(name);
return Ok(Node::new_instance_var(id, loc));
}
TokenKind::GlobalVar(name) => {
let id = self.get_ident_id(name);
return Ok(Node::new_global_var(id, loc));
}
TokenKind::Const(name, has_suffix, _) => {
let id = self.get_ident_id(name);
if *has_suffix {
if self.peek_no_term()?.kind == TokenKind::Punct(Punct::LParen) {
let node = Node::new_identifier(id, loc);
return Ok(self.parse_function_args(node)?);
//return Ok(Node::new_identifier(id, loc));
}
};
Ok(Node::new_const(id, false, loc))
}
TokenKind::NumLit(num) => Ok(Node::new_integer(*num, loc)),
TokenKind::FloatLit(num) => Ok(Node::new_float(*num, loc)),
TokenKind::StringLit(s) => Ok(self.parse_string_literal(s)?),
TokenKind::OpenString(s) => Ok(self.parse_interporated_string_literal(s)?),
TokenKind::Punct(punct) => match punct {
Punct::Minus => match self.get()?.kind {
TokenKind::NumLit(num) => Ok(Node::new_integer(-num, loc)),
TokenKind::FloatLit(num) => Ok(Node::new_float(-num, loc)),
_ => unreachable!(),
},
Punct::LParen => {
let node = self.parse_comp_stmt()?;
self.expect_punct(Punct::RParen)?;
Ok(node)
}
Punct::LBracket => {
// Array literal
let mut nodes = self.parse_arg_list(Punct::RBracket)?;
nodes.reverse();
let loc = loc.merge(self.prev_loc());
Ok(Node::new_array(nodes, loc))
}
Punct::LBrace => self.parse_hash_literal(),
Punct::Colon => {
// Symbol literal
let token = self.get()?;
let symbol_loc = self.prev_loc();
let id = match &token.kind {
TokenKind::Punct(punct) => self.parse_op_definable(punct)?,
_ if token.can_be_symbol() => {
let ident = self.token_as_symbol(&token);
self.get_ident_id(ident)
}
_ => {
if let TokenKind::OpenString(s) = token.kind {
let node = self.parse_interporated_string_literal(&s)?;
let method = self.ident_table.get_ident_id("to_sym");
let loc = symbol_loc.merge(node.loc());
return Ok(Node::new_send_noarg(
node,
method,
true,
loc,
));
}
return Err(
self.error_unexpected(symbol_loc, "Expect identifier or string.")
);
}
};
Ok(Node::new_symbol(id, loc.merge(self.prev_loc())))
}
Punct::Arrow => {
// Lambda literal
let mut params = vec![];
self.context_stack.push(Context::new_block());
if self.consume_punct(Punct::LParen)? {
if !self.consume_punct(Punct::RParen)? {
loop {
let id = self.expect_ident()?;
params.push(Node::new_param(id, self.prev_loc()));
self.new_param(id, self.prev_loc())?;
if !self.consume_punct(Punct::Comma)? {
break;
}
}
self.expect_punct(Punct::RParen)?;
}
} else if let TokenKind::Ident(_, _, _) = self.peek()?.kind {
let id = self.expect_ident()?;
self.new_param(id, self.prev_loc())?;
params.push(Node::new_param(id, self.prev_loc()));
};
self.expect_punct(Punct::LBrace)?;
let body = self.parse_comp_stmt()?;
self.expect_punct(Punct::RBrace)?;
let lvar = self.context_stack.pop().unwrap().lvar;
Ok(Node::new_proc(params, body, lvar, loc))
}
Punct::Scope => {
let id = self.expect_const()?;
Ok(Node::new_const(id, true, loc))
}
Punct::Div => {
let node = self.parse_regexp()?;
Ok(node)
}
Punct::Rem => {
let node = self.parse_percent_notation()?;
Ok(node)
}
_ => {
return Err(
self.error_unexpected(loc, format!("Unexpected token: {:?}", tok.kind))
)
}
},
TokenKind::Reserved(Reserved::If) => {
let node = self.parse_if_then()?;
self.expect_reserved(Reserved::End)?;
Ok(node)
}
TokenKind::Reserved(Reserved::Unless) => {
let node = self.parse_unless()?;
self.expect_reserved(Reserved::End)?;
Ok(node)
}
TokenKind::Reserved(Reserved::For) => {
let loc = self.prev_loc();
let var_id = self.expect_ident()?;
let var = Node::new_lvar(var_id, self.prev_loc());
self.add_local_var_if_new(var_id);
self.expect_reserved(Reserved::In)?;
let iter = self.parse_expr()?;
self.parse_do()?;
let body = self.parse_comp_stmt()?;
self.expect_reserved(Reserved::End)?;
let node = Node::new(
NodeKind::For {
param: Box::new(var),
iter: Box::new(iter),
body: Box::new(body),
},
loc.merge(self.prev_loc()),
);
Ok(node)
}
TokenKind::Reserved(Reserved::While) => {
let loc = self.prev_loc();
let cond = self.parse_expr()?;
self.parse_do()?;
let body = self.parse_comp_stmt()?;
self.expect_reserved(Reserved::End)?;
let loc = loc.merge(self.prev_loc());
Ok(Node::new_while(cond, body, loc))
}
TokenKind::Reserved(Reserved::Until) => {
let loc = self.prev_loc();
let cond = self.parse_expr()?;
let cond = Node::new_unop(UnOp::Not, cond, loc);
self.parse_do()?;
let body = self.parse_comp_stmt()?;
self.expect_reserved(Reserved::End)?;
let loc = loc.merge(self.prev_loc());
Ok(Node::new_while(cond, body, loc))
}
TokenKind::Reserved(Reserved::Case) => {
let loc = self.prev_loc();
let cond = self.parse_expr()?;
self.consume_term()?;
let mut when_ = vec![];
while self.consume_reserved(Reserved::When)? {
let arg = self.parse_arg_list(None)?;
self.parse_then()?;
let body = self.parse_comp_stmt()?;
when_.push(CaseBranch::new(arg, body));
}
let else_ = if self.consume_reserved(Reserved::Else)? {
self.parse_comp_stmt()?
} else {
Node::new_comp_stmt(vec![], self.loc())
};
self.expect_reserved(Reserved::End)?;
Ok(Node::new_case(cond, when_, else_, loc))
}
TokenKind::Reserved(Reserved::Def) => Ok(self.parse_def()?),
TokenKind::Reserved(Reserved::Class) => {
if self.context_stack.last().unwrap().kind == ContextKind::Method {
return Err(
self.error_unexpected(loc, "SyntaxError: class definition in method body.")
);
}
Ok(self.parse_class(false)?)
}
TokenKind::Reserved(Reserved::Module) => {
if self.context_stack.last().unwrap().kind == ContextKind::Method {
return Err(
self.error_unexpected(loc, "SyntaxError: class definition in method body.")
);
}
Ok(self.parse_class(true)?)
}
TokenKind::Reserved(Reserved::Return) => {
let tok = self.peek_no_term()?;
// TODO: This is not correct.
if tok.is_term()
|| tok.kind == TokenKind::Reserved(Reserved::Unless)
|| tok.kind == TokenKind::Reserved(Reserved::If)
|| tok.check_stmt_end()
{
let val = Node::new_nil(loc);
return Ok(Node::new_return(val, loc));
};
let val = self.parse_arg()?;
let ret_loc = val.loc();
if self.consume_punct_no_term(Punct::Comma)? {
let mut vec = vec![val, self.parse_arg()?];
while self.consume_punct_no_term(Punct::Comma)? {
vec.push(self.parse_arg()?);
}
vec.reverse();
let val = Node::new_array(vec, ret_loc);
Ok(Node::new_return(val, loc))
} else {
Ok(Node::new_return(val, loc))
}
}
TokenKind::Reserved(Reserved::Break) => {
let tok = self.peek_no_term()?;
// TODO: This is not correct.
if tok.is_term()
|| tok.kind == TokenKind::Reserved(Reserved::Unless)
|| tok.kind == TokenKind::Reserved(Reserved::If)
|| tok.check_stmt_end()
{
let val = Node::new_nil(loc);
return Ok(Node::new_break(val, loc));
};
let val = self.parse_arg()?;
let ret_loc = val.loc();
if self.consume_punct_no_term(Punct::Comma)? {
let mut vec = vec![val, self.parse_arg()?];
while self.consume_punct_no_term(Punct::Comma)? {
vec.push(self.parse_arg()?);
}
vec.reverse();
let val = Node::new_array(vec, ret_loc);
Ok(Node::new_break(val, loc))
} else {
Ok(Node::new_break(val, loc))
}
}
TokenKind::Reserved(Reserved::Next) => {
let tok = self.peek_no_term()?;
// TODO: This is not correct.
if tok.is_term()
|| tok.kind == TokenKind::Reserved(Reserved::Unless)
|| tok.kind == TokenKind::Reserved(Reserved::If)
|| tok.check_stmt_end()
{
let val = Node::new_nil(loc);
return Ok(Node::new_next(val, loc));
};
let val = self.parse_arg()?;
let ret_loc = val.loc();
if self.consume_punct_no_term(Punct::Comma)? {
let mut vec = vec![val, self.parse_arg()?];
while self.consume_punct_no_term(Punct::Comma)? {
vec.push(self.parse_arg()?);
}
vec.reverse();
let val = Node::new_array(vec, ret_loc);
Ok(Node::new_next(val, loc))
} else {
Ok(Node::new_next(val, loc))
}
}
TokenKind::Reserved(Reserved::True) => Ok(Node::new_bool(true, loc)),
TokenKind::Reserved(Reserved::False) => Ok(Node::new_bool(false, loc)),
TokenKind::Reserved(Reserved::Nil) => Ok(Node::new_nil(loc)),
TokenKind::Reserved(Reserved::Self_) => Ok(Node::new_self(loc)),
TokenKind::Reserved(Reserved::Begin) => Ok(self.parse_begin()?),
TokenKind::EOF => return Err(self.error_eof(loc)),
_ => {
return Err(self.error_unexpected(loc, format!("Unexpected token: {:?}", tok.kind)))
}
}
}
fn is_command_(&mut self) -> Result<bool, RubyError> {
let tok = self.peek_no_term()?;
match tok.kind {
TokenKind::Ident(_, _, _)
| TokenKind::InstanceVar(_)
| TokenKind::Const(_, _, _)
| TokenKind::NumLit(_)
| TokenKind::FloatLit(_)
| TokenKind::StringLit(_)
| TokenKind::OpenString(_) => Ok(true),
TokenKind::Punct(p) => match p {
Punct::LParen
| Punct::LBracket
| Punct::Colon
| Punct::Scope
| Punct::Arrow => Ok(true),
_ => Ok(false),
},
TokenKind::Reserved(r) => match r {
Reserved::False | Reserved::Nil | Reserved::True | Reserved::Self_=> Ok(true),
_ => Ok(false),
},
_ => Ok(false),
}
}
fn parse_string_literal(&mut self, s: &str) -> Result<Node, RubyError> {
let loc = self.prev_loc();
let mut s = s.to_string();
while let TokenKind::StringLit(next_s) = self.peek_no_term()?.kind {
self.get()?;
s = format!("{}{}", s, next_s);
}
Ok(Node::new_string(s, loc))
}
fn parse_interporated_string_literal(&mut self, s: &str) -> Result<Node, RubyError> {
let start_loc = self.prev_loc();
let mut nodes = vec![Node::new_string(s.to_string(), start_loc)];
loop {
match self.peek()?.kind {
TokenKind::CloseString(s) => {
let end_loc = self.loc();
nodes.push(Node::new_string(s.clone(), end_loc));
self.get()?;
return Ok(Node::new_interporated_string(
nodes,
start_loc.merge(end_loc),
));
}
TokenKind::InterString(s) => {
nodes.push(Node::new_string(s.clone(), self.loc()));
self.get()?;
}
TokenKind::OpenString(s) => {
let s = s.clone();
self.get()?;
self.parse_interporated_string_literal(&s)?;
}
TokenKind::EOF => {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Unexpectd EOF."));
}
_ => {
nodes.push(self.parse_comp_stmt()?);
}
}
}
}
fn parse_regexp(&mut self) -> Result<Node, RubyError> {
let tok = self.lexer.lex_regexp()?;
let mut nodes = match tok.kind {
TokenKind::StringLit(s) => {
return Ok(Node::new_regexp(
vec![Node::new_string(s, tok.loc)],
tok.loc,
));
}
TokenKind::OpenRegex(s) => vec![Node::new_string(s.clone(), tok.loc)],
_ => panic!(),
};
loop {
match self.peek()?.kind {
TokenKind::CloseString(s) => {
self.get()?;
let end_loc = self.prev_loc();
nodes.push(Node::new_string(s.clone(), end_loc));
return Ok(Node::new_regexp(nodes, tok.loc.merge(end_loc)));
}
TokenKind::InterString(s) => {
self.get()?;
nodes.push(Node::new_string(s.clone(), self.prev_loc()));
}
TokenKind::EOF => {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Unexpectd EOF."));
}
_ => {
nodes.push(self.parse_comp_stmt()?);
}
}
}
}
fn parse_percent_notation(&mut self) -> Result<Node, RubyError> {
let tok = self.lexer.lex_percent_notation()?;
let loc = tok.loc;
if let TokenKind::PercentNotation(_kind, content) = tok.kind {
let ary = content
.split(' ')
.map(|x| Node::new_string(x.to_string(), loc))
.rev()
.collect();
Ok(Node::new_array(ary, tok.loc))
} else {
panic!();
}
}
fn parse_hash_literal(&mut self) -> Result<Node, RubyError> {
let mut kvp = vec![];
let loc = self.prev_loc();
loop {
if self.consume_punct(Punct::RBrace)? {
return Ok(Node::new_hash(kvp, loc.merge(self.prev_loc())));
};
let ident_loc = self.loc();
let mut symbol_flag = false;
let key = if self.peek()?.can_be_symbol() {
self.save_state();
let token = self.get()?.clone();
let ident = self.token_as_symbol(&token);
if self.consume_punct(Punct::Colon)? {
self.discard_state();
let id = self.get_ident_id(ident);
symbol_flag = true;
Node::new_symbol(id, ident_loc)
} else {
self.restore_state();
self.parse_arg()?
}
} else {
self.parse_arg()?
};
if !symbol_flag {
self.expect_punct(Punct::FatArrow)?
};
let value = self.parse_arg()?;
kvp.push((key, value));
if !self.consume_punct(Punct::Comma)? {
break;
};
}
self.expect_punct(Punct::RBrace)?;
Ok(Node::new_hash(kvp, loc.merge(self.prev_loc())))
}
fn parse_if_then(&mut self) -> Result<Node, RubyError> {
// if EXPR THEN
// COMPSTMT
// (elsif EXPR THEN COMPSTMT)*
// [else COMPSTMT]
// end
let loc = self.prev_loc();
let cond = self.parse_expr()?;
self.parse_then()?;
let then_ = self.parse_comp_stmt()?;
let else_ = if self.consume_reserved(Reserved::Elsif)? {
self.parse_if_then()?
} else if self.consume_reserved(Reserved::Else)? {
self.parse_comp_stmt()?
} else {
Node::new_comp_stmt(vec![], self.loc())
};
Ok(Node::new_if(cond, then_, else_, loc))
}
fn parse_unless(&mut self) -> Result<Node, RubyError> {
// unless EXPR THEN
// COMPSTMT
// [else COMPSTMT]
// end
let loc = self.prev_loc();
let cond = self.parse_expr()?;
self.parse_then()?;
let then_ = self.parse_comp_stmt()?;
let else_ = if self.consume_reserved(Reserved::Else)? {
self.parse_comp_stmt()?
} else {
Node::new_comp_stmt(vec![], self.loc())
};
Ok(Node::new_if(cond, else_, then_, loc))
}
fn parse_then(&mut self) -> Result<(), RubyError> {
if self.consume_term()? {
self.consume_reserved(Reserved::Then)?;
return Ok(());
}
self.expect_reserved(Reserved::Then)?;
Ok(())
}
fn parse_do(&mut self) -> Result<(), RubyError> {
if self.consume_term()? {
return Ok(());
}
self.expect_reserved(Reserved::Do)?;
Ok(())
}
fn parse_def(&mut self) -> Result<Node, RubyError> {
// def FNAME ARGDECL
// COMPSTMT
// [rescue [ARGS] [`=>' LHS] THEN COMPSTMT]+
// [else COMPSTMT]
// [ensure COMPSTMT]
// end
let mut is_singleton_method = None;
let tok = self.get()?;
let id = match tok.kind {
TokenKind::Reserved(Reserved::Self_) => {
is_singleton_method = Some(Node::new_self(tok.loc()));
self.expect_punct(Punct::Dot)?;
self.expect_ident()?
}
TokenKind::Reserved(r) => {
let string = self.lexer.get_string_from_reserved(r).to_owned();
self.get_ident_id(string)
}
TokenKind::Ident(name, has_suffix, _) => {
if has_suffix {
match self.peek_no_term()?.kind {
TokenKind::Punct(Punct::Assign) => {
self.get()?;
self.get_ident_id(name + "=")
}
_ => self.get_ident_id(name),
}
} else {
self.get_ident_id(name)
}
}
TokenKind::Punct(Punct::Plus) => self.get_ident_id("+"),
TokenKind::Punct(Punct::Minus) => self.get_ident_id("-"),
TokenKind::Punct(Punct::Mul) => self.get_ident_id("*"),
TokenKind::Punct(Punct::LBracket) => {
if self.consume_punct_no_term(Punct::RBracket)? {
if self.consume_punct_no_term(Punct::Assign)? {
self.get_ident_id("[]=")
} else {
self.get_ident_id("[]")
}
} else {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expected `]'"));
}
}
_ => {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expected identifier or operator."));
}
};
self.context_stack.push(Context::new_method());
let args = self.parse_def_params()?;
let body = self.parse_begin()?;
let lvar = self.context_stack.pop().unwrap().lvar;
match is_singleton_method {
Some(singleton) => Ok(Node::new_singleton_method_decl(singleton, id, args, body, lvar)),
None => Ok(Node::new_method_decl(id, args, body, lvar)),
}
}
/// Parse parameters.
/// required, optional = defaule, *rest, post_required, kw: default, **rest_kw, &block
fn parse_params(&mut self, terminator:TokenKind) -> Result<Vec<Node>, RubyError> {
#[derive(Debug, Clone, PartialEq, PartialOrd)]
enum Kind {
Reqired,
Optional,
Rest,
PostReq,
KeyWord,
KWRest,
}
let mut args = vec![];
let mut state = Kind::Reqired;
loop {
let mut loc = self.loc();
if self.consume_punct(Punct::BitAnd)? {
// Block param
let id = self.expect_ident()?;
loc = loc.merge(self.prev_loc());
args.push(Node::new_block_param(id, loc));
self.new_block_param(id, loc)?;
break;
} else if self.consume_punct(Punct::Mul)? {
// Splat(Rest) param
let id = self.expect_ident()?;
loc = loc.merge(self.prev_loc());
if state >= Kind::Rest {
return Err(self
.error_unexpected(loc, "Splat parameter is not allowed in ths position."));
} else {
state = Kind::Rest;
}
args.push(Node::new_splat_param(id, loc));
self.new_param(id, self.prev_loc())?;
} else {
let id = self.expect_ident()?;
if self.consume_punct(Punct::Assign)? {
// Optional param
let default = self.parse_arg()?;
loc = loc.merge(self.prev_loc());
match state {
Kind::Reqired => state = Kind::Optional,
Kind::Optional => {}
_ => {
return Err(self.error_unexpected(
loc,
"Optional parameter is not allowed in ths position.",
))
}
};
args.push(Node::new_optional_param(id, default, loc));
self.new_param(id, loc)?;
} else if self.consume_punct_no_term(Punct::Colon)? {
// Keyword param
let next = self.peek_no_term()?.kind;
let default = if next == TokenKind::Punct(Punct::Comma) || next == terminator || next == TokenKind::LineTerm {
None
} else {
Some(self.parse_arg()?)
};
loc = loc.merge(self.prev_loc());
if state == Kind::KWRest {
return Err(self.error_unexpected(
loc,
"Keyword parameter is not allowed in ths position.",
));
} else {
state = Kind::KeyWord;
};
args.push(Node::new_keyword_param(id, default, loc));
self.new_param(id, loc)?;
} else {
// Required param
loc = self.prev_loc();
match state {
Kind::Reqired => {
args.push(Node::new_param(id, loc));
self.new_param(id, loc)?;
}
Kind::PostReq | Kind::Optional | Kind::Rest => {
args.push(Node::new_post_param(id, loc));
self.new_param(id, loc)?;
state = Kind::PostReq;
}
_ => {
return Err(self.error_unexpected(
loc,
"Required parameter is not allowed in ths position.",
))
}
}
};
}
if !self.consume_punct_no_term(Punct::Comma)? {
break;
}
};
Ok(args)
}
// ( )
// ( ident [, ident]* )
fn parse_def_params(&mut self) -> Result<Vec<Node>, RubyError> {
if self.consume_term()? {
return Ok(vec![]);
};
let paren_flag = self.consume_punct(Punct::LParen)?;
if paren_flag && self.consume_punct(Punct::RParen)? {
if !self.consume_term()? {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expect terminator"));
}
return Ok(vec![]);
}
let args = self.parse_params(TokenKind::Punct(Punct::RParen))?;
if paren_flag {
self.expect_punct(Punct::RParen)?
};
if !self.consume_term()? {
let loc = self.loc();
return Err(self.error_unexpected(loc, "Expect terminator."));
}
Ok(args)
}
fn parse_class(&mut self, is_module: bool) -> Result<Node, RubyError> {
// class identifier [`<' EXPR]
// COMPSTMT
// end
let loc = self.prev_loc();
let name = match &self.get()?.kind {
TokenKind::Const(s, _, _) => s.clone(),
_ => return Err(self.error_unexpected(loc, "Class/Module name must be CONSTANT.")),
};
let superclass = if self.consume_punct_no_term(Punct::Lt)? {
if is_module {
return Err(self.error_unexpected(self.prev_loc(), "Unexpected '<'."));
};
self.parse_expr()?
} else {
let loc = loc.merge(self.prev_loc());
Node::new_nil(loc)
};
let loc = loc.merge(self.prev_loc());
self.consume_term()?;
let id = self.get_ident_id(&name);
self.context_stack.push(Context::new_class(None));
let body = self.parse_begin()?;
let lvar = self.context_stack.pop().unwrap().lvar;
#[cfg(feature = "verbose")]
eprintln!(
"Parsed {} name:{}",
if is_module { "module" } else { "class" },
name
);
Ok(Node::new_class_decl(
id, superclass, body, lvar, is_module, loc,
))
}
fn parse_op_definable(&mut self, punct: &Punct) -> Result<IdentId, RubyError> {
match punct {
Punct::LBracket => {
if self.consume_punct_no_term(Punct::RBracket)? {
if self.consume_punct_no_term(Punct::Assign)? {
Ok(self.get_ident_id("[]="))
} else {
Ok(self.get_ident_id("[]"))
}
} else {
let loc = self.loc();
Err(self.error_unexpected(loc, "Invalid symbol literal."))
}
}
_ => Err(self.error_unexpected(self.prev_loc(), "Invalid symbol literal.")),
}
}
fn parse_begin(&mut self) -> Result<Node, RubyError> {
let body = self.parse_comp_stmt()?;
if self.consume_reserved(Reserved::Rescue)? {
if self.consume_const()? {}
if self.consume_punct_no_term(Punct::FatArrow)? {
self.expect_ident()?;
}
self.parse_comp_stmt()?;
}
let ensure = if self.consume_reserved(Reserved::Ensure)? {
self.parse_comp_stmt()?
} else {
Node::new_nop(body.loc())
};
self.expect_reserved(Reserved::End)?;
let loc = body.loc();
Ok(Node::new_begin(
body,
vec![],
Node::new_nop(loc),
ensure,
loc,
))
}
}
|
use rocket::config::{ Config, Environment, LoggingLevel };
use dotenv;
fn get_env(key: &str) -> String {
dotenv::var(key).unwrap()
}
fn get_stage() -> Environment {
match get_env("ENV_STAGE").as_str() {
"prod" => Environment::Production,
"dev" => Environment::Development,
"staging" => Environment::Staging,
_ => Environment::Development
}
}
fn get_logging_level() -> LoggingLevel {
match get_env("API_LOGGING").as_str() {
"critical" => LoggingLevel::Critical,
"normal" => LoggingLevel::Normal,
"debug" => LoggingLevel::Debug,
"none" => LoggingLevel::Off,
_ => LoggingLevel::Off
}
}
pub fn get_config() -> Config {
let config = Config::build(get_stage())
.address(get_env("API_IP").as_str())
.port(get_env("BACKEND_PORT").parse::<u16>().unwrap())
.log_level(get_logging_level())
.unwrap();
config
}
|
use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::ops::Sub;
use super::chunk::Chunk;
use super::compiler::InterpretResult;
use super::opcode::OpCode;
use super::value::Value;
struct Vm<'a> {
chunk: Option<&'a Chunk>,
ip: Option<std::iter::Peekable<std::iter::Enumerate<std::slice::Iter<'a, u8>>>>,
stack: Vec<Value>,
trace_execution: bool,
globals: BTreeMap<String, Value>,
}
macro_rules! binary_op {
($self:expr, $valtype:tt, $op:tt) => {
if let Value::Number(b) = $self.peek(0) {
if let Value::Number(a) = $self.peek(1) {
$self.stack.pop().unwrap();
$self.stack.pop().unwrap();
$self.stack.push(Value::$valtype(a $op b));
} else {
$self.runtime_error("Operands must be numbers.");
return InterpretResult::RuntimeError;
}
} else {
$self.runtime_error("Operands must be numbers.");
return InterpretResult::RuntimeError;
}
}
}
pub fn interpret(chunk: &Chunk, trace: bool) -> InterpretResult {
let mut vm = Vm {
chunk: Some(chunk),
ip: Some(chunk.code.iter().enumerate().peekable()),
stack: Vec::new(),
trace_execution: trace,
globals: BTreeMap::new(),
};
vm.run()
}
impl<'a> Vm<'a> {
fn run(&mut self) -> InterpretResult {
if self.trace_execution {
self.chunk.unwrap().disassemble("program");
}
loop {
if self.trace_execution {
print!(" ");
for val in self.stack.iter().rev() {
print!("[ {:?} ]", val);
}
println!("");
self.chunk.unwrap().disassemble_instruction(
self.ip.as_mut().map(|x| x.peek()).unwrap().unwrap().0,
);
}
let instruction = OpCode::try_from(self.read_byte()).unwrap();
match instruction {
OpCode::Constant => {
let constant = self.read_constant();
self.stack.push(constant.clone());
}
OpCode::Nil => {
self.stack.push(Value::Nil);
}
OpCode::True => {
self.stack.push(Value::Boolean(true));
}
OpCode::False => {
self.stack.push(Value::Boolean(false));
}
OpCode::Pop => {
self.stack.pop().unwrap();
}
OpCode::GetLocal => {
let slot = self.read_byte();
self.stack.push(self.stack[slot as usize].clone());
}
OpCode::SetLocal => {
let slot = self.read_byte();
self.stack[slot as usize] = self.peek(0);
}
OpCode::GetGlobal => {
if let Value::String(s) = self.read_constant() {
match self.globals.get(&s) {
None => {
self.runtime_error(format!("Undefined variable '{}'.", s).as_str());
return InterpretResult::RuntimeError;
}
Some(v) => {
self.stack.push(v.clone());
}
}
}
}
OpCode::DefineGlobal => {
if let Value::String(s) = self.read_constant() {
self.globals.insert(s, self.stack.pop().unwrap());
}
}
OpCode::SetGlobal => {
if let Value::String(s) = self.read_constant() {
if let None = self.globals.insert(s.clone(), self.peek(0)) {
self.globals.remove(&s).unwrap();
self.runtime_error(format!("Undefined variable '{}'.", s).as_str());
return InterpretResult::RuntimeError;
}
}
}
OpCode::Equal => {
let b = self.stack.pop().unwrap();
let a = self.stack.pop().unwrap();
self.stack.push(Value::Boolean(a.equals(&b)));
}
OpCode::Greater => {
binary_op!(self, Boolean, >);
}
OpCode::Less => {
binary_op!(self, Boolean, <);
}
OpCode::Add => {
let bv = self.peek(0);
let av = self.peek(1);
match av {
Value::String(mut a) => match bv {
Value::String(b) => {
self.stack.pop();
self.stack.pop();
a.push_str(b.as_str());
self.stack.push(Value::String(a));
}
_ => {
self.runtime_error("Operands must be two numbers or two strings.");
return InterpretResult::RuntimeError;
}
},
Value::Number(a) => match bv {
Value::Number(b) => {
self.stack.pop();
self.stack.pop();
self.stack.push(Value::Number(a + b));
}
_ => {
self.runtime_error("Operands must be two numbers or two strings.");
return InterpretResult::RuntimeError;
}
},
_ => {
self.runtime_error("Operands must be two numbers or two strings.");
return InterpretResult::RuntimeError;
}
}
}
OpCode::Subtract => {
binary_op!(self, Number, -);
}
OpCode::Multiply => {
binary_op!(self, Number, *);
}
OpCode::Divide => {
binary_op!(self, Number, /);
}
OpCode::Not => {
let val = self.stack.pop().unwrap().is_falsey();
self.stack.push(Value::Boolean(val));
}
OpCode::Negate => match self.peek(0) {
Value::Number(x) => {
self.stack.pop().unwrap();
self.stack.push(Value::Number(-x));
}
_ => {
self.runtime_error("Operand must be a number.");
return InterpretResult::RuntimeError;
}
},
OpCode::Print => {
println!("{}", self.stack.pop().unwrap());
}
OpCode::Jump => {
let offset = self.read_short() as usize;
self.ip.as_mut().map(|x| x.nth(offset.sub(1)));
}
OpCode::JumpIfFalse => {
let offset = self.read_short() as usize;
if self.peek(0).is_falsey() {
self.ip.as_mut().map(|x| x.nth(offset.sub(1)));
}
}
OpCode::Loop => {
let offset = self.read_short() as usize;
let ip = self.ip.as_mut().unwrap().peek().unwrap().0;
self.ip = Some(self.chunk.unwrap().code.iter().enumerate().peekable());
self.ip.as_mut().map(|x| x.nth(ip.sub(offset).sub(1)));
}
OpCode::Return => {
return InterpretResult::Ok;
}
}
}
}
fn read_byte(&mut self) -> u8 {
*self.ip.as_mut().map(|x| x.next()).unwrap().unwrap().1
}
fn read_short(&mut self) -> u16 {
let hi = self.read_byte();
let lo = self.read_byte();
(hi as u16) << 8 | (lo as u16)
}
fn read_constant(&mut self) -> Value {
self.chunk.unwrap().constant(self.read_byte() as usize)
}
fn peek(&self, distance: usize) -> Value {
self.stack
.get(self.stack.len() - 1 - distance)
.unwrap()
.clone()
}
fn current_line(&mut self) -> usize {
self.chunk.map_or(0, |chunk| chunk.line(self.ip.as_mut().map_or(0, |x| x.peek().map_or(0, |x| x.0))))
}
fn runtime_error(&mut self, msg: &str) {
eprintln!("{}", msg);
eprintln!("[line {}] in script", self.current_line());
self.reset_stack();
}
fn reset_stack(&mut self) {
self.stack.clear();
}
}
|
use sudo_test::{Command, Env, User};
use crate::{Result, USERNAME};
#[test]
fn sets_the_working_directory_of_the_executed_command() -> Result<()> {
let expected_path = "/root";
let env = Env(format!("ALL ALL=(ALL:ALL) CWD={expected_path} ALL")).build()?;
let stdout = Command::new("sh")
.args(["-c", "cd /; sudo pwd"])
.output(&env)?
.stdout()?;
assert_eq!(expected_path, stdout);
Ok(())
}
#[test]
fn glob_has_no_effect_on_its_own() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=* ALL").build()?;
let expected_path = "/";
let stdout = Command::new("sh")
.arg("-c")
.arg(format!("cd {expected_path}; sudo pwd"))
.output(&env)?
.stdout()?;
assert_eq!(expected_path, stdout);
Ok(())
}
#[test]
fn non_absolute_path_is_rejected() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=usr ALL").build()?;
let output = Command::new("sh")
.args(["-c", "cd /; sudo pwd"])
.output(&env)?;
assert!(!output.status().success());
assert_eq!(Some(1), output.status().code());
let diagnostic = if sudo_test::is_original_sudo() {
"values for \"CWD\" must start with a '/', '~', or '*'"
} else {
"expected directory or '*'"
};
assert_contains!(output.stderr(), diagnostic);
Ok(())
}
#[test]
fn dot_slash_is_rejected() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=./usr ALL").build()?;
let output = Command::new("sh")
.args(["-c", "cd /; sudo pwd"])
.output(&env)?;
assert!(!output.status().success());
assert_eq!(Some(1), output.status().code());
let diagnostic = if sudo_test::is_original_sudo() {
"values for \"CWD\" must start with a '/', '~', or '*'"
} else {
"expected directory or '*'"
};
assert_contains!(output.stderr(), diagnostic);
Ok(())
}
#[test]
fn tilde_when_target_user_is_root() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=~ ALL").build()?;
let stdout = Command::new("sh")
.args(["-c", "cd /; sudo pwd"])
.output(&env)?
.stdout()?;
assert_eq!("/root", stdout);
Ok(())
}
#[test]
fn tilde_when_target_user_is_regular_user() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=~ NOPASSWD: ALL")
.user(User(USERNAME).create_home_directory())
.build()?;
let stdout = Command::new("sh")
.arg("-c")
.arg(format!("cd /; sudo -u {USERNAME} pwd"))
.output(&env)?
.stdout()?;
assert_eq!(format!("/home/{USERNAME}"), stdout);
Ok(())
}
#[test]
fn tilde_username() -> Result<()> {
let env = Env(format!("ALL ALL=(ALL:ALL) CWD=~{USERNAME} NOPASSWD: ALL"))
.user(User(USERNAME).create_home_directory())
.build()?;
for target_user in ["root", USERNAME] {
let stdout = Command::new("sh")
.arg("-c")
.arg(format!("cd /; sudo -u {target_user} pwd"))
.output(&env)?
.stdout()?;
assert_eq!(format!("/home/{USERNAME}"), stdout);
}
Ok(())
}
#[test]
fn path_does_not_exist() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=/path/to/nowhere NOPASSWD: ALL").build()?;
let output = Command::new("sh")
.arg("-c")
.arg("cd /; sudo pwd")
.output(&env)?;
assert!(!output.status().success());
assert_eq!(Some(1), output.status().code());
assert_contains!(
output.stderr(),
"sudo: unable to change directory to /path/to/nowhere: No such file or directory"
);
Ok(())
}
#[test]
fn path_is_file() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=/dev/null NOPASSWD: ALL").build()?;
let output = Command::new("sh")
.arg("-c")
.arg("cd /; sudo pwd")
.output(&env)?;
assert!(!output.status().success());
assert_eq!(Some(1), output.status().code());
assert_contains!(
output.stderr(),
"sudo: unable to change directory to /dev/null: Not a directory"
);
Ok(())
}
#[test]
fn target_user_has_insufficient_permissions() -> Result<()> {
let env = Env("ALL ALL=(ALL:ALL) CWD=/root NOPASSWD: ALL")
.user(USERNAME)
.build()?;
let output = Command::new("sh")
.arg("-c")
.arg(format!("cd /; sudo -u {USERNAME} pwd"))
.output(&env)?;
assert!(!output.status().success());
assert_eq!(Some(1), output.status().code());
assert_contains!(
output.stderr(),
"sudo: unable to change directory to /root: Permission denied"
);
Ok(())
}
|
use git_lfs_spec::transfer::custom;
#[derive(Display, Debug)]
pub enum CliError {
#[display(fmt = "{}", _0)]
SerdeJsonError(serde_json::error::Error),
#[display(fmt = "{}", _0)]
Io(std::io::Error),
#[display(fmt = "Input was an unexpected event {:?}", _0)]
UnexpectedEvent(custom::Event),
// TODO: Actix developers made the Actix error !Send + !Sync. Once this is handled in rust-ipfs-api, can restore the error here.
#[display(fmt = "Error with a request to the IPFS API {:?}", _0)]
IpfsApiError(String),
}
|
use std::path::PathBuf;
use anyhow::anyhow;
use structopt::StructOpt;
use flamegraph::Workload;
#[derive(Debug, StructOpt)]
#[structopt(
setting = structopt::clap::AppSettings::TrailingVarArg
)]
struct Opt {
/// Profile a running process by pid
#[structopt(short = "p", long = "pid")]
pid: Option<u32>,
/// Generate shell completions for the given shell.
#[structopt(long = "completions", conflicts_with = "pid")]
completions: Option<structopt::clap::Shell>,
#[structopt(flatten)]
graph: flamegraph::Options,
#[structopt(parse(from_os_str), long = "perfdata", conflicts_with = "pid")]
perf_file: Option<PathBuf>,
trailing_arguments: Vec<String>,
}
fn main() -> anyhow::Result<()> {
let opt = Opt::from_args();
if let Some(shell) = opt.completions {
return match opt.trailing_arguments.is_empty() {
true => {
Opt::clap().gen_completions_to("flamegraph", shell, &mut std::io::stdout().lock());
Ok(())
}
false => {
return Err(anyhow!(
"command arguments cannot be used with --completions <completions>"
))
}
};
}
opt.graph.check()?;
let workload = if let Some(perf_file) = opt.perf_file {
let path = perf_file.to_str().unwrap();
Workload::ReadPerf(path.to_string())
} else {
match (opt.pid, opt.trailing_arguments.is_empty()) {
(Some(p), true) => Workload::Pid(p),
(None, false) => Workload::Command(opt.trailing_arguments.clone()),
(Some(_), false) => return Err(anyhow!("cannot pass in command with --pid")),
(None, true) => return Err(anyhow!("no workload given to generate a flamegraph for")),
}
};
flamegraph::generate_flamegraph_for_workload(workload, opt.graph)
}
|
use rocket::serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(crate = "rocket::serde")]
pub struct Album {
pub id: u32,
pub title: String,
pub artist: String,
pub price: f32,
}
pub fn dummy() -> Vec<Album> {
let albums = vec![
Album {
id: 1,
title: String::from("Blue Train"),
artist: String::from("John Coltrane"),
price: 56.99,
},
Album {
id: 2,
title: String::from("Jeru"),
artist: String::from("Gerry Mulligan"),
price: 17.99,
},
Album {
id: 3,
title: String::from("Sarah Vaughan and Clifford Brown"),
artist: String::from("Sarah Vaughan"),
price: 39.99,
},
];
albums
}
|
use std::fmt;
use serde::Serialize;
/// Branch types detected by the IL.
/// Sentinels are used internally to resolve indirect call/jump and ret destinations.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub enum Branch {
DirectCall {
site_pc: u64,
dst_pc: u64,
},
DirectJump {
site_pc: u64,
dst_pc: u64,
taken: bool,
},
IndirectCall {
site_pc: u64,
dst_pc: u64,
reg_used: String,
},
IndirectJump {
site_pc: u64,
dst_pc: u64,
reg_used: String,
},
CallSentinel {
site_pc: u64,
seq_num: usize,
reg: String,
},
IndirectJumpSentinel {
site_pc: u64,
seq_num: usize,
reg: String,
},
DirectJumpSentinel {
site_pc: u64,
seq_num: usize,
},
ReturnSentinel {
site_pc: u64,
seq_num: usize,
},
Return {
site_pc: u64,
dst_pc: u64,
},
}
impl fmt::Display for Branch {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self {
Branch::DirectCall { site_pc, dst_pc } => {
write!(f, "DirectCall@0x{:016x} -> 0x{:016x}", site_pc, dst_pc)
}
Branch::DirectJump {
site_pc,
dst_pc,
taken,
} => {
write!(
f,
"DirectJump@0x{:016x} -> 0x{:016x} [taken: {}]",
site_pc, dst_pc, taken
)
}
Branch::IndirectCall {
site_pc,
dst_pc,
reg_used,
} => write!(
f,
"IndirectCall@0x{:016x} -> 0x{:016x} [{}]",
site_pc, dst_pc, reg_used
),
Branch::IndirectJump {
site_pc,
dst_pc,
reg_used,
} => write!(
f,
"IndirectJump@0x{:016x} -> 0x{:016x} [{}]",
site_pc, dst_pc, reg_used
),
Branch::CallSentinel {
site_pc,
seq_num,
reg,
} => write!(
f,
"CallSentinel@0x{:016x} [{}], seq_num: {}",
site_pc, reg, seq_num
),
Branch::IndirectJumpSentinel {
site_pc,
seq_num,
reg,
} => write!(
f,
"IndirectJumpSentinel@0x{:016x} [{}], seq_num: {}",
site_pc, reg, seq_num
),
Branch::DirectJumpSentinel { site_pc, seq_num } => {
write!(
f,
"DirectJumpSentinel@0x{:016x}, seq_num: {}",
site_pc, seq_num
)
}
Branch::ReturnSentinel { site_pc, seq_num } => {
write!(f, "ReturnSentinel@0x{:016x}, seq_num: {}", site_pc, seq_num)
}
Branch::Return { site_pc, dst_pc } => {
write!(f, "Return@0x{:016x} -> 0x{:016x}", site_pc, dst_pc)
}
}
}
}
|
//! Error types.
#[derive(Debug)]
pub enum Error {
/// Failure parsing response from HAProxy.
ParseFailure,
/// HAProxy was not able to find an item by the ID provided.
UnknownId,
/// Command did not have enough parameters.
MissingParameters,
/// Error encountered while performing IO.
IoError(std::io::Error),
}
impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
Error::IoError(err)
}
}
impl From<std::num::ParseIntError> for Error {
fn from(_err: std::num::ParseIntError) -> Self {
Error::ParseFailure
}
}
|
#[macro_use]
extern crate serde_derive;
extern crate serde_bytes;
extern crate crypto_hash;
extern crate serde;
extern crate bincode;
mod block;
mod node;
mod chain;
fn main() {
let mut node = node::Node::new();
node.mine();
}
|
/* Network Management */
/* NMT Can Only Be Used As A Master */
use super::CANOpen;
use crate::stm32hal::{can::CanMsg, common};
use crate::driver::can::canopen;
/* Local Const To Form The Message */
const START: u8 = 0x01; // Start Remote Node
const STOP: u8 = 0x02; // Stop Remote Node
const PREOP: u8 = 0x80; // Pre-Operational Remote Node
const RESET: u8 = 0x81; // Reset Remote Node
const COMMS: u8 = 0x82; // Reset Communication Remote Node
const DLC_NMT: u32 = 0x02; // NMT Standard DLC
const DLC_HB: u32 = 0x01; // NMT Heartbeat DLC
const DLC_RTR: u32 = 0x00; // NMT Heartbeat RTR
const CO_IDE: bool = false; // CANOpen supports 1 -127 nodes
const HB_MASK: u32 = common::MASK_1_BIT;
const MASK: u32 = common::MASK_7_BIT;
const SHIFT: u32 = 7;
pub const HB: u32 = 0x0700; // Heartbeat / Node Guarding COB-ID
pub const NMT_NODE: u32 = 0x0000; // All NMT Command Messages Will Not Have A Node In ID -> COB-ID = 0
impl CANOpen {
/* Start Remote Node */
pub fn nmt_write_start(&self, msg: &mut CanMsg) {
msg.set_id(NMT_NODE, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_NMT);
msg.set_data([START, self.node as u8 , 0, 0, 0, 0, 0, 0]);
}
/* Stop Remote Node */
pub fn nmt_write_stop(&self, msg: &mut CanMsg) {
msg.set_id(NMT_NODE, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_NMT);
msg.set_data([STOP, self.node as u8, 0, 0, 0, 0, 0, 0]);
}
/* Pre-Operational Remote Node */
pub fn nmt_write_preop(&self, msg: &mut CanMsg) {
msg.set_id(NMT_NODE, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_NMT);
msg.set_data([PREOP, self.node as u8, 0, 0, 0, 0, 0, 0]);
}
/* Reset Remote Node */
pub fn nmt_write_reset(&self, msg: &mut CanMsg) {
msg.set_id(NMT_NODE, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_NMT);
msg.set_data([RESET, self.node as u8, 0, 0, 0, 0, 0, 0]);
}
/* Reset Communication Remote Node */
pub fn nmt_write_comms(&self, msg: &mut CanMsg) {
msg.set_id(NMT_NODE, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_NMT);
msg.set_data([COMMS, self.node as u8, 0, 0, 0, 0, 0, 0]);
}
/* Heartbeat / Guarding Consumer */
pub fn nmt_read_heartbeat(&mut self, msg: &CanMsg) -> u8 {
let data = msg.get_data()[0];
if ((data >> SHIFT) & HB_MASK as u8) == 1 {
self.toggle = true;
} else {
self.toggle = false;
}
let state = data & MASK as u8;
self.state = canopen::canopen_state(state);
return data & MASK as u8;
}
/* Heartbeat Producer */
pub fn nmt_write_heartbeat(&self, msg: &mut CanMsg) {
msg.set_id(HB + self.node, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_HB);
msg.set_data([canopen::canopen_state_val(self.state), 0, 0, 0, 0, 0, 0, 0]);
}
/* Guarding */
/* Is A Client Server - Request Response Of Heartbeat, Can Be Used To read The State */
pub fn nmt_request_guarding(&self, msg: &mut CanMsg) {
msg.set_id(HB + self.node, CO_IDE);
msg.set_rtr();
msg.set_dlc(DLC_RTR);
msg.set_data([0, 0, 0, 0, 0, 0, 0, 0]);
}
/* Guarding */
/* Is a Client Server - This Is The Server Response Of Its Own State */
pub fn nmt_response_guarding(&mut self, msg: &mut CanMsg) {
let hb;
if self.toggle { // Generate a heartbeat signal for the 7 bit in the first byte of data
hb = 1 << SHIFT;
self.toggle = false;
} else {
hb = 0 << SHIFT;
self.toggle = true;
}
msg.set_id(HB + self.node, CO_IDE);
msg.clr_rtr();
msg.set_dlc(DLC_HB);
msg.set_data([canopen::canopen_state_val(self.state) | hb, 0, 0, 0, 0, 0, 0, 0]);
}
} |
use std::io::{stdout, Write};
use std::{thread, time};
use crossterm::{style, AlternateScreen, ClearType, Color, Crossterm, Result};
fn print_wait_screen() -> Result<()> {
let crossterm = Crossterm::new();
let terminal = crossterm.terminal();
let cursor = crossterm.cursor();
terminal.clear(ClearType::All)?;
cursor.hide()?;
cursor.goto(0, 0)?;
println!("Welcome to the wait screen.");
cursor.goto(0, 1)?;
println!("Please wait a few seconds until we arrive back at the main screen.");
cursor.goto(0, 2)?;
println!("Progress:");
cursor.goto(0, 3)?;
// print some progress example.
for i in 1..5 {
// print the current counter at the line of `Seconds to Go: {counter}`
cursor.goto(10, 2)?;
print!(
"{}",
style(format!("{} of the 5 items processed", i))
.with(Color::Red)
.on(Color::Blue)
);
stdout().flush()?;
// 1 second delay
thread::sleep(time::Duration::from_secs(1));
}
Ok(())
}
fn print_wait_screen_on_alternate_window() -> Result<()> {
// by passing in 'true' the alternate screen will be in raw modes.
let _alt = AlternateScreen::to_alternate(true)?;
print_wait_screen()
}
// cargo run --example raw_mode
fn main() -> Result<()> {
print_wait_screen_on_alternate_window()
}
|
use crate as mongodb;
// begin lambda connection example 1
use async_once::AsyncOnce;
use lambda_runtime::{service_fn, LambdaEvent};
use lazy_static::lazy_static;
use mongodb::{bson::doc, Client};
use serde_json::Value;
// Initialize a global static MongoDB Client.
//
// The client can be accessed as follows:
// let client = MONGODB_CLIENT.get().await;
lazy_static! {
static ref MONGODB_CLIENT: AsyncOnce<Client> = AsyncOnce::new(async {
let uri = std::env::var("MONGODB_URI")
.expect("MONGODB_URI must be set to the URI of the MongoDB deployment");
Client::with_uri_str(uri)
.await
.expect("Failed to create MongoDB Client")
});
}
// Runs a ping operation on the "db" database and returns the response.
async fn handler(_: LambdaEvent<Value>) -> Result<Value, lambda_runtime::Error> {
let client = MONGODB_CLIENT.get().await;
let response = client
.database("db")
.run_command(doc! { "ping": 1 }, None)
.await?;
let json = serde_json::to_value(response)?;
Ok(json)
}
#[tokio::main]
async fn main() -> Result<(), lambda_runtime::Error> {
let service = service_fn(handler);
lambda_runtime::run(service).await?;
Ok(())
}
// end lambda connection example 1
#[cfg_attr(feature = "tokio-runtime", tokio::test(flavor = "multi_thread"))]
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
async fn test_handler() {
if std::env::var("MONGODB_API_VERSION").is_ok() {
return;
}
if std::env::var("MONGODB_URI").is_err() {
std::env::set_var("MONGODB_URI", "mongodb://localhost:27017");
}
let event = LambdaEvent::new(Value::Null, Default::default());
handler(event).await.unwrap();
}
|
use htmldsl::attributes;
use htmldsl::elements;
use htmldsl::styles;
use htmldsl::units;
use htmldsl::TagRenderableIntoElement;
use crate::models;
use crate::html::shared;
pub fn page<'a>(games: Vec<models::Game>) -> elements::Body<'a> {
elements::Body::style_less(vec![
shared::index_link(),
shared::games_link(),
elements::Div::style_less(
games
.into_iter()
.map(|game| {
elements::A::style_less(
attributes::Href {
value: units::SourceValue::new(format!("/games/{}", game.id)),
},
vec![htmldsl::text(format!("game: {}", game.id))],
)
.into_element()
})
.chain(
vec![elements::Form {
formmethod: attributes::Formmethod {
inner: units::FormmethodValue::Post,
},
action: Some(attributes::Action {
value: units::SourceValue::new("/games".into()),
}),
inputs: Vec::new(),
button: elements::Button::style_less(htmldsl::text("add map game")),
styles: attributes::StyleAttr::new(vec![&styles::Display::Inline]),
}
.into_element()]
.into_iter(),
)
.collect(),
)
.into_element(),
])
}
|
extern crate cupi;
use cupi::{CuPi, delay_ms, DigitalWrite};
fn main() {
let cupi = CuPi::new().unwrap();
let mut pinout = cupi.pin(0).unwrap().high().output();
//let mut pin = cupi.pin_sys(0).unwrap();
//pin.export().unwrap();
//let mut pinout = pin.output().unwrap();
for _ in 0..20 {
pinout.high().unwrap();
delay_ms(600);
pinout.low().unwrap();
delay_ms(600);
}
}
|
use std::fmt::Debug;
use error::Result;
use super::Context;
/// Any object (tag/block) that can be rendered by liquid must implement this trait.
pub trait Renderable: Send + Sync + Debug {
/// Renders the Renderable instance given a Liquid context.
/// The Result that is returned signals if there was an error rendering,
/// the Option<String> that is wrapped by the Result will be None if
/// the render has run successfully but there is no content to render.
fn render(&self, context: &mut Context) -> Result<Option<String>>;
}
|
#[doc = "Register `DDRCTRL_DFIUPD0` reader"]
pub type R = crate::R<DDRCTRL_DFIUPD0_SPEC>;
#[doc = "Register `DDRCTRL_DFIUPD0` writer"]
pub type W = crate::W<DDRCTRL_DFIUPD0_SPEC>;
#[doc = "Field `DFI_T_CTRLUP_MIN` reader - DFI_T_CTRLUP_MIN"]
pub type DFI_T_CTRLUP_MIN_R = crate::FieldReader<u16>;
#[doc = "Field `DFI_T_CTRLUP_MIN` writer - DFI_T_CTRLUP_MIN"]
pub type DFI_T_CTRLUP_MIN_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 10, O, u16>;
#[doc = "Field `DFI_T_CTRLUP_MAX` reader - DFI_T_CTRLUP_MAX"]
pub type DFI_T_CTRLUP_MAX_R = crate::FieldReader<u16>;
#[doc = "Field `DFI_T_CTRLUP_MAX` writer - DFI_T_CTRLUP_MAX"]
pub type DFI_T_CTRLUP_MAX_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 10, O, u16>;
#[doc = "Field `CTRLUPD_PRE_SRX` reader - CTRLUPD_PRE_SRX"]
pub type CTRLUPD_PRE_SRX_R = crate::BitReader;
#[doc = "Field `CTRLUPD_PRE_SRX` writer - CTRLUPD_PRE_SRX"]
pub type CTRLUPD_PRE_SRX_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DIS_AUTO_CTRLUPD_SRX` reader - DIS_AUTO_CTRLUPD_SRX"]
pub type DIS_AUTO_CTRLUPD_SRX_R = crate::BitReader;
#[doc = "Field `DIS_AUTO_CTRLUPD_SRX` writer - DIS_AUTO_CTRLUPD_SRX"]
pub type DIS_AUTO_CTRLUPD_SRX_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DIS_AUTO_CTRLUPD` reader - DIS_AUTO_CTRLUPD"]
pub type DIS_AUTO_CTRLUPD_R = crate::BitReader;
#[doc = "Field `DIS_AUTO_CTRLUPD` writer - DIS_AUTO_CTRLUPD"]
pub type DIS_AUTO_CTRLUPD_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
impl R {
#[doc = "Bits 0:9 - DFI_T_CTRLUP_MIN"]
#[inline(always)]
pub fn dfi_t_ctrlup_min(&self) -> DFI_T_CTRLUP_MIN_R {
DFI_T_CTRLUP_MIN_R::new((self.bits & 0x03ff) as u16)
}
#[doc = "Bits 16:25 - DFI_T_CTRLUP_MAX"]
#[inline(always)]
pub fn dfi_t_ctrlup_max(&self) -> DFI_T_CTRLUP_MAX_R {
DFI_T_CTRLUP_MAX_R::new(((self.bits >> 16) & 0x03ff) as u16)
}
#[doc = "Bit 29 - CTRLUPD_PRE_SRX"]
#[inline(always)]
pub fn ctrlupd_pre_srx(&self) -> CTRLUPD_PRE_SRX_R {
CTRLUPD_PRE_SRX_R::new(((self.bits >> 29) & 1) != 0)
}
#[doc = "Bit 30 - DIS_AUTO_CTRLUPD_SRX"]
#[inline(always)]
pub fn dis_auto_ctrlupd_srx(&self) -> DIS_AUTO_CTRLUPD_SRX_R {
DIS_AUTO_CTRLUPD_SRX_R::new(((self.bits >> 30) & 1) != 0)
}
#[doc = "Bit 31 - DIS_AUTO_CTRLUPD"]
#[inline(always)]
pub fn dis_auto_ctrlupd(&self) -> DIS_AUTO_CTRLUPD_R {
DIS_AUTO_CTRLUPD_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl W {
#[doc = "Bits 0:9 - DFI_T_CTRLUP_MIN"]
#[inline(always)]
#[must_use]
pub fn dfi_t_ctrlup_min(&mut self) -> DFI_T_CTRLUP_MIN_W<DDRCTRL_DFIUPD0_SPEC, 0> {
DFI_T_CTRLUP_MIN_W::new(self)
}
#[doc = "Bits 16:25 - DFI_T_CTRLUP_MAX"]
#[inline(always)]
#[must_use]
pub fn dfi_t_ctrlup_max(&mut self) -> DFI_T_CTRLUP_MAX_W<DDRCTRL_DFIUPD0_SPEC, 16> {
DFI_T_CTRLUP_MAX_W::new(self)
}
#[doc = "Bit 29 - CTRLUPD_PRE_SRX"]
#[inline(always)]
#[must_use]
pub fn ctrlupd_pre_srx(&mut self) -> CTRLUPD_PRE_SRX_W<DDRCTRL_DFIUPD0_SPEC, 29> {
CTRLUPD_PRE_SRX_W::new(self)
}
#[doc = "Bit 30 - DIS_AUTO_CTRLUPD_SRX"]
#[inline(always)]
#[must_use]
pub fn dis_auto_ctrlupd_srx(&mut self) -> DIS_AUTO_CTRLUPD_SRX_W<DDRCTRL_DFIUPD0_SPEC, 30> {
DIS_AUTO_CTRLUPD_SRX_W::new(self)
}
#[doc = "Bit 31 - DIS_AUTO_CTRLUPD"]
#[inline(always)]
#[must_use]
pub fn dis_auto_ctrlupd(&mut self) -> DIS_AUTO_CTRLUPD_W<DDRCTRL_DFIUPD0_SPEC, 31> {
DIS_AUTO_CTRLUPD_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
}
#[doc = "DDRCTRL DFI update register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ddrctrl_dfiupd0::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ddrctrl_dfiupd0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct DDRCTRL_DFIUPD0_SPEC;
impl crate::RegisterSpec for DDRCTRL_DFIUPD0_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`ddrctrl_dfiupd0::R`](R) reader structure"]
impl crate::Readable for DDRCTRL_DFIUPD0_SPEC {}
#[doc = "`write(|w| ..)` method takes [`ddrctrl_dfiupd0::W`](W) writer structure"]
impl crate::Writable for DDRCTRL_DFIUPD0_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets DDRCTRL_DFIUPD0 to value 0x0040_0003"]
impl crate::Resettable for DDRCTRL_DFIUPD0_SPEC {
const RESET_VALUE: Self::Ux = 0x0040_0003;
}
|
use crate::errors::*;
use crate::message::header::{Header, HeaderInternal, Section};
use crate::message::resource::{unpack_resource_body, Resource, ResourceBody, ResourceHeader};
use crate::message::name::Name;
use crate::message::question::Question;
use crate::message::{DnsClass, DnsType};
use util::Error;
// A Parser allows incrementally parsing a DNS message.
//
// When parsing is started, the Header is parsed. Next, each question can be
// either parsed or skipped. Alternatively, all Questions can be skipped at
// once. When all Questions have been parsed, attempting to parse Questions
// will return (nil, nil) and attempting to skip Questions will return
// (true, nil). After all Questions have been either parsed or skipped, all
// Answers, Authorities and Additionals can be either parsed or skipped in the
// same way, and each type of Resource must be fully parsed or skipped before
// proceeding to the next type of Resource.
//
// Note that there is no requirement to fully skip or parse the message.
#[derive(Default)]
pub struct Parser<'a> {
pub msg: &'a [u8],
pub header: HeaderInternal,
pub section: Section,
pub off: usize,
pub index: usize,
pub res_header_valid: bool,
pub res_header: ResourceHeader,
}
impl<'a> Parser<'a> {
// start parses the header and enables the parsing of Questions.
pub fn start(&mut self, msg: &'a [u8]) -> Result<Header, Error> {
*self = Parser {
msg,
..Default::default()
};
self.off = self.header.unpack(msg, 0)?;
self.section = Section::Questions;
Ok(self.header.header())
}
fn check_advance(&mut self, sec: Section) -> Result<(), Error> {
if self.section < sec {
return Err(ERR_NOT_STARTED.to_owned());
}
if self.section > sec {
return Err(ERR_SECTION_DONE.to_owned());
}
self.res_header_valid = false;
if self.index == self.header.count(sec) as usize {
self.index = 0;
self.section = Section::from(1 + self.section as u8);
return Err(ERR_SECTION_DONE.to_owned());
}
Ok(())
}
fn resource(&mut self, sec: Section) -> Result<Resource, Error> {
let header = self.resource_header(sec)?;
self.res_header_valid = false;
let (body, off) =
unpack_resource_body(header.typ, self.msg, self.off, header.length as usize)?;
self.off = off;
self.index += 1;
Ok(Resource {
header,
body: Some(body),
})
}
fn resource_header(&mut self, sec: Section) -> Result<ResourceHeader, Error> {
if self.res_header_valid {
return Ok(self.res_header.clone());
}
self.check_advance(sec)?;
let mut hdr = ResourceHeader::default();
let off = hdr.unpack(self.msg, self.off, 0)?;
self.res_header_valid = true;
self.res_header = hdr.clone();
self.off = off;
Ok(hdr)
}
fn skip_resource(&mut self, sec: Section) -> Result<(), Error> {
if self.res_header_valid {
let new_off = self.off + self.res_header.length as usize;
if new_off > self.msg.len() {
return Err(ERR_RESOURCE_LEN.to_owned());
}
self.off = new_off;
self.res_header_valid = false;
self.index += 1;
return Ok(());
}
self.check_advance(sec)?;
self.off = Resource::skip(self.msg, self.off)?;
self.index += 1;
Ok(())
}
// question parses a single question.
pub fn question(&mut self) -> Result<Question, Error> {
self.check_advance(Section::Questions)?;
let mut name = Name::new("")?;
let mut off = name.unpack(self.msg, self.off)?;
let mut typ = DnsType::Unsupported;
off = typ.unpack(self.msg, off)?;
let mut class = DnsClass::default();
off = class.unpack(self.msg, off)?;
self.off = off;
self.index += 1;
Ok(Question { name, typ, class })
}
// all_questions parses all Questions.
pub fn all_questions(&mut self) -> Result<Vec<Question>, Error> {
// Multiple questions are valid according to the spec,
// but servers don't actually support them. There will
// be at most one question here.
//
// Do not pre-allocate based on info in self.header, since
// the data is untrusted.
let mut qs = vec![];
loop {
match self.question() {
Err(err) => {
if err == *ERR_SECTION_DONE {
return Ok(qs);
} else {
return Err(err);
}
}
Ok(q) => qs.push(q),
}
}
}
// skip_question skips a single question.
pub fn skip_question(&mut self) -> Result<(), Error> {
self.check_advance(Section::Questions)?;
let mut off = Name::skip(self.msg, self.off)?;
off = DnsType::skip(self.msg, off)?;
off = DnsClass::skip(self.msg, off)?;
self.off = off;
self.index += 1;
Ok(())
}
// skip_all_questions skips all Questions.
pub fn skip_all_questions(&mut self) -> Result<(), Error> {
loop {
if let Err(err) = self.skip_question() {
if err == *ERR_SECTION_DONE {
return Ok(());
} else {
return Err(err);
}
}
}
}
// answer_header parses a single answer ResourceHeader.
pub fn answer_header(&mut self) -> Result<ResourceHeader, Error> {
self.resource_header(Section::Answers)
}
// answer parses a single answer Resource.
pub fn answer(&mut self) -> Result<Resource, Error> {
self.resource(Section::Answers)
}
// all_answers parses all answer Resources.
pub fn all_answers(&mut self) -> Result<Vec<Resource>, Error> {
// The most common query is for A/AAAA, which usually returns
// a handful of IPs.
//
// Pre-allocate up to a certain limit, since self.header is
// untrusted data.
let mut n = self.header.answers as usize;
if n > 20 {
n = 20
}
let mut a = Vec::with_capacity(n);
loop {
match self.answer() {
Err(err) => {
if err == *ERR_SECTION_DONE {
return Ok(a);
} else {
return Err(err);
}
}
Ok(r) => a.push(r),
}
}
}
// skip_answer skips a single answer Resource.
pub fn skip_answer(&mut self) -> Result<(), Error> {
self.skip_resource(Section::Answers)
}
// skip_all_answers skips all answer Resources.
pub fn skip_all_answers(&mut self) -> Result<(), Error> {
loop {
if let Err(err) = self.skip_answer() {
if err == *ERR_SECTION_DONE {
return Ok(());
} else {
return Err(err);
}
}
}
}
// authority_header parses a single authority ResourceHeader.
pub fn authority_header(&mut self) -> Result<ResourceHeader, Error> {
self.resource_header(Section::Authorities)
}
// authority parses a single authority Resource.
pub fn authority(&mut self) -> Result<Resource, Error> {
self.resource(Section::Authorities)
}
// all_authorities parses all authority Resources.
pub fn all_authorities(&mut self) -> Result<Vec<Resource>, Error> {
// Authorities contains SOA in case of NXDOMAIN and friends,
// otherwise it is empty.
//
// Pre-allocate up to a certain limit, since self.header is
// untrusted data.
let mut n = self.header.authorities as usize;
if n > 10 {
n = 10;
}
let mut a = Vec::with_capacity(n);
loop {
match self.authority() {
Err(err) => {
if err == *ERR_SECTION_DONE {
return Ok(a);
} else {
return Err(err);
}
}
Ok(r) => a.push(r),
}
}
}
// skip_authority skips a single authority Resource.
pub fn skip_authority(&mut self) -> Result<(), Error> {
self.skip_resource(Section::Authorities)
}
// skip_all_authorities skips all authority Resources.
pub fn skip_all_authorities(&mut self) -> Result<(), Error> {
loop {
if let Err(err) = self.skip_authority() {
if err == *ERR_SECTION_DONE {
return Ok(());
} else {
return Err(err);
}
}
}
}
// additional_header parses a single additional ResourceHeader.
pub fn additional_header(&mut self) -> Result<ResourceHeader, Error> {
self.resource_header(Section::Additionals)
}
// additional parses a single additional Resource.
pub fn additional(&mut self) -> Result<Resource, Error> {
self.resource(Section::Additionals)
}
// all_additionals parses all additional Resources.
pub fn all_additionals(&mut self) -> Result<Vec<Resource>, Error> {
// Additionals usually contain OPT, and sometimes A/AAAA
// glue records.
//
// Pre-allocate up to a certain limit, since self.header is
// untrusted data.
let mut n = self.header.additionals as usize;
if n > 10 {
n = 10;
}
let mut a = Vec::with_capacity(n);
loop {
match self.additional() {
Err(err) => {
if err == *ERR_SECTION_DONE {
return Ok(a);
} else {
return Err(err);
}
}
Ok(r) => a.push(r),
}
}
}
// skip_additional skips a single additional Resource.
pub fn skip_additional(&mut self) -> Result<(), Error> {
self.skip_resource(Section::Additionals)
}
// skip_all_additionals skips all additional Resources.
pub fn skip_all_additionals(&mut self) -> Result<(), Error> {
loop {
if let Err(err) = self.skip_additional() {
if err == *ERR_SECTION_DONE {
return Ok(());
} else {
return Err(err);
}
}
}
}
// resource_body parses a single resource_boy.
//
// One of the XXXHeader methods must have been called before calling this
// method.
pub fn resource_body(&mut self) -> Result<Box<dyn ResourceBody>, Error> {
if !self.res_header_valid {
return Err(ERR_NOT_STARTED.to_owned());
}
let (rb, _off) = unpack_resource_body(
self.res_header.typ,
self.msg,
self.off,
self.res_header.length as usize,
)?;
self.off += self.res_header.length as usize;
self.res_header_valid = false;
self.index += 1;
Ok(rb)
}
}
|
/// An enum to represent all characters in the AncientGreekMusicalNotation block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum AncientGreekMusicalNotation {
/// \u{1d200}: '𝈀'
GreekVocalNotationSymbolDash1,
/// \u{1d201}: '𝈁'
GreekVocalNotationSymbolDash2,
/// \u{1d202}: '𝈂'
GreekVocalNotationSymbolDash3,
/// \u{1d203}: '𝈃'
GreekVocalNotationSymbolDash4,
/// \u{1d204}: '𝈄'
GreekVocalNotationSymbolDash5,
/// \u{1d205}: '𝈅'
GreekVocalNotationSymbolDash6,
/// \u{1d206}: '𝈆'
GreekVocalNotationSymbolDash7,
/// \u{1d207}: '𝈇'
GreekVocalNotationSymbolDash8,
/// \u{1d208}: '𝈈'
GreekVocalNotationSymbolDash9,
/// \u{1d209}: '𝈉'
GreekVocalNotationSymbolDash10,
/// \u{1d20a}: '𝈊'
GreekVocalNotationSymbolDash11,
/// \u{1d20b}: '𝈋'
GreekVocalNotationSymbolDash12,
/// \u{1d20c}: '𝈌'
GreekVocalNotationSymbolDash13,
/// \u{1d20d}: '𝈍'
GreekVocalNotationSymbolDash14,
/// \u{1d20e}: '𝈎'
GreekVocalNotationSymbolDash15,
/// \u{1d20f}: '𝈏'
GreekVocalNotationSymbolDash16,
/// \u{1d210}: '𝈐'
GreekVocalNotationSymbolDash17,
/// \u{1d211}: '𝈑'
GreekVocalNotationSymbolDash18,
/// \u{1d212}: '𝈒'
GreekVocalNotationSymbolDash19,
/// \u{1d213}: '𝈓'
GreekVocalNotationSymbolDash20,
/// \u{1d214}: '𝈔'
GreekVocalNotationSymbolDash21,
/// \u{1d215}: '𝈕'
GreekVocalNotationSymbolDash22,
/// \u{1d216}: '𝈖'
GreekVocalNotationSymbolDash23,
/// \u{1d217}: '𝈗'
GreekVocalNotationSymbolDash24,
/// \u{1d218}: '𝈘'
GreekVocalNotationSymbolDash50,
/// \u{1d219}: '𝈙'
GreekVocalNotationSymbolDash51,
/// \u{1d21a}: '𝈚'
GreekVocalNotationSymbolDash52,
/// \u{1d21b}: '𝈛'
GreekVocalNotationSymbolDash53,
/// \u{1d21c}: '𝈜'
GreekVocalNotationSymbolDash54,
/// \u{1d21d}: '𝈝'
GreekInstrumentalNotationSymbolDash1,
/// \u{1d21e}: '𝈞'
GreekInstrumentalNotationSymbolDash2,
/// \u{1d21f}: '𝈟'
GreekInstrumentalNotationSymbolDash4,
/// \u{1d220}: '𝈠'
GreekInstrumentalNotationSymbolDash5,
/// \u{1d221}: '𝈡'
GreekInstrumentalNotationSymbolDash7,
/// \u{1d222}: '𝈢'
GreekInstrumentalNotationSymbolDash8,
/// \u{1d223}: '𝈣'
GreekInstrumentalNotationSymbolDash11,
/// \u{1d224}: '𝈤'
GreekInstrumentalNotationSymbolDash12,
/// \u{1d225}: '𝈥'
GreekInstrumentalNotationSymbolDash13,
/// \u{1d226}: '𝈦'
GreekInstrumentalNotationSymbolDash14,
/// \u{1d227}: '𝈧'
GreekInstrumentalNotationSymbolDash17,
/// \u{1d228}: '𝈨'
GreekInstrumentalNotationSymbolDash18,
/// \u{1d229}: '𝈩'
GreekInstrumentalNotationSymbolDash19,
/// \u{1d22a}: '𝈪'
GreekInstrumentalNotationSymbolDash23,
/// \u{1d22b}: '𝈫'
GreekInstrumentalNotationSymbolDash24,
/// \u{1d22c}: '𝈬'
GreekInstrumentalNotationSymbolDash25,
/// \u{1d22d}: '𝈭'
GreekInstrumentalNotationSymbolDash26,
/// \u{1d22e}: '𝈮'
GreekInstrumentalNotationSymbolDash27,
/// \u{1d22f}: '𝈯'
GreekInstrumentalNotationSymbolDash29,
/// \u{1d230}: '𝈰'
GreekInstrumentalNotationSymbolDash30,
/// \u{1d231}: '𝈱'
GreekInstrumentalNotationSymbolDash32,
/// \u{1d232}: '𝈲'
GreekInstrumentalNotationSymbolDash36,
/// \u{1d233}: '𝈳'
GreekInstrumentalNotationSymbolDash37,
/// \u{1d234}: '𝈴'
GreekInstrumentalNotationSymbolDash38,
/// \u{1d235}: '𝈵'
GreekInstrumentalNotationSymbolDash39,
/// \u{1d236}: '𝈶'
GreekInstrumentalNotationSymbolDash40,
/// \u{1d237}: '𝈷'
GreekInstrumentalNotationSymbolDash42,
/// \u{1d238}: '𝈸'
GreekInstrumentalNotationSymbolDash43,
/// \u{1d239}: '𝈹'
GreekInstrumentalNotationSymbolDash45,
/// \u{1d23a}: '𝈺'
GreekInstrumentalNotationSymbolDash47,
/// \u{1d23b}: '𝈻'
GreekInstrumentalNotationSymbolDash48,
/// \u{1d23c}: '𝈼'
GreekInstrumentalNotationSymbolDash49,
/// \u{1d23d}: '𝈽'
GreekInstrumentalNotationSymbolDash50,
/// \u{1d23e}: '𝈾'
GreekInstrumentalNotationSymbolDash51,
/// \u{1d23f}: '𝈿'
GreekInstrumentalNotationSymbolDash52,
/// \u{1d240}: '𝉀'
GreekInstrumentalNotationSymbolDash53,
/// \u{1d241}: '𝉁'
GreekInstrumentalNotationSymbolDash54,
/// \u{1d242}: '𝉂'
CombiningGreekMusicalTriseme,
/// \u{1d243}: '𝉃'
CombiningGreekMusicalTetraseme,
/// \u{1d244}: '𝉄'
CombiningGreekMusicalPentaseme,
/// \u{1d245}: '𝉅'
GreekMusicalLeimma,
}
impl Into<char> for AncientGreekMusicalNotation {
fn into(self) -> char {
match self {
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash1 => '𝈀',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash2 => '𝈁',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash3 => '𝈂',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash4 => '𝈃',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash5 => '𝈄',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash6 => '𝈅',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash7 => '𝈆',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash8 => '𝈇',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash9 => '𝈈',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash10 => '𝈉',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash11 => '𝈊',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash12 => '𝈋',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash13 => '𝈌',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash14 => '𝈍',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash15 => '𝈎',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash16 => '𝈏',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash17 => '𝈐',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash18 => '𝈑',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash19 => '𝈒',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash20 => '𝈓',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash21 => '𝈔',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash22 => '𝈕',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash23 => '𝈖',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash24 => '𝈗',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash50 => '𝈘',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash51 => '𝈙',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash52 => '𝈚',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash53 => '𝈛',
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash54 => '𝈜',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash1 => '𝈝',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash2 => '𝈞',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash4 => '𝈟',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash5 => '𝈠',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash7 => '𝈡',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash8 => '𝈢',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash11 => '𝈣',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash12 => '𝈤',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash13 => '𝈥',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash14 => '𝈦',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash17 => '𝈧',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash18 => '𝈨',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash19 => '𝈩',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash23 => '𝈪',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash24 => '𝈫',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash25 => '𝈬',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash26 => '𝈭',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash27 => '𝈮',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash29 => '𝈯',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash30 => '𝈰',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash32 => '𝈱',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash36 => '𝈲',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash37 => '𝈳',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash38 => '𝈴',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash39 => '𝈵',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash40 => '𝈶',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash42 => '𝈷',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash43 => '𝈸',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash45 => '𝈹',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash47 => '𝈺',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash48 => '𝈻',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash49 => '𝈼',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash50 => '𝈽',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash51 => '𝈾',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash52 => '𝈿',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash53 => '𝉀',
AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash54 => '𝉁',
AncientGreekMusicalNotation::CombiningGreekMusicalTriseme => '𝉂',
AncientGreekMusicalNotation::CombiningGreekMusicalTetraseme => '𝉃',
AncientGreekMusicalNotation::CombiningGreekMusicalPentaseme => '𝉄',
AncientGreekMusicalNotation::GreekMusicalLeimma => '𝉅',
}
}
}
impl std::convert::TryFrom<char> for AncientGreekMusicalNotation {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
match c {
'𝈀' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash1),
'𝈁' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash2),
'𝈂' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash3),
'𝈃' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash4),
'𝈄' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash5),
'𝈅' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash6),
'𝈆' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash7),
'𝈇' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash8),
'𝈈' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash9),
'𝈉' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash10),
'𝈊' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash11),
'𝈋' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash12),
'𝈌' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash13),
'𝈍' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash14),
'𝈎' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash15),
'𝈏' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash16),
'𝈐' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash17),
'𝈑' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash18),
'𝈒' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash19),
'𝈓' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash20),
'𝈔' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash21),
'𝈕' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash22),
'𝈖' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash23),
'𝈗' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash24),
'𝈘' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash50),
'𝈙' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash51),
'𝈚' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash52),
'𝈛' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash53),
'𝈜' => Ok(AncientGreekMusicalNotation::GreekVocalNotationSymbolDash54),
'𝈝' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash1),
'𝈞' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash2),
'𝈟' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash4),
'𝈠' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash5),
'𝈡' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash7),
'𝈢' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash8),
'𝈣' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash11),
'𝈤' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash12),
'𝈥' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash13),
'𝈦' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash14),
'𝈧' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash17),
'𝈨' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash18),
'𝈩' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash19),
'𝈪' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash23),
'𝈫' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash24),
'𝈬' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash25),
'𝈭' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash26),
'𝈮' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash27),
'𝈯' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash29),
'𝈰' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash30),
'𝈱' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash32),
'𝈲' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash36),
'𝈳' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash37),
'𝈴' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash38),
'𝈵' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash39),
'𝈶' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash40),
'𝈷' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash42),
'𝈸' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash43),
'𝈹' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash45),
'𝈺' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash47),
'𝈻' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash48),
'𝈼' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash49),
'𝈽' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash50),
'𝈾' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash51),
'𝈿' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash52),
'𝉀' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash53),
'𝉁' => Ok(AncientGreekMusicalNotation::GreekInstrumentalNotationSymbolDash54),
'𝉂' => Ok(AncientGreekMusicalNotation::CombiningGreekMusicalTriseme),
'𝉃' => Ok(AncientGreekMusicalNotation::CombiningGreekMusicalTetraseme),
'𝉄' => Ok(AncientGreekMusicalNotation::CombiningGreekMusicalPentaseme),
'𝉅' => Ok(AncientGreekMusicalNotation::GreekMusicalLeimma),
_ => Err(()),
}
}
}
impl Into<u32> for AncientGreekMusicalNotation {
fn into(self) -> u32 {
let c: char = self.into();
let hex = c
.escape_unicode()
.to_string()
.replace("\\u{", "")
.replace("}", "");
u32::from_str_radix(&hex, 16).unwrap()
}
}
impl std::convert::TryFrom<u32> for AncientGreekMusicalNotation {
type Error = ();
fn try_from(u: u32) -> Result<Self, Self::Error> {
if let Ok(c) = char::try_from(u) {
Self::try_from(c)
} else {
Err(())
}
}
}
impl Iterator for AncientGreekMusicalNotation {
type Item = Self;
fn next(&mut self) -> Option<Self> {
let index: u32 = (*self).into();
use std::convert::TryFrom;
Self::try_from(index + 1).ok()
}
}
impl AncientGreekMusicalNotation {
/// The character with the lowest index in this unicode block
pub fn new() -> Self {
AncientGreekMusicalNotation::GreekVocalNotationSymbolDash1
}
/// The character's name, in sentence case
pub fn name(&self) -> String {
let s = std::format!("AncientGreekMusicalNotation{:#?}", self);
string_morph::to_sentence_case(&s)
}
}
|
mod collection;
mod publication;
pub use collection::*;
pub use publication::*;
|
// See https://en.wikipedia.org/wiki/Quickselect
fn partition<T: PartialOrd>(a: &mut [T], left: usize, right: usize, pivot: usize) -> usize {
a.swap(pivot, right);
let mut store_index = left;
for i in left..right {
if a[i] < a[right] {
a.swap(store_index, i);
store_index += 1;
}
}
a.swap(right, store_index);
store_index
}
fn pivot_index(left: usize, right: usize) -> usize {
return left + (right - left) / 2;
}
fn select<T: PartialOrd>(a: &mut [T], mut left: usize, mut right: usize, n: usize) {
loop {
if left == right {
break;
}
let mut pivot = pivot_index(left, right);
pivot = partition(a, left, right, pivot);
if n == pivot {
break;
} else if n < pivot {
right = pivot - 1;
} else {
left = pivot + 1;
}
}
}
// Rearranges the elements of 'a' such that the element at index 'n' is
// the same as it would be if the array were sorted, smaller elements are
// to the left of it and larger elements are to its right.
fn nth_element<T: PartialOrd>(a: &mut [T], n: usize) {
select(a, 0, a.len() - 1, n);
}
fn main() {
let a = vec![9, 8, 7, 6, 5, 0, 1, 2, 3, 4];
for n in 0..a.len() {
let mut b = a.clone();
nth_element(&mut b, n);
println!("n = {}, nth element = {}", n + 1, b[n]);
}
} |
mod clock;
mod display;
mod keyboard;
mod memory;
mod opcode;
mod register;
mod settings;
mod stack;
pub use display::FrameBuffer;
use super::Sdl2Wrapper;
use clock::Clock;
use display::Display;
use keyboard::Keyboard;
use memory::Memory;
use opcode::OpCode;
use register::Registers;
use settings::Settings;
use stack::Stack;
use anyhow::Result;
use rand::Rng;
use sdl2::event::Event;
use std::convert::TryFrom;
#[derive(PartialEq, Eq, Debug)]
pub struct Chip8 {
settings: Settings,
display: Display,
memory: Memory,
v: Registers,
stack: Stack,
input: Keyboard,
index: u16,
program_counter: u16,
delay_timer: u8,
sound_timer: u8,
}
impl Chip8 {
pub fn new() -> Self {
Self {
settings: Settings::new(),
display: Display::new(),
memory: Memory::new(),
v: Registers::new(),
stack: Stack::new(),
input: Keyboard::new(),
index: 0,
program_counter: 0x200,
delay_timer: 0,
sound_timer: 0,
}
}
pub fn load_rom(&mut self, rom: &[u8]) -> Result<()> {
self.memory.load_rom(rom)
}
pub fn run(&mut self, sdl: &mut Sdl2Wrapper) -> Result<()> {
let mut cpu_clock = Clock::new(700.0);
let mut delay_clock = Clock::new(60.0);
let mut sound_clock = Clock::new(60.0);
loop {
match sdl.poll_event() {
Some(Event::Quit { .. }) => {
break;
}
Some(Event::KeyDown { scancode, .. }) => {
self.input
.press_key(scancode.and_then(Sdl2Wrapper::translate_scancode));
}
_ => {
if delay_clock.tick() {
self.delay_timer = self.delay_timer.saturating_sub(1);
}
if sound_clock.tick() {
self.sound_timer = self.sound_timer.saturating_sub(1);
if self.should_beep() {
sdl.beep();
} else {
sdl.stop_beep();
}
}
if cpu_clock.tick() {
self.input.set_keys(sdl.poll_input());
self.cycle()?;
sdl.draw_on_canvas(self.get_frame_buffer())?;
}
}
}
}
Ok(())
}
fn cycle(&mut self) -> Result<()> {
let word = self.fetch()?;
let op = Self::decode(word)?;
self.execute(op)
}
fn fetch(&mut self) -> Result<u16> {
let next_instr = self.memory.get_word(self.program_counter)?;
self.program_counter += 2;
Ok(next_instr)
}
fn decode(op: u16) -> Result<OpCode> {
TryFrom::try_from(op)
}
#[allow(clippy::too_many_lines)]
fn execute(&mut self, op: OpCode) -> Result<()> {
match op {
OpCode::SysAddr(_addr) => {
// Unimplemented on most machines, this is purposefully skipped
// TODO: Make this a possible error
}
OpCode::Clear => {
self.display.clear();
}
OpCode::Return => {
self.program_counter = self.stack.pop()?;
}
OpCode::Jump(addr) => {
self.program_counter = addr;
}
OpCode::Call(addr) => {
self.stack.push(self.program_counter)?;
self.program_counter = addr;
}
OpCode::SkipEqual(x, kk) => {
if self.v[x] == kk {
self.program_counter += 2;
}
}
OpCode::SkipNotEqual(x, kk) => {
if self.v[x] != kk {
self.program_counter += 2;
}
}
OpCode::SkipEqualRegister(x, y) => {
if self.v[x] == self.v[y] {
self.program_counter += 2;
}
}
OpCode::Load(x, kk) => {
self.v[x] = kk;
}
OpCode::Add(x, kk) => {
self.v[x] = self.v[x].wrapping_add(kk);
}
OpCode::LoadRegister(x, y) => {
self.v[x] = self.v[y];
}
OpCode::OrRegister(x, y) => {
self.v[x] |= self.v[y];
}
OpCode::AndRegister(x, y) => {
self.v[x] &= self.v[y];
}
OpCode::XorRegister(x, y) => {
self.v[x] ^= self.v[y];
}
OpCode::AddRegister(x, y) => {
let (res, over) = self.v[x].overflowing_add(self.v[y]);
self.set_vf(over);
self.v[x] = res;
}
OpCode::SubRegister(x, y) => {
let (res, under) = self.v[x].overflowing_sub(self.v[y]);
self.set_vf(!under); // VF is set if underflow did not occur
self.v[x] = res;
}
OpCode::ShiftRightRegister(x, y) => {
if self.settings.shift_quirk {
self.v[x] = self.v[y];
}
let shifted_bit = self.v[x] & 0x1;
self.set_vf(shifted_bit == 0x1);
self.v[x] >>= 1;
}
OpCode::SubReverseRegister(x, y) => {
let (res, under) = self.v[y].overflowing_sub(self.v[x]);
self.set_vf(!under);
self.v[x] = res;
}
OpCode::ShiftLeftRegister(x, y) => {
if self.settings.shift_quirk {
self.v[x] = self.v[y];
}
let bit = self.v[x] & 0x80;
self.set_vf(bit == 0x80);
self.v[x] <<= 1;
}
OpCode::SkipNotEqualRegister(x, y) => {
if self.v[x] != self.v[y] {
self.program_counter += 2;
}
}
OpCode::SetIndexRegister(addr) => {
self.index = addr;
}
OpCode::JumpWithOffset(addr) => {
let reg_value = if self.settings.jump_quirk {
#[allow(clippy::cast_possible_truncation)]
let x = ((addr & 0x0F00) >> 8) as u8;
self.v[x]
} else {
self.v[0]
};
self.program_counter = addr + u16::from(reg_value);
}
OpCode::Random(x, kk) => {
self.v[x] = Self::generate_random_byte() & kk;
}
OpCode::Draw(x, y, n) => {
let x = self.v[x] as usize;
let y = self.v[y] as usize;
let h = n as usize;
let mut pixel_erased = false;
for oy in 0..h {
let px_y = y + oy;
if !self.settings.vertical_wrap && px_y >= crate::CHIP8_HEIGHT {
break;
}
#[allow(clippy::cast_possible_truncation)]
let byte = self.memory.get_byte(self.index + oy as u16)?;
for ox in 0..8 {
let pixel = (byte >> (7 - ox)) & 1;
let px_x = x + ox;
pixel_erased |= self.display.draw_pixel(px_x, px_y, pixel);
}
}
self.set_vf(pixel_erased);
}
OpCode::SkipKeyPressed(x) => {
if self.input.is_key_pressed(x) {
self.program_counter += 2;
}
}
OpCode::SkipKeyNotPressed(x) => {
if !self.input.is_key_pressed(x) {
self.program_counter += 2;
}
}
OpCode::LoadDelay(x) => {
self.v[x] = self.delay_timer;
}
OpCode::LoadNextKeyPress(x) => {
if let Some(key) = self.input.get_next_key() {
self.v[x] = key;
} else {
self.program_counter -= 2;
}
}
OpCode::SetDelayTimer(x) => {
self.delay_timer = self.v[x];
}
OpCode::SetSoundTimer(x) => {
self.sound_timer = self.v[x];
}
OpCode::AddIndexRegister(x) => {
let (addr, carry) = self.index.overflowing_add(u16::from(self.v[x]));
self.index = addr;
if self.settings.index_overflow {
self.set_vf(carry);
}
}
OpCode::IndexAtSprite(x) => {
self.index = Memory::index_of_font_char(x)?;
}
OpCode::BinaryCodeConversion(x) => {
let value = self.v[x];
*self.memory.get_byte_mut(self.index)? = value / 100;
*self.memory.get_byte_mut(self.index + 1)? = (value % 100) / 10;
*self.memory.get_byte_mut(self.index + 2)? = value % 10;
}
OpCode::StoreAllRegisters(x) => {
for offset in 0..=x {
*self.memory.get_byte_mut(self.index + u16::from(offset))? = self.v[offset];
}
if self.settings.load_store_quirk {
self.index += u16::from(x) + 1;
}
}
OpCode::LoadAllRegisters(x) => {
for offset in 0..=x {
self.v[offset] = *self.memory.get_byte(self.index + u16::from(offset))?;
}
if self.settings.load_store_quirk {
self.index += u16::from(x) + 1;
}
}
}
Ok(())
}
fn set_vf(&mut self, cond: bool) {
self.v[0xf] = if cond { 1 } else { 0 };
}
fn generate_random_byte() -> u8 {
rand::thread_rng().gen::<u8>()
}
fn should_beep(&self) -> bool {
self.sound_timer > 0
}
fn get_frame_buffer(&mut self) -> &FrameBuffer {
self.display.get_frame_buffer()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn sysaddr() {
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::SysAddr(0x0000)).is_ok());
assert_eq!(cpu, Chip8::new());
}
#[test]
fn clear() {
let mut cpu = Chip8::new();
cpu.display.fill_buffer();
assert!(cpu.execute(OpCode::Clear).is_ok());
assert_eq!(cpu, Chip8::new());
}
#[test]
fn r#return() {
const ADDR: u16 = 0x420;
let mut cpu = Chip8::new();
cpu.stack.push(ADDR).unwrap();
assert!(cpu.execute(OpCode::Return).is_ok());
assert_eq!(cpu.program_counter, ADDR);
}
#[test]
fn jump() {
const ADDR: u16 = 0x420;
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::Jump(ADDR)).is_ok());
assert_eq!(cpu.program_counter, ADDR);
}
#[test]
fn call() {
const CALL_ADDR: u16 = 0x420;
const PROGRAM_COUNTER: u16 = 0x360;
let mut cpu = Chip8::new();
cpu.program_counter = PROGRAM_COUNTER;
assert!(cpu.execute(OpCode::Call(CALL_ADDR)).is_ok());
assert_eq!(cpu.program_counter, CALL_ADDR);
assert_eq!(cpu.stack.pop().unwrap(), PROGRAM_COUNTER);
}
#[test]
fn skip_equal() {
let mut skip = Chip8::new();
skip.v[0xC] = 0xAB;
assert!(skip.execute(OpCode::SkipEqual(0xC, 0xAB)).is_ok());
assert_eq!(skip.program_counter, 0x200 + 2);
let mut dont_skip = Chip8::new();
dont_skip.v[0xC] = 0xAD;
assert!(dont_skip.execute(OpCode::SkipEqual(0xC, 0xAB)).is_ok());
assert_eq!(dont_skip.program_counter, 0x200 + 0);
}
#[test]
fn skip_not_equal() {
let mut skip = Chip8::new();
skip.v[0xC] = 0xAD;
assert!(skip.execute(OpCode::SkipNotEqual(0xC, 0xAB)).is_ok());
assert_eq!(skip.program_counter, 0x200 + 2);
let mut dont_skip = Chip8::new();
dont_skip.v[0xC] = 0xAB;
assert!(dont_skip.execute(OpCode::SkipNotEqual(0xC, 0xAB)).is_ok());
assert_eq!(dont_skip.program_counter, 0x200 + 0);
}
#[test]
fn skip_equal_register() {
let mut skip = Chip8::new();
skip.v[0xC] = 0xA;
skip.v[0xB] = 0xA;
assert!(skip.execute(OpCode::SkipEqualRegister(0xC, 0xB)).is_ok());
assert_eq!(skip.program_counter, 0x200 + 2);
let mut dont_skip = Chip8::new();
dont_skip.v[0xC] = 0xC;
dont_skip.v[0xB] = 0xB;
assert!(dont_skip
.execute(OpCode::SkipEqualRegister(0xC, 0xB))
.is_ok());
assert_eq!(dont_skip.program_counter, 0x200 + 0);
}
#[test]
fn load() {
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::Load(0xC, 0xAB)).is_ok());
assert_eq!(cpu.v[0xC], 0xAB);
}
#[test]
fn add() {
let mut cpu = Chip8::new();
cpu.v[0xC] = 0xA;
assert!(cpu.execute(OpCode::Add(0xC, 0xFC)).is_ok());
assert_eq!(cpu.v[0xC], 0x06);
assert_eq!(cpu.v[0xF], 0);
}
#[test]
fn load_register() {
let mut cpu = Chip8::new();
cpu.v[0xC] = 0xFF;
assert!(cpu.execute(OpCode::LoadRegister(0x0, 0xC)).is_ok());
assert_eq!(cpu.v[0x0], cpu.v[0xC]);
assert_eq!(cpu.v[0x0], 0xFF);
}
#[test]
fn or_register() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 0x0F;
cpu.v[0x1] = 0xF0;
assert!(cpu.execute(OpCode::OrRegister(0x0, 0x1)).is_ok());
assert_eq!(cpu.v[0x0], 0xFF);
assert_eq!(cpu.v[0x1], 0xF0);
}
#[test]
fn and_register() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 0x2F;
cpu.v[0x1] = 0xF2;
assert!(cpu.execute(OpCode::AndRegister(0x0, 0x1)).is_ok());
assert_eq!(cpu.v[0x0], 0x22);
assert_eq!(cpu.v[0x1], 0xF2);
}
#[test]
fn xor_register() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 0b1010_1010;
cpu.v[0x1] = 0b0101_0101;
assert!(cpu.execute(OpCode::XorRegister(0x0, 0x1)).is_ok());
assert_eq!(cpu.v[0x0], 0b1111_1111);
assert_eq!(cpu.v[0x1], 0b0101_0101);
}
#[test]
fn add_register() {
let mut set_flag = Chip8::new();
set_flag.v[0x0] = 0xAF;
set_flag.v[0x1] = 0xBC;
assert!(set_flag.execute(OpCode::AddRegister(0x0, 0x1)).is_ok());
assert_eq!(set_flag.v[0x0], 0x6B);
assert_eq!(set_flag.v[0x1], 0xBC);
assert_eq!(set_flag.v[0xF], 0x01);
let mut no_flag = Chip8::new();
no_flag.v[0x0] = 0x0F;
no_flag.v[0x1] = 0xE1;
assert!(no_flag.execute(OpCode::AddRegister(0x0, 0x1)).is_ok());
assert_eq!(no_flag.v[0x0], 0xF0);
assert_eq!(no_flag.v[0x1], 0xE1);
assert_eq!(no_flag.v[0xF], 0x00);
}
#[test]
fn sub_register() {
let mut set_flag = Chip8::new();
set_flag.v[0x0] = 0xFF;
set_flag.v[0x1] = 0x01;
assert!(set_flag.execute(OpCode::SubRegister(0x0, 0x1)).is_ok());
assert_eq!(set_flag.v[0x0], 0xFE);
assert_eq!(set_flag.v[0x1], 0x01);
assert_eq!(set_flag.v[0xF], 0x01);
let mut no_flag = Chip8::new();
no_flag.v[0x0] = 0x01;
no_flag.v[0x1] = 0x02;
assert!(no_flag.execute(OpCode::SubRegister(0x0, 0x1)).is_ok());
assert_eq!(no_flag.v[0x0], 0xFF);
assert_eq!(no_flag.v[0x1], 0x02);
assert_eq!(no_flag.v[0xF], 0x00);
}
#[test]
fn shift_right_register() {
let mut set_flag = Chip8::new();
set_flag.v[0x0] = 0x11;
assert!(set_flag
.execute(OpCode::ShiftRightRegister(0x0, 0x0))
.is_ok());
assert_eq!(set_flag.v[0x0], 0x08);
assert_eq!(set_flag.v[0xF], 0x01);
let mut no_flag = Chip8::new();
no_flag.v[0x0] = 0x10;
assert!(no_flag
.execute(OpCode::ShiftRightRegister(0x0, 0x0))
.is_ok());
assert_eq!(no_flag.v[0x0], 0x08);
assert_eq!(no_flag.v[0xF], 0x00);
}
#[test]
fn sub_reverse_register() {
let mut set_flag = Chip8::new();
set_flag.v[0x0] = 0x01;
set_flag.v[0x1] = 0x02;
assert!(set_flag
.execute(OpCode::SubReverseRegister(0x0, 0x1))
.is_ok());
assert_eq!(set_flag.v[0x0], 0x01);
assert_eq!(set_flag.v[0x1], 0x02);
assert_eq!(set_flag.v[0xF], 0x01);
let mut no_flag = Chip8::new();
no_flag.v[0x0] = 0x0B;
no_flag.v[0x1] = 0x0A;
assert!(no_flag
.execute(OpCode::SubReverseRegister(0x0, 0x1))
.is_ok());
assert_eq!(no_flag.v[0x0], 0xFF);
assert_eq!(no_flag.v[0x1], 0x0A);
assert_eq!(no_flag.v[0xF], 0x00);
}
#[test]
fn shift_left_register() {
let mut set_flag = Chip8::new();
set_flag.v[0x0] = 0x88;
assert!(set_flag
.execute(OpCode::ShiftLeftRegister(0x0, 0x0))
.is_ok());
assert_eq!(set_flag.v[0x0], 0x10);
assert_eq!(set_flag.v[0xF], 0x01);
let mut no_flag = Chip8::new();
no_flag.v[0x0] = 0x01;
assert!(no_flag.execute(OpCode::ShiftLeftRegister(0x0, 0x0)).is_ok());
assert_eq!(no_flag.v[0x0], 0x02);
assert_eq!(no_flag.v[0xF], 0x00);
}
#[test]
fn skip_not_equal_register() {
let mut skip = Chip8::new();
skip.v[0xC] = 0xC;
skip.v[0xB] = 0xB;
assert!(skip.execute(OpCode::SkipEqualRegister(0xC, 0xB)).is_ok());
assert_eq!(skip.program_counter, 0x200 + 0);
let mut not_skip = Chip8::new();
not_skip.v[0xC] = 0xA;
not_skip.v[0xB] = 0xA;
assert!(not_skip
.execute(OpCode::SkipEqualRegister(0xC, 0xB))
.is_ok());
assert_eq!(not_skip.program_counter, 0x200 + 2);
}
#[test]
fn set_index_register() {
const ADDR: u16 = 0x500;
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::SetIndexRegister(ADDR)).is_ok());
assert_eq!(cpu.index, 0x500);
}
#[test]
fn jump_with_offset() {
const ADDR: u16 = 0x500;
let mut cpu = Chip8::new();
cpu.v[0] = 0x20;
assert!(cpu.execute(OpCode::JumpWithOffset(ADDR)).is_ok());
assert_eq!(cpu.program_counter, 0x520);
}
#[test]
fn random() {
// There is not really a good test for this, as it just generates a random byte
// so, I will just make sure that the CPU has a function for generating a random byte.
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::Random(0x0, 0xFF)).is_ok());
let _byte = Chip8::generate_random_byte();
}
#[test]
fn skip_key_pressed() {
let mut cpu = Chip8::new();
let mut keys = [false; 16];
keys[0xA] = true;
cpu.input.set_keys(keys);
assert!(cpu.execute(OpCode::SkipKeyPressed(0xA)).is_ok());
assert_eq!(cpu.program_counter, 0x200 + 2);
}
#[test]
fn skip_key_not_pressed() {
let mut cpu = Chip8::new();
let mut keys = [false; 16];
keys[0xA] = true;
cpu.input.set_keys(keys);
assert!(cpu.execute(OpCode::SkipKeyNotPressed(0xA)).is_ok());
assert_eq!(cpu.program_counter, 0x200 + 0);
}
#[test]
fn load_delay() {
let mut cpu = Chip8::new();
cpu.delay_timer = 0x20;
assert!(cpu.execute(OpCode::LoadDelay(0x0)).is_ok());
assert_eq!(cpu.v[0x0], cpu.delay_timer);
}
#[test]
fn load_next_key_press() {
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::LoadNextKeyPress(0x0)).is_ok());
cpu.input.press_key(Some(0xA));
assert!(cpu.execute(OpCode::LoadNextKeyPress(0x0)).is_ok());
assert_eq!(cpu.v[0x0], 0xA);
}
#[test]
fn set_delay_timer() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 0x20;
cpu.delay_timer = 0x1;
assert!(cpu.execute(OpCode::SetDelayTimer(0x0)).is_ok());
assert_eq!(cpu.v[0x0], cpu.delay_timer);
}
#[test]
fn set_sound_timer() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 0x20;
cpu.sound_timer = 0x1;
assert!(cpu.execute(OpCode::SetSoundTimer(0x0)).is_ok());
assert_eq!(cpu.v[0x0], cpu.sound_timer);
}
#[test]
fn add_index_register() {
let mut cpu = Chip8::new();
cpu.index = 0x01;
cpu.v[0x0] = 0x20;
assert!(cpu.execute(OpCode::AddIndexRegister(0x0)).is_ok());
assert_eq!(cpu.index, 0x21);
assert_eq!(cpu.v[0xF], 0x0);
}
#[test]
fn index_at_sprite() {
let mut cpu = Chip8::new();
assert!(cpu.execute(OpCode::IndexAtSprite(0x1)).is_ok());
assert_eq!(cpu.index, Memory::index_of_font_char(0x1).unwrap());
}
#[test]
fn binary_code_conversion() {
let mut cpu = Chip8::new();
cpu.v[0x0] = 152;
cpu.index = 0x100;
assert!(cpu.execute(OpCode::BinaryCodeConversion(0x0)).is_ok());
assert_eq!(cpu.v[0x0], 152);
assert_eq!(cpu.index, 0x100);
assert_eq!(*cpu.memory.get_byte(0x100).unwrap(), 0x1);
assert_eq!(*cpu.memory.get_byte(0x101).unwrap(), 0x5);
assert_eq!(*cpu.memory.get_byte(0x102).unwrap(), 0x2);
}
#[test]
fn store_all_registers() {
let mut cpu = Chip8::new();
cpu.index = 0x100;
cpu.v[0x0] = 0xB;
cpu.v[0x1] = 0xE;
cpu.v[0x2] = 0xE;
cpu.v[0x3] = 0xF;
assert!(cpu.execute(OpCode::StoreAllRegisters(0x3)).is_ok());
assert_eq!(*cpu.memory.get_byte(0x100).unwrap(), 0xB);
assert_eq!(*cpu.memory.get_byte(0x101).unwrap(), 0xE);
assert_eq!(*cpu.memory.get_byte(0x102).unwrap(), 0xE);
assert_eq!(*cpu.memory.get_byte(0x103).unwrap(), 0xF);
}
#[test]
fn load_all_registers() {
let mut cpu = Chip8::new();
cpu.index = 0x100;
*cpu.memory.get_byte_mut(0x100).unwrap() = 0xB;
*cpu.memory.get_byte_mut(0x101).unwrap() = 0xE;
*cpu.memory.get_byte_mut(0x102).unwrap() = 0xE;
*cpu.memory.get_byte_mut(0x103).unwrap() = 0xF;
assert!(cpu.execute(OpCode::LoadAllRegisters(0x3)).is_ok());
assert_eq!(cpu.v[0x0], 0xB);
assert_eq!(cpu.v[0x1], 0xE);
assert_eq!(cpu.v[0x2], 0xE);
assert_eq!(cpu.v[0x3], 0xF);
}
}
|
extern crate skeptic;
#[test] fn readme_0() {
let ref s = format!("{}", r####"extern crate carboxyl;
fn main() {
let sink = carboxyl::Sink::new();
let stream = sink.stream();
let signal = stream.hold(3);
// The current value of the signal is initially 3
assert_eq!(signal.sample(), 3);
// When we fire an event, the signal get updated accordingly
sink.send(5);
assert_eq!(signal.sample(), 5);
}
"####);
skeptic::rt::run_test(r#"/home/maxtnt/My_workspace/rust/crate_test/carboxyl/test_rx/target/debug/build/carboxyl-d875304b1cca4e2d/out"#, s);
}
#[test] fn readme_1() {
let ref s = format!("{}", r####"extern crate carboxyl;
fn main() {
let sink = carboxyl::Sink::new();
let stream = sink.stream();
let mut events = stream.events();
sink.send(4);
assert_eq!(events.next(), Some(4));
}
"####);
skeptic::rt::run_test(r#"/home/maxtnt/My_workspace/rust/crate_test/carboxyl/test_rx/target/debug/build/carboxyl-d875304b1cca4e2d/out"#, s);
}
#[test] fn readme_2() {
let ref s = format!("{}", r####"extern crate carboxyl;
fn main() {
let sink = carboxyl::Sink::new();
let stream = sink.stream();
let squares = stream.map(|x| x * x).hold(0);
sink.send(4);
assert_eq!(squares.sample(), 16);
}
"####);
skeptic::rt::run_test(r#"/home/maxtnt/My_workspace/rust/crate_test/carboxyl/test_rx/target/debug/build/carboxyl-d875304b1cca4e2d/out"#, s);
}
#[test] fn readme_3() {
let ref s = format!("{}", r####"extern crate carboxyl;
fn main() {
let sink = carboxyl::Sink::new();
let stream = sink.stream();
let negatives = stream.filter(|&x| x < 0).hold(0);
// This won't arrive at the signal.
sink.send(4);
assert_eq!(negatives.sample(), 0);
// But this will!
sink.send(-3);
assert_eq!(negatives.sample(), -3);
}
"####);
skeptic::rt::run_test(r#"/home/maxtnt/My_workspace/rust/crate_test/carboxyl/test_rx/target/debug/build/carboxyl-d875304b1cca4e2d/out"#, s);
}
|
extern crate time;
extern crate ansi_term;
extern crate regex;
use std::io::prelude::*;
use ansi_term::Colour::*;
use std::str;
use std::io;
use std::path::Path;
//use std::fs::File;
use std::fs::OpenOptions;
use std::error::Error;
use regex::Regex;
struct BalanceHandler {
balance: i32,
lines: Vec<String>,
arguments: Vec<String>,
}
trait HasLines {
fn initialize_lines(&mut self);
fn print_all_lines_file(&self);
fn add_entry(&mut self) -> Result<String, ::std::io::Error>;
fn provide_command(&self) -> &str;
fn get_current_balance(&mut self);
}
impl HasLines for BalanceHandler {
fn initialize_lines(&mut self) {
if self.lines.len() <= 1 {
let path = Path::new("log.txt");
let display = path.display();
let mut f = match OpenOptions::new().append(true).open(&path) {
Err(why) => panic!("Couldn't open {}: {}", display, why.description()),
Ok(f) => f,
};
match f.write_all("Entry: 00000000; Balance: $0; Date: 00/00/00.\n".as_bytes()) {
Err(why) => panic!("Couldn't write to {}: {}", display, why.description()),
Ok(_) => (),
}
}
}
fn print_all_lines_file(&self) {
for(count, i) in self.lines.iter().enumerate() {
println!("Line: {0}, Message: {1}", count, i);
}
}
fn add_entry(&mut self) -> Result<String, ::std::io::Error> {
let path = Path::new("log.txt");
let display = path.display();
let current = time::get_time();
let current = time::at(current);
let (day, month, year) = (current.tm_mday, current.tm_mon, current.tm_year);
let mut entry_id: i32 = 0;
let mut message = "None.";
let mut f = match OpenOptions::new().read(true).append(true).open(&path) {
Err(why) => panic!("Couldn't open {}: {}", display,
why.description()),
Ok(f) => f,
};
let re = Regex::new(r"[^\d]").unwrap();
if self.arguments.len() >= 3 {
let matcher: &str = &self.arguments[2];
match matcher {
"+" => self.balance += re.replace_all(&self.arguments[1], "").parse::<i32>().unwrap(),
"-" => self.balance -= re.replace_all(&self.arguments[1], "").parse::<i32>().unwrap(),
_ => println!("Improper withdraw/deposit symbol!"),
}
if self.arguments.len() > 3 {
message = &self.arguments[3];
}
} else {
self.balance += re.replace_all(&self.arguments[1], "").parse::<i32>().unwrap();
}
/*
match self.lines.iter().position(|r| r.to_string() == to_push) {
Some(x) => entry_id = x as i32,
None => break,
}
*/
let mut to_push = format!(
"Entry: {1:02}{2:02}{3:02}{4:02}; Balance: ${0}; Date: {1:02}/{2:02}/{3:02}; Message: {5}\n",
self.balance, month + 1, day, year - 100, entry_id, message).to_string();
// !! Figure out how to make better ID system for each entry.
for x in &self.lines {
if x.to_string().split(";").collect::<Vec<&str>>()[0] == to_push.split(";").collect::<Vec<&str>>()[0] {
entry_id += 1;
}
to_push = format!(
"Entry: {1:02}{2:02}{3:02}{4:02}; Balance: ${0}; Date: {1:02}/{2:02}/{3:02}; Message: {5}\n",
self.balance, month + 1, day, year - 100, entry_id, message).to_string();
}
match f.write_all(to_push.as_bytes()) {
Err(why) => panic!("Couldn't write to {}: {}", display,
why.description()),
Ok(_) => println!("Successfully wrote to {}", display),
}
Ok(to_push)
}
fn provide_command(&self) -> &str {
&self.arguments[0] as &str
}
fn get_current_balance(&mut self) {
self.balance = self.lines[self.lines.len() - 2].split("; ").collect::<Vec<&str>>()[1]
//Minus 2 because of the fact that the last line of the file will always be a \n.
.split(" ").collect::<Vec<&str>>()[1][1..].parse::<i32>().unwrap();
}
}
fn get_file_string() -> Result<String, ::std::io::Error> {
let path = Path::new("log.txt");
let display = path.display();
let mut f = match OpenOptions::new().read(true).open(&path) {
Err(why) => panic!("Couldn't open {}: {}", display,
why.description()),
Ok(f) => f,
};
//Try to be consistent with error handling and OpenOptions!
let mut s = String::new();
f.read_to_string(&mut s)?;
Ok(s)
}
fn main() {
println!("Paco's Basic Money Manager v1.0.0");
let entries = get_file_string().unwrap();
let mut handler = BalanceHandler { balance: 0,
lines: entries.split("\n").map(|x| x.to_string()).collect::<Vec<String>>(),
arguments: vec!["".to_string(); 3] };
handler.initialize_lines();
loop {
let entries = get_file_string().unwrap();
handler = BalanceHandler
{ lines: entries.split("\n").map(|x| x.to_string()).collect::<Vec<String>>(), .. handler };
//Updates the lines for every loop, making sure that every entry is recorded in the struct.
handler.get_current_balance();
let mut input_text = String::new();
io::stdin()
.read_line(&mut input_text)
.expect("Can\'t read from stdin!");
handler.arguments =
input_text.trim().split(" ").map(|x| x.to_string()).collect::<Vec<String>>();
match handler.provide_command() {
"help" => println!("{}", RGB(70, 130, 180)
.bold().paint("Commands: help, showall, showentry [date: mm/dd/yy], addentry [entry: $(amount)] [+/-] [message], quit")),
"addentry" => println!("Entry was parsed with status: {:?}", handler.add_entry()),
"showall" => handler.print_all_lines_file(),
"quit" => break,
_ => println!("Incorrect command!"),
}
}
} |
extern crate diesel;
extern crate rust_pdx_schedule;
use self::models::*;
use diesel::prelude::*;
use rust_pdx_schedule::*;
fn main() {
use self::schema::term::dsl::*;
let connection = establish_connection();
let results = term
.limit(5)
.load::<Term>(&connection)
.expect("Error loading terms");
println!("Displaying {} terms", results.len());
for t in results {
println!("{}", t.date);
println!("----------\n");
println!("{}", t.description);
}
}
|
//! Soft client to talk with soft server
use error::*;
use std::io::{Read, Write};
use types::*;
/// Soft client
///
/// ```no_run
/// use soft_core::client::SoftClient;
/// use std::net::TcpStream;
///
/// let stream = TcpStream::connect("127.0.0.1:9045").unwrap();
/// let mut client = SoftClient::new(stream);
/// ```
pub struct SoftClient<S: Read + Write> {
stream: S,
exited: bool,
}
impl<S: Read + Write> SoftClient<S> {
/// Initialize a new client from stream
pub fn new(stream: S) -> SoftClient<S> {
SoftClient {
stream: stream,
exited: false,
}
}
/// Login to soft server
pub fn login(&mut self, user: &str, pass: &str) -> Result<()> {
self.write_command(Command::Login(user.into(), pass.into()))?;
self.check_status()
}
/// Ask and get file from soft server
pub fn get(&mut self, path: &str) -> Result<Vec<u8>> {
self.write_command(Command::Get(path.into()))?;
self.check_status()?;
self.recv_file()
}
/// Ask and put file to soft server
pub fn put(&mut self, local_path: &str, remote_path: &str) -> Result<()> {
self.write_command(Command::Put(remote_path.into()))?;
self.check_status()?;
self.send_file(local_path)
}
/// Ask and list file from soft server
pub fn list(&mut self, path: &str) -> Result<Vec<String>> {
self.write_command(Command::List(path.into()))?;
self.check_status()?;
self.recv_list_file()
}
/// Ask and list file recursively from soft server
pub fn list_recursive(&mut self, path: &str) -> Result<Vec<String>> {
let mut list = self.list(path)?;
for file in list.clone() {
if file.ends_with('/') {
let sublist = self.list_recursive(&file)?;
for subfile in sublist {
list.push(subfile);
}
}
}
list.sort();
Ok(list)
}
/// Get the current working directory
pub fn cwd(&mut self) -> Result<String> {
self.write_command(Command::Cwd)?;
self.check_status()?;
self.read_line()
}
/// Change directory
pub fn cd(&mut self, path: &str) -> Result<()> {
self.write_command(Command::Cd(path.into()))?;
self.check_status()
}
/// Make directory
pub fn mkdir(&mut self, path: &str) -> Result<()> {
self.write_command(Command::Mkdir(path.into()))?;
self.check_status()
}
/// Remove a file
pub fn rm(&mut self, path: &str) -> Result<()> {
self.write_command(Command::Rm(path.into()))?;
self.check_status()
}
/// Remove a directory
pub fn rmdir(&mut self, path: &str, recursive: bool) -> Result<()> {
self.write_command(Command::Rmdir(path.into(), recursive))?;
self.check_status()
}
/// Check presence of server
pub fn presence(&mut self) -> Result<()> {
self.write_command(Command::Presence)?;
self.check_status()
}
/// Send to server an exit command
pub fn exit(&mut self) -> Result<()> {
self.write_command(Command::Exit)?;
self.exited = true;
self.check_status()
}
/// Check sended status
fn check_status(&mut self) -> Result<()> {
let status = self.read_status()?;
if status.is_negative() {
match status {
Status::WrongLogin => bail!(ErrorKind::InvalidLogin),
Status::NotConnected => bail!(ErrorKind::NotConnected),
_ => {}
}
}
Ok(())
}
// Low level functions
/// Send a command to server
///
/// Warning: this is a low level function
pub fn write_command(&mut self, command: Command) -> Result<()> {
self.stream.write(format!("{}\n", command).as_bytes())?;
Ok(())
}
/// Receive status from server
///
/// Warning: this is a low level function
pub fn read_status(&mut self) -> Result<Status> {
let mut buf = [0];
self.stream.read(&mut buf)?;
Ok(Status::from(buf[0]))
}
/// Receive file from soft server
///
/// Warning: this is a low level function
pub fn recv_file(&mut self) -> Result<Vec<u8>> {
::common::recv_file(&mut self.stream)
}
/// Receive list of file from soft server
///
/// Warning: this is a low level function
pub fn recv_list_file(&mut self) -> Result<Vec<String>> {
::common::recv_list_file(&mut self.stream)
}
/// Send file to soft server
///
/// Warning: this is a low level function
pub fn send_file(&mut self, path: &str) -> Result<()> {
::common::send_file(&mut self.stream, path)
}
/// Read a single line
pub fn read_line(&mut self) -> Result<String> {
let mut buf = String::new();
::common::read_line(&mut self.stream, &mut buf)?;
Ok(buf)
}
}
impl<S: Read + Write> Drop for SoftClient<S> {
fn drop(&mut self) {
if !self.exited {
let _ = self.exit();
}
}
}
|
/*
chapter 4
functions
*/
fn main() {
print_sum(5, 6);
}
fn print_sum(a: i32, b: i32) {
println!("sum is {}", a + b);
}
// output should be:
/*
sum is 11
*/
|
#[doc = "Register `AHB1RSTR` reader"]
pub type R = crate::R<AHB1RSTR_SPEC>;
#[doc = "Register `AHB1RSTR` writer"]
pub type W = crate::W<AHB1RSTR_SPEC>;
#[doc = "Field `DMA1RST` reader - DMA1 reset"]
pub type DMA1RST_R = crate::BitReader;
#[doc = "Field `DMA1RST` writer - DMA1 reset"]
pub type DMA1RST_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DMA2RST` reader - DMA2 reset"]
pub type DMA2RST_R = crate::BitReader;
#[doc = "Field `DMA2RST` writer - DMA2 reset"]
pub type DMA2RST_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `DMAMUXRST` reader - DMAMUX reset"]
pub type DMAMUXRST_R = crate::BitReader;
#[doc = "Field `DMAMUXRST` writer - DMAMUX reset"]
pub type DMAMUXRST_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `CRCRST` reader - CRC reset"]
pub type CRCRST_R = crate::BitReader;
#[doc = "Field `CRCRST` writer - CRC reset"]
pub type CRCRST_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `TSCRST` reader - Touch Sensing Controller reset"]
pub type TSCRST_R = crate::BitReader;
#[doc = "Field `TSCRST` writer - Touch Sensing Controller reset"]
pub type TSCRST_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
impl R {
#[doc = "Bit 0 - DMA1 reset"]
#[inline(always)]
pub fn dma1rst(&self) -> DMA1RST_R {
DMA1RST_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - DMA2 reset"]
#[inline(always)]
pub fn dma2rst(&self) -> DMA2RST_R {
DMA2RST_R::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 2 - DMAMUX reset"]
#[inline(always)]
pub fn dmamuxrst(&self) -> DMAMUXRST_R {
DMAMUXRST_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 12 - CRC reset"]
#[inline(always)]
pub fn crcrst(&self) -> CRCRST_R {
CRCRST_R::new(((self.bits >> 12) & 1) != 0)
}
#[doc = "Bit 16 - Touch Sensing Controller reset"]
#[inline(always)]
pub fn tscrst(&self) -> TSCRST_R {
TSCRST_R::new(((self.bits >> 16) & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - DMA1 reset"]
#[inline(always)]
#[must_use]
pub fn dma1rst(&mut self) -> DMA1RST_W<AHB1RSTR_SPEC, 0> {
DMA1RST_W::new(self)
}
#[doc = "Bit 1 - DMA2 reset"]
#[inline(always)]
#[must_use]
pub fn dma2rst(&mut self) -> DMA2RST_W<AHB1RSTR_SPEC, 1> {
DMA2RST_W::new(self)
}
#[doc = "Bit 2 - DMAMUX reset"]
#[inline(always)]
#[must_use]
pub fn dmamuxrst(&mut self) -> DMAMUXRST_W<AHB1RSTR_SPEC, 2> {
DMAMUXRST_W::new(self)
}
#[doc = "Bit 12 - CRC reset"]
#[inline(always)]
#[must_use]
pub fn crcrst(&mut self) -> CRCRST_W<AHB1RSTR_SPEC, 12> {
CRCRST_W::new(self)
}
#[doc = "Bit 16 - Touch Sensing Controller reset"]
#[inline(always)]
#[must_use]
pub fn tscrst(&mut self) -> TSCRST_W<AHB1RSTR_SPEC, 16> {
TSCRST_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
}
#[doc = "AHB1 peripheral reset register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ahb1rstr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ahb1rstr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct AHB1RSTR_SPEC;
impl crate::RegisterSpec for AHB1RSTR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`ahb1rstr::R`](R) reader structure"]
impl crate::Readable for AHB1RSTR_SPEC {}
#[doc = "`write(|w| ..)` method takes [`ahb1rstr::W`](W) writer structure"]
impl crate::Writable for AHB1RSTR_SPEC {
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets AHB1RSTR to value 0"]
impl crate::Resettable for AHB1RSTR_SPEC {
const RESET_VALUE: Self::Ux = 0;
}
|
use std::os::raw::c_char;
use libloading::{Library, Symbol};
use super::{State, Function};
lazy_static::lazy_static! {
pub static ref INSTANCE: Functions = {
Functions::new()
};
}
type Int = std::os::raw::c_int;
type Size = usize;
pub struct Functions {
pub lua_settop: Symbol<'static, unsafe extern "C" fn(state: State, count: Int)>,
pub lua_pushvalue: Symbol<'static, unsafe extern "C" fn(state: State, index: Int)>,
pub lua_replace: Symbol<'static, unsafe extern "C" fn(state: State, index: Int)>,
pub lua_pushlstring: Symbol<'static, unsafe extern "C" fn(state: State, data: *const c_char, length: Size)>,
pub lua_pushcclosure: Symbol<'static, unsafe extern "C" fn(state: State, func: Function, upvalues: Int)>,
pub lua_settable: Symbol<'static, unsafe extern "C" fn(state: State, index: Int)>,
pub lua_tolstring: Symbol<'static, unsafe extern "C" fn(state: State, index: Int, out_size: *mut Size) -> *const c_char>,
pub lual_loadbuffer: Symbol<'static, unsafe extern "C" fn(state: State, code: *const c_char, length: Size, name: *const c_char) -> i32>,
}
impl Functions {
fn new() -> Self {
unsafe {
let library = Box::new(Self::find_library());
let library = Box::leak(library); // Keep this library referenced forever
Functions {
lua_settop: Self::find_symbol(library, b"lua_settop"),
lua_pushvalue: Self::find_symbol(library, b"lua_pushvalue"),
lua_replace: Self::find_symbol(library, b"lua_replace"),
lua_pushlstring: Self::find_symbol(library, b"lua_pushlstring"),
lua_pushcclosure: Self::find_symbol(library, b"lua_pushcclosure"),
lua_settable: Self::find_symbol(library, b"lua_settable"),
lua_tolstring: Self::find_symbol(library, b"lua_tolstring"),
lual_loadbuffer: Self::find_symbol(library, b"luaL_loadbuffer"),
}
}
}
unsafe fn find_symbol<T>(library: &'static Library, symbol: &[u8]) -> Symbol<'static, T> {
library.get(symbol).unwrap()
}
#[cfg(target_os = "windows")]
unsafe fn find_library() -> Library {
Library::new("lua_shared.dll").unwrap()
}
#[cfg(target_os = "linux")]
unsafe fn find_library() -> Library {
Library::new("lua_shared_srv.so")
.or_else(|_| Library::new("lua_shared.so"))
.or_else(|_| Library::new("garrysmod/bin/lua_shared_srv.so"))
.or_else(|_| Library::new("garrysmod/bin/lua_shared.so"))
.or_else(|_| Library::new("bin/lua_shared_srv.so"))
.or_else(|_| Library::new("bin/lua_shared.so"))
.or_else(|_| Library::new("../lua_shared_srv.so"))
.or_else(|_| Library::new("../lua_shared.so"))
.unwrap()
}
}
|
use approx::ApproxEq;
use alga::general::{SubsetOf, Field};
use core::{Scalar, SquareMatrix};
use core::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use core::storage::OwnedStorage;
use core::allocator::OwnedAllocator;
use geometry::{TransformBase, TCategory, SuperTCategoryOf};
impl<N1, N2, D: DimName, SA, SB, C1, C2> SubsetOf<TransformBase<N2, D, SB, C2>> for TransformBase<N1, D, SA, C1>
where N1: Scalar + Field + ApproxEq + SubsetOf<N2>,
N2: Scalar + Field + ApproxEq,
C1: TCategory,
C2: SuperTCategoryOf<C1>,
D: DimNameAdd<U1>,
SA: OwnedStorage<N1, DimNameSum<D, U1>, DimNameSum<D, U1>>,
SB: OwnedStorage<N2, DimNameSum<D, U1>, DimNameSum<D, U1>>,
SA::Alloc: OwnedAllocator<N1, DimNameSum<D, U1>, DimNameSum<D, U1>, SA>,
SB::Alloc: OwnedAllocator<N2, DimNameSum<D, U1>, DimNameSum<D, U1>, SB>,
N1::Epsilon: Copy,
N2::Epsilon: Copy {
#[inline]
fn to_superset(&self) -> TransformBase<N2, D, SB, C2> {
TransformBase::from_matrix_unchecked(self.to_homogeneous().to_superset())
}
#[inline]
fn is_in_subset(t: &TransformBase<N2, D, SB, C2>) -> bool {
<Self as SubsetOf<_>>::is_in_subset(t.matrix())
}
#[inline]
unsafe fn from_superset_unchecked(t: &TransformBase<N2, D, SB, C2>) -> Self {
Self::from_superset_unchecked(t.matrix())
}
}
impl<N1, N2, D: DimName, SA, SB, C> SubsetOf<SquareMatrix<N2, DimNameSum<D, U1>, SB>> for TransformBase<N1, D, SA, C>
where N1: Scalar + Field + ApproxEq + SubsetOf<N2>,
N2: Scalar + Field + ApproxEq,
C: TCategory,
D: DimNameAdd<U1>,
SA: OwnedStorage<N1, DimNameSum<D, U1>, DimNameSum<D, U1>>,
SB: OwnedStorage<N2, DimNameSum<D, U1>, DimNameSum<D, U1>>,
SA::Alloc: OwnedAllocator<N1, DimNameSum<D, U1>, DimNameSum<D, U1>, SA>,
SB::Alloc: OwnedAllocator<N2, DimNameSum<D, U1>, DimNameSum<D, U1>, SB>,
N1::Epsilon: Copy,
N2::Epsilon: Copy {
#[inline]
fn to_superset(&self) -> SquareMatrix<N2, DimNameSum<D, U1>, SB> {
self.matrix().to_superset()
}
#[inline]
fn is_in_subset(m: &SquareMatrix<N2, DimNameSum<D, U1>, SB>) -> bool {
C::check_homogeneous_invariants(m)
}
#[inline]
unsafe fn from_superset_unchecked(m: &SquareMatrix<N2, DimNameSum<D, U1>, SB>) -> Self {
TransformBase::from_matrix_unchecked(::convert_ref_unchecked(m))
}
}
|
use util::*;
pub const PAGE_SIZE : usize = 4096; // bytes
pub const HEADER_SIZE : usize = 16; // bytes
pub struct Page {
pub id: usize,
pub storage: [u8; PAGE_SIZE],
pub num_records: usize,
// page_id of overflow bucket
pub next: Option<usize>,
pub dirty: bool,
keysize: usize,
valsize: usize,
}
// Row layout:
// | key | val |
#[derive(Debug)]
struct RowOffsets {
key_offset: usize,
val_offset: usize,
row_end: usize,
}
impl Page {
pub fn new(keysize: usize, valsize: usize) -> Page {
Page {
id: 0,
num_records: 0,
storage: [0; PAGE_SIZE],
next: None,
keysize: keysize,
valsize: valsize,
dirty: false,
}
}
/// Compute where in the page the row should be placed. Within the
/// row, calculate the offsets of the header, key and value.
fn compute_offsets(&self, row_num: usize) -> RowOffsets {
let total_size = self.keysize + self.valsize;
let row_offset = HEADER_SIZE + (row_num * total_size);
let key_offset = row_offset;
let val_offset = key_offset + self.keysize;
let row_end = val_offset + self.valsize;
RowOffsets {
key_offset: key_offset,
val_offset: val_offset,
row_end: row_end,
}
}
pub fn read_header(&mut self) {
let num_records : usize = bytearray_to_usize(self.storage[0..8].to_vec());
let next : usize = bytearray_to_usize(self.storage[8..16].to_vec());
self.num_records = num_records;
self.next = if next != 0 {
Some(next)
} else {
None
};
}
pub fn write_header(&mut self) {
mem_move(&mut self.storage[0..8], &usize_to_bytearray(self.num_records));
mem_move(&mut self.storage[8..16], &usize_to_bytearray(self.next.unwrap_or(0)));
}
pub fn read_record(&mut self, row_num: usize) -> (&[u8], &[u8]) {
let offsets = self.compute_offsets(row_num);
let key = &self.storage[offsets.key_offset..offsets.val_offset];
let val = &self.storage[offsets.val_offset..offsets.row_end];
(key, val)
}
/// Write record to offset specified by `row_num`. The offset is
/// calculated to accomodate header as well.
pub fn write_record(&mut self, row_num: usize, key: &[u8], val: &[u8]) {
let offsets = self.compute_offsets(row_num);
mem_move(&mut self.storage[offsets.key_offset..offsets.val_offset],
key);
mem_move(&mut self.storage[offsets.val_offset..offsets.row_end],
val);
}
/// Increment number of records in page
pub fn incr_num_records(&mut self) {
self.num_records += 1;
}
}
|
extern crate discord;
use arg;
use self::discord::Discord;
use self::discord::model::{ChannelId, LiveServer, Message, ServerId, ServerInfo};
pub struct BasicServerInfo {
pub id: ServerId,
pub name: String,
pub icon: Option<String>,
}
impl From<LiveServer> for BasicServerInfo {
fn from(live_server: LiveServer) -> Self {
BasicServerInfo {
id: live_server.id,
name: live_server.name,
icon: live_server.icon,
}
}
}
impl From<ServerInfo> for BasicServerInfo {
fn from(server_info: ServerInfo) -> Self {
BasicServerInfo {
id: server_info.id,
name: server_info.name,
icon: server_info.icon,
}
}
}
pub trait MessageRecipient {
fn send_message(&self, discord: &Discord, message: &str);
}
impl MessageRecipient for ChannelId {
fn send_message(&self, discord: &Discord, message: &str) {
let _ = discord.send_message(*self, message, "", false);
}
}
impl MessageRecipient for Message {
fn send_message(&self, discord: &Discord, message: &str) {
let _ = discord.send_message(self.channel_id, message, "", false);
}
}
// If s begins with a valid arg::Type::UserId, arg::Type::ChannelId, arg::Type::RoleId, or
// arg::Type::EmojiId, returns (that arg, the string without the arg)
// Otherwise, returns (None, s)
pub fn extract_preceding_arg<'a>(s: &'a str) -> (Option<arg::Type<'a>>, &str) {
if s.trim_left().starts_with("<") && s.contains(">") {
let maybe_end_of_arg = s.find(">").unwrap() + 1;
let (maybe_arg, maybe_rest) = s.split_at(maybe_end_of_arg);
match arg::get_type(maybe_arg.trim()) {
arg::Type::Text(_) => {}
arg => {
return (Some(arg), maybe_rest);
}
}
}
(None, s)
}
// Removes all characters not used in commands from the beginning of a &str
pub fn remove_non_command_characters(s: &str) -> &str {
let mut s_chars = s.chars();
let mut skip_pos = 0;
while let Some(c) = s_chars.next() {
if c.is_whitespace() || c == ',' {
skip_pos += c.len_utf8();
} else {
break;
}
}
s.split_at(skip_pos).1
}
// Splits a &str into two parts: (The first word preceding whitespace, everything else)
// Trims whitespace at the beginning if there is any
// Used to split a command from its arguments
pub fn extract_first_word(s: &str) -> (&str, &str) {
let s = s.trim_left();
let mut s_chars = s.chars();
let mut end_of_first_word = 0;
while let Some(c) = s_chars.next() {
if !c.is_whitespace() {
end_of_first_word += c.len_utf8();
} else {
break;
}
}
let (first_word, the_rest) = s.split_at(end_of_first_word);
let the_rest = the_rest.trim_left();
(first_word, the_rest)
}
mod tests {
#[allow(unused_imports)]
use super::{extract_preceding_arg, remove_non_command_characters, extract_first_word};
#[allow(unused_imports)]
use super::discord::model::{ChannelId, EmojiId, RoleId, UserId};
#[allow(unused_imports)]
use super::arg::Type;
#[test]
fn test_extract_preceding_arg() {
macro_rules! test {
($test_string:expr => (None, $expected_command:expr)) => {
let (arg, expected_command) = extract_preceding_arg($test_string);
assert_eq!(arg.is_none(), true);
assert_eq!(expected_command, $expected_command);
};
($test_string:expr => ($expected_type:ident($value:expr), $expected_command:expr)) => {
let (arg, expected_command) = extract_preceding_arg($test_string);
assert_eq!(
match arg {
Some(Type::$expected_type(v)) => Some(v),
_ => None,
},
Some($expected_type($value)));
assert_eq!(expected_command, $expected_command);
};
}
test!(" abc " => (None, " abc "));
test!(" <@> abc " => (None, " <@> abc "));
test!(" <@123> abc " => (UserId(123), " abc "));
test!(" <@!123> abc " => (UserId(123), " abc "));
test!(" <@&123> abc " => (RoleId(123), " abc "));
test!(" <#123> abc " => (ChannelId(123), " abc "));
test!(" <:emoji:123> abc " => (EmojiId(123), " abc "));
}
#[test]
fn test_remove_non_command_characters() {
macro_rules! test {
($test_string:expr => $expected_value:expr) => {
assert_eq!(remove_non_command_characters($test_string), $expected_value);
};
}
test!("abcd " => "abcd ");
test!(".abcd " => "abcd ");
test!(".-_abcd " => "-_abcd ");
test!(" _abcd " => "_abcd ");
test!(" - . _abcd " => "- . _abcd ");
}
#[test]
fn test_extract_first_word() {
macro_rules! test {
($test_string:expr => ($s1:expr, $s2:expr)) => {
assert_eq!(extract_first_word($test_string), ($s1, $s2));
};
}
test!("" => ("", ""));
test!(" \t " => ("", ""));
test!(" ab " => ("ab", ""));
test!(" ab \t " => ("ab", ""));
test!("ab cd" => ("ab", "cd"));
test!("ab cd \t " => ("ab", "cd \t "));
}
}
|
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{commands::*, sg_client_proxy::SGClientProxy};
use sgtypes::account_state::AccountState;
/// Major command for account related operations.
pub struct AccountCommand {}
impl Command for AccountCommand {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["account", "a"]
}
fn get_description(&self) -> &'static str {
"Account operations"
}
fn execute(&self, client: &mut SGClientProxy, params: &[&str]) {
let commands: Vec<Box<dyn Command>> = vec![
Box::new(AccountCommandCreate {}),
Box::new(AccountCommandMint {}),
Box::new(AccountCommandState {}),
Box::new(AccountCommandRecoverWallet {}),
Box::new(AccountCommandWriteRecovery {}),
];
subcommand_execute(¶ms[0], commands, client, ¶ms[1..]);
}
}
/// Sub command to create a random account. The account will not be saved on chain.
pub struct AccountCommandCreate {}
impl Command for AccountCommandCreate {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["create", "c"]
}
fn get_description(&self) -> &'static str {
"Create an account. Returns reference ID to use in other operations"
}
fn execute(&self, client: &mut SGClientProxy, _params: &[&str]) {
println!(">> Creating/retrieving next account from wallet");
match client.create_account() {
Ok((addr, index)) => println!(
"Created/retrieved address {},index {:?}",
hex::encode(addr),
index
),
Err(e) => report_error("Error creating account", e),
}
}
}
pub struct AccountCommandMint {}
impl Command for AccountCommandMint {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["mint", "mintb", "m", "mb"]
}
fn get_params_help(&self) -> &'static str {
"<receiver_account_ref_id>|<receiver_account_address> <number_of_coins>"
}
fn get_description(&self) -> &'static str {
"Mint coins to the account. Suffix 'b' is for blocking"
}
fn execute(&self, client: &mut SGClientProxy, params: &[&str]) {
if params.len() < 3 {
println!("Invalid number of arguments for mint");
return;
}
match client.faucet(params[2].parse::<u64>().unwrap(), params[1]) {
Ok(_result) => println!("mint success"),
Err(e) => report_error("Error mint account", e),
}
}
}
pub struct AccountCommandState {}
impl Command for AccountCommandState {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["state", "s"]
}
fn get_params_help(&self) -> &'static str {
"<receiver_account_ref_id>|<receiver_account_address>"
}
fn get_description(&self) -> &'static str {
"get state of account"
}
fn execute(&self, client: &mut SGClientProxy, params: &[&str]) {
if params.len() < 2 {
println!("Invalid number of arguments for state");
return;
}
match client.account_state(params[1]) {
Ok((version, result, proof)) => match result {
Some(data) => {
let account_resource =
AccountState::from_account_state_blob(version, data, proof)
.unwrap()
.get_account_resource();
match account_resource {
Some(resource) => {
println!("account state is {:?}", resource);
}
None => {
println!("no such account state ");
}
}
}
None => {
println!("no such account state ");
}
},
Err(e) => report_error("Error mint account", e),
}
}
}
/// Sub command to recover wallet from the file specified.
pub struct AccountCommandRecoverWallet {}
impl Command for AccountCommandRecoverWallet {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["recover", "r"]
}
fn get_params_help(&self) -> &'static str {
"<file_path>"
}
fn get_description(&self) -> &'static str {
"Recover Libra wallet from the file path"
}
fn execute(&self, client: &mut SGClientProxy, params: &[&str]) {
println!(">> Recovering Wallet");
if params.len() < 1 {
println!("Invalid number of arguments for recovery");
return;
}
match client.recover_wallet_accounts(¶ms) {
Ok(account_data) => {
println!(
"Wallet recovered and the first {} child accounts were derived",
account_data.len()
);
for (index, address) in account_data.iter().enumerate() {
println!("#{} address {}", index, hex::encode(address));
}
}
Err(e) => report_error("Error recovering Libra wallet", e),
}
}
}
/// Sub command to backup wallet to the file specified.
pub struct AccountCommandWriteRecovery {}
impl Command for AccountCommandWriteRecovery {
fn get_aliases(&self) -> Vec<&'static str> {
vec!["write", "w"]
}
fn get_params_help(&self) -> &'static str {
"<file_path>"
}
fn get_description(&self) -> &'static str {
"Save Libra wallet mnemonic recovery seed to disk"
}
fn execute(&self, client: &mut SGClientProxy, params: &[&str]) {
println!(">> Saving Libra wallet mnemonic recovery seed to disk");
if params.len() < 1 {
println!("Invalid number of arguments for write");
return;
}
match client.write_recovery(¶ms) {
Ok(_) => println!("Saved mnemonic seed to disk"),
Err(e) => report_error("Error writing mnemonic recovery seed to file", e),
}
}
}
|
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
}
/// A function that returns the sign of a floating-point number or zero if it is
/// close to zero (within epsilon). Note that the method `std::f32::signum()` exists,
/// but it doesn't work exactly the same way.
pub fn sign_with_tolerance(value: f32) -> f32 {
if value > 0.001 {
1.0
} else if value < -0.001 {
-1.0
} else {
0.0
}
}
|
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate log;
extern crate fern;
#[macro_use]
extern crate lazy_static;
extern crate multipart;
pub mod logger;
pub mod api;
use crate::logger::setup_logger;
use crate::api::server::build_server;
fn main() {
if let Err(_) = setup_logger() {
error!("Failed to set up logger!")
}
build_server().launch();
}
|
use super::{Result, WebSocketError};
use serde::de::DeserializeOwned;
use wasm_bindgen::{JsCast, JsValue};
use web_sys::MessageEvent;
#[allow(clippy::module_name_repetitions)]
#[derive(Debug)]
pub struct WebSocketMessage {
pub(crate) data: JsValue,
pub(crate) message_event: MessageEvent,
}
impl WebSocketMessage {
/// Return message data as `String`.
///
/// # Errors
///
/// Returns `WebSocketError::TextError` if data isn't a valid utf-8 string.
pub fn text(&self) -> Result<String> {
self.data.as_string().ok_or(WebSocketError::TextError(
"data is not a valid utf-8 string",
))
}
/// JSON parse message data into provided type.
///
/// # Errors
///
/// Returns
/// - `WebSocketError::TextError` if data isn't a valid utf-8 string.
/// - `WebSocketError::SerdeError` when JSON decoding fails.
pub fn json<T: DeserializeOwned + 'static>(&self) -> Result<T> {
let text = self.text()?;
serde_json::from_str(&text).map_err(WebSocketError::SerdeError)
}
/// Return message data as `Vec<u8>`.
///
/// # Errors
///
/// Returns:
/// - `WebSocketError::PromiseError` when loading bytes from `Blob` fails.
/// - `WebSocketError::TextError` if the message data isn't binary but also not a valid utf-8 string.
pub async fn bytes(&self) -> Result<Vec<u8>> {
if let Some(array_buffer) = self.data.dyn_ref::<js_sys::ArrayBuffer>() {
let bytes = js_sys::Uint8Array::new(array_buffer).to_vec();
return Ok(bytes);
}
if let Some(blob) = self.data.dyn_ref::<web_sys::Blob>() {
let blob = gloo_file::Blob::from(blob.clone());
let bytes = gloo_file::futures::read_as_bytes(&blob)
.await
.map_err(WebSocketError::FileReaderError)?;
return Ok(bytes);
}
Ok(self.text()?.into_bytes())
}
/// Return message data as `Blob`.
///
/// # Errors
///
/// Returns `WebSocketError::TextError` if the message data is neither binary nor a valid utf-8 string.
pub fn blob(self) -> Result<gloo_file::Blob> {
if self.contains_array_buffer() {
let array_buffer = self.data.unchecked_into::<js_sys::ArrayBuffer>();
return Ok(gloo_file::Blob::new(array_buffer));
}
if self.contains_blob() {
let blob = self.data.unchecked_into::<web_sys::Blob>();
return Ok(gloo_file::Blob::from(blob));
}
Ok(gloo_file::Blob::new(self.text()?.as_str()))
}
/// Is message data `ArrayBuffer`?
pub fn contains_array_buffer(&self) -> bool {
self.data.has_type::<js_sys::ArrayBuffer>()
}
/// Is message data `Blob`?
pub fn contains_blob(&self) -> bool {
self.data.has_type::<web_sys::Blob>()
}
/// Is message data `String`?
pub fn contains_text(&self) -> bool {
self.data.has_type::<js_sys::JsString>()
}
/// Get underlying data as `wasm_bindgen::JsValue`.
///
/// This is an escape path if current API can't handle your needs.
/// Should you find yourself using it, please consider [opening an issue][issue].
///
/// [issue]: https://github.com/seed-rs/seed/issues
pub const fn raw_data(&self) -> &JsValue {
&self.data
}
/// Get underlying `web_sys::MessageEvent`.
///
/// This is an escape path if current API can't handle your needs.
/// Should you find yourself using it, please consider [opening an issue][issue].
///
/// [issue]: https://github.com/seed-rs/seed/issues
pub const fn raw_message(&self) -> &web_sys::MessageEvent {
&self.message_event
}
}
#[cfg(test)]
pub mod tests {
use crate::browser::web_socket::WebSocketMessage;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
async fn get_bytes_from_message() {
let bytes = "some test message".as_bytes();
let blob = gloo_file::Blob::new(bytes);
let message_event = web_sys::MessageEvent::new("test").unwrap();
let ws_msg = WebSocketMessage {
data: blob.into(),
message_event,
};
let result_bytes = ws_msg.bytes().await.unwrap();
assert_eq!(bytes, &*result_bytes);
}
}
|
use crate::{Atomize, IsBot, IsTop, LatticeFrom, LatticeOrd, Merge};
impl Merge<Self> for () {
fn merge(&mut self, _other: Self) -> bool {
false
}
}
impl LatticeOrd for () {}
impl LatticeFrom<Self> for () {
fn lattice_from(other: Self) -> Self {
other
}
}
impl IsBot for () {
fn is_bot(&self) -> bool {
true
}
}
impl IsTop for () {
fn is_top(&self) -> bool {
true
}
}
impl Atomize for () {
type Atom = Self;
type AtomIter = std::iter::Once<Self>;
fn atomize(self) -> Self::AtomIter {
std::iter::once(self)
}
}
|
//! # JSON RPC module errors
use super::core;
use super::storage;
use crate::contract;
use crate::keystore;
use crate::mnemonic;
use failure::Fail;
use hex;
use jsonrpc_core;
use reqwest;
use serde_json;
use std::io;
/// JSON RPC errors
#[derive(Debug, Fail)]
pub enum Error {
/// Http client error
#[fail(display = "HTTP client error: {:?}", _0)]
HttpClient(reqwest::Error),
/// RPC error
#[fail(display = "RPC error: {:?}", _0)]
RPC(jsonrpc_core::Error),
/// Invalid data format
#[fail(display = "Invalid data format: {}", _0)]
InvalidDataFormat(String),
/// Storage error
#[fail(display = "Keyfile storage error: {}", _0)]
StorageError(String),
/// Storage error
#[fail(display = "Contract ABI error: {}", _0)]
ContractAbiError(String),
/// Mnemonic phrase operations error
#[fail(display = "Mnemonic error: {}", _0)]
MnemonicError(String),
/// Typed Data Error
TypedDataError(String),
}
impl From<keystore::Error> for Error {
fn from(err: keystore::Error) -> Self {
Error::InvalidDataFormat(format!("keystore: {}", err.to_string()))
}
}
impl From<io::Error> for Error {
fn from(e: io::Error) -> Self {
Error::InvalidDataFormat(e.to_string())
}
}
impl From<reqwest::Error> for Error {
fn from(err: reqwest::Error) -> Self {
Error::HttpClient(err)
}
}
impl From<core::Error> for Error {
fn from(err: core::Error) -> Self {
Error::InvalidDataFormat(err.to_string())
}
}
impl From<serde_json::Error> for Error {
fn from(err: serde_json::Error) -> Self {
Error::InvalidDataFormat(err.to_string())
}
}
impl From<hex::FromHexError> for Error {
fn from(err: hex::FromHexError) -> Self {
Error::InvalidDataFormat(err.to_string())
}
}
impl From<jsonrpc_core::Error> for Error {
fn from(err: jsonrpc_core::Error) -> Self {
Error::RPC(err)
}
}
impl From<storage::KeystoreError> for Error {
fn from(err: storage::KeystoreError) -> Self {
Error::StorageError(err.to_string())
}
}
impl From<contract::Error> for Error {
fn from(err: contract::Error) -> Self {
Error::ContractAbiError(err.to_string())
}
}
impl From<mnemonic::Error> for Error {
fn from(err: mnemonic::Error) -> Self {
Error::MnemonicError(err.to_string())
}
}
impl Into<jsonrpc_core::Error> for Error {
fn into(self) -> jsonrpc_core::Error {
jsonrpc_core::Error::internal_error()
}
}
|
#[derive(Debug, PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Hash)]
pub struct Address(pub u64);
#[derive(Debug, PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Hash)]
pub struct Pass(pub u64);
#[derive(Debug, PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Hash)]
pub struct Size(pub u64);
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub enum CurrentStatus {
CopyNonTriedBlock,
TrimmingBlock,
ScrapingBlock,
RetryBadSector,
Filling,
Approximate,
Finished,
}
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub enum BlockStatus {
Untried,
NonTrimmed,
NonScraped,
BadSector,
Finished,
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub struct MapFile {
pub current_state: CurrentState,
pub blocks: Vec<Block>,
}
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub struct CurrentState {
pub current_pos: Address,
pub current_status: CurrentStatus,
pub current_pass: Option<Pass>,
}
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub struct Block {
pub pos: Address,
pub size: Size,
pub status: BlockStatus,
}
|
use logos::Logos;
use new_pratt::*;
use std::io::{BufRead, Write};
use std::iter::Peekable;
#[derive(Logos, Debug, PartialEq)]
enum Token {
#[token("(")]
LeftParen,
#[token(")")]
RightParen,
#[token("+")]
Plus,
#[token("-")]
Minus,
#[token("*")]
Star,
#[token("/")]
Slash,
#[token("^")]
Caret,
#[regex(r"\d+", |lex| lex.slice().parse())]
Number(i32),
#[error]
#[regex(r"[ \t\r\n]+", logos::skip)]
Error,
}
#[derive(Debug, PartialEq)]
enum Expr {
Binary(Box<Expr>, Token, Box<Expr>),
Prefix(Token, Box<Expr>),
Number(i32),
}
#[derive(Debug)]
enum ParseError {
PrattError(PrattError<Token>),
EmptyParens,
NoMatchingParen,
}
impl From<PrattError<Token>> for ParseError {
fn from(err: PrattError<Token>) -> Self {
Self::PrattError(err)
}
}
struct Parser;
impl<I> PrattParser<I> for Parser
where
I: Iterator<Item = Token>,
{
type Input = Token;
type Output = Expr;
type Error = ParseError;
fn query_affix(
&mut self,
token: &Self::Input,
mode: ParseMode,
) -> Result<Option<Affix>, Self::Error> {
let ret = match token {
Token::LeftParen => Some(Affix::Nilfix),
Token::RightParen => None,
Token::Minus if mode.prefix() => Some(Affix::Prefix(Precedence(4))),
Token::Plus | Token::Minus => Some(Affix::Infix(Precedence(1), Associativity::Left)),
Token::Star | Token::Slash => Some(Affix::Infix(Precedence(2), Associativity::Left)),
Token::Caret => Some(Affix::Infix(Precedence(3), Associativity::Right)),
Token::Number(_) => Some(Affix::Nilfix),
_ => panic!("unexpected token: {:?}", token),
};
Ok(ret)
}
fn nilfix(
&mut self,
token: Self::Input,
input: &mut Peekable<&mut I>,
) -> Result<Self::Output, Self::Error> {
let ret = match token {
Token::LeftParen => {
let inner = self
.parse_precedence(input, Precedence::MIN)
.and_then(|opt| opt.ok_or(ParseError::EmptyParens))?;
input
.next_if_eq(&Token::RightParen)
.ok_or(ParseError::NoMatchingParen)?;
inner
}
Token::Number(x) => Expr::Number(x),
_ => unreachable!(),
};
Ok(ret)
}
fn prefix(
&mut self,
op: Self::Input,
rhs: Self::Output,
_input: &mut Peekable<&mut I>,
) -> Result<Self::Output, Self::Error> {
let ret = match op {
Token::Minus => Expr::Prefix(op, Box::new(rhs)),
_ => unreachable!(),
};
Ok(ret)
}
fn postfix(
&mut self,
_lhs: Self::Output,
_op: Self::Input,
_input: &mut Peekable<&mut I>,
) -> Result<Self::Output, Self::Error> {
unreachable!()
}
fn infix(
&mut self,
lhs: Self::Output,
op: Self::Input,
rhs: Self::Output,
_: &mut Peekable<&mut I>,
) -> Result<Self::Output, Self::Error> {
let ret = match op {
Token::Plus | Token::Minus | Token::Star | Token::Slash | Token::Caret => {
Expr::Binary(Box::new(lhs), op, Box::new(rhs))
}
_ => unreachable!(),
};
Ok(ret)
}
fn custom(
&mut self,
_lhs: Option<Self::Output>,
_token: Self::Input,
_rhs: Option<Self::Output>,
_input: &mut Peekable<&mut I>,
) -> Result<Self::Output, Self::Error> {
unreachable!()
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut stdout = std::io::stdout();
print!("> ");
stdout.flush()?;
for line in std::io::stdin().lock().lines() {
let line = line?;
match Parser.parse(&mut Token::lexer(line.trim())) {
Ok(expr) => println!("{:?}", expr),
Err(why) => eprintln!("Error while parsing: {:?}", why),
};
print!("> ");
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
fn parse(input: &str) -> Expr {
Parser.parse(&mut Token::lexer(input)).unwrap()
}
fn parse_err(input: &str) -> ParseError {
Parser.parse(&mut Token::lexer(input)).unwrap_err()
}
fn check(input: &str, expected: Expr) {
assert_eq!(parse(input), expected);
}
fn check_err(input: &str, expected: &str) {
assert_eq!(&format!("{:?}", parse_err(input)), expected);
}
#[test]
fn parse_number() {
check("123", Expr::Number(123));
check("1234567890", Expr::Number(1234567890));
}
#[test]
fn parse_prefix() {
check(
"-500",
Expr::Prefix(Token::Minus, Box::new(Expr::Number(500))),
);
check(
"---1",
Expr::Prefix(
Token::Minus,
Box::new(Expr::Prefix(
Token::Minus,
Box::new(Expr::Prefix(Token::Minus, Box::new(Expr::Number(1)))),
)),
),
);
}
#[test]
fn parse_binary() {
check(
"1 + 2",
Expr::Binary(
Box::new(Expr::Number(1)),
Token::Plus,
Box::new(Expr::Number(2)),
),
);
check(
"10 -- 4",
Expr::Binary(
Box::new(Expr::Number(10)),
Token::Minus,
Box::new(Expr::Prefix(Token::Minus, Box::new(Expr::Number(4)))),
),
);
check(
"1 * 2 + 3 / -4",
Expr::Binary(
Box::new(Expr::Binary(
Box::new(Expr::Number(1)),
Token::Star,
Box::new(Expr::Number(2)),
)),
Token::Plus,
Box::new(Expr::Binary(
Box::new(Expr::Number(3)),
Token::Slash,
Box::new(Expr::Prefix(Token::Minus, Box::new(Expr::Number(4)))),
)),
),
);
check(
"2 ^ 3 ^ 4",
Expr::Binary(
Box::new(Expr::Number(2)),
Token::Caret,
Box::new(Expr::Binary(
Box::new(Expr::Number(3)),
Token::Caret,
Box::new(Expr::Number(4)),
)),
),
);
}
#[test]
fn parse_grouping() {
check(
"2 * (1 + 3)",
Expr::Binary(
Box::new(Expr::Number(2)),
Token::Star,
Box::new(Expr::Binary(
Box::new(Expr::Number(1)),
Token::Plus,
Box::new(Expr::Number(3)),
)),
),
);
check(
"2 * (1 + 2 * (1 + 2))",
Expr::Binary(
Box::new(Expr::Number(2)),
Token::Star,
Box::new(Expr::Binary(
Box::new(Expr::Number(1)),
Token::Plus,
Box::new(Expr::Binary(
Box::new(Expr::Number(2)),
Token::Star,
Box::new(Expr::Binary(
Box::new(Expr::Number(1)),
Token::Plus,
Box::new(Expr::Number(2)),
)),
)),
)),
),
)
}
#[test]
fn errors() {
check_err("", "PrattError(EmptyInput)");
check_err("1 1", "PrattError(UnexpectedNilfix(Number(1)))");
check_err("1 ** 1", "PrattError(UnexpectedInfix(Star))");
check_err("1 + ()", "EmptyParens");
check_err("1 * (2 + 3", "NoMatchingParen");
}
}
|
/*!
Fast badge generator for any purpose
Create badges with text, icons and sparkline chart
# Web
See <https://github.com/msuntharesan/badgeland#web>
# Quick start
Add `badgeland` to your `Cargo.toml` as as a dependency.
# Examples
```rust
use badgeland::{Badge};
fn badge() {
let mut badge = Badge::new();
badge.subject("Subject");
println!("{}", badge.text("Text").to_string());
}
```
This produce a svg badge: 
```rust
use badgeland::{Badge};
fn badge_with_data() {
let mut badge = Badge::new();
badge.subject("Subject");
println!("{}", badge.data(&[12., 34., 23., 56., 45.]).to_string());
}
```
This produce a svg badge: 
*/
mod badge;
mod badge_data;
mod color;
mod error;
mod icons;
pub use badge::{Badge, Size, Style};
pub use badge_data::BadgeData;
pub use color::*;
pub use error::*;
pub use icons::Icon;
#[cfg(feature = "static_icons")]
pub use icons::{icon_exists, icon_keys};
pub type InitialBadge<'a> = Badge<'a, badge::BadgeTypeInit>;
|
use std::io;
pub fn read_line() -> String {
let mut input = String::new();
io::stdin()
.read_line(&mut input)
.expect("Error reading stdin");
input.trim().to_owned()
}
mod response;
pub use response::do_what;
pub use response::dont_have;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.