• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited.
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 
16 #ifndef KV_CONF_H
17 #define KV_CONF_H
18 
19 #include "duet_cm4.h"
20 #include "cmsis_os2.h"
21 
22 #define KV_CONFIG_TOTAL_SIZE 0x8000
23 
24 /* The totally storage size for key-value store */
25 #ifndef KV_CONFIG_TOTAL_SIZE
26 #define KV_TOTAL_SIZE KV_MAX_SIZE
27 #else
28 #define KV_TOTAL_SIZE KV_CONFIG_TOTAL_SIZE
29 #endif
30 
31 #if KV_TOTAL_SIZE < 0x2000
32 #error KV TOTALSIZE ERROR
33 #endif
34 
35 /* The physical parition for key-value store */
36 #ifndef KV_CONFIG_PARTITION
37 #define KV_PARTITION PARTITION_PARAMETER_2
38 #else
39 #define KV_PARTITION KV_CONFIG_PARTITION
40 #endif
41 
42 /* The number of bits in block size */
43 #ifndef KV_CONFIG_BLOCK_SIZE_BITS
44 /* Default is 4K bytes, should equal or larger than erase sector size */
45 #define KV_BLOCK_SIZE_BITS 14
46 #else
47 #define KV_BLOCK_SIZE_BITS KV_CONFIG_BLOCK_SIZE_BITS
48 #endif
49 
50 #ifndef KV_CONFIG_TASK_PRIORITY
51 #define KV_TASK_PRIORITY osPriorityAboveNormal
52 #else
53 #define KV_TASK_PRIORITY KV_CONFIG_TASK_PRIORITY
54 #endif
55 
56 #ifndef KV_CONFIG_TASK_STACK_SIZE
57 #define KV_TASK_STACK_SIZE 1024
58 #else
59 #define KV_TASK_STACK_SIZE KV_CONFIG_TASK_STACK_SIZE
60 #endif
61 
62 #ifndef KV_CONFIG_MAX_KEY_LEN
63 #define KV_MAX_KEY_LEN 256
64 #else
65 #define KV_MAX_KEY_LEN KV_CONFIG_MAX_KEY_LEN
66 #endif
67 
68 #ifndef KV_CONFIG_MAX_VAL_LEN
69 #define KV_MAX_VAL_LEN 8192
70 #else
71 #define KV_MAX_VAL_LEN KV_CONFIG_MAX_VAL_LEN
72 #endif
73 
74 #endif  /* KV_CONF_H */
75 
76