]> Git Repo - esp-hosted.git/blame - host/stm32/common/common.h
Merge branch 'pr129_vuhailongkl97' into 'master'
[esp-hosted.git] / host / stm32 / common / common.h
CommitLineData
683f0529 1// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD
14af1026
YM
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/** prevent recursive inclusion **/
16#ifndef __COMMON_H
17#define __COMMON_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/** Includes **/
24#include "stdint.h"
25#include "stddef.h"
26
27/** Constants/Macros **/
28#define UNUSED_VAR(x) (void)(x);
5b9622cd 29#define MAX_SPI_BUFFER_SIZE 1600
14af1026
YM
30#define malloc pvPortMalloc
31#define free vPortFree
32
33#define htole16(x) ((uint16_t)(x))
34#define le16toh(x) ((uint16_t)(x))
35
9e2ef93b
YM
36#define IP_ADDR_LEN 4
37#define MAC_LEN 6
38#define MIN_MAC_STRING_LEN 17
39
40
41
14af1026
YM
42typedef enum stm_ret_s {
43 STM_FAIL = -1,
44 STM_OK = 0
45}stm_ret_t;
46
14af1026
YM
47
48/** Exported Structures **/
49/* interface header */
50typedef struct {
51 union {
52 void *priv_buffer_handle;
53 };
54 uint8_t if_type;
55 uint8_t if_num;
56 uint8_t *payload;
913f9031
YM
57 uint8_t flag;
58 uint16_t payload_len;
59 uint16_t seq_num;
14af1026
YM
60
61 void (*free_buf_handle)(void *buf_handle);
62} interface_buffer_handle_t;
63
64/** Exported variables **/
65
66/** Exported Functions **/
9e2ef93b
YM
67uint16_t hton_short (uint16_t x);
68uint32_t hton_long (uint32_t x);
69
70#define ntoh_long hton_long
71#define ntoh_short hton_short
72
73typedef unsigned char u_char;
74typedef unsigned long u_long;
75
14af1026
YM
76void hard_delay(int x);
77int min(int x, int y);
6e029e3a 78int get_num_from_string(int *val, char *arg);
14af1026
YM
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif
85
This page took 0.028878 seconds and 4 git commands to generate.