Skip to content

Commit 58e7464

Browse files
tianhaoespTimXia
authored andcommitted
component/esp32 : clear some minor thingsw about PM and coexistence
1 parent 595ddfd commit 58e7464

File tree

7 files changed

+133
-59
lines changed

7 files changed

+133
-59
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ build_template_app:
9898
- make all V=1
9999
# Check if there are any stray printf/ets_printf references in WiFi libs
100100
- cd ../components/esp32/lib
101-
- test $(ls *.a|awk '{if ($1 != "libcoexist.a") print $1}' | xargs xtensa-esp32-elf-nm | grep -w printf | wc -l) -eq 0
102-
- test $(ls *.a|awk '{if ($1 != "libcoexist.a") print $1}' | xargs xtensa-esp32-elf-nm | grep -w ets_printf | wc -l) -eq 0
101+
- test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
102+
- test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
103103

104104

105105
.build_template: &build_template

components/esp32/coexist.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2018-2018 Espressif Systems (Shanghai) PTE LTD
2+
//
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+
#include "esp_coexist.h"
16+
#include "coexist_internal.h"
17+
18+
const char *esp_coex_version_get(void)
19+
{
20+
return coex_version_get();
21+
}
22+
23+
esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer)
24+
{
25+
return coex_preference_set((coex_prefer_t)prefer);
26+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2018-2018 Espressif Systems (Shanghai) PTE LTD
2+
//
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+
#ifndef __COEXIST_INTERNAL_H__
16+
#define __COEXIST_INTERNAL_H__
17+
18+
#include <stdbool.h>
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
typedef enum {
25+
COEX_PREFER_WIFI = 0,
26+
COEX_PREFER_BT,
27+
COEX_PREFER_BALANCE,
28+
COEX_PREFER_NUM,
29+
} coex_prefer_t;
30+
31+
/**
32+
* @brief Init software coexist
33+
* extern function for internal use.
34+
*
35+
* @return Init ok or failed.
36+
*/
37+
esp_err_t coex_init(void);
38+
39+
/**
40+
* @brief De-init software coexist
41+
* extern function for internal use.
42+
*/
43+
void coex_deinit(void);
44+
45+
/**
46+
* @brief Pause software coexist
47+
* extern function for internal use.
48+
*/
49+
void coex_pause(void);
50+
51+
/**
52+
* @brief Resume software coexist
53+
* extern function for internal use.
54+
*/
55+
void coex_resume(void);
56+
57+
/**
58+
* @brief Get software coexist version string
59+
* extern function for internal use.
60+
* @return : version string
61+
*/
62+
const char *coex_version_get(void);
63+
64+
/**
65+
* @brief Coexist performance preference set from libbt.a
66+
* extern function for internal use.
67+
*
68+
* @param prefer : the prefer enumeration value
69+
* @return : ESP_OK - success, other - failed
70+
*/
71+
esp_err_t coex_preference_set(coex_prefer_t prefer);
72+
73+
#ifdef __cplusplus
74+
}
75+
#endif
76+
77+
#endif /* __COEXIST_INTERNAL_H__ */
Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
1+
// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,70 +12,32 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#ifndef __ESP_COEXIST_H__
16+
#define __ESP_COEXIST_H__
17+
1518
#include <stdbool.h>
19+
#include "esp_err.h"
1620

1721
#ifdef __cplusplus
1822
extern "C" {
1923
#endif
2024

21-
typedef enum {
22-
COEX_PREFER_WIFI = 0,
23-
COEX_PREFER_BT,
24-
COEX_PREFER_BALANCE,
25-
COEX_PREFER_NUM,
26-
} coex_prefer_t;
27-
28-
/**
29-
* @brief Init software coexist
30-
* extern function for internal use.
31-
*
32-
* @return Init ok or failed.
33-
*/
34-
esp_err_t coex_init(void);
35-
3625
/**
37-
* @brief De-init software coexist
38-
* extern function for internal use.
26+
* @brief coex prefer value
3927
*/
40-
void coex_deinit(void);
41-
42-
/**
43-
* @brief Pause software coexist
44-
* extern function for internal use.
45-
*/
46-
void coex_pause(void);
47-
48-
/**
49-
* @brief Resume software coexist
50-
* extern function for internal use.
51-
*/
52-
void coex_resume(void);
53-
54-
/**
55-
* @brief Get software coexist version string
56-
* extern function for internal use.
57-
* @return : version string
58-
*/
59-
const char *coex_version_get(void);
60-
61-
/**
62-
* @brief Coexist performance preference set from libbt.a
63-
* extern function for internal use.
64-
*
65-
* @param prefer : the prefer enumeration value
66-
* @return : ESP_OK - success, other - failed
67-
*/
68-
esp_err_t coex_preference_set(coex_prefer_t prefer);
28+
typedef enum {
29+
ESP_COEX_PREFER_WIFI = 0, /*!< Prefer to WiFi, WiFi will have more opportunity to use RF */
30+
ESP_COEX_PREFER_BT, /*!< Prefer to bluetooth, bluetooth will have more opportunity to use RF */
31+
ESP_COEX_PREFER_BALANCE, /*!< Do balance of WiFi and bluetooth */
32+
ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */
33+
} esp_coex_prefer_t;
6934

7035
/**
7136
* @brief Get software coexist version string
7237
*
7338
* @return : version string
7439
*/
75-
static inline const char *esp_coex_version_get(void)
76-
{
77-
return coex_version_get();
78-
}
40+
const char *esp_coex_version_get(void);
7941

8042
/**
8143
* @brief Set coexist preference of performance
@@ -87,11 +49,11 @@ static inline const char *esp_coex_version_get(void)
8749
* @param prefer : the prefer enumeration value
8850
* @return : ESP_OK - success, other - failed
8951
*/
90-
static inline esp_err_t esp_coex_preference_set(coex_prefer_t prefer)
91-
{
92-
return coex_preference_set(prefer);
93-
}
52+
esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer);
9453

9554
#ifdef __cplusplus
9655
}
9756
#endif
57+
58+
59+
#endif /* __ESP_COEXIST_H__ */

components/esp32/lib

components/esp32/lib_printf.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,12 @@ int net80211_printf(const char* format, ...)
128128
va_end(arg);
129129
return res;
130130
}
131+
132+
int coexist_printf(const char* format, ...)
133+
{
134+
va_list arg;
135+
va_start(arg, format);
136+
int res = lib_printf("coexist", format, arg);
137+
va_end(arg);
138+
return res;
139+
}

components/esp32/phy_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "freertos/portmacro.h"
3737
#include "phy.h"
3838
#include "phy_init_data.h"
39-
#include "esp_coexist.h"
39+
#include "coexist_internal.h"
4040
#include "driver/periph_ctrl.h"
4141

4242

0 commit comments

Comments
 (0)