更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
types_adapt.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef TYPES_ADAPT_H
33#define TYPES_ADAPT_H
34
35#include <stdint.h>
36#include <stdbool.h>
37#include <inttypes.h>
38
39#define LWIP_TFTP 1
40#define LOSCFG_NET_LWIP_SACK_TFTP 1
41#define LOSCFG_SHELL_CMD_DEBUG 1
42
43#define u8_t uint8_t
44#define s8_t int8_t
45#define u16_t uint16_t
46#define s16_t int16_t
47#define u32_t uint32_t
48#define s32_t int32_t
49
50#define X8_F "02" PRIx8
51#define U16_F PRIu16
52#define S16_F PRId16
53#define X16_F PRIx16
54#define U32_F PRIu32
55#define S32_F PRId32
56#define X32_F PRIx32
57#define SZT_F PRIuPTR
58
59#define PRINTK(fmt, ...) printf(fmt, ##__VA_ARGS__)
60#define LWIP_ASSERT(msg, expr) assert(expr)
61#define LWIP_DEBUGF(module, msg) PRINTK msg
62
63#define LOS_OK 0
64#define LOS_NOK 1
65#define ERR_OK 0
66#define EOK 0
67
68#define mem_malloc malloc
69#define mem_free free
70#define lwip_socket socket
71#define lwip_ioctl ioctl
72#define lwip_close close
73#define lwip_bind bind
74#define lwip_sendto sendto
75#define lwip_recvfrom recvfrom
76
77#define IPADDR_NONE INADDR_NONE
78#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) //对应就是 chmod = 666
79
80#define SHELLCMD_ENTRY(l, cmdType, cmdKey, paraNum, cmdHook) \
81int main(int argc, const char **argv) \
82{ \
83 return (int)cmdHook(argc, argv); \
84}
85
86typedef u32_t (*CmdCallBackFunc)(u32_t argc, const char **argv);
87
88#endif /* TYPES_ADAPT_H */
u32_t(* CmdCallBackFunc)(u32_t argc, const char **argv)
Definition: types_adapt.h:86