/
test_block.c
68 lines (40 loc) · 989 Bytes
/
test_block.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <raw_api.h>
#define TEST_TASK_STK_SIZE 1024
static RAW_TASK_OBJ test_task_obj;
static PORT_STACK test_task_stack1[TEST_TASK_STK_SIZE];
static RAW_U8 buffer[1024];
static RAW_U8* p_block;
static MEM_POOL mem_pool;
static RAW_U8 count = 0;
static void test_task1(void * pParam)
{
RAW_U8* addr;
while(1) {
if(RAW_SUCCESS == raw_block_allocate(&mem_pool, (void**)&addr)) {
count ++;
__put_char("ok ", 3);
}else {
__put_char("error ", 6);
}
raw_sleep(20);
}
}
extern int test_switch;
void test_block()
{
if(1 == test_switch) {
return;
}
test_switch = 1;
if (RAW_SUCCESS != raw_block_pool_create(&mem_pool,
"pool_block1",
32,
buffer,
1024)) {
__put_char("error ", 6);
return;
}
raw_task_create(&test_task_obj, (RAW_U8 *)"task1", 0,
5, 10, test_task_stack1,
TEST_TASK_STK_SIZE , test_task1, 1);
}