1 /*
2  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3  */
4 
5 #ifndef CLI_ADAPT_H
6 #define CLI_ADAPT_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /**
13  * @brief Create a task
14  *
15  * @param[in] name name of the task
16  * @param[in] fn   the entry function of task
17  * @param[in] arg  the parameter of task entry function
18  * @param[in] stack the size of task stack
19  *
20  * @return 0 on success, otherwise failed
21  */
22 
23 int32_t cli_task_create(const char *name, void (*fn)(void *), void *arg,
24                         uint32_t stack, uint32_t priority);
25 
26 /**
27  * @brief Task exit.
28  *
29  * @return none
30  */
31 void cli_task_exit(void);
32 
33 /**
34  * @brief Get character from uart
35  *
36  * @param[out] inbuf pointer to the buffer storing the character
37  *
38  * @return the number of the character
39  *
40  */
41 int32_t cli_getchar(char *inbuf);
42 
43 /**
44  * @brief Put the message via uart
45  *
46  * @param[in] msg pointer to the message
47  *
48  * @return 0 on success, otherwise failed
49  *
50  */
51 int32_t cli_putstr(char *msg);
52 
53 /**
54  * @brief wrapper of MM allocation
55  *
56  * @param[in]  size size of the mem to alloc
57  *
58  * @return NULL is error, other is memory address
59  *
60  */
61 void *cli_malloc(uint32_t size);
62 
63 /**
64  * @brief wrapper of MM free
65  *
66  * @param[in] ptr address point of the mem
67  *
68  */
69 void cli_free(void *ptr);
70 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* CLI_ADAPT_H */
77