Loading...
Searching...
No Matches
pio.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Otto-von-Guericke Universität Magdeburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
42
43#include <stdbool.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
52#ifndef PIO_DEV
53#define PIO_DEV(x) (x)
54#endif
55
60#define PIO_PROGRAM_NOT_LOADED (-1)
61
67struct pio_isr_vec;
68
72typedef unsigned pio_t;
73
77typedef int pio_sm_t;
78
82typedef struct {
83 unsigned instr_numof;
85 bool written;
87
96void pio_init(pio_t pio);
97
105
115
123
131
139
151
167
175
176#ifdef __cplusplus
177}
178#endif
179
void pio_sm_start(pio_t pio, pio_sm_t sm)
Start a state machine and execute the previously loaded program.
pio_sm_t pio_sm_lock(pio_t pio)
Get exclusive access to one of the state machines of PIO pio.
unsigned pio_t
PIO index type.
Definition pio.h:72
void pio_init(pio_t pio)
Initialize a PIO device.
void pio_start_programs(void)
Start automatically configured PIO programs.
int pio_alloc_program_sm_lock_any(pio_t *pio_ptr, pio_sm_t *sm_ptr, pio_program_t *program)
Convenience function which performs the usual PIO program resource acquisition.
void pio_free_program(pio_t pio, pio_program_t *prog)
Release the allocated instruction memory occupied by prog.
int pio_sm_t
PIO state machine index type.
Definition pio.h:77
void pio_sm_unlock(pio_t pio, pio_sm_t sm)
Release a previously locked state machine.
int pio_alloc_program(pio_t pio, pio_program_t *prog)
Allocate the required instruction memory to load the given PIO program into.
void pio_sm_stop(pio_t pio, pio_sm_t sm)
Stop the execution of a program.
PIO interrupt callbacks for FIFO interrupts.
Definition pio.h:723
Struct that models a PIO program.
Definition pio.h:82
int location
Program location in memory.
Definition pio.h:84
unsigned instr_numof
Number of instructions.
Definition pio.h:83
bool written
Program was already written.
Definition pio.h:85