Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
serial_mac_api.h
00001 /* 00002 * Copyright (c) 2016-2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may 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, 00013 * WITHOUT 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 00018 /** \file serial_mac_api.h 00019 * \brief Serial MAC API. 00020 */ 00021 00022 #ifndef SERIAL_MAC_API_H_ 00023 #define SERIAL_MAC_API_H_ 00024 00025 #include <inttypes.h> 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 struct virtual_data_req_s; 00032 00033 typedef struct serial_mac_api_s serial_mac_api_t; 00034 00035 /** 00036 * Create serial MAC 00037 * @param serial_driver_id PHY driver ID. 00038 * @return Serial MAC callback structure on success. 00039 * @return NULL on failure. 00040 */ 00041 extern serial_mac_api_t *serial_mac_create(int8_t serial_driver_id); 00042 00043 /** 00044 * @brief data_request data request call 00045 * @param api API to handle the request 00046 * @param data Data to be sent 00047 * @param data_length Length of the data 00048 */ 00049 typedef int8_t data_request(const serial_mac_api_t* api, const uint8_t *data_ptr, uint16_t data_length); 00050 00051 00052 /** 00053 * @brief data_indication Data indication is called when MAC layer has received data 00054 * @param api The API which handled the response 00055 * @param data Data to be sent 00056 * @param data_length Length of the data 00057 */ 00058 typedef void data_indication(const serial_mac_api_t *api, const uint8_t *data_ptr, uint16_t data_length); 00059 00060 /** 00061 * * @brief serial_mac_api_initialize Initialises Serial MAC layer into use 00062 * @param api API to initialize 00063 * @param ind_cb Callback to call when data is received. 00064 * @return 0 if success, -1 if api is invalid 00065 */ 00066 typedef int8_t serial_mac_api_initialize(serial_mac_api_t *api, data_indication *ind_cb); 00067 00068 /** 00069 * @brief serial_mac_virtual_initialize Initialises MAC to use virtual driver 00070 * @param api API to start using virtual driver 00071 * @param driver_id Virtual driver ID. Must be valid. 00072 * @return 0 if success, -1 if api or driver is invalid 00073 */ 00074 typedef int8_t serial_mac_virtual_initialize(const serial_mac_api_t *api, int8_t driver_id); 00075 00076 /** 00077 * Serial MAC callback structure. 00078 */ 00079 struct serial_mac_api_s { 00080 serial_mac_api_initialize *mac_initialize; /**< Inititilize data callback */ 00081 serial_mac_virtual_initialize * virtual_initilize; /**< Enable bridge to virtual driver */ 00082 data_request *data_request_cb; /**< Data request callback */ 00083 data_indication *data_ind_cb; /**< Data indication callback */ 00084 }; 00085 00086 #ifdef __cplusplus 00087 } 00088 #endif 00089 00090 #endif /* SERIAL_MAC_API_H_ */
Generated on Fri Jul 22 2022 04:54:00 by
 1.7.2 
    