forked from alibaba/AliOS-Things
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BugID:17707347: add base64,chip_code,cjson,digest_algorithm,hashtable…
…,zlib,libc README.md and Config.in Change-Id: Ia03b36778d3ab16b1dbe5387a640ca37eeb17f72
- Loading branch information
1 parent
ac86905
commit 327da97
Showing
15 changed files
with
1,235 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source "utility/base64/Config.in" | ||
source "utility/chip_code/Config.in" | ||
source "utility/cjson/Config.in" | ||
source "utility/digest_algorithm/Config.in" | ||
source "utility/libc/Config.in" | ||
source "utility/log/Config.in" | ||
source "utility/zlib/Config.in" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
## Contents | ||
|
||
*(source code, in tree view, list major entries if too many)* | ||
|
||
``` | ||
udata/ | ||
├── README.md | ||
├── abs_data_model/ | ||
├── cali_data/ | ||
├── include | ||
│ ├── abs_data_model.h | ||
│ ├── aos/ | ||
│ ├── ... | ||
│ └── uData_queue.h | ||
├── service/ | ||
├── service_mgr/ | ||
├── ucube.py | ||
├── udata.mk | ||
├── ... | ||
└── udata_service_task.c | ||
``` | ||
|
||
## Introduction | ||
|
||
*(In brief word, introduce WHAT is it and WHAT does it do.)* | ||
|
||
### Features | ||
|
||
*(list features)* | ||
|
||
* Feature 1, description 1 | ||
* Feature 2, description 2 | ||
* Feature 3, description 3 | ||
|
||
### Dependencies | ||
|
||
*(list component dependencies)* | ||
|
||
* component 1 | ||
* component 2 | ||
|
||
## API | ||
|
||
*(list exported APIs)* | ||
|
||
### krhino_task_create | ||
``` | ||
kstat_t krhino_task_create(ktask_t *task, const name_t *name, void *arg, uint8_t prio, tick_t ticks, cpu_stack_t *stack_buf, size_t stack_size, task_entry_t entry, uint8_t autorun) | ||
``` | ||
|
||
*(description of this api, if needed)* | ||
|
||
#### Arguments | ||
| name | type |description | | ||
| --- | --- | --- | | ||
| task | ktask_t| | | ||
| name_t |const name_t| | | ||
| arg |void| | | ||
| prio |uint8_t| | | ||
| tick |tick_t| | | ||
| stack_buf |cpu_stack_t| | | ||
| stack_size |size_t| | | ||
| entry |task_entry_t| | | ||
|
||
##### Return | ||
|
||
`ktask_t task` | ||
|return|description| | ||
|---| --- | | ||
| task | task handle | | ||
| -1| fail | | ||
|
||
### krhino_task_sleep | ||
|
||
### krhino_task_del | ||
|
||
### krhino_task_find | ||
|
||
## Reference | ||
|
||
*(external links, resources, pictures, etc.)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config AOS_COMP_BASE64 | ||
bool "base64" | ||
default n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
## Introduction | ||
|
||
**Base64** is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. | ||
|
||
**Base64** encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. | ||
|
||
### Features | ||
|
||
The **Base64** component provides 2 APIs to encode & decode data: | ||
* [base64_encode()](#base64_encode) | ||
* [base64_decode()](#base64_decode) | ||
|
||
### Dependencies | ||
|
||
*(none)* | ||
|
||
## APIs | ||
|
||
### base64_encode() | ||
|
||
`base64_encode()` used to encode data to base64 format. | ||
|
||
```c | ||
unsigned char *base64_encode(const unsigned char *input, int input_len, | ||
unsigned char *output, int *output_len); | ||
``` | ||
##### Arguments | ||
| name | type |description | | ||
|:------------|:-----------------------|-------------------------| | ||
| `input` | `const unsigned char *`| the data need to encode | | ||
| `input_len` | `int` | input data len | | ||
| `output` | `unsigned char *` | already encoded data | | ||
| `input_len` | `int *` | encoded data len | | ||
##### Return | ||
|return |description | | ||
|:------------------| ---------------------- | | ||
| `unsigned char *` | address of output data | | ||
| `NULL` | something error | | ||
##### sample code | ||
```c | ||
unsigned char input[] = "AliOS-Things"; | ||
unsigned char *output; | ||
int output_len; | ||
base64_encode(input, strlen(input), output, &output_len); | ||
``` | ||
|
||
You can use linux command: `base64` to test the `base64_encode()` result: | ||
|
||
```sh | ||
$ echo "AliOS-Things" | base64 | ||
QWxpT1MtVGhpbmdzCg== | ||
``` | ||
|
||
### base64_decode() | ||
|
||
`base64_decode()` use to decode base64 format data to normal data. | ||
|
||
```c | ||
unsigned char *base64_decode(const unsigned char *input, int input_len, | ||
unsigned char *output, int *output_len) | ||
``` | ||
##### Arguments | ||
| name | type |description | | ||
|:------------|:-----------------------|-------------------------| | ||
| `input` | `const unsigned char *`| the data need to decode | | ||
| `input_len` | `int` | input data len | | ||
| `output` | `unsigned char *` | already decoded data | | ||
| `input_len` | `int *` | decoded data len | | ||
##### Return | ||
|return |description | | ||
|:------------------|-------------------------| | ||
| `unsigned char *` | address of decoded data | | ||
| `NULL` | something error | | ||
##### sample code | ||
```c | ||
unsigned char input[] = "QWxpT1MtVGhpbmdzCg=="; | ||
unsigned char *output; | ||
int output_len; | ||
base64_decode(input, strlen(input), output, &output_len); | ||
``` | ||
|
||
you can use linux command: `base64` to test the `base64_decode()` result: | ||
|
||
```sh | ||
$ echo "QWxpT1MtVGhpbmdzCg==" | base64 -d | ||
AliOS-Things | ||
``` | ||
|
||
## Reference | ||
|
||
* [base64 Wikipedia](https://en.wikipedia.org/wiki/Base64) | ||
* [base64 decode/encode online](https://www.base64decode.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config AOS_COMP_CHIPCODE | ||
bool "chip_code" | ||
default n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Introduction | ||
|
||
**chip_code** provides app or other component an api([get_chip_code()](#get_chip_code)) to get chip_code by chip name. | ||
|
||
### Features | ||
|
||
chip_code data struct including `vendor`, `id`, `mcu_family_name`, and defined as this: | ||
|
||
```c | ||
typedef struct __chip_code { | ||
UINT16 vendor; | ||
UINT16 id; | ||
const char *mcu_family_name; | ||
} chip_code_st; | ||
``` | ||
|
||
* `vendor` list can be found by enum **CHIP_VENDOR** in `chip_code.h`. | ||
* `id` list can be found by enum **CHIP_ID** in `chip_code.h`. | ||
* `mcu_family_name` must be same with `HOST_MCU_FAMILY`(defined by the build system). | ||
|
||
all the already defined chip_code can be found by the variable **g_chip_codes** in `chip_code.c`. | ||
|
||
### Dependencies | ||
|
||
*(None)* | ||
|
||
## APIs | ||
|
||
### get_chip_code() | ||
|
||
```c | ||
chip_code_st *get_chip_code( char *name); | ||
``` | ||
##### Arguments | ||
| name | type |description | | ||
|:------------|:--------|---------------| | ||
| `name` | `char *`| the chip name | | ||
##### Return | ||
|return |description | | ||
|:-----------------| ----------------------| | ||
| `chip_code_st *` | address of found chip | | ||
| `NULL` | find nothing | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config AOS_COMP_CJSON | ||
bool "cjson" | ||
default n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config AOS_COMP_DIGEST_ALGORITHM | ||
bool "digest_algorithm" | ||
default n |
Oops, something went wrong.