mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-18 18:39:11 +08:00
[w60x][drivers] auto formatted
This commit is contained in:
parent
849c99d2fa
commit
c20c2b6d5e
@ -98,14 +98,14 @@ void disp_version_info(void)
|
|||||||
|
|
||||||
void wm_gpio_config(void)
|
void wm_gpio_config(void)
|
||||||
{
|
{
|
||||||
/* must call first */
|
/* must call first */
|
||||||
wm_gpio_af_disable();
|
wm_gpio_af_disable();
|
||||||
|
|
||||||
/*MASTER SPI configuratioin*/
|
/*MASTER SPI configuratioin*/
|
||||||
wm_spi_cs_config(WM_IO_PA_02);
|
wm_spi_cs_config(WM_IO_PA_02);
|
||||||
wm_spi_ck_config(WM_IO_PA_11);
|
wm_spi_ck_config(WM_IO_PA_11);
|
||||||
wm_spi_di_config(WM_IO_PA_03);
|
wm_spi_di_config(WM_IO_PA_03);
|
||||||
wm_spi_do_config(WM_IO_PA_09);
|
wm_spi_do_config(WM_IO_PA_09);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm_infsl_init(void)
|
static int wm_infsl_init(void)
|
||||||
|
@ -465,25 +465,25 @@ static rt_err_t _bignum_exptmod(struct hwcrypto_bignum *bignum_ctx,
|
|||||||
const struct hw_bignum_mpi *b,
|
const struct hw_bignum_mpi *b,
|
||||||
const struct hw_bignum_mpi *c)
|
const struct hw_bignum_mpi *c)
|
||||||
{
|
{
|
||||||
pstm_int pa, pb, pm, pres;
|
pstm_int pa, pb, pm, pres;
|
||||||
u32 * buff_a = NULL;
|
u32 * buff_a = NULL;
|
||||||
u32 * buff_b = NULL;
|
u32 * buff_b = NULL;
|
||||||
u32 * buff_m = NULL;
|
u32 * buff_m = NULL;
|
||||||
int err = -1;
|
int err = -1;
|
||||||
void *buff;
|
void *buff;
|
||||||
int buff_len;
|
int buff_len;
|
||||||
|
|
||||||
pstm_init(NULL, &pres);
|
pstm_init(NULL, &pres);
|
||||||
|
|
||||||
buff_a = tls_mem_alloc(a->total);
|
buff_a = tls_mem_alloc(a->total);
|
||||||
if(buff_a == NULL)
|
if(buff_a == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
buff_b = tls_mem_alloc(b->total);
|
buff_b = tls_mem_alloc(b->total);
|
||||||
if(buff_b == NULL)
|
if(buff_b == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
buff_m = tls_mem_alloc(c->total);
|
buff_m = tls_mem_alloc(c->total);
|
||||||
if(buff_m == NULL)
|
if(buff_m == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(buff_a, 0, a->total);
|
memset(buff_a, 0, a->total);
|
||||||
memset(buff_b, 0, b->total);
|
memset(buff_b, 0, b->total);
|
||||||
@ -494,29 +494,29 @@ static rt_err_t _bignum_exptmod(struct hwcrypto_bignum *bignum_ctx,
|
|||||||
memcpy(buff_m, c->p, c->total);
|
memcpy(buff_m, c->p, c->total);
|
||||||
|
|
||||||
pstm_reverse((unsigned char *)buff_a, a->total);
|
pstm_reverse((unsigned char *)buff_a, a->total);
|
||||||
pstm_reverse((unsigned char *)buff_b, b->total);
|
pstm_reverse((unsigned char *)buff_b, b->total);
|
||||||
pstm_reverse((unsigned char *)buff_m, c->total);
|
pstm_reverse((unsigned char *)buff_m, c->total);
|
||||||
|
|
||||||
// *((volatile unsigned int *)0x40000710) = *((volatile unsigned int *)0x40000710) | (0x1 << 28);
|
// *((volatile unsigned int *)0x40000710) = *((volatile unsigned int *)0x40000710) | (0x1 << 28);
|
||||||
|
|
||||||
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pa, a->total)) != PS_SUCCESS){
|
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pa, a->total)) != PS_SUCCESS){
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((err = pstm_read_unsigned_bin(&pa, (unsigned char *)buff_a, a->total)) != PS_SUCCESS) {
|
if ((err = pstm_read_unsigned_bin(&pa, (unsigned char *)buff_a, a->total)) != PS_SUCCESS) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pb, b->total)) != PS_SUCCESS){
|
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pb, b->total)) != PS_SUCCESS){
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((err = pstm_read_unsigned_bin(&pb, (unsigned char *)buff_b, b->total)) != PS_SUCCESS) {
|
if ((err = pstm_read_unsigned_bin(&pb, (unsigned char *)buff_b, b->total)) != PS_SUCCESS) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pm, c->total)) != PS_SUCCESS){
|
if ((err = pstm_init_for_read_unsigned_bin(NULL, &pm, c->total)) != PS_SUCCESS){
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((err = pstm_read_unsigned_bin(&pm, (unsigned char *)buff_m, c->total)) != PS_SUCCESS) {
|
if ((err = pstm_read_unsigned_bin(&pm, (unsigned char *)buff_m, c->total)) != PS_SUCCESS) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
tls_crypto_exptmod(&pa, &pb, &pm, &pres);
|
tls_crypto_exptmod(&pa, &pb, &pm, &pres);
|
||||||
buff_len = pstm_unsigned_bin_size(&pres);
|
buff_len = pstm_unsigned_bin_size(&pres);
|
||||||
@ -528,16 +528,16 @@ static rt_err_t _bignum_exptmod(struct hwcrypto_bignum *bignum_ctx,
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if(buff_a)
|
if(buff_a)
|
||||||
tls_mem_free(buff_a);
|
tls_mem_free(buff_a);
|
||||||
if(buff_b)
|
if(buff_b)
|
||||||
tls_mem_free(buff_b);
|
tls_mem_free(buff_b);
|
||||||
if(buff_m)
|
if(buff_m)
|
||||||
tls_mem_free(buff_m);
|
tls_mem_free(buff_m);
|
||||||
|
|
||||||
pstm_clear(&pa);
|
pstm_clear(&pa);
|
||||||
pstm_clear(&pb);
|
pstm_clear(&pb);
|
||||||
pstm_clear(&pm);
|
pstm_clear(&pm);
|
||||||
pstm_clear(&pres);
|
pstm_clear(&pres);
|
||||||
|
|
||||||
if (a->sign < 0)
|
if (a->sign < 0)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -208,7 +208,7 @@ static int wm_uart_flow_ctrl_set(TLS_UART_REGS_T *UARTx, TLS_UART_FLOW_CTRL_MODE
|
|||||||
|
|
||||||
case TLS_UART_FLOW_CTRL_HARDWARE:
|
case TLS_UART_FLOW_CTRL_HARDWARE:
|
||||||
UARTx->UR_FC = (1UL << 0) | (6UL << 2);
|
UARTx->UR_FC = (1UL << 0) | (6UL << 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
@ -16,37 +16,37 @@
|
|||||||
/* start oneshot */
|
/* start oneshot */
|
||||||
int wm_oneshot_start(WM_ONESHOT_MODE mode, wm_oneshot_callback callback)
|
int wm_oneshot_start(WM_ONESHOT_MODE mode, wm_oneshot_callback callback)
|
||||||
{
|
{
|
||||||
tls_wifi_oneshot_callback_register(callback);
|
tls_wifi_oneshot_callback_register(callback);
|
||||||
if(mode == WM_UDP)
|
if(mode == WM_UDP)
|
||||||
{
|
{
|
||||||
tls_wifi_set_oneshot_config_mode(0);
|
tls_wifi_set_oneshot_config_mode(0);
|
||||||
}
|
}
|
||||||
else if (mode == WM_APSOCKET)
|
else if (mode == WM_APSOCKET)
|
||||||
{
|
{
|
||||||
tls_wifi_set_oneshot_config_mode(1);
|
tls_wifi_set_oneshot_config_mode(1);
|
||||||
}
|
}
|
||||||
else if(mode == WM_APWEB)
|
else if(mode == WM_APWEB)
|
||||||
{
|
{
|
||||||
tls_wifi_set_oneshot_config_mode(2);
|
tls_wifi_set_oneshot_config_mode(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tls_wifi_set_oneshot_flag(1);
|
tls_wifi_set_oneshot_flag(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop oneshot */
|
/* stop oneshot */
|
||||||
int wm_oneshot_stop(void)
|
int wm_oneshot_stop(void)
|
||||||
{
|
{
|
||||||
tls_wifi_oneshot_callback_delete();
|
tls_wifi_oneshot_callback_delete();
|
||||||
tls_wifi_set_oneshot_flag(0);
|
tls_wifi_set_oneshot_flag(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get status */
|
/* get status */
|
||||||
int wm_oneshot_get(void)
|
int wm_oneshot_get(void)
|
||||||
{
|
{
|
||||||
return tls_wifi_get_oneshot_flag();
|
return tls_wifi_get_oneshot_flag();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
@ -12,9 +12,9 @@
|
|||||||
#define DRV_ONESHOT_H__
|
#define DRV_ONESHOT_H__
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{
|
||||||
WM_UDP,
|
WM_UDP,
|
||||||
WM_APSOCKET,
|
WM_APSOCKET,
|
||||||
WM_APWEB
|
WM_APWEB
|
||||||
}WM_ONESHOT_MODE;
|
}WM_ONESHOT_MODE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user