Skip to content
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

Msp432: DMA-support #2066

Merged
merged 5 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion chips/msp432/src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::fmt::Write;
use cortexm4;
use kernel::Chip;

use crate::dma;
use crate::gpio;
use crate::nvic;
use crate::timer;
Expand All @@ -17,6 +18,14 @@ pub struct Msp432 {

impl Msp432 {
pub unsafe fn new() -> Msp432 {
// Setup DMA channels
uart::UART0.set_dma(
&dma::DMA_CHANNELS[uart::UART0.tx_dma_chan],
&dma::DMA_CHANNELS[uart::UART0.rx_dma_chan],
);
dma::DMA_CHANNELS[uart::UART0.tx_dma_chan].set_client(&uart::UART0);
dma::DMA_CHANNELS[uart::UART0.rx_dma_chan].set_client(&uart::UART0);

Msp432 {
mpu: cortexm4::mpu::MPU::new(),
userspace_kernel_boundary: cortexm4::syscall::SysCall::new(),
Expand All @@ -37,7 +46,11 @@ impl Chip for Msp432 {
loop {
if let Some(interrupt) = cortexm4::nvic::next_pending() {
match interrupt {
nvic::USCI_A0 => uart::UART0.handle_interrupt(),
nvic::DMA_INT0 => dma::handle_interrupt(0),
nvic::DMA_INT1 => dma::handle_interrupt(1),
nvic::DMA_INT2 => dma::handle_interrupt(2),
nvic::DMA_INT3 => dma::handle_interrupt(3),
nvic::DMA_ERR => dma::handle_interrupt(-1),
nvic::IO_PORT1 => gpio::handle_interrupt(0),
nvic::IO_PORT2 => gpio::handle_interrupt(1),
nvic::IO_PORT3 => gpio::handle_interrupt(2),
Expand Down