Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
f4grx
NuttX RTOS
Commits
424a3aa8
Commit
424a3aa8
authored
7 years ago
by
Matt Thompson
Browse files
Options
Downloads
Patches
Plain Diff
SAMDL: Added DMAC header for SAMD, fixed up sam_dmac to compile with debugging enabled
parent
f118d1ad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arch/arm/src/samdl/chip/samd_dmac.h
+399
-0
399 additions, 0 deletions
arch/arm/src/samdl/chip/samd_dmac.h
arch/arm/src/samdl/sam_dmac.c
+12
-8
12 additions, 8 deletions
arch/arm/src/samdl/sam_dmac.c
arch/arm/src/samdl/sam_dmac.h
+2
-2
2 additions, 2 deletions
arch/arm/src/samdl/sam_dmac.h
with
413 additions
and
10 deletions
arch/arm/src/samdl/chip/samd_dmac.h
0 → 100644
+
399
−
0
View file @
424a3aa8
This diff is collapsed.
Click to expand it.
arch/arm/src/samdl/sam_dmac.c
+
12
−
8
View file @
424a3aa8
...
...
@@ -500,7 +500,7 @@ static struct dma_desc_s *sam_append_desc(struct sam_dmach_s *dmach,
{
/* There is no previous link. This is the new head of the list */
DEBUGASSERT
(
desc
==
g_base_desc
[
dmach
->
dc_chan
]);
DEBUGASSERT
(
desc
==
&
g_base_desc
[
dmach
->
dc_chan
]);
}
#if CONFIG_SAMDL_DMAC_NDESC > 0
...
...
@@ -627,7 +627,7 @@ static int sam_txbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
uint16_t
btcnt
;
uint16_t
tmp
;
DEBUGASSERT
(
dmac
->
dc_dir
==
DMADIR_UNKOWN
||
dmac
->
dc_dir
==
DMADIR_TX
);
DEBUGASSERT
(
dmac
h
->
dc_dir
==
DMADIR_UNKOWN
||
dmac
h
->
dc_dir
==
DMADIR_TX
);
/* Set up the Block Transfer Control Register configuration:
*
...
...
@@ -703,7 +703,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
uint16_t
btcnt
;
uint16_t
tmp
;
DEBUGASSERT
(
dmac
->
dc_dir
==
DMADIR_UNKOWN
||
dmac
->
dc_dir
==
DMADIR_RX
);
DEBUGASSERT
(
dmac
h
->
dc_dir
==
DMADIR_UNKOWN
||
dmac
h
->
dc_dir
==
DMADIR_RX
);
/* Set up the Block Transfer Control Register configuration:
*
...
...
@@ -1218,10 +1218,13 @@ int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
/* Enable the channel */
ctrla
=
DMAC_CHCTRLA_ENABLE
;
#ifdef CONFIG_ARCH_FAMILY_SAML21
if
(
dmach
->
dc_flags
&
DMACH_FLAG_RUNINSTDBY
)
{
ctrla
|=
DMAC_CHCTRLA_RUNSTDBY
;
}
#endif
putreg8
(
ctrla
,
SAM_DMAC_CHCTRLA
);
...
...
@@ -1272,19 +1275,18 @@ void sam_dmastop(DMA_HANDLE handle)
#ifdef CONFIG_DEBUG_DMA_INFO
void
sam_dmasample
(
DMA_HANDLE
handle
,
struct
sam_dmaregs_s
*
regs
)
{
struct
sam_dmach_s
*
dmach
=
(
struct
sam_dmach_s
*
)
handle
;
uintptr_t
base
;
irqstate_t
flags
;
/* Sample DMAC registers. */
flags
=
enter_critical_section
();
regs
->
ctrl
=
getreg16
(
SAM_DMAC_CTRL
);
/* Control Register */
regs
->
crcctrl
=
getreg16
(
SAM_DMAC_CRCCTRL
);
/* CRC Control Register */
regs
->
crcdatain
=
getreg32
(
SAM_DMAC_CRCDATAIN
);
/* CRC Data Input Register */
regs
->
crcchksum
=
getreg32
(
SAM_DMAC_CRCCHKSUM
);
/* CRC Checksum Register */
regs
->
crcstatus
=
getreg8
(
SAM_DMAC_CRCSTATUS
);
/* CRC Status Register */
regs
->
err
ctrl
=
getreg8
(
SAM_DMAC_DBGCTRL
);
/* Debug Control Register */
regs
->
dbg
ctrl
=
getreg8
(
SAM_DMAC_DBGCTRL
);
/* Debug Control Register */
regs
->
qosctrl
=
getreg8
(
SAM_DMAC_QOSCTRL
);
/* Quality of Service Control Register */
regs
->
swtrigctrl
=
getreg32
(
SAM_DMAC_SWTRIGCTRL
);
/* Software Trigger Control Register */
regs
->
prictrl0
=
getreg32
(
SAM_DMAC_PRICTRL0
);
/* Priority Control 0 Register */
...
...
@@ -1300,6 +1302,8 @@ void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs)
regs
->
chctrlb
=
getreg32
(
SAM_DMAC_CHCTRLB
);
/* Channel Control B Register */
regs
->
chintflag
=
getreg8
(
SAM_DMAC_CHINTFLAG
);
/* Channel Interrupt Flag Status and Clear Register */
regs
->
chstatus
=
getreg8
(
SAM_DMAC_CHSTATUS
);
/* Channel Status Register */
leave_critical_section
(
flags
);
}
#endif
/* CONFIG_DEBUG_DMA_INFO */
...
...
@@ -1325,13 +1329,13 @@ void sam_dmadump(DMA_HANDLE handle, const struct sam_dmaregs_s *regs,
dmainfo
(
" CTRL: %04x CRCCTRL: %04x CRCDATAIN: %08x CRCCHKSUM: %08x
\n
"
,
regs
->
ctrl
,
regs
->
crcctrl
,
regs
->
crcdatain
,
regs
->
crcchksum
);
dmainfo
(
" CRCSTATUS: %02x DBGCTRL: %02x QOSCTRL: %02x SWTRIGCTRL: %08x
\n
"
,
regs
->
crcstatus
,
regs
->
err
ctrl
,
regs
->
qosctrl
,
regs
->
swtrigctrl
);
regs
->
crcstatus
,
regs
->
dbg
ctrl
,
regs
->
qosctrl
,
regs
->
swtrigctrl
);
dmainfo
(
" PRICTRL0: %08x INTPEND: %04x INSTSTATUS: %08x BUSYCH: %08x
\n
"
,
regs
->
prictrl0
,
regs
->
intpend
,
regs
->
intstatus
,
regs
->
busych
);
dmainfo
(
" PENDCH: %08x ACTIVE: %08x BASEADDR: %08x WRBADDR: %08x
\n
"
,
regs
->
pendch
,
regs
->
active
,
regs
->
baseaddr
,
regs
->
wrbaddr
);
dmainfo
(
" CHID: %02x CHCRTRLA: %02x CHCRTRLB: %08x CHINFLAG: %02x
\n
"
,
regs
->
chid
,
regs
->
chctrla
,
regs
->
chctrlb
,
regs
->
chintflag
,
regs
->
chid
,
regs
->
chctrla
,
regs
->
chctrlb
,
regs
->
chintflag
);
dmainfo
(
" CHSTATUS: %02x
\n
"
,
regs
->
chstatus
);
}
...
...
This diff is collapsed.
Click to expand it.
arch/arm/src/samdl/sam_dmac.h
+
2
−
2
View file @
424a3aa8
...
...
@@ -50,8 +50,8 @@
#ifdef CONFIG_SAMDL_DMAC
#if defined(CONFIG_ARCH_FAMILY_SAMD20)
#
error Missing support for the SAMD20 architecture
#if defined(CONFIG_ARCH_FAMILY_SAMD20)
|| defined(CONFIG_ARCH_FAMILY_SAMD21)
#
include "chip/samd_dmac.h"
#elif defined(CONFIG_ARCH_FAMILY_SAML21)
# include "chip/saml_dmac.h"
#else
...
...
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