no-OS
no_os_tdm.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _NO_OS_TDM_H_
40 #define _NO_OS_TDM_H_
41 
42 #include <stdint.h>
43 #include <stdbool.h>
44 
51 
57 };
58 
67  uint8_t data_size;
69  uint8_t data_offset;
73  uint8_t slots_per_frame;
79  bool fs_lastbit;
82  /* IRQ ID */
83  uint32_t irq_id;
85  void (*rx_complete_callback)(void *rx_arg);
87  void (*rx_half_complete_callback)(void *rx_arg);
91  void *extra;
92 };
93 
99  /* IRQ ID */
100  uint32_t irq_id;
104  struct lf256fifo *rx_fifo;
106  void *extra;
107 };
108 
116  int32_t (*tdm_ops_init)(struct no_os_tdm_desc **,
117  const struct no_os_tdm_init_param *);
119  int32_t (*tdm_ops_read)(struct no_os_tdm_desc *, void *, uint16_t);
121  int32_t (*tdm_ops_write)(struct no_os_tdm_desc *, void *, uint16_t);
123  int32_t (*tdm_ops_pause)(struct no_os_tdm_desc *);
125  int32_t (*tdm_ops_resume)(struct no_os_tdm_desc *);
127  int32_t (*tdm_ops_stop)(struct no_os_tdm_desc *);
129  int32_t (*tdm_ops_remove)(struct no_os_tdm_desc *);
130 };
131 
132 /* Initialize the TDM communication peripheral. */
133 int32_t no_os_tdm_init(struct no_os_tdm_desc **desc,
134  const struct no_os_tdm_init_param *param);
135 
136 /* Free the resources allocated by no_os_tdm_init(). */
137 int32_t no_os_tdm_remove(struct no_os_tdm_desc *desc);
138 
139 /* Read data. */
140 int32_t no_os_tdm_read(struct no_os_tdm_desc *desc,
141  void *data,
142  uint16_t bytes_number);
143 
144 /* Write data. */
145 int32_t no_os_tdm_write(struct no_os_tdm_desc *desc,
146  void *data,
147  uint16_t bytes_number);
148 
149 /* Pause TDM DMA Transfer */
150 int32_t no_os_tdm_pause(struct no_os_tdm_desc *desc);
151 
152 /* Resume TDM DMA Transfer */
153 int32_t no_os_tdm_resume(struct no_os_tdm_desc *desc);
154 
155 /* Stop TDM DMA Transfer */
156 int32_t no_os_tdm_stop(struct no_os_tdm_desc *desc);
157 
158 #endif // _NO_OS_TDM_H_
no_os_tdm_write
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:126
NO_OS_TDM_MASTER_RX
@ NO_OS_TDM_MASTER_RX
Definition: no_os_tdm.h:54
no_os_tdm_desc::extra
void * extra
Definition: no_os_tdm.h:106
no_os_tdm_platform_ops::tdm_ops_write
int32_t(* tdm_ops_write)(struct no_os_tdm_desc *, void *, uint16_t)
Definition: no_os_tdm.h:121
no_os_tdm_platform_ops::tdm_ops_pause
int32_t(* tdm_ops_pause)(struct no_os_tdm_desc *)
Definition: no_os_tdm.h:123
no_os_tdm_init_param::fs_active_length
uint8_t fs_active_length
Definition: no_os_tdm.h:77
no_os_tdm_init_param::data_offset
uint8_t data_offset
Definition: no_os_tdm.h:69
no_os_tdm_init_param::platform_ops
const struct no_os_tdm_platform_ops * platform_ops
Definition: no_os_tdm.h:89
no_os_tdm_init_param::fs_lastbit
bool fs_lastbit
Definition: no_os_tdm.h:79
no_os_tdm_init_param::rx_half_complete_callback
void(* rx_half_complete_callback)(void *rx_arg)
Definition: no_os_tdm.h:87
no_os_tdm_platform_ops::tdm_ops_read
int32_t(* tdm_ops_read)(struct no_os_tdm_desc *, void *, uint16_t)
Definition: no_os_tdm.h:119
no_os_tdm_platform_ops::tdm_ops_stop
int32_t(* tdm_ops_stop)(struct no_os_tdm_desc *)
Definition: no_os_tdm.h:127
NO_OS_TDM_SLAVE_RX
@ NO_OS_TDM_SLAVE_RX
Definition: no_os_tdm.h:56
no_os_tdm_desc::irq_id
uint32_t irq_id
Definition: no_os_tdm.h:100
no_os_tdm_platform_ops::tdm_ops_remove
int32_t(* tdm_ops_remove)(struct no_os_tdm_desc *)
Definition: no_os_tdm.h:129
no_os_tdm_init_param::mode
enum no_os_tdm_mode mode
Definition: no_os_tdm.h:65
no_os_tdm_init
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:51
no_os_tdm_desc
Structure holding TDM descriptor.
Definition: no_os_tdm.h:98
no_os_tdm_init_param::irq_id
uint32_t irq_id
Definition: no_os_tdm.h:83
no_os_tdm_init_param::fs_active_low
bool fs_active_low
Definition: no_os_tdm.h:75
no_os_tdm_platform_ops
Structure holding TDM function pointers that point to the platform specific function.
Definition: no_os_tdm.h:114
no_os_tdm_init_param::data_lsb_first
bool data_lsb_first
Definition: no_os_tdm.h:71
NO_OS_TDM_SLAVE_TX
@ NO_OS_TDM_SLAVE_TX
Definition: no_os_tdm.h:55
no_os_tdm_init_param::rx_complete_callback
void(* rx_complete_callback)(void *rx_arg)
Definition: no_os_tdm.h:85
no_os_tdm_init_param::extra
void * extra
Definition: no_os_tdm.h:91
no_os_tdm_mode
no_os_tdm_mode
Definition: no_os_tdm.h:52
no_os_tdm_read
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:82
no_os_tdm_pause
int32_t no_os_tdm_pause(struct no_os_tdm_desc *desc)
Pause TDM DMA transfer.
Definition: no_os_tdm.c:94
no_os_tdm_platform_ops::tdm_ops_resume
int32_t(* tdm_ops_resume)(struct no_os_tdm_desc *)
Definition: no_os_tdm.h:125
NO_OS_TDM_MASTER_TX
@ NO_OS_TDM_MASTER_TX
Definition: no_os_tdm.h:53
no_os_tdm_platform_ops::tdm_ops_init
int32_t(* tdm_ops_init)(struct no_os_tdm_desc **, const struct no_os_tdm_init_param *)
Definition: no_os_tdm.h:116
no_os_tdm_remove
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:70
no_os_tdm_resume
int32_t no_os_tdm_resume(struct no_os_tdm_desc *desc)
Resume TDM DMA transfer.
Definition: no_os_tdm.c:104
no_os_tdm_stop
int32_t no_os_tdm_stop(struct no_os_tdm_desc *desc)
Stop TDM DMA transfer.
Definition: no_os_tdm.c:114
no_os_tdm_init_param::data_size
uint8_t data_size
Definition: no_os_tdm.h:67
no_os_tdm_init_param
Structure holding the parameters for TDM initialization.
Definition: no_os_tdm.h:63
no_os_tdm_init_param::slots_per_frame
uint8_t slots_per_frame
Definition: no_os_tdm.h:73
no_os_tdm_desc::platform_ops
const struct no_os_tdm_platform_ops * platform_ops
Definition: no_os_tdm.h:102
no_os_tdm_init_param::rising_edge_sampling
bool rising_edge_sampling
Definition: no_os_tdm.h:81
no_os_tdm_desc::rx_fifo
struct lf256fifo * rx_fifo
Definition: no_os_tdm.h:104