libpynq  (release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
pulsecounter.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2023 Eindhoven University of Technology
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22 #ifndef PULSECOUNTER_H
23 #define PULSECOUNTER_H
24 #include <gpio.h>
25 #include <stdbool.h>
26 #include <stdint.h>
27 
45 typedef enum {
50 
56 extern void pulsecounter_init(const pulsecounter_index_t pci);
57 
64 extern void pulsecounter_destroy(const pulsecounter_index_t pci);
65 
74 extern uint32_t pulsecounter_get_count(const pulsecounter_index_t pci,
75  uint32_t *timestamp);
76 
82 extern void pulsecounter_reset_count(const pulsecounter_index_t pci);
83 
93 extern void pulsecounter_set_edge(const pulsecounter_index_t pci,
94  const gpio_level_t edge);
95 
102 
111  uint8_t const count);
112 
122 #endif
pulsecounter_set_edge
void pulsecounter_set_edge(const pulsecounter_index_t pci, const gpio_level_t edge)
Definition: pulsecounter.c:72
pulsecounter_get_count
uint32_t pulsecounter_get_count(const pulsecounter_index_t pci, uint32_t *timestamp)
Definition: pulsecounter.c:60
pulsecounter_init
void pulsecounter_init(const pulsecounter_index_t pci)
initialize the pulsecounter specified by the index with a shared memory pointer
Definition: pulsecounter.c:39
pulsecounter_destroy
void pulsecounter_destroy(const pulsecounter_index_t pci)
Close the shared memory handle for the specified PULSECOUNTER index.
Definition: pulsecounter.c:52
PULSECOUNTER1
@ PULSECOUNTER1
Definition: pulsecounter.h:47
pulsecounter_get_filter_length
uint8_t pulsecounter_get_filter_length(const pulsecounter_index_t pci)
Definition: pulsecounter.c:94
gpio_level_t
gpio_level_t
Definition: gpio.h:98
pulsecounter_reset_count
void pulsecounter_reset_count(const pulsecounter_index_t pci)
Definition: pulsecounter.c:87
PULSECOUNTER0
@ PULSECOUNTER0
Definition: pulsecounter.h:46
gpio.h
NUM_PULSECOUNTERS
@ NUM_PULSECOUNTERS
Definition: pulsecounter.h:48
pulsecounter_get_edge
gpio_level_t pulsecounter_get_edge(const pulsecounter_index_t pci)
Definition: pulsecounter.c:80
pulsecounter_index_t
pulsecounter_index_t
Enum of PULSECOUNTERs. Functions use a switch numbered from 0..NUM_PULSECOUNTERS-1.
Definition: pulsecounter.h:45
pulsecounter_set_filter_length
void pulsecounter_set_filter_length(const pulsecounter_index_t pci, uint8_t const count)
Definition: pulsecounter.c:101