Skip to content

Commit 03600f6

Browse files
committed
rtl8195am - fix spi_api.c warnings
Fix the following warnings: [Warning] hal_ssi.h@28,85: suggest braces around empty body in an 'if' statement [-Wempty-body] [Warning] spi_api.c@87,27: comparison between signed and unsigned integer expressions [-Wsign-compare] [Warning] spi_api.c@76,14: unused variable 'MaxSsiFreq' [-Wunused-variable] Signed-off-by: Tony Wu <[email protected]>
1 parent 7b0ff75 commit 03600f6

File tree

2 files changed

+5
-6
lines changed
  • targets/TARGET_Realtek/TARGET_AMEBA

2 files changed

+5
-6
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/spi_api.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,18 @@ void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName sse
6565
{
6666
SSI_DBG_ENTRANCE("spi_init()\n");
6767

68-
uint32_t ssi_mosi, ssi_miso, ssi_peri;
68+
int ssi_mosi, ssi_miso, ssi_peri;
6969
uint8_t ssi_idx, ssi_pinmux;
7070
PHAL_SSI_ADAPTOR pHalSsiAdaptor;
7171
PHAL_SSI_OP pHalSsiOp;
7272

7373
_memset((void*)obj, 0, sizeof(spi_t));
7474
obj->state = 0;
75-
uint32_t SystemClock = SystemGetCpuClk();
76-
uint32_t MaxSsiFreq = (SystemClock >> 2) >> 1;
7775

7876
/* SsiClockDivider doesn't support odd number */
7977

80-
DBG_SSI_INFO("SystemClock: %d\n", SystemClock);
81-
DBG_SSI_INFO("MaxSsiFreq : %d\n", MaxSsiFreq);
78+
DBG_SSI_INFO("SystemClock: %d\n", SystemGetCpuClk());
79+
DBG_SSI_INFO("MaxSsiFreq : %d\n", SystemGetCpuClk() >> 3);
8280

8381
ssi_mosi = pinmap_peripheral(mosi, PinMap_SSI_MOSI);
8482
ssi_miso = pinmap_peripheral(miso, PinMap_SSI_MISO);

targets/TARGET_Realtek/TARGET_AMEBA/sdk/soc/realtek/8195a/fwlib/hal_ssi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ extern u32 SSI_DBG_CONFIG;
2424

2525

2626
#define SSI_DBG_ENTRANCE(...) do {\
27-
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_ENTRANCE)) \
27+
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_ENTRANCE)) { \
2828
DBG_SSI_INFO(IDENT_FOUR_SPACE ANSI_COLOR_GREEN __VA_ARGS__ ANSI_COLOR_RESET); \
29+
} \
2930
}while(0)
3031

3132
#define SSI_DBG_INIT(...) do {\

0 commit comments

Comments
 (0)