HPM SDK
HPMicro Software Development Kit
hpm_owr_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef HPM_OWR_DRV_H
8 #define HPM_OWR_DRV_H
9 
10 #include "hpm_common.h"
11 #include "hpm_owr_regs.h"
12 
13 /*---------------------------------------------------------------------
14  * Macro Constant Declarations
15  *-------------------------------------------------------------------*/
16 #ifndef OWR_RPP_TIMEOUT
17 #define OWR_RPP_TIMEOUT (50000U)
18 #endif
19 
20 #ifndef OWR_WR_TIMEOUT
21 #define OWR_WR_TIMEOUT (50000U)
22 #endif
23 
24 /*---------------------------------------------------------------------
25  * Typedef Enum Declarations
26  *-------------------------------------------------------------------*/
27 
29 typedef enum {
30  owr_irq_receive_shift_register_full = OWR_IRQ_STS_RSRF_MASK,
31  owr_irq_receive_buff_full = OWR_IRQ_STS_RBF_MASK,
32  owr_irq_transmit_shift_register_empty = OWR_IRQ_STS_TEMT_MASK,
33  owr_irq_transmit_buffer_empty = OWR_IRQ_STS_TBE_MASK,
34  owr_irq_presence_detected = OWR_IRQ_STS_PST_DET_MASK
36 
38 typedef struct {
40 } owr_config_t;
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
52 hpm_stat_t owr_sw_reset(OWR_Type *ptr);
53 
61 hpm_stat_t owr_init(OWR_Type *ptr, owr_config_t *config);
62 
70 
78 hpm_stat_t owr_get_presence_status(OWR_Type *ptr, uint32_t *status);
79 
86 hpm_stat_t owr_release_bus(OWR_Type *ptr);
87 
95 hpm_stat_t owr_write_data(OWR_Type *ptr, uint32_t data);
96 
104 hpm_stat_t owr_read_data(OWR_Type *ptr, uint32_t *data);
105 
113 hpm_stat_t owr_clear_irq_status(OWR_Type *ptr, uint32_t mask);
114 
122 hpm_stat_t owr_enable_interrupts(OWR_Type *ptr, uint32_t mask);
123 
131 hpm_stat_t owr_disable_interrupts(OWR_Type *ptr, uint32_t mask);
132 
140 hpm_stat_t owr_get_irq_status(OWR_Type *ptr, uint32_t *status);
141 
142 #ifdef __cplusplus
143 }
144 #endif /* __cplusplus */
145 
146 #endif /* HPM_OWR_DRV_H */
147 
uint32_t hpm_stat_t
Definition: hpm_common.h:126
hpm_stat_t owr_enable_interrupts(OWR_Type *ptr, uint32_t mask)
Enable interrupts.
Definition: hpm_owr_drv.c:148
owr_irq_t
OWR IRQ Type.
Definition: hpm_owr_drv.h:29
@ owr_irq_transmit_shift_register_empty
Definition: hpm_owr_drv.h:32
@ owr_irq_receive_shift_register_full
Definition: hpm_owr_drv.h:30
@ owr_irq_presence_detected
Definition: hpm_owr_drv.h:34
@ owr_irq_receive_buff_full
Definition: hpm_owr_drv.h:31
@ owr_irq_transmit_buffer_empty
Definition: hpm_owr_drv.h:33
hpm_stat_t owr_get_presence_status(OWR_Type *ptr, uint32_t *status)
Get presence status.
Definition: hpm_owr_drv.c:52
hpm_stat_t owr_clear_irq_status(OWR_Type *ptr, uint32_t mask)
Clear irq status.
Definition: hpm_owr_drv.c:141
hpm_stat_t owr_get_irq_status(OWR_Type *ptr, uint32_t *status)
Get irq status.
Definition: hpm_owr_drv.c:162
hpm_stat_t owr_reset_and_presence_pulses(OWR_Type *ptr)
Reset and presence pulses.
Definition: hpm_owr_drv.c:35
hpm_stat_t owr_init(OWR_Type *ptr, owr_config_t *config)
Init OWR.
Definition: hpm_owr_drv.c:18
hpm_stat_t owr_read_data(OWR_Type *ptr, uint32_t *data)
Read data.
Definition: hpm_owr_drv.c:113
hpm_stat_t owr_disable_interrupts(OWR_Type *ptr, uint32_t mask)
Disable interrupts.
Definition: hpm_owr_drv.c:155
hpm_stat_t owr_write_data(OWR_Type *ptr, uint32_t data)
Write data.
Definition: hpm_owr_drv.c:88
hpm_stat_t owr_release_bus(OWR_Type *ptr)
Release bus.
Definition: hpm_owr_drv.c:63
hpm_stat_t owr_sw_reset(OWR_Type *ptr)
Software Reset OWR.
Definition: hpm_owr_drv.c:10
OWR config struct.
Definition: hpm_owr_drv.h:38
uint8_t clock_source_frequency
Definition: hpm_owr_drv.h:39