Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
labo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISC2
pro
labo
Commits
9ad389e9
Commit
9ad389e9
authored
1 year ago
by
iliya
Browse files
Options
Downloads
Patches
Plain Diff
feat: ex1 lab4 pretty much done, irq_handler should be adjusted
parent
3ba655d1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
labo4.1_DMA_new/src/dma.c
+28
-9
28 additions, 9 deletions
labo4.1_DMA_new/src/dma.c
labo4.1_DMA_new/src/dmatest.c
+2
-0
2 additions, 0 deletions
labo4.1_DMA_new/src/dmatest.c
with
30 additions
and
9 deletions
labo4.1_DMA_new/src/dma.c
+
28
−
9
View file @
9ad389e9
...
...
@@ -16,6 +16,9 @@ volatile uint32_t DMAErrCount = 0;
void
DMA_IRQHandler
(
void
)
{
/*...*/
DMATCCount
+=
1
;
// Clears the channels terminal count interrupt
LPC_GPDMA
->
DMACIntTCClear
=
1
;
}
...
...
@@ -34,17 +37,33 @@ void DMA_IRQHandler (void)
******************************************************************************/
void
DMA_Init
(
uint32_t
*
src
,
uint32_t
*
dest
,
uint32_t
len
,
uint32_t
LLI
)
{
NVIC_EnableIRQ
(
DMA_IRQn
);
LPC_SC
->
PCONP
|=
(
1
<<
29
);
/* Enable GPDMA clock */
LPC_GPDMACH0
->
DMACCConfig
|=
(
1
<<
0
);
// Enabling channel 0 (bit 1 is associated with endianness [by default val = 0] => little-endian)
LPC_GPDMA
->
DMACIntTCClear
|=
(
1
<<
0
);
// Clears the channels terminal count interrupt
LPC_GPDMA
->
DMACIntErrClr
|=
(
1
<<
0
);
// Clears the channels error interrupt
// Enabling DMA controller
LPC_GPDMA
->
DMACConfig
=
1
;
// Clears the channels terminal count interrupt
LPC_GPDMA
->
DMACIntTCClear
=
1
;
// Clears the channels error interrupt
LPC_GPDMA
->
DMACIntErrClr
=
1
;
LPC_GPDMACH0
->
DMACCSrcAddr
=
(
uint32_t
)
src
;
LPC_GPDMACH0
->
DMACCDestAddr
=
(
uint32_t
)
dest
;
LPC_GPDMACH0
->
DMACCLLI
=
LLI
;
LPC_GPDMACH0
->
DMACCControl
|=
(
len
&
0xFFF
);
// Setting transfer size
LPC_GPDMACH0
->
DMACCControl
|=
(
1
<<
12
);
// Burst size of 4 for src
LPC_GPDMACH0
->
DMACCControl
|=
(
1
<<
15
);
// Burst size of 4 for dst
LPC_GPDMACH0
->
DMACCControl
|=
(
1
<<
31
);
// Enabling interrupt on terminal count
NVIC_EnableIRQ
(
DMA_IRQn
);
/*...*/
// LPC_GPDMACH0->DMACCControl |= (len & 0xFFF); // Setting transfer size
LPC_GPDMACH0
->
DMACCControl
=
(
len
|
DMA_CFG
);
// LPC_GPDMACH0->DMACCControl |= (1 << 12); // Burst size of 4 for src
// LPC_GPDMACH0->DMACCControl &= ~(3 << 13); // Setting the rest of burst src to 0
//
// LPC_GPDMACH0->DMACCControl |= (1 << 15); // Burst size of 4 for dst
// LPC_GPDMACH0->DMACCControl &= ~(3 << 16); // Setting the rest of burst dst to 0
//
// Enabling ITC (bit 15) / Enabling channel 0 (bit 1 is associated with endianness [by default val = 0] => little-endian)
LPC_GPDMACH0
->
DMACCConfig
=
(
1
<<
15
)
|
(
1
<<
0
);
}
This diff is collapsed.
Click to expand it.
labo4.1_DMA_new/src/dmatest.c
+
2
−
0
View file @
9ad389e9
...
...
@@ -24,6 +24,8 @@ void single_copy()
DMA_Init
(
src1
,
dest
,
DMA_SIZE
/
4
,
0
);
while
(
!
DMATCCount
);
/* Wait until DMA is done */
volatile
char
rnd
=
0
;
}
// copy 3 source buffers in 1 destination buffer with DMA linked lists
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment