1 /*
2 * Copyright (c) 2012, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /*
33 * ======== ladclient.h ========
34 */
36 /**
37 * @file ti/dsplink/utils/ladclient/ladclient.h
38 *
39 * @brief The Link Arbiter Daemon (LAD) communication interface.
40 * Provides wrapper functions to communicate with LAD, allowing
41 * a client to: establish a connection to LAD; and disconnect
42 * from LAD.
43 */
44 /**
45 * @defgroup _ladclient_LAD LAD - Link Arbiter Client Interface
46 *
47 * This module provides an API to enable communication with the Link Arbiter
48 * Daemon (LAD).
49 */
51 #ifndef _ladclient_LAD_
52 #define _ladclient_LAD_
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
58 #include <_lad.h>
60 /* LAD return codes */
61 typedef enum {
62 LAD_SUCCESS = 0, /**< success */
63 LAD_FAILURE, /**< general failure */
64 LAD_INVALIDARG, /**< invalid argument */
65 LAD_ACCESSDENIED, /**< the request was denied */
66 LAD_IOFAILURE, /**< communication failure */
67 LAD_NOTCONNECTED, /**< not connected to LAD yet */
68 LAD_INVALIDVERSION /**< unsupported communication protocol */
69 } LAD_Status;
71 typedef UInt LAD_ClientHandle; /**< handle for communicating with LAD */
74 /*
75 * ======== LAD_connect ========
76 */
77 /**
78 * @brief Connect to LAD.
79 *
80 * @param[out] handle The new client handle, as defined by LAD.
81 *
82 * @retval LAD_SUCCESS Success.
83 * @retval LAD_INVALIDARG The handle pointer is NULL.
84 * @retval LAD_ACCESSDENIED Returned on either of two conditions: this
85 * client is trying to establish a second active connection to
86 * LAD, and the request is denied; or, the total number of
87 * simultaneous client connections to LAD has been reached, and
88 * no more client handles are available.
89 * @retval LAD_IOFAILURE Unable to communicate with LAD, due to an
90 * OS-level I/O failure. A full system reboot may be necessary.
91 * @retval LAD_INVALIDVERSION Unable to communicate with LAD due to a
92 * mismatch in the communication protocol between the client and
93 * LAD.
94 *
95 * @sa LAD_disconnect().
96 */
97 extern LAD_Status LAD_connect(LAD_ClientHandle * handle);
99 /*
100 * ======== LAD_disconnect ========
101 */
102 /**
103 * @brief Disconnect from LAD.
104 *
105 * @param[in] handle The client handle, as returned from previous call to
106 * LAD_connect().
107 *
108 * @retval LAD_SUCCESS Success.
109 * @retval LAD_INVALIDARG Invalid client handle.
110 * @retval LAD_NOTCONNECTED Not currently connected to LAD.
111 * @retval LAD_STILLRUNNING This client has previously started the DSP
112 * via a call to LAD_startupDsp, and must call LAD_releaseDsp
113 * before attempting to disconnect from LAD.
114 * @retval LAD_IOFAILURE Unable to communicate with LAD, due to an
115 * OS-level I/O failure, or timeout. A full system reboot may be
116 * necessary.
117 *
118 * @sa LAD_connect().
119 */
120 extern LAD_Status LAD_disconnect(LAD_ClientHandle handle);
122 extern LAD_ClientHandle LAD_findHandle(Void);
123 extern LAD_Status LAD_getResponse(LAD_ClientHandle handle, union LAD_ResponseObj *rsp);
124 extern LAD_Status LAD_putCommand(struct LAD_CommandObj *cmd);
126 #ifdef __cplusplus
127 }
128 #endif
130 #endif