From 38ae31ebc4e34e764d46bf6f110f0d14c716d5b0 Mon Sep 17 00:00:00 2001 From: baohongde Date: Wed, 14 Aug 2019 21:24:24 +0800 Subject: [PATCH] components/bt: Fix linking fail with toolchain 8.2.0 --- .../api/include/api/esp_gap_bt_api.h | 10 ++-- .../bluedroid/common/include/common/bt_defs.h | 59 +------------------ .../common/include/common/bt_trace.h | 2 +- .../decoder/include/oi_codec_sbc_private.h | 16 ++--- .../external/sbc/decoder/srce/dequant.c | 2 +- .../external/sbc/decoder/srce/framing.c | 10 ++-- .../sbc/decoder/srce/synthesis-dct8.c | 2 +- .../external/sbc/decoder/srce/synthesis-sbc.c | 2 +- 8 files changed, 23 insertions(+), 80 deletions(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h index 076f59caf7..9e9ab235db 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h @@ -326,7 +326,7 @@ typedef void (* esp_bt_gap_cb_t)(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_para * @param[in] cod: Class of Device * @return major service bits */ -inline uint32_t esp_bt_gap_get_cod_srvc(uint32_t cod) +static inline uint32_t esp_bt_gap_get_cod_srvc(uint32_t cod) { return (cod & ESP_BT_COD_SRVC_BIT_MASK) >> ESP_BT_COD_SRVC_BIT_OFFSET; } @@ -336,7 +336,7 @@ inline uint32_t esp_bt_gap_get_cod_srvc(uint32_t cod) * @param[in] cod: Class of Device * @return major device bits */ -inline uint32_t esp_bt_gap_get_cod_major_dev(uint32_t cod) +static inline uint32_t esp_bt_gap_get_cod_major_dev(uint32_t cod) { return (cod & ESP_BT_COD_MAJOR_DEV_BIT_MASK) >> ESP_BT_COD_MAJOR_DEV_BIT_OFFSET; } @@ -346,7 +346,7 @@ inline uint32_t esp_bt_gap_get_cod_major_dev(uint32_t cod) * @param[in] cod: Class of Device * @return minor service bits */ -inline uint32_t esp_bt_gap_get_cod_minor_dev(uint32_t cod) +static inline uint32_t esp_bt_gap_get_cod_minor_dev(uint32_t cod) { return (cod & ESP_BT_COD_MINOR_DEV_BIT_MASK) >> ESP_BT_COD_MINOR_DEV_BIT_OFFSET; } @@ -356,7 +356,7 @@ inline uint32_t esp_bt_gap_get_cod_minor_dev(uint32_t cod) * @param[in] cod: Class of Device * @return format type */ -inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod) +static inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod) { return (cod & ESP_BT_COD_FORMAT_TYPE_BIT_MASK); } @@ -368,7 +368,7 @@ inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod) * - true if cod is valid * - false otherise */ -inline bool esp_bt_gap_is_valid_cod(uint32_t cod) +static inline bool esp_bt_gap_is_valid_cod(uint32_t cod) { if (esp_bt_gap_get_cod_format_type(cod) == ESP_BT_COD_FORMAT_TYPE_1 && esp_bt_gap_get_cod_srvc(cod) != ESP_BT_COD_SRVC_NONE) { diff --git a/components/bt/host/bluedroid/common/include/common/bt_defs.h b/components/bt/host/bluedroid/common/include/common/bt_defs.h index 7421e7b147..1ff02ea1f3 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_defs.h +++ b/components/bt/host/bluedroid/common/include/common/bt_defs.h @@ -21,6 +21,7 @@ #include #include +#include #include "bt_common.h" #include "common/bt_target.h" @@ -69,62 +70,4 @@ typedef struct { #define CPU_LITTLE_ENDIAN #endif -inline uint16_t swap_byte_16(uint16_t x) -{ - return (((x & 0x00ffU) << 8) | - ((x & 0xff00U) >> 8)); -} - -inline uint32_t swap_byte_32(uint32_t x) -{ - return (((x & 0x000000ffUL) << 24) | - ((x & 0x0000ff00UL) << 8) | - ((x & 0x00ff0000UL) >> 8) | - ((x & 0xff000000UL) >> 24)); -} - -#ifndef ntohs -inline uint16_t ntohs(uint16_t x) -{ -#ifdef CPU_LITTLE_ENDIAN - return swap_byte_16(x); -#else - return x; -#endif -} -#endif /* #ifndef ntohs */ - -#ifndef htons -inline uint16_t htons(uint16_t x) -{ -#ifdef CPU_LITTLE_ENDIAN - return swap_byte_16(x); -#else - return x; -#endif -} -#endif /* #ifndef htons */ - -#ifndef ntohl -inline uint32_t ntohl(uint32_t x) -{ -#ifdef CPU_LITTLE_ENDIAN - return swap_byte_32(x); -#else - return x; -#endif -} -#endif /* #ifndef ntohl*/ - -#ifndef htonl -inline uint32_t htonl(uint32_t x) -{ -#ifdef CPU_LITTLE_ENDIAN - return swap_byte_32(x); -#else - return x; -#endif -} -#endif /* #ifndef htonl*/ - #endif /* _BT_DEFS_H_ */ diff --git a/components/bt/host/bluedroid/common/include/common/bt_trace.h b/components/bt/host/bluedroid/common/include/common/bt_trace.h index 09412ca7f3..780894887e 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_trace.h +++ b/components/bt/host/bluedroid/common/include/common/bt_trace.h @@ -25,7 +25,7 @@ #include "stack/bt_types.h" #include "bt_common.h" -inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len) +static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len) { uint16_t i; diff --git a/components/bt/host/bluedroid/external/sbc/decoder/include/oi_codec_sbc_private.h b/components/bt/host/bluedroid/external/sbc/decoder/include/oi_codec_sbc_private.h index 092d26f9af..5682672aab 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/include/oi_codec_sbc_private.h +++ b/components/bt/host/bluedroid/external/sbc/decoder/include/oi_codec_sbc_private.h @@ -143,11 +143,11 @@ OI_INT adjustToFitBitpool(const OI_UINT bitpool, OI_UINT bitcount, OI_UINT *excess); -INLINE OI_INT allocAdjustedBits(OI_UINT8 *dest, +OI_INT allocAdjustedBits(OI_UINT8 *dest, OI_INT bits, OI_INT excess); -INLINE OI_INT allocExcessBits(OI_UINT8 *dest, +OI_INT allocExcessBits(OI_UINT8 *dest, OI_INT excess); PRIVATE OI_UINT32 internal_CalculateBitrate(OI_CODEC_SBC_FRAME_INFO *frame); @@ -165,7 +165,7 @@ PRIVATE OI_STATUS internal_DecodeRaw(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_INT16 *pcmData, OI_UINT32 *pcmBytes); -INLINE OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context, +OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_UINT32 *decoderData, OI_UINT32 decoderDataBytes, OI_BYTE maxChannels, @@ -173,7 +173,7 @@ INLINE OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_BOOL enhanced, OI_BOOL msbc_enable); -INLINE OI_UINT16 OI_SBC_CalculateFrameAndHeaderlen(OI_CODEC_SBC_FRAME_INFO *frame, OI_UINT *headerLen_); +OI_UINT16 OI_SBC_CalculateFrameAndHeaderlen(OI_CODEC_SBC_FRAME_INFO *frame, OI_UINT *headerLen_); PRIVATE OI_UINT32 OI_SBC_MaxBitpool(OI_CODEC_SBC_FRAME_INFO *frame); @@ -185,13 +185,13 @@ PRIVATE void shift_buffer(SBC_BUFFER_T *dest, SBC_BUFFER_T *src, OI_UINT wordCou PRIVATE void cosineModulateSynth4(SBC_BUFFER_T *RESTRICT out, OI_INT32 const *RESTRICT in); PRIVATE void SynthWindow40_int32_int32_symmetry_with_sum(OI_INT16 *pcm, SBC_BUFFER_T buffer[80], OI_UINT strideShift); -INLINE void dct3_4(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in); +void dct3_4(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in); PRIVATE void analyze4_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 40], OI_INT16 *pcm, OI_UINT strideShift, OI_INT32 subband[4]); -INLINE void dct3_8(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in); +void dct3_8(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in); PRIVATE void analyze8_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 80], OI_INT16 *pcm, @@ -207,12 +207,12 @@ PRIVATE void analyze8_enhanced_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 11 /* Decoder functions */ -INLINE void OI_SBC_ReadHeader(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *data); +void OI_SBC_ReadHeader(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *data); PRIVATE void OI_SBC_ReadScalefactors(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *b, OI_BITSTREAM *bs); PRIVATE void OI_SBC_ReadSamples(OI_CODEC_SBC_DECODER_CONTEXT *common, OI_BITSTREAM *ob); PRIVATE void OI_SBC_ReadSamplesJoint(OI_CODEC_SBC_DECODER_CONTEXT *common, OI_BITSTREAM *global_bs); PRIVATE void OI_SBC_SynthFrame(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_INT16 *pcm, OI_UINT start_block, OI_UINT nrof_blocks); -INLINE OI_INT32 OI_SBC_Dequant(OI_UINT32 raw, OI_UINT scale_factor, OI_UINT bits); +OI_INT32 OI_SBC_Dequant(OI_UINT32 raw, OI_UINT scale_factor, OI_UINT bits); PRIVATE OI_BOOL OI_SBC_ExamineCommandPacket(OI_CODEC_SBC_DECODER_CONTEXT *context, const OI_BYTE *data, OI_UINT32 len); PRIVATE void OI_SBC_GenerateTestSignal(OI_INT16 pcmData[][2], OI_UINT32 sampleCount); diff --git a/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c b/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c index 5c529e0b12..1d26596016 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c +++ b/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c @@ -125,7 +125,7 @@ const OI_UINT32 dequant_long_unscaled[17]; #include -INLINE float dequant_float(OI_UINT32 raw, OI_UINT scale_factor, OI_UINT bits) +static INLINE float dequant_float(OI_UINT32 raw, OI_UINT scale_factor, OI_UINT bits) { float result = (1 << (scale_factor + 1)) * ((raw * 2.0f + 1.0f) / ((1 << bits) - 1.0f) - 1.0f); diff --git a/components/bt/host/bluedroid/external/sbc/decoder/srce/framing.c b/components/bt/host/bluedroid/external/sbc/decoder/srce/framing.c index f819ae9aa0..9c4eb3a4dc 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/srce/framing.c +++ b/components/bt/host/bluedroid/external/sbc/decoder/srce/framing.c @@ -110,7 +110,7 @@ const OI_UINT32 dequant_long_unscaled[17] = { #endif #ifdef USE_WIDE_CRC -INLINE OI_CHAR crc_iterate(OI_UINT8 oldcrc, OI_UINT8 next) +static INLINE OI_CHAR crc_iterate(OI_UINT8 oldcrc, OI_UINT8 next) { OI_UINT crc; OI_UINT idx; @@ -125,7 +125,7 @@ INLINE OI_CHAR crc_iterate(OI_UINT8 oldcrc, OI_UINT8 next) return crc; } -INLINE OI_CHAR crc_iterate_top4(OI_UINT8 oldcrc, OI_UINT8 next) +static INLINE OI_CHAR crc_iterate_top4(OI_UINT8 oldcrc, OI_UINT8 next) { OI_UINT crc; OI_UINT idx; @@ -142,13 +142,13 @@ INLINE OI_CHAR crc_iterate_top4(OI_UINT8 oldcrc, OI_UINT8 next) #else // USE_WIDE_CRC -INLINE OI_UINT8 crc_iterate_top4(OI_UINT8 oldcrc, OI_UINT8 next) +static INLINE OI_UINT8 crc_iterate_top4(OI_UINT8 oldcrc, OI_UINT8 next) { return (oldcrc << 4) ^ crc8_narrow[(oldcrc ^ next) >> 4]; } #ifdef USE_NIBBLEWISE_CRC -INLINE OI_UINT8 crc_iterate(OI_UINT8 crc, OI_UINT8 next) +static INLINE OI_UINT8 crc_iterate(OI_UINT8 crc, OI_UINT8 next) { crc = (crc << 4) ^ crc8_narrow[(crc ^ next) >> 4]; crc = (crc << 4) ^ crc8_narrow[((crc >> 4)^next) & 0xf]; @@ -157,7 +157,7 @@ INLINE OI_UINT8 crc_iterate(OI_UINT8 crc, OI_UINT8 next) } #else // USE_NIBBLEWISE_CRC -INLINE OI_UINT8 crc_iterate(OI_UINT8 crc, OI_UINT8 next) +static INLINE OI_UINT8 crc_iterate(OI_UINT8 crc, OI_UINT8 next) { return crc8_narrow[crc ^ next]; } diff --git a/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-dct8.c b/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-dct8.c index 1a12774e71..504e3c3bff 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-dct8.c +++ b/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-dct8.c @@ -62,7 +62,7 @@ * @return A signed 32-bit value corresponding to the 32 most significant bits * of the 64-bit product of u and v. */ -INLINE OI_INT32 default_mul_32s_32s_hi(OI_INT32 u, OI_INT32 v) +static INLINE OI_INT32 default_mul_32s_32s_hi(OI_INT32 u, OI_INT32 v) { OI_UINT32 u0, v0; OI_INT32 u1, v1, w1, w2, t; diff --git a/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-sbc.c b/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-sbc.c index 158ba6fbf5..cff4863262 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-sbc.c +++ b/components/bt/host/bluedroid/external/sbc/decoder/srce/synthesis-sbc.c @@ -215,7 +215,7 @@ const OI_INT32 dec_window_4[21] = { * @return A signed 32-bit value corresponding to the 32 most significant bits * of the 48-bit product of u and v. */ -INLINE OI_INT32 default_mul_16s_32s_hi(OI_INT16 u, OI_INT32 v) +static INLINE OI_INT32 default_mul_16s_32s_hi(OI_INT16 u, OI_INT32 v) { OI_UINT16 v0; OI_INT16 v1;