aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/lib.rs b/src/lib.rs
index af8f74a6d..069ca40f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,17 +11,17 @@ mod bus;
11mod consts; 11mod consts;
12mod countries; 12mod countries;
13mod events; 13mod events;
14mod ioctl;
14mod structs; 15mod structs;
15 16
16mod control; 17mod control;
17mod nvram; 18mod nvram;
18mod runner; 19mod runner;
19 20
20use core::cell::Cell;
21
22use embassy_net_driver_channel as ch; 21use embassy_net_driver_channel as ch;
23use embedded_hal_1::digital::OutputPin; 22use embedded_hal_1::digital::OutputPin;
24use events::EventQueue; 23use events::EventQueue;
24use ioctl::IoctlState;
25 25
26use crate::bus::Bus; 26use crate::bus::Bus;
27pub use crate::bus::SpiBusCyw43; 27pub use crate::bus::SpiBusCyw43;
@@ -30,12 +30,6 @@ pub use crate::runner::Runner;
30 30
31const MTU: usize = 1514; 31const MTU: usize = 1514;
32 32
33#[derive(Clone, Copy)]
34pub enum IoctlType {
35 Get = 0,
36 Set = 2,
37}
38
39#[allow(unused)] 33#[allow(unused)]
40#[derive(Clone, Copy, PartialEq, Eq)] 34#[derive(Clone, Copy, PartialEq, Eq)]
41enum Core { 35enum Core {
@@ -106,26 +100,8 @@ const CHIP: Chip = Chip {
106 chanspec_ctl_sb_mask: 0x0700, 100 chanspec_ctl_sb_mask: 0x0700,
107}; 101};
108 102
109#[derive(Clone, Copy)]
110enum IoctlState {
111 Idle,
112
113 Pending {
114 kind: IoctlType,
115 cmd: u32,
116 iface: u32,
117 buf: *mut [u8],
118 },
119 Sent {
120 buf: *mut [u8],
121 },
122 Done {
123 resp_len: usize,
124 },
125}
126
127pub struct State { 103pub struct State {
128 ioctl_state: Cell<IoctlState>, 104 ioctl_state: IoctlState,
129 ch: ch::State<MTU, 4, 4>, 105 ch: ch::State<MTU, 4, 4>,
130 events: EventQueue, 106 events: EventQueue,
131} 107}
@@ -133,7 +109,7 @@ pub struct State {
133impl State { 109impl State {
134 pub fn new() -> Self { 110 pub fn new() -> Self {
135 Self { 111 Self {
136 ioctl_state: Cell::new(IoctlState::Idle), 112 ioctl_state: IoctlState::new(),
137 ch: ch::State::new(), 113 ch: ch::State::new(),
138 events: EventQueue::new(), 114 events: EventQueue::new(),
139 } 115 }