-
Notifications
You must be signed in to change notification settings - Fork 80
Add esp32c3 support #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xuchang-vivo
wants to merge
60
commits into
vivoblueos:main
Choose a base branch
from
xuchang-vivo:xc/seeed_xiao_esp32c3_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add esp32c3 support #334
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
df32a77
minor
xuchang-vivo d32a02e
minor
xuchang-vivo 08db650
minor
xuchang-vivo 522d981
minor
xuchang-vivo b983588
laji
xuchang-vivo be8a54f
wip
xuchang-vivo b0906eb
minor
xuchang-vivo 5bf7855
add intr
xuchang-vivo 188fa62
minor
xuchang-vivo a4a053e
minor
xuchang-vivo 4f3fdcc
minor
xuchang-vivo b87cdb6
minor
xuchang-vivo 6cfc9a9
del idf deps
xuchang-vivo 51ebf12
add riscv kconfig
xuchang-vivo b31e749
set mie
xuchang-vivo d66be8e
minor
xuchang-vivo 1ce0425
minor
xuchang-vivo 3af91c9
minor
xuchang-vivo 410d64a
minor
xuchang-vivo 5f27e0d
minor
xuchang-vivo 93a386a
minor
xuchang-vivo 61cad70
minor
xuchang-vivo 5ad8675
minor
xuchang-vivo a7c7f77
minor
xuchang-vivo d6498c8
make fifo tx enable
xuchang-vivo e7aadfc
disable wdt
xuchang-vivo c71d44e
add intc
xuchang-vivo c8b0a88
minor
xuchang-vivo 7685348
add copyright
xuchang-vivo 472bfff
add link.x
xuchang-vivo bc8be07
make mtime optional
xuchang-vivo b146042
minor
xuchang-vivo 29179e2
Apply suggestion from @lawkai-vivo
lawkai-vivo 06a314f
Update kconfig/config/seeed_xiao_esp32c3/debug/defconfig
lawkai-vivo f52645a
Update driver/src/systimer/esp32_sys_timer.rs
xuchang-vivo 19afb4c
Update driver/src/systimer/esp32_sys_timer.rs
xuchang-vivo 4a549a0
add unittest_kernel
xuchang-vivo 2445235
fix bug
xuchang-vivo 563936f
set unittest thread num options
xuchang-vivo 632cbb0
fix
xuchang-vivo da57e7c
del unncessary logic
xuchang-vivo 90d10f1
minor
xuchang-vivo 5a60b80
add check_all
xuchang-vivo d6f0a09
del kconfig.test
xuchang-vivo 287a38e
fix compile error
xuchang-vivo d63e450
minor
xuchang-vivo 9e845ac
minor
xuchang-vivo 262ea0b
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 193baea
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 8ec65b8
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 121354d
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 7e30211
fix
xuchang-vivo bf9adfe
add compensation
xuchang-vivo 101242c
minor
xuchang-vivo 035a5db
fix test_timer_timeout_accuracy
xuchang-vivo 874f231
minor
xuchang-vivo 18c529f
minor
xuchang-vivo cadfb06
let mutex wait
xuchang-vivo 92b6e40
del unnecessary logic
xuchang-vivo 7c6a8ce
add compensation
xuchang-vivo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (c) 2026 vivo Mobile Communication Co., Ltd. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use tock_registers::{ | ||
| interfaces::{ReadWriteable, Readable, Writeable}, | ||
| register_bitfields, register_structs, | ||
| registers::ReadWrite, | ||
| }; | ||
|
|
||
| use crate::{ | ||
| interrupt_controller::Interrupt, static_ref::StaticRef, | ||
| uart::esp32_usb_serial::JFIFO_ST_REG::OUT_FIFO_FULL, | ||
| }; | ||
|
|
||
| register_structs! { | ||
| pub IntcRegisters { | ||
| (0x000 => _reserved0), | ||
| (0x104 => cpu_int_enable_reg: ReadWrite<u32>), | ||
| (0x108 => _reserved1), | ||
| (0x118 => priority_reg: [ReadWrite<u32, PRIORITY_REG::Register>; 31]), | ||
| (0x194 => threshold_reg: ReadWrite<u32, THRESHOLD_REG::Register>), | ||
| (0x198 => @END), | ||
| } | ||
| } | ||
|
|
||
| register_bitfields! [ | ||
| u32, | ||
|
|
||
| pub PRIORITY_REG [ | ||
| PRIORITY OFFSET(0) NUMBITS(4) [], | ||
| ], | ||
|
|
||
| pub THRESHOLD_REG [ | ||
| THRESHOLD OFFSET(0) NUMBITS(4) [], | ||
| ], | ||
| ]; | ||
|
|
||
| pub struct Esp32Intc { | ||
| registers: StaticRef<IntcRegisters>, | ||
| } | ||
|
|
||
| impl Esp32Intc { | ||
| pub const fn new(base: usize) -> Self { | ||
| Self { | ||
| registers: unsafe { StaticRef::new(base as *const IntcRegisters) }, | ||
| } | ||
| } | ||
|
|
||
| pub fn allocate_irq(&self, irq: Interrupt) { | ||
| let mut map_reg = | ||
| self.registers.inner() as *const IntcRegisters as usize + irq.source_no * 4; | ||
| unsafe { | ||
| core::ptr::write_volatile(map_reg as *mut u32, irq.irq_no as u32); | ||
| } | ||
| } | ||
|
|
||
| pub fn enable_irq(&self, irq: Interrupt) { | ||
| let mut enable_reg = self.registers.cpu_int_enable_reg.get(); | ||
| enable_reg |= 1 << irq.irq_no; | ||
| self.registers.cpu_int_enable_reg.set(enable_reg); | ||
| } | ||
|
|
||
| pub fn set_priority(&self, irq: Interrupt, priority: u8) { | ||
| self.registers.priority_reg[(irq.irq_no - 1) as usize] | ||
| .write(PRIORITY_REG::PRIORITY.val(priority as u32)); | ||
| } | ||
|
|
||
| pub fn set_threshold(&self, threshold: u8) { | ||
| self.registers | ||
| .threshold_reg | ||
| .write(THRESHOLD_REG::THRESHOLD.val(threshold as u32)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) 2026 vivo Mobile Communication Co., Ltd. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #[cfg(target_chip = "esp32c3")] | ||
| pub mod esp32_intc; | ||
|
|
||
| pub struct Interrupt { | ||
| pub(crate) source_no: usize, | ||
| pub(crate) irq_no: usize, | ||
| } | ||
|
|
||
| impl Interrupt { | ||
| pub const fn new(source_no: usize, irq_no: usize) -> Self { | ||
| Self { source_no, irq_no } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.