no-OS
Loading...
Searching...
No Matches
no_os_tdm.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef _NO_OS_TDM_H_
34#define _NO_OS_TDM_H_
35
36#include <stdint.h>
37#include <stdbool.h>
38
45
52
61 uint8_t data_size;
63 uint8_t data_offset;
69 uint32_t active_slots;
78 /* IRQ ID */
79 uint32_t irq_id;
81 void (*rx_complete_callback)(void *rx_arg);
83 void (*rx_half_complete_callback)(void *rx_arg);
87 void *extra;
88};
89
95 /* IRQ ID */
96 uint32_t irq_id;
100 struct lf256fifo *rx_fifo;
102 void *extra;
103};
104
112 int32_t (*tdm_ops_init)(struct no_os_tdm_desc **,
113 const struct no_os_tdm_init_param *);
115 int32_t (*tdm_ops_read)(struct no_os_tdm_desc *, void *, uint16_t);
117 int32_t (*tdm_ops_write)(struct no_os_tdm_desc *, void *, uint16_t);
119 int32_t (*tdm_ops_pause)(struct no_os_tdm_desc *);
121 int32_t (*tdm_ops_resume)(struct no_os_tdm_desc *);
123 int32_t (*tdm_ops_stop)(struct no_os_tdm_desc *);
125 int32_t (*tdm_ops_remove)(struct no_os_tdm_desc *);
126};
127
128/* Initialize the TDM communication peripheral. */
129int32_t no_os_tdm_init(struct no_os_tdm_desc **desc,
130 const struct no_os_tdm_init_param *param);
131
132/* Free the resources allocated by no_os_tdm_init(). */
133int32_t no_os_tdm_remove(struct no_os_tdm_desc *desc);
134
135/* Read data. */
136int32_t no_os_tdm_read(struct no_os_tdm_desc *desc,
137 void *data,
138 uint16_t bytes_number);
139
140/* Write data. */
141int32_t no_os_tdm_write(struct no_os_tdm_desc *desc,
142 void *data,
143 uint16_t bytes_number);
144
145/* Pause TDM DMA Transfer */
146int32_t no_os_tdm_pause(struct no_os_tdm_desc *desc);
147
148/* Resume TDM DMA Transfer */
149int32_t no_os_tdm_resume(struct no_os_tdm_desc *desc);
150
151/* Stop TDM DMA Transfer */
152int32_t no_os_tdm_stop(struct no_os_tdm_desc *desc);
153
154#endif // _NO_OS_TDM_H_
int32_t no_os_tdm_write(struct no_os_tdm_desc *desc, void *data, uint16_t bytes_number)
Write data using the TDM interface.
Definition no_os_tdm.c:120
int32_t no_os_tdm_remove(struct no_os_tdm_desc *desc)
Free the resources allocated by no_os_tdm_init().
Definition no_os_tdm.c:64
int32_t no_os_tdm_resume(struct no_os_tdm_desc *desc)
Resume TDM DMA transfer.
Definition no_os_tdm.c:98
no_os_tdm_mode
Definition no_os_tdm.h:46
@ NO_OS_TDM_MASTER_TX
Definition no_os_tdm.h:47
@ NO_OS_TDM_SLAVE_TX
Definition no_os_tdm.h:49
@ NO_OS_TDM_MASTER_RX
Definition no_os_tdm.h:48
@ NO_OS_TDM_SLAVE_RX
Definition no_os_tdm.h:50
int32_t no_os_tdm_stop(struct no_os_tdm_desc *desc)
Stop TDM DMA transfer.
Definition no_os_tdm.c:108
int32_t no_os_tdm_init(struct no_os_tdm_desc **desc, const struct no_os_tdm_init_param *param)
Initialize the TDM communication peripheral.
Definition no_os_tdm.c:45
int32_t no_os_tdm_read(struct no_os_tdm_desc *desc, void *data, uint16_t bytes_number)
Read data using the TDM interface.
Definition no_os_tdm.c:76
int32_t no_os_tdm_pause(struct no_os_tdm_desc *desc)
Pause TDM DMA transfer.
Definition no_os_tdm.c:88
Structure holding TDM descriptor.
Definition no_os_tdm.h:94
void * extra
Definition no_os_tdm.h:102
uint32_t irq_id
Definition no_os_tdm.h:96
struct lf256fifo * rx_fifo
Definition no_os_tdm.h:100
const struct no_os_tdm_platform_ops * platform_ops
Definition no_os_tdm.h:98
Structure holding the parameters for TDM initialization.
Definition no_os_tdm.h:57
enum no_os_tdm_mode mode
Definition no_os_tdm.h:59
void(* rx_complete_callback)(void *rx_arg)
Definition no_os_tdm.h:81
uint8_t data_offset
Definition no_os_tdm.h:63
uint8_t slots_per_frame
Definition no_os_tdm.h:67
uint32_t irq_id
Definition no_os_tdm.h:79
uint8_t data_size
Definition no_os_tdm.h:61
bool fs_active_low
Definition no_os_tdm.h:71
uint8_t fs_active_length
Definition no_os_tdm.h:73
uint32_t active_slots
Definition no_os_tdm.h:69
void(* rx_half_complete_callback)(void *rx_arg)
Definition no_os_tdm.h:83
bool data_lsb_first
Definition no_os_tdm.h:65
bool rising_edge_sampling
Definition no_os_tdm.h:77
void * extra
Definition no_os_tdm.h:87
bool fs_lastbit
Definition no_os_tdm.h:75
const struct no_os_tdm_platform_ops * platform_ops
Definition no_os_tdm.h:85
Structure holding TDM function pointers that point to the platform specific function.
Definition no_os_tdm.h:110
int32_t(* tdm_ops_remove)(struct no_os_tdm_desc *)
Definition no_os_tdm.h:125
int32_t(* tdm_ops_read)(struct no_os_tdm_desc *, void *, uint16_t)
Definition no_os_tdm.h:115
int32_t(* tdm_ops_init)(struct no_os_tdm_desc **, const struct no_os_tdm_init_param *)
Definition no_os_tdm.h:112
int32_t(* tdm_ops_stop)(struct no_os_tdm_desc *)
Definition no_os_tdm.h:123
int32_t(* tdm_ops_write)(struct no_os_tdm_desc *, void *, uint16_t)
Definition no_os_tdm.h:117
int32_t(* tdm_ops_resume)(struct no_os_tdm_desc *)
Definition no_os_tdm.h:121
int32_t(* tdm_ops_pause)(struct no_os_tdm_desc *)
Definition no_os_tdm.h:119