SAM4SD32 (SAM4S-EK2)
Loading...
Searching...
No Matches
ioport_pio.h File Reference

SAM architecture specific IOPORT service implementation header file. More...

#include <sysclk.h>

Go to the source code of this file.

Macros

#define IOPORT_BASE_ADDRESS   (uintptr_t)PIOA
#define IOPORT_CREATE_PIN(port, pin)
 Create IOPORT pin number.
#define IOPORT_PIO_OFFSET   ((uintptr_t)PIOB - (uintptr_t)PIOA)
#define IOPORT_PIOA   0
#define IOPORT_PIOB   1
#define IOPORT_PIOC   2
#define IOPORT_PIOD   3
#define IOPORT_PIOE   4
#define IOPORT_PIOF   5
IOPORT Mode bit definitions
#define IOPORT_MODE_DEBOUNCE   ( 1 << 7)
#define IOPORT_MODE_GLITCH_FILTER   ( 1 << 6)
#define IOPORT_MODE_MUX_A   ( 0 << 0)
#define IOPORT_MODE_MUX_B   ( 1 << 0)
#define IOPORT_MODE_MUX_BIT0   ( 1 << 0)
#define IOPORT_MODE_MUX_BIT1   ( 1 << 1)
#define IOPORT_MODE_MUX_C   ( 2 << 0)
#define IOPORT_MODE_MUX_D   ( 3 << 0)
#define IOPORT_MODE_MUX_MASK   (0x7 << 0)
#define IOPORT_MODE_OPEN_DRAIN   ( 1 << 5)
#define IOPORT_MODE_PULLDOWN   ( 1 << 4)
#define IOPORT_MODE_PULLUP   ( 1 << 3)

Typedefs

typedef uint32_t ioport_mode_t
typedef uint32_t ioport_pin_t
typedef uint32_t ioport_port_mask_t
typedef uint32_t ioport_port_t

Functions

static __always_inline void arch_ioport_disable_pin (ioport_pin_t pin)
static __always_inline void arch_ioport_disable_port (ioport_port_t port, ioport_port_mask_t mask)
static __always_inline void arch_ioport_enable_pin (ioport_pin_t pin)
static __always_inline void arch_ioport_enable_port (ioport_port_t port, ioport_port_mask_t mask)
static __always_inline bool arch_ioport_get_pin_level (ioport_pin_t pin)
static __always_inline ioport_port_mask_t arch_ioport_get_port_level (ioport_port_t port, ioport_port_mask_t mask)
static __always_inline void arch_ioport_init (void)
static __always_inline Pioarch_ioport_pin_to_base (ioport_pin_t pin)
static __always_inline ioport_port_mask_t arch_ioport_pin_to_mask (ioport_pin_t pin)
static __always_inline ioport_port_t arch_ioport_pin_to_port_id (ioport_pin_t pin)
static __always_inline Pioarch_ioport_port_to_base (ioport_port_t port)
static __always_inline void arch_ioport_set_pin_dir (ioport_pin_t pin, enum ioport_direction dir)
static __always_inline void arch_ioport_set_pin_level (ioport_pin_t pin, bool level)
static __always_inline void arch_ioport_set_pin_mode (ioport_pin_t pin, ioport_mode_t mode)
static __always_inline void arch_ioport_set_pin_sense_mode (ioport_pin_t pin, enum ioport_sense pin_sense)
static __always_inline void arch_ioport_set_port_dir (ioport_port_t port, ioport_port_mask_t mask, enum ioport_direction group_direction)
static __always_inline void arch_ioport_set_port_level (ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level)
static __always_inline void arch_ioport_set_port_mode (ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode)
static __always_inline void arch_ioport_set_port_sense_mode (ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense)
static __always_inline void arch_ioport_toggle_pin_level (ioport_pin_t pin)
static __always_inline void arch_ioport_toggle_port_level (ioport_port_t port, ioport_port_mask_t mask)

Detailed Description

SAM architecture specific IOPORT service implementation header file.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

\cond ASF_LICENSE

Definition in file ioport_pio.h.

Macro Definition Documentation

◆ IOPORT_BASE_ADDRESS

#define IOPORT_BASE_ADDRESS   (uintptr_t)PIOA

Definition at line 42 of file ioport_pio.h.

Referenced by arch_ioport_port_to_base().

◆ IOPORT_PIO_OFFSET

#define IOPORT_PIO_OFFSET   ((uintptr_t)PIOB - (uintptr_t)PIOA)

Definition at line 43 of file ioport_pio.h.

Referenced by arch_ioport_port_to_base().

◆ IOPORT_PIOA

#define IOPORT_PIOA   0

Definition at line 45 of file ioport_pio.h.

◆ IOPORT_PIOB

#define IOPORT_PIOB   1

Definition at line 46 of file ioport_pio.h.

◆ IOPORT_PIOC

#define IOPORT_PIOC   2

Definition at line 47 of file ioport_pio.h.

Referenced by arch_ioport_port_to_base().

◆ IOPORT_PIOD

#define IOPORT_PIOD   3

Definition at line 48 of file ioport_pio.h.

Referenced by arch_ioport_port_to_base().

◆ IOPORT_PIOE

#define IOPORT_PIOE   4

Definition at line 49 of file ioport_pio.h.

◆ IOPORT_PIOF

#define IOPORT_PIOF   5

Definition at line 50 of file ioport_pio.h.

Typedef Documentation

◆ ioport_mode_t

typedef uint32_t ioport_mode_t

Definition at line 92 of file ioport_pio.h.

◆ ioport_pin_t

typedef uint32_t ioport_pin_t

Definition at line 93 of file ioport_pio.h.

◆ ioport_port_mask_t

typedef uint32_t ioport_port_mask_t

Definition at line 95 of file ioport_pio.h.

◆ ioport_port_t

typedef uint32_t ioport_port_t

Definition at line 94 of file ioport_pio.h.

Function Documentation

◆ arch_ioport_disable_pin()

__always_inline void arch_ioport_disable_pin ( ioport_pin_t pin)
static

Definition at line 171 of file ioport_pio.h.

172{
175}
static __always_inline ioport_port_t arch_ioport_pin_to_port_id(ioport_pin_t pin)
Definition ioport_pio.h:97
static __always_inline ioport_port_mask_t arch_ioport_pin_to_mask(ioport_pin_t pin)
Definition ioport_pio.h:126
static __always_inline void arch_ioport_disable_port(ioport_port_t port, ioport_port_mask_t mask)
Definition ioport_pio.h:159

References arch_ioport_disable_port(), arch_ioport_pin_to_mask(), and arch_ioport_pin_to_port_id().

Referenced by ioport_disable_pin().

◆ arch_ioport_disable_port()

__always_inline void arch_ioport_disable_port ( ioport_port_t port,
ioport_port_mask_t mask )
static

Definition at line 159 of file ioport_pio.h.

161{
162 arch_ioport_port_to_base(port)->PIO_PDR = mask;
163}
static __always_inline Pio * arch_ioport_port_to_base(ioport_port_t port)
Definition ioport_pio.h:102
__O uint32_t PIO_PDR
(Pio Offset: 0x0004) PIO Disable Register

References arch_ioport_port_to_base(), and Pio::PIO_PDR.

Referenced by arch_ioport_disable_pin(), and ioport_disable_port().

◆ arch_ioport_enable_pin()

__always_inline void arch_ioport_enable_pin ( ioport_pin_t pin)
static

Definition at line 165 of file ioport_pio.h.

166{
169}
static __always_inline void arch_ioport_enable_port(ioport_port_t port, ioport_port_mask_t mask)
Definition ioport_pio.h:153

References arch_ioport_enable_port(), arch_ioport_pin_to_mask(), and arch_ioport_pin_to_port_id().

Referenced by ioport_enable_pin().

◆ arch_ioport_enable_port()

__always_inline void arch_ioport_enable_port ( ioport_port_t port,
ioport_port_mask_t mask )
static

Definition at line 153 of file ioport_pio.h.

155{
156 arch_ioport_port_to_base(port)->PIO_PER = mask;
157}
__O uint32_t PIO_PER
(Pio Offset: 0x0000) PIO Enable Register

References arch_ioport_port_to_base(), and Pio::PIO_PER.

Referenced by arch_ioport_enable_pin(), and ioport_enable_port().

◆ arch_ioport_get_pin_level()

__always_inline bool arch_ioport_get_pin_level ( ioport_pin_t pin)
static

Definition at line 302 of file ioport_pio.h.

303{
305}
static __always_inline Pio * arch_ioport_pin_to_base(ioport_pin_t pin)
Definition ioport_pio.h:121
__I uint32_t PIO_PDSR
(Pio Offset: 0x003C) Pin Data Status Register

References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), and Pio::PIO_PDSR.

Referenced by ioport_get_pin_level().

◆ arch_ioport_get_port_level()

__always_inline ioport_port_mask_t arch_ioport_get_port_level ( ioport_port_t port,
ioport_port_mask_t mask )
static

Definition at line 307 of file ioport_pio.h.

309{
310 return arch_ioport_port_to_base(port)->PIO_PDSR & mask;
311}

References arch_ioport_port_to_base(), and Pio::PIO_PDSR.

Referenced by ioport_get_port_level().

◆ arch_ioport_init()

__always_inline void arch_ioport_init ( void )
static

Definition at line 131 of file ioport_pio.h.

132{
133#ifdef ID_PIOA
134 sysclk_enable_peripheral_clock(ID_PIOA);
135#endif
136#ifdef ID_PIOB
137 sysclk_enable_peripheral_clock(ID_PIOB);
138#endif
139#ifdef ID_PIOC
140 sysclk_enable_peripheral_clock(ID_PIOC);
141#endif
142#ifdef ID_PIOD
143 sysclk_enable_peripheral_clock(ID_PIOD);
144#endif
145#ifdef ID_PIOE
146 sysclk_enable_peripheral_clock(ID_PIOE);
147#endif
148#ifdef ID_PIOF
149 sysclk_enable_peripheral_clock(ID_PIOF);
150#endif
151}
#define ID_PIOA
Parallel I/O Controller A (PIOA).
Definition sam4sd32c.h:331
#define ID_PIOB
Parallel I/O Controller B (PIOB).
Definition sam4sd32c.h:332
#define ID_PIOC
Parallel I/O Controller C (PIOC).
Definition sam4sd32c.h:333

References ID_PIOA, ID_PIOB, and ID_PIOC.

Referenced by ioport_init().

◆ arch_ioport_pin_to_base()

__always_inline Pio * arch_ioport_pin_to_base ( ioport_pin_t pin)
static

◆ arch_ioport_pin_to_mask()

◆ arch_ioport_pin_to_port_id()

__always_inline ioport_port_t arch_ioport_pin_to_port_id ( ioport_pin_t pin)
static

◆ arch_ioport_port_to_base()

__always_inline Pio * arch_ioport_port_to_base ( ioport_port_t port)
static

Definition at line 102 of file ioport_pio.h.

103{
104#if (SAM4C || SAM4CM || SAM4CP)
105 if (port == IOPORT_PIOC) {
106 return (Pio *)(uintptr_t)PIOC;
107# ifdef ID_PIOD
108 } else if (port == IOPORT_PIOD) {
109 return (Pio *)(uintptr_t)PIOD;
110# endif
111 } else {
112 return (Pio *)((uintptr_t)IOPORT_BASE_ADDRESS +
113 (IOPORT_PIO_OFFSET * port));
114 }
115#else
116 return (Pio *)((uintptr_t)IOPORT_BASE_ADDRESS +
117 (IOPORT_PIO_OFFSET * port));
118#endif
119}
#define IOPORT_PIO_OFFSET
Definition ioport_pio.h:43
#define IOPORT_BASE_ADDRESS
Definition ioport_pio.h:42
#define IOPORT_PIOD
Definition ioport_pio.h:48
#define IOPORT_PIOC
Definition ioport_pio.h:47
#define PIOC
(PIOC ) Base Address
Definition sam4sd32c.h:450
Pio hardware registers.

References IOPORT_BASE_ADDRESS, IOPORT_PIO_OFFSET, IOPORT_PIOC, IOPORT_PIOD, and PIOC.

Referenced by arch_ioport_disable_port(), arch_ioport_enable_port(), arch_ioport_get_port_level(), arch_ioport_pin_to_base(), arch_ioport_set_port_dir(), arch_ioport_set_port_level(), arch_ioport_set_port_mode(), arch_ioport_set_port_sense_mode(), and arch_ioport_toggle_port_level().

◆ arch_ioport_set_pin_dir()

__always_inline void arch_ioport_set_pin_dir ( ioport_pin_t pin,
enum ioport_direction dir )
static

Definition at line 264 of file ioport_pio.h.

266{
267 Pio *base = arch_ioport_pin_to_base(pin);
268
269 if (dir == IOPORT_DIR_OUTPUT) {
270 base->PIO_OER = arch_ioport_pin_to_mask(pin);
271 } else if (dir == IOPORT_DIR_INPUT) {
272 base->PIO_ODR = arch_ioport_pin_to_mask(pin);
273 }
274
276}
@ IOPORT_DIR_OUTPUT
Definition ioport.h:78
@ IOPORT_DIR_INPUT
Definition ioport.h:77
__O uint32_t PIO_OWER
(Pio Offset: 0x00A0) Output Write Enable
__O uint32_t PIO_ODR
(Pio Offset: 0x0014) Output Disable Register
__O uint32_t PIO_OER
(Pio Offset: 0x0010) Output Enable Register

References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), IOPORT_DIR_INPUT, IOPORT_DIR_OUTPUT, Pio::PIO_ODR, Pio::PIO_OER, and Pio::PIO_OWER.

Referenced by ioport_set_pin_dir().

◆ arch_ioport_set_pin_level()

__always_inline void arch_ioport_set_pin_level ( ioport_pin_t pin,
bool level )
static

Definition at line 278 of file ioport_pio.h.

280{
281 Pio *base = arch_ioport_pin_to_base(pin);
282
283 if (level) {
285 } else {
287 }
288}
__O uint32_t PIO_CODR
(Pio Offset: 0x0034) Clear Output Data Register
__O uint32_t PIO_SODR
(Pio Offset: 0x0030) Set Output Data Register

References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), Pio::PIO_CODR, and Pio::PIO_SODR.

Referenced by ioport_set_pin_level().

◆ arch_ioport_set_pin_mode()

__always_inline void arch_ioport_set_pin_mode ( ioport_pin_t pin,
ioport_mode_t mode )
static

Definition at line 243 of file ioport_pio.h.

245{
247 arch_ioport_pin_to_mask(pin), mode);
248}
static __always_inline void arch_ioport_set_port_mode(ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode)
Definition ioport_pio.h:177

References arch_ioport_pin_to_mask(), arch_ioport_pin_to_port_id(), and arch_ioport_set_port_mode().

Referenced by ioport_reset_pin_mode(), and ioport_set_pin_mode().

◆ arch_ioport_set_pin_sense_mode()

__always_inline void arch_ioport_set_pin_sense_mode ( ioport_pin_t pin,
enum ioport_sense pin_sense )
static

Definition at line 366 of file ioport_pio.h.

368{
370 arch_ioport_pin_to_mask(pin), pin_sense);
371}
static __always_inline void arch_ioport_set_port_sense_mode(ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense)
Definition ioport_pio.h:331

References arch_ioport_pin_to_mask(), arch_ioport_pin_to_port_id(), and arch_ioport_set_port_sense_mode().

Referenced by ioport_set_pin_sense_mode().

◆ arch_ioport_set_port_dir()

__always_inline void arch_ioport_set_port_dir ( ioport_port_t port,
ioport_port_mask_t mask,
enum ioport_direction group_direction )
static

Definition at line 250 of file ioport_pio.h.

252{
253 Pio *base = arch_ioport_port_to_base(port);
254
255 if (group_direction == IOPORT_DIR_OUTPUT) {
256 base->PIO_OER = mask;
257 } else if (group_direction == IOPORT_DIR_INPUT) {
258 base->PIO_ODR = mask;
259 }
260
261 base->PIO_OWER = mask;
262}

References arch_ioport_port_to_base(), IOPORT_DIR_INPUT, IOPORT_DIR_OUTPUT, Pio::PIO_ODR, Pio::PIO_OER, and Pio::PIO_OWER.

Referenced by ioport_set_port_dir().

◆ arch_ioport_set_port_level()

__always_inline void arch_ioport_set_port_level ( ioport_port_t port,
ioport_port_mask_t mask,
enum ioport_value level )
static

Definition at line 290 of file ioport_pio.h.

292{
293 Pio *base = arch_ioport_port_to_base(port);
294
295 if (level){
296 base->PIO_SODR = mask;
297 } else {
298 base->PIO_CODR = mask;
299 }
300}

References arch_ioport_port_to_base(), Pio::PIO_CODR, and Pio::PIO_SODR.

Referenced by ioport_set_port_level().

◆ arch_ioport_set_port_mode()

__always_inline void arch_ioport_set_port_mode ( ioport_port_t port,
ioport_port_mask_t mask,
ioport_mode_t mode )
static

Definition at line 177 of file ioport_pio.h.

179{
180 Pio *base = arch_ioport_port_to_base(port);
181
182 if (mode & IOPORT_MODE_PULLUP) {
183 base->PIO_PUER = mask;
184 } else {
185 base->PIO_PUDR = mask;
186 }
187
188#if defined(IOPORT_MODE_PULLDOWN)
189 if (mode & IOPORT_MODE_PULLDOWN) {
190 base->PIO_PPDER = mask;
191 } else {
192 base->PIO_PPDDR = mask;
193 }
194#endif
195
196 if (mode & IOPORT_MODE_OPEN_DRAIN) {
197 base->PIO_MDER = mask;
198 } else {
199 base->PIO_MDDR = mask;
200 }
201
203 base->PIO_IFER = mask;
204 } else {
205 base->PIO_IFDR = mask;
206 }
207
208 if (mode & IOPORT_MODE_DEBOUNCE) {
209#if SAM3U || SAM3XA
210 base->PIO_DIFSR = mask;
211#else
212 base->PIO_IFSCER = mask;
213#endif
214 } else {
215#if SAM3U || SAM3XA
216 base->PIO_SCIFSR = mask;
217#else
218 base->PIO_IFSCDR = mask;
219#endif
220 }
221
222#if !defined(IOPORT_MODE_MUX_BIT1)
223 if (mode & IOPORT_MODE_MUX_BIT0) {
224 base->PIO_ABSR |= mask;
225 } else {
226 base->PIO_ABSR &= ~mask;
227 }
228#else
229 if (mode & IOPORT_MODE_MUX_BIT0) {
230 base->PIO_ABCDSR[0] |= mask;
231 } else {
232 base->PIO_ABCDSR[0] &= ~mask;
233 }
234
235 if (mode & IOPORT_MODE_MUX_BIT1) {
236 base->PIO_ABCDSR[1] |= mask;
237 } else {
238 base->PIO_ABCDSR[1] &= ~mask;
239 }
240#endif
241}
#define IOPORT_MODE_PULLUP
Definition ioport_pio.h:78
#define IOPORT_MODE_GLITCH_FILTER
Definition ioport_pio.h:86
#define IOPORT_MODE_PULLDOWN
Definition ioport_pio.h:81
#define IOPORT_MODE_OPEN_DRAIN
Definition ioport_pio.h:84
#define IOPORT_MODE_MUX_BIT0
Definition ioport_pio.h:64
#define IOPORT_MODE_MUX_BIT1
Definition ioport_pio.h:67
#define IOPORT_MODE_DEBOUNCE
Definition ioport_pio.h:87
__IO uint32_t PIO_ABCDSR[2]
(Pio Offset: 0x0070) Peripheral Select Register
__O uint32_t PIO_PUDR
(Pio Offset: 0x0060) Pull-up Disable Register
__O uint32_t PIO_IFDR
(Pio Offset: 0x0024) Glitch Input Filter Disable Register
__O uint32_t PIO_MDDR
(Pio Offset: 0x0054) Multi-driver Disable Register
__O uint32_t PIO_IFSCER
(Pio Offset: 0x0084) Input Filter Slow Clock Enable Register
__O uint32_t PIO_IFSCDR
(Pio Offset: 0x0080) Input Filter Slow Clock Disable Register
__O uint32_t PIO_PPDDR
(Pio Offset: 0x0090) Pad Pull-down Disable Register
__O uint32_t PIO_PUER
(Pio Offset: 0x0064) Pull-up Enable Register
__O uint32_t PIO_IFER
(Pio Offset: 0x0020) Glitch Input Filter Enable Register
__O uint32_t PIO_MDER
(Pio Offset: 0x0050) Multi-driver Enable Register
__O uint32_t PIO_PPDER
(Pio Offset: 0x0094) Pad Pull-down Enable Register

References arch_ioport_port_to_base(), IOPORT_MODE_DEBOUNCE, IOPORT_MODE_GLITCH_FILTER, IOPORT_MODE_MUX_BIT0, IOPORT_MODE_MUX_BIT1, IOPORT_MODE_OPEN_DRAIN, IOPORT_MODE_PULLDOWN, IOPORT_MODE_PULLUP, Pio::PIO_ABCDSR, Pio::PIO_IFDR, Pio::PIO_IFER, Pio::PIO_IFSCDR, Pio::PIO_IFSCER, Pio::PIO_MDDR, Pio::PIO_MDER, Pio::PIO_PPDDR, Pio::PIO_PPDER, Pio::PIO_PUDR, and Pio::PIO_PUER.

Referenced by arch_ioport_set_pin_mode(), ioport_reset_port_mode(), and ioport_set_port_mode().

◆ arch_ioport_set_port_sense_mode()

__always_inline void arch_ioport_set_port_sense_mode ( ioport_port_t port,
ioport_port_mask_t mask,
enum ioport_sense pin_sense )
static

Definition at line 331 of file ioport_pio.h.

333{
334 Pio *base = arch_ioport_port_to_base(port);
335 /* AIMMR ELSR FRLHSR
336 * 0 X X IOPORT_SENSE_BOTHEDGES (Default)
337 * 1 0 0 IOPORT_SENSE_FALLING
338 * 1 0 1 IOPORT_SENSE_RISING
339 * 1 1 0 IOPORT_SENSE_LEVEL_LOW
340 * 1 1 1 IOPORT_SENSE_LEVEL_HIGH
341 */
342 switch(pin_sense) {
344 base->PIO_LSR = mask;
345 base->PIO_FELLSR = mask;
346 break;
348 base->PIO_LSR = mask;
349 base->PIO_REHLSR = mask;
350 break;
352 base->PIO_ESR = mask;
353 base->PIO_FELLSR = mask;
354 break;
356 base->PIO_ESR = mask;
357 base->PIO_REHLSR = mask;
358 break;
359 default:
360 base->PIO_AIMDR = mask;
361 return;
362 }
363 base->PIO_AIMER = mask;
364}
@ IOPORT_SENSE_LEVEL_HIGH
Definition ioport.h:102
@ IOPORT_SENSE_RISING
Definition ioport.h:100
@ IOPORT_SENSE_LEVEL_LOW
Definition ioport.h:101
@ IOPORT_SENSE_FALLING
Definition ioport.h:99
__O uint32_t PIO_ESR
(Pio Offset: 0x00C0) Edge Select Register
__O uint32_t PIO_REHLSR
(Pio Offset: 0x00D4) Rising Edge/ High Level Select Register
__O uint32_t PIO_LSR
(Pio Offset: 0x00C4) Level Select Register
__O uint32_t PIO_AIMER
(Pio Offset: 0x00B0) Additional Interrupt Modes Enable Register
__O uint32_t PIO_AIMDR
(Pio Offset: 0x00B4) Additional Interrupt Modes Disables Register
__O uint32_t PIO_FELLSR
(Pio Offset: 0x00D0) Falling Edge/Low Level Select Register

References arch_ioport_port_to_base(), IOPORT_SENSE_FALLING, IOPORT_SENSE_LEVEL_HIGH, IOPORT_SENSE_LEVEL_LOW, IOPORT_SENSE_RISING, Pio::PIO_AIMDR, Pio::PIO_AIMER, Pio::PIO_ESR, Pio::PIO_FELLSR, Pio::PIO_LSR, and Pio::PIO_REHLSR.

Referenced by arch_ioport_set_pin_sense_mode(), and ioport_set_port_sense_mode().

◆ arch_ioport_toggle_pin_level()

__always_inline void arch_ioport_toggle_pin_level ( ioport_pin_t pin)
static

Definition at line 313 of file ioport_pio.h.

314{
315 Pio *port = arch_ioport_pin_to_base(pin);
317
318 if (port->PIO_PDSR & arch_ioport_pin_to_mask(pin)) {
319 port->PIO_CODR = mask;
320 } else {
321 port->PIO_SODR = mask;
322 }
323}
uint32_t ioport_port_mask_t
Definition ioport_pio.h:95

References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), Pio::PIO_CODR, Pio::PIO_PDSR, and Pio::PIO_SODR.

Referenced by ioport_toggle_pin_level().

◆ arch_ioport_toggle_port_level()

__always_inline void arch_ioport_toggle_port_level ( ioport_port_t port,
ioport_port_mask_t mask )
static

Definition at line 325 of file ioport_pio.h.

327{
328 arch_ioport_port_to_base(port)->PIO_ODSR ^= mask;
329}
__IO uint32_t PIO_ODSR
(Pio Offset: 0x0038) Output Data Status Register

References arch_ioport_port_to_base(), and Pio::PIO_ODSR.

Referenced by ioport_toggle_port_level().