xref: /OK3568_Linux_fs/external/mpp/osal/test/mpp_env_test.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2015 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define MODULE_TAG "mpp_env_test"
18 
19 #include "mpp_env.h"
20 #include "mpp_log.h"
21 
22 const char env_debug[] = "test_env_debug";
23 const char env_string[] = "test_env_string";
24 char env_test_string[] = "just for debug";
25 
main()26 int main()
27 {
28     RK_U32 env_debug_u32 = 0x100;
29     const char *env_str_out = NULL;
30 
31     mpp_env_set_u32(env_debug, env_debug_u32);
32     mpp_env_set_str(env_string, env_test_string);
33     mpp_log("set env: %s to %u\n", env_debug, env_debug_u32);
34     mpp_log("set env: %s to %s\n", env_string, env_test_string);
35 
36     env_debug_u32 = 0;
37     mpp_log("start reading env:\n");
38 
39     mpp_env_get_u32(env_debug, &env_debug_u32, 0);
40     mpp_env_get_str(env_string, &env_str_out, NULL);
41 
42     mpp_log("get env: %s is %u\n", env_debug, env_debug_u32);
43     mpp_log("get env: %s is %s\n", env_string, env_str_out);
44 
45     return 0;
46 }
47 
48