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
emac_util.h
00001 /* 00002 * Copyright (c) 2017, 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 00018 #ifndef EMAC_UTIL_H 00019 #define EMAC_UTIL_H 00020 00021 #define SECOND_TO_US 1000000 00022 #define SECOND_TO_MS 1000 00023 #define MS_TO_US 1000 00024 00025 extern const unsigned char eth_mac_broadcast_addr[]; 00026 00027 // Trace flags 00028 #define TRACE_ETH_FRAMES 0x01 00029 #define TRACE_SUCCESS 0x02 00030 #define TRACE_FAILURE 0x04 00031 #define SET_TRACE_LEVEL(level) emac_if_set_trace_level(level) 00032 00033 // Message validation flags 00034 #define BROADCAST 0x01 00035 #define RESPONSE_RECEIVED 0x02 00036 #define INVALID_LENGHT 0x04 00037 #define INVALID_DATA 0x08 00038 #define PRINTED 0x10 00039 00040 #define RESET_OUTGOING_MSG_DATA emac_if_reset_outgoing_msg() 00041 00042 // General error flags 00043 #define TEST_FAILED 0x01 00044 #define MSG_VALID_ERROR 0x02 00045 #define OUT_OF_MSG_DATA 0x04 00046 #define NO_FREE_MEM_BUF 0x08 00047 #define NO_RESPONSE 0x10 00048 00049 #define ERROR_FLAGS emac_if_get_error_flags() 00050 #define RESET_ERROR_FLAGS emac_if_reset_error_flags() 00051 #define PRINT_ERROR_FLAGS emac_if_print_error_flags() 00052 #define SET_ERROR_FLAGS(flags) emac_if_set_error_flags(flags) 00053 00054 #define ETH_FRAME_HEADER_LEN 28 00055 #define ETH_FRAME_MIN_LEN 60 00056 #define ETH_MAC_ADDR_LEN 6 00057 00058 int emac_if_find_outgoing_msg(int receipt_number); 00059 void emac_if_free_outgoing_msg(int index); 00060 int emac_if_count_outgoing_msg(void); 00061 void emac_if_reset_outgoing_msg(void); 00062 int emac_if_add_outgoing_msg(int length); 00063 void emac_if_timeout_outgoing_msg(void); 00064 void emac_if_validate_outgoing_msg(void); 00065 void emac_if_set_outgoing_msg_receipt_num(int index, int receipt_number); 00066 void emac_if_set_outgoing_msg_flags(int index, int flags); 00067 00068 void emac_if_add_echo_server_addr(unsigned char *addr); 00069 int emac_if_count_echo_server_addr(void); 00070 unsigned char *emac_if_get_echo_server_addr(int index); 00071 00072 void emac_if_set_error_flags(unsigned int error_flags_value); 00073 unsigned int emac_if_get_error_flags(void); 00074 void emac_if_reset_error_flags(void); 00075 void emac_if_print_error_flags(void); 00076 00077 void emac_if_set_trace_level(char trace_level_value); 00078 00079 void emac_if_trace_to_ascii_hex_dump(const char *prefix, int len, char *data); 00080 00081 void emac_if_link_state_change_cb(void *data, bool up); 00082 00083 unsigned char *emac_if_get_own_addr(void); 00084 00085 extern void emac_if_link_input_cb(void *data, void *mem_chain_p); 00086 extern void emac_if_link_state_change_cb(void *data, bool up); 00087 00088 void worker_loop_start(void (*test_step_cb_fnc)(void), int timeout); 00089 void worker_loop_end(void); 00090 00091 void emac_if_init_main_thread(void); 00092 00093 #endif /* EMAC_UTIL_H */
Generated on Fri Jul 22 2022 04:53:47 by
 1.7.2
 1.7.2 
    