blob: 4eb5178f1030064e94aa84036395c32f9ac4e409 [file] [log] [blame]
developere0cea0f2021-12-16 16:08:26 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * si_voice_ctrl.h
4 * SPI driver header file
5 *
6 * Author(s):
7 * laj
8 *
9 * Distributed by:
10 * Silicon Laboratories, Inc
11 *
12 * File Description:
13 * This is the header file for the control driver used
14 * in the ProSLIC demonstration code.
15 *
16 *
17 */
18
19#ifndef CTRL_H
20#define CTRL_H
21
22/** @defgroup PROSLIC_CUSTOMER_APIS Customer implemented functions
23 * This section has documentation related to APIs that the customer
24 * needs to implement to allow the ProSLIC API to function correctly.
25 *
26 * @note Please note, in addition to the functions mentioned here, the
27 * customer will need to review/modify si_voice_datatypes.h to match
28 * the native datatypes of their system.
29 *
30 * @{
31 */
32/*****************************************************************************/
33/** @defgroup PROSLIC_CUSTOMER_CONTROL Customer implemented control functions
34 * This group of function pointer prototypes need to be implemented by the
35 * customer in order for the ProSLIC API to function correctly. These functions
36 * need to be associated with the API by the functions documented in @ref SIVOICE_IO
37 * @{
38 */
39
40/**
41* @brief
42* Sets/clears the reset pin of all the ProSLICs/VDAAs
43*
44* @param[in] *hCtrl - which interface to reset (this is a customer supplied structure)
45* @param[in] in_reset - 0 = Take the device out of reset, 1 = place the device(s) in reset
46* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
47*/
48
49typedef int (*ctrl_Reset_fptr) (void *hCtrl, int in_reset);
50
51/**
52* @brief
53* Register write function pointer
54*
55* @param[in] *hCtrl - which interface to communicate through (this is a customer supplied structure)
56* @param[in] channel - ProSLIC channel to write to (this is the value passed is the same as found in @ref SiVoice_SWInitChan)
57* @param[in] regAddr - Address of register to write
58* @param[in] data - data to write to register
59* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
60*
61*/
62
63typedef int (*ctrl_WriteRegister_fptr) (void *hCtrl, uInt8 channel,
64 uInt8 regAddr, uInt8 data);
65
66/**
67* @brief
68* RAM write function pointer
69*
70* @param[in] *hCtrl - which interface to communicate through (this is a customer supplied structure)
71* @param[in] channel - ProSLIC channel to write to (this is the value passed is the same as found in @ref SiVoice_SWInitChan)
72* @param[in] ramAddr - Address of the RAM location to write
73* @param[in] ramData - data to write to the RAM location
74* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
75*
76*/
77
78typedef int (*ctrl_WriteRAM_fptr) (void *hCtrl, uInt8 channel, uInt16 ramAddr,
79 ramData data);
80
81/**
82* @brief
83* Register read function pointer
84*
85* @param[in] *hCtrl - which interface to communicate through (this is a customer supplied structure)
86* @param[in] channel - ProSLIC channel to read from (this is the value passed is the same as found in @ref SiVoice_SWInitChan)
87* @param[in] regAddr - Address of register to read from
88* @retval uInt8 - the value read. If an error occurs, this value is undefined.
89*/
90
91typedef uInt8 (*ctrl_ReadRegister_fptr) (void *hCtrl, uInt8 channel,
92 uInt8 regAddr);
93
94/**
95* @brief
96* RAM read function pointer
97*
98* @param[in] *hCtrl - which interface to communicate through (this is a customer supplied structure)
99* @param[in] channel - ProSLIC channel to read from (this is the value passed is the same as found in @ref SiVoice_SWInitChan)
100* @param[in] ramAddr - Address of the RAM location to read from
101* @retval ramData - the value read. If an error occurs, this value is undefined.
102*/
103
104typedef ramData (*ctrl_ReadRAM_fptr) (void *hCtrl, uInt8 channel,
105 uInt16 ramAddr);
106
107/**
108 * @brief
109 * Critical Section/Semaphore function pointer
110 *
111* @param[in] *hCtrl - which interface to communicate through (this is a customer supplied structure)
112* @param[in] in_critical_section - request to lock the critical section 1 = lock, 0 = unlock
113* @retval 1 = success, 0 = failed
114*/
115
116typedef int (*ctrl_Semaphore_fptr) (void *hCtrl, int in_critical_section);
117
118/** @} PROSLIC_CUSTOMER_CONTROL */
119/** @} */
120#endif
121