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
2d95fa6d
Commit
2d95fa6d
authored
7 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
arch/arm/src/samdl: Correct a link time error if CONFIG_SAMDL_EIC is not enabled.
parent
667ff07e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arch/arm/src/samdl/sam_eic.c
+51
-11
51 additions, 11 deletions
arch/arm/src/samdl/sam_eic.c
arch/arm/src/samdl/sam_eic.h
+18
-18
18 additions, 18 deletions
arch/arm/src/samdl/sam_eic.h
arch/arm/src/samdl/sam_port.c
+3
-1
3 additions, 1 deletion
arch/arm/src/samdl/sam_port.c
with
72 additions
and
30 deletions
arch/arm/src/samdl/sam_eic.c
+
51
−
11
View file @
2d95fa6d
...
...
@@ -83,7 +83,7 @@ static int sam_eic_isr(int irq, FAR void *context, FAR void *arg)
for
(
bit
=
0
;
bit
<
SAM_IRQ_NEXTINTS
;
bit
++
)
{
if
(
intflag
>>
bit
&
0x1
)
if
(
intflag
>>
bit
&
0x1
)
{
irq_dispatch
(
SAM_IRQ_EXTINT0
+
bit
,
context
);
}
...
...
@@ -126,7 +126,13 @@ void sam_eic_dumpregs(void)
* Name: sam_eic_initialize
*
* Description:
* Configure the external interrupt controller.
* Initialize the external interrupt controller (EIC).
*
* Input Parameters:
* gclkgen - GCLK Generator
*
* Returned Value:
* None
*
****************************************************************************/
...
...
@@ -151,12 +157,26 @@ int sam_eic_initialize(uint8_t gclkgen)
return
OK
;
}
/****************************************************************************
* Name: sam_eic_initialize
*
* Description:
* Enable a external interrupt.
*
* Input Parameters:
* irq - SAM_IRQ_EXTINTn IRQ to be enabled
*
* Returned Value:
* None
*
****************************************************************************/
int
sam_eic_irq_enable
(
int
irq
)
{
uint32_t
config
;
int
eirq
=
irq
-
SAM_IRQ_EXTINT0
;
config
=
getreg32
(
SAM_EIC_CONFIG0
);
config
=
getreg32
(
SAM_EIC_CONFIG0
);
config
|=
EIC_CONFIG0_FILTEN
(
eirq
)
|
EIC_CONFIG0_SENSE_FALL
(
eirq
);
putreg32
(
config
,
SAM_EIC_CONFIG0
);
...
...
@@ -165,6 +185,21 @@ int sam_eic_irq_enable(int irq)
return
OK
;
}
/****************************************************************************
* Name: sam_eic_config
*
* Description:
* Configure the interrupt edge sensitivity in CONFIGn register of the EIC
*
* Input Parameters:
* eirq - Pin to be configured
* pinset - Configuration of the pin
*
* Returned Value:
* None
*
****************************************************************************/
int
sam_eic_config
(
uint8_t
eirq
,
port_pinset_t
pinset
)
{
uint32_t
reg
;
...
...
@@ -173,18 +208,24 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
/* Determine which of the CONFIG[0:2] registers to write to */
if
(
eirq
<
8
)
if
(
eirq
<
8
)
{
reg
=
SAM_EIC_CONFIG0
;
val
=
EIC_CONFIG0_SENSE_BOTH
(
eirq
);
if
(
pinset
&
PORT_INT_RISING
)
val
=
EIC_CONFIG0_SENSE_RISE
(
eirq
);
if
(
pinset
&
PORT_INT_FALLING
)
val
=
EIC_CONFIG0_SENSE_FALL
(
eirq
);
if
(
pinset
&
PORT_INT_RISING
)
{
val
=
EIC_CONFIG0_SENSE_RISE
(
eirq
);
}
if
(
pinset
&
PORT_INT_FALLING
)
{
val
=
EIC_CONFIG0_SENSE_FALL
(
eirq
);
}
val
|=
EIC_CONFIG0_FILTEN
(
eirq
);
}
else
if
(
eirq
<
16
)
else
if
(
eirq
<
16
)
{
reg
=
SAM_EIC_CONFIG1
;
val
=
EIC_CONFIG1_FILTEN
(
eirq
)
|
EIC_CONFIG1_SENSE_FALL
(
eirq
);
...
...
@@ -197,7 +238,7 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
/* Write the new config to the CONFIGn register */
config
=
getreg32
(
reg
);
config
=
getreg32
(
reg
);
config
|=
val
;
putreg32
(
config
,
reg
);
...
...
@@ -206,6 +247,5 @@ int sam_eic_config(uint8_t eirq, port_pinset_t pinset)
putreg32
(
EIC_EXTINT
(
eirq
),
SAM_EIC_INTENSET
);
sam_eic_dumpregs
();
return
OK
;
}
This diff is collapsed.
Click to expand it.
arch/arm/src/samdl/sam_eic.h
+
18
−
18
View file @
2d95fa6d
...
...
@@ -57,19 +57,7 @@
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Data
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
...
...
@@ -82,24 +70,36 @@ extern "C"
#endif
/****************************************************************************
* Public Function Prototypes
* Name: sam_eic_initialize
*
* Description:
* Initialize the EIC
*
* Input Parameters:
* gclkgen - GCLK Generator
*
* Returned Value:
* None
*
****************************************************************************/
int
sam_eic_initialize
(
uint8_t
gclkgen
);
/****************************************************************************
* Name: sam_eic_config
ure
* Name: sam_eic_config
*
* Description:
* Configure the EIC
* Configure the
interrupt edge sensitivity in CONFIGn register of the
EIC
*
* Input Parameters:
* gclkgen - GCLK Generator
* eirq - Pin to be configured
* pinset - Configuration of the pin
*
* Returned Value:
* None
*
****************************************************************************/
int
sam_eic_initialize
(
uint8_t
gclkgen
);
int
sam_eic_config
(
uint8_t
eirq
,
port_pinset_t
pinset
);
#undef EXTERN
...
...
This diff is collapsed.
Click to expand it.
arch/arm/src/samdl/sam_port.c
+
3
−
1
View file @
2d95fa6d
/****************************************************************************
* arch/arm/src/samdl/sam_port.c
*
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2014-2016
, 2018
Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
...
...
@@ -204,9 +204,11 @@ static inline void sam_configinterrupt(uintptr_t base, port_pinset_t pinset)
putreg32
(
regval
,
base
+
SAM_PORT_WRCONFIG_OFFSET
);
#ifdef CONFIG_SAMDL_EIC
/* Configure the interrupt edge sensitivity in CONFIGn register of the EIC */
sam_eic_config
(
pin
,
pinset
);
#endif
#ifdef CONFIG_DEBUG_GPIO_INFO
sam_dumpport
(
pinset
,
"extint"
);
...
...
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