dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rpc.h Source File

rpc.h

00001 /*
00002  * Copyright (c) 2016, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef __UVISOR_API_RPC_H__
00018 #define __UVISOR_API_RPC_H__
00019 
00020 #include "api/inc/uvisor_exports.h"
00021 #include <stdint.h>
00022 #include <stddef.h>
00023 
00024 /** Specify the maximum number of incoming RPC messages for a box
00025  *
00026  * @param max_num_incoming_rpc The maximum number of incoming RPC messages for
00027  *                             a box
00028  */
00029 /* FIXME This is a dummy implementation. */
00030 #define UVISOR_BOX_RPC_MAX_INCOMING(max_num_incoming_rpc)
00031 
00032 /* This is the token to wait on for the result of an asynchronous RPC. */
00033 typedef uint32_t uvisor_rpc_result_t;
00034 
00035 typedef uint32_t (*TFN_Ptr)(uint32_t, uint32_t, uint32_t, uint32_t);
00036 
00037 /** Wait for incoming RPC.
00038  *
00039  * @param fn_ptr_array an array of RPC function targets that this call to
00040  *                     `rpc_fncall_waitfor` should handle RPC to
00041  * @param fn_count     the number of function targets in this array
00042  * @param timeout_ms   specifies how long to wait (in ms) for an incoming RPC
00043  *                     message before returning
00044  */
00045 UVISOR_EXTERN int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
00046 
00047 /** Wait for an outgoing RPC to finish.
00048  *
00049  * Wait for the result of a previously started asynchronous RPC. After this
00050  * call, ret will contain the return value of the RPC. The return value of this
00051  * function may indicate that there was an error or a timeout with non-zero.
00052  *
00053  * @param result[in]     The token to wait on for the result of an asynchronous RPC
00054  * @param timeout_ms[in] How long to wait (in ms) for the asynchronous RPC
00055  *                       message to finish before returning
00056  * @param ret[out]       The return value resulting from the finished RPC to
00057  *                       the target function
00058  * @returns              Non-zero on error or timeout, zero on successful wait
00059  */
00060 UVISOR_EXTERN int rpc_fncall_wait(uvisor_rpc_result_t result, uint32_t timeout_ms, uint32_t * ret);
00061 
00062 #endif /* __UVISOR_API_RPC_H__ */