[bsp][essemi] fix bugs. (#5585)

* [bsp][essemi] update es32f36xx libraries.
* [bsp][essemi] add led_pin control.
This commit is contained in:
liuhy-2020 2022-02-08 09:13:05 +08:00 committed by GitHub
parent 4192f0d651
commit a23aadd631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 950 additions and 616 deletions

View File

@ -12,7 +12,11 @@
#include <rtdevice.h>
#include "drv_gpio.h"
#ifdef ES_RTT_APP_LED_PIN
#define LED_PIN ES_RTT_APP_LED_PIN
#else
#define LED_PIN GET_PIN( C , 8 )
#endif
int main(void)
{

View File

@ -2687,5 +2687,6 @@ static const struct pin_index pins[] =
#define ES_RTT_APP_LED_PIN ES_PIN_GPIO_C_8
#endif

View File

@ -12,7 +12,11 @@
#include <rtdevice.h>
#include "drv_gpio.h"
#ifdef ES_RTT_APP_LED_PIN
#define LED_PIN ES_RTT_APP_LED_PIN
#else
#define LED_PIN GET_PIN( F , 0 )
#endif
int main(void)
{

View File

@ -2999,5 +2999,6 @@ static const struct pin_index pins[] =
#define ES_RTT_APP_LED_PIN ES_PIN_GPIO_F_0
#endif

View File

@ -12,7 +12,11 @@
#include <rtdevice.h>
#include "drv_gpio.h"
#ifdef ES_RTT_APP_LED_PIN
#define LED_PIN ES_RTT_APP_LED_PIN
#else
#define LED_PIN GET_PIN( F , 0 )
#endif
int main(void)
{

View File

@ -2904,5 +2904,6 @@ static const struct pin_index pins[] =
/* GP16C2T_CH2N */
#define ES_RTT_APP_LED_PIN ES_PIN_GPIO_F_0
#endif

View File

@ -8,6 +8,9 @@
* @date 18 Dec 2018
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 18 Dec 2018 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ES32F36XX_H__

View File

@ -1,12 +1,14 @@
/**
******************************************************************************
* @file startup_es32f36xx.s
* @author AE Team
* @brief ES32F36xx devices vector table for GCC toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR address
* - Set the vector table entries with the exceptions ISR addres
s
* - Branches to main in the C library (which eventually
* calls main()).
* After Reset the Cortex-M3 processor is in Thread mode,
@ -16,7 +18,8 @@
* Date Author Notes
* 23 Jan 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserve
d.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -31,7 +34,8 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**********************************************************************************
******************************************************************************
****
*/
.syntax unified
@ -138,9 +142,10 @@ LoopFillZerobss:
bl sys_config
bl adc_config
bl __libc_init_array
/*bl __libc_init_array
bl main
bl main */
bl entry
LoopForever:
b LoopForever

View File

@ -8,10 +8,26 @@
* @date 24 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 24 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
*********************************************************************************
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**********************************************************************************
*/
#include "utils.h"

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_ACMP_H__

View File

@ -6,9 +6,12 @@
* @version V1.0
* @date 28 Jun 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* @note
* Change Logs:
* Date Author Notes
* 28 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -23,8 +26,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
**********************************************************************************
*/
#ifndef __ALD_ADC_H__
@ -320,7 +322,7 @@ typedef struct {
type_func_t scan; /**< Choose scan mode enable or not */
type_func_t cont; /**< Choose continuous mode enable or not */
adc_nch_nr_t nch_nr; /**< Length of normal ranks will be converted */
adc_ich_nr_t ich_nr; /**< Length of insert ranks will be converted */
adc_ich_nr_t ich_nr; /**< Length of insert ranks will be converted */
adc_disc_mode_t disc; /**< Discontinuous mode enable or not */
adc_disc_nr_t disc_nr; /**< Number of discontinuous conversions channel */
adc_conv_bit_t data_bit; /**< The precision of conversion */
@ -368,10 +370,10 @@ typedef struct {
typedef struct adc_handle_s {
ADC_TypeDef *perh; /**< Register base address */
adc_init_t init; /**< ADC required parameters */
#ifdef ALD_DMA
dma_handle_t hdma; /**< Pointer DMA Handler */
pis_handle_t hpis; /**< Pointer PIS Handler for connect adc and dma */
#endif
lock_state_t lock; /**< ADC locking object */
adc_state_t state; /**< ADC communication state */
adc_error_t error_code; /**< ADC Error code */
@ -405,7 +407,7 @@ typedef struct {
timer_handle_t h_timer; /**< Handle of TIMER module */
adc_handle_t h_adc; /**< Handle of ADC module */
adc_nch_conf_t config; /**< Struct for chanel configure */
adc_ich_conf_t i_config; /**< Struct for insert channel configure */
adc_ich_conf_t i_config;/**< Struct for insert channel configuration */
} adc_timer_config_t;
/**
* @}

View File

@ -8,6 +8,9 @@
* @date 15 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 15 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_BKPC_H__

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_CALC_H__

View File

@ -7,6 +7,9 @@
* @date 16 Apr 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 16 Apr 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -23,8 +26,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
**********************************************************************************
*/
#ifndef __ALD_CAN_H

View File

@ -8,6 +8,9 @@
* @date 22 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 22 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_CMU_H__

View File

@ -1,78 +1,231 @@
/**
*********************************************************************************
*
* @file ald_conf.h
* @brief Enable/Disable the peripheral module.
*
* @version V1.0
* @date 01 Jul 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
*/
/**********************************************************************************
*
* @file ald_conf.h
* @brief Enable/Disable the peripheral module.
*
* @date 30 Apri 2021
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 30 Apri 2021 yanght the first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************
*/
#ifndef __ALD_CONF_H__
#define __ALD_CONF_H__
#define ALD_DMA
#define ALD_GPIO
#define ALD_UART
#define ALD_LPUART
#define ALD_I2C
#define ALD_CMU
#define ALD_RMU
#define ALD_PMU
#define ALD_WDT
#define ALD_LCD
#define ALD_RTC
#define ALD_CAN
#define ALD_FLASH
/* Exported Macros ----------------------------------------------------------- */
#define ALD_ACMP
#define ALD_ADC
#define ALD_BKPC
#define ALD_CALC
#define ALD_CAN
#define ALD_CMU
#define ALD_CRC
#define ALD_CRYPT
#define ALD_TIMER
#define ALD_LPTIM
#define ALD_DAC
#define ALD_DBGC
#define ALD_DMA
#define ALD_EBI
#define ALD_FLASH
#define ALD_GPIO
#define ALD_I2C
#define ALD_I2S
#define ALD_IAP
#define ALD_NAND
#define ALD_NOR
#define ALD_PIS
#define ALD_PMU
#define ALD_QSPI
#define ALD_RMU
#define ALD_RTC
#define ALD_SPI
#define ALD_CALC
#define ALD_ACMP
#define ALD_OPAMP
#define ALD_SRAM
#define ALD_SYSCFG
#define ALD_TIMER
#define ALD_TRNG
#define ALD_TSENSE
#define ALD_BKPC
#define ALD_DAC
#define ALD_IAP
#define ALD_I2S
#define ALD_ECC
#define ALD_NAND
#define ALD_QSPI
#define ALD_NOR
#define ALD_SRAM
#define ALD_UART
#define ALD_USB
#define ALD_WDT
#define TYPE_H
#define UTILS
/* Includes ------------------------------------------------------------------ */
#ifdef ALD_ACMP
#include "ald_acmp.h"
#endif /* ALD_ACMP */
#ifdef ALD_ADC
#include "ald_adc.h"
#endif /* ALD_ADC */
#ifdef ALD_BKPC
#include "ald_bkpc.h"
#endif /* ALD_BKPC */
#ifdef ALD_CALC
#include "ald_calc.h"
#endif /* ALD_CALC */
#ifdef ALD_CAN
#include "ald_can.h"
#endif /* ALD_CAN */
#ifdef ALD_CMU
#include "ald_cmu.h"
#endif /* ALD_CMU */
#ifdef ALD_CRC
#include "ald_crc.h"
#endif /* ALD_CRC */
#ifdef ALD_CRYPT
#include "ald_crypt.h"
#endif /* ALD_CRYPT */
#ifdef ALD_DAC
#include "ald_dac.h"
#endif /* ALD_DAC */
#ifdef ALD_DBGC
#include "ald_dbgc.h"
#endif /* ALD_DBGC */
#ifdef ALD_DMA
#include "ald_dma.h"
#endif /* ALD_DMA */
#ifdef ALD_EBI
#include "ald_ebi.h"
#endif /* ALD_EBI */
#ifdef ALD_FLASH
#include "ald_flash.h"
#endif /* ALD_FLASH */
#ifdef ALD_GPIO
#include "ald_gpio.h"
#endif /* ALD_GPIO */
#ifdef ALD_I2C
#include "ald_i2c.h"
#endif /* ALD_I2C */
#ifdef ALD_I2S
#include "ald_i2s.h"
#endif /* ALD_I2S */
#ifdef ALD_IAP
#include "ald_iap.h"
#endif /* ALD_IAP */
#ifdef ALD_NAND
#include "ald_nand.h"
#endif /* ALD_NAND */
#ifdef ALD_NOR
#include "ald_nor_lcd.h"
#endif /* ALD_NOR */
#ifdef ALD_PIS
#include "ald_pis.h"
#endif /* ALD_PIS */
#ifdef ALD_PMU
#include "ald_pmu.h"
#endif /* ALD_PMU */
#ifdef ALD_QSPI
#include "ald_qspi.h"
#endif /* ALD_QSPI */
#ifdef ALD_RMU
#include "ald_rmu.h"
#endif /* ALD_RMU */
#ifdef ALD_RTC
#include "ald_rtc.h"
#endif /* ALD_RTC */
#ifdef ALD_RTC
#include "ald_rtchw.h"
#endif /* ALD_RTC */
#ifdef ALD_SPI
#include "ald_spi.h"
#endif /* ALD_SPI */
#ifdef ALD_SRAM
#include "ald_sram.h"
#endif /* ALD_SRAM */
#ifdef ALD_SYSCFG
#include "ald_syscfg.h"
#endif /* ALD_SYSCFG */
#ifdef ALD_TIMER
#include "ald_timer.h"
#endif /* ALD_TIMER */
#ifdef ALD_TRNG
#include "ald_trng.h"
#endif /* ALD_TRNG */
#ifdef ALD_TSENSE
#include "ald_tsense.h"
#endif /* ALD_TSENSE */
#ifdef ALD_UART
#include "ald_uart.h"
#endif /* ALD_UART */
#ifdef ALD_USB
#include "ald_usb.h"
#endif /* ALD_USB */
#ifdef ALD_WDT
#include "ald_wdt.h"
#endif /* ALD_WDT */
#ifdef TYPE_H
#include "type.h"
#endif /* TYPE_H */
#ifdef UTILS
#include "utils.h"
#endif /* UTILS */
#if defined(ALD_NAND) || defined(ALD_NOR) || defined(ALD_SRAM)
#define ALD_EBI
#endif
#define ALD_EBI
#endif /*ALD_EBI*/
#define TICK_INT_PRIORITY 3
#define TICK_INT_PRIORITY 3
#endif
/* Exported Types ------------------------------------------------------------ */
/* Exported Variables -------------------------------------------------------- */
/* Exported Constants -------------------------------------------------------- */
/* Exported Functions -------------------------------------------------------- */
#endif /*__ALD_CONF_H__*/
/************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/

View File

@ -8,6 +8,9 @@
* @date 18 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 18 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_CRC_H__
@ -108,9 +110,9 @@ typedef struct crc_handle_s {
crc_init_t init; /**< CRC required parameters */
uint8_t *cal_buf; /**< The pointer of preparing buffer */
uint32_t *cal_res; /**< The pointer of result */
#ifdef ALD_DMA
dma_handle_t hdma; /**< CRC DMA handle parameters */
#endif
lock_state_t lock; /**< Locking object */
crc_state_t state; /**< CRC operation state */
@ -169,7 +171,7 @@ uint32_t ald_crc_calculate_word(crc_handle_t *hperh, uint32_t *buf, uint32_t siz
* @}
*/
#ifdef ALD_DMA
/** @addtogroup CRC_Public_Functions_Group3
* @{
*/
@ -182,7 +184,7 @@ ald_status_t ald_crc_dma_stop(crc_handle_t *hperh);
/**
* @}
*/
#endif
/** @addtogroup CRC_Public_Functions_Group4
* @{
*/

View File

@ -8,8 +8,11 @@
* @date 19 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 19 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_CRYPT_H__
@ -36,7 +38,6 @@
#endif
#include "utils.h"
#include "ald_dma.h"
/** @addtogroup ES32FXXX_ALD
* @{
@ -184,10 +185,10 @@ typedef struct {
typedef struct crypt_handle_s {
CRYPT_TypeDef *perh; /**< Register base address */
crypt_init_t init; /**< CRYPT required parameters */
#ifdef ALD_DMA
dma_handle_t hdma_m2p; /**< CRYPT DMA handle parameters memory to crypt module */
dma_handle_t hdma_p2m; /**< CRYPT DMA handle parameters crypt module to memory */
#endif
uint8_t *plain_text; /**< Pointer to plain text */
uint8_t *cipher_text; /**< Pointer to cipher text */
uint32_t size; /**< The size of crypt data buf */
@ -279,12 +280,12 @@ extern ald_status_t ald_crypt_decrypt(crypt_handle_t *hperh, uint8_t * cipher_te
extern ald_status_t ald_crypt_gcm_verify(crypt_handle_t *hperh, uint8_t *cipher_text, uint32_t size, uint8_t *aadata, uint32_t alen, uint8_t *tag);
extern ald_status_t ald_crypt_encrypt_by_it(crypt_handle_t *hperh, uint8_t *plain_text, uint8_t *cipher_text, uint32_t size);
extern ald_status_t ald_crypt_decrypt_by_it(crypt_handle_t *hperh, uint8_t *cipher_text, uint8_t *plain_text, uint32_t size);
#ifdef ALD_DMA
extern ald_status_t ald_crypt_encrypt_by_dma(crypt_handle_t *hperh, uint8_t * plain_text,
uint8_t *cipher_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m);
extern ald_status_t ald_crypt_decrypt_by_dma(crypt_handle_t *hperh, uint8_t * cipher_text,
uint8_t *plain_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m);
#endif
/**
* @}
*/
@ -292,11 +293,11 @@ extern ald_status_t ald_crypt_decrypt_by_dma(crypt_handle_t *hperh, uint8_t * ci
/** @addtogroup CRYPT_Public_Functions_Group3
* @{
*/
#ifdef ALD_DMA
extern ald_status_t ald_crypt_dma_pause(crypt_handle_t *hperh);
extern ald_status_t ald_crypt_dma_resume(crypt_handle_t *hperh);
extern ald_status_t ald_crypt_dma_stop(crypt_handle_t *hperh);
#endif
extern void ald_crypt_irq_handler(crypt_handle_t *hperh);
/**
* @}

View File

@ -6,9 +6,12 @@
* @version V1.0
* @date 28 Jun 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* @note
* Change Logs:
* Date Author Notes
* 28 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -23,8 +26,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
**********************************************************************************
*/
#ifndef __ALD_DAC_H__
@ -35,8 +37,6 @@
#endif
#include "utils.h"
#include "ald_dma.h"
#include "ald_pis.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,6 +8,9 @@
* @date 04 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,9 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_DBGC_H__

View File

@ -8,6 +8,9 @@
* @date 09 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 09 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_DMA_H__

View File

@ -8,6 +8,9 @@
* @date 20 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 20 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/

View File

@ -8,6 +8,9 @@
* @date 17 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 17 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_FLASH_H__

View File

@ -8,8 +8,11 @@
* @date 07 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_GPIO_H__

View File

@ -7,9 +7,12 @@
* @version V1.0
* @date 15 Nov 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* @note
* Change Logs:
* Date Author Notes
* 30 Jun 2020 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_I2C_H__
@ -286,10 +288,10 @@ typedef struct i2c_handle_s {
uint8_t *p_buff; /**< Pointer to I2C transfer buffer */
uint16_t xfer_size; /**< I2C transfer size */
__IO uint16_t xfer_count; /**< I2C transfer counter */
#ifdef ALD_DMA
dma_handle_t hdmatx; /**< I2C Tx DMA handle parameters */
dma_handle_t hdmarx; /**< I2C Rx DMA handle parameters */
#endif
lock_state_t lock; /**< I2C locking object */
__IO i2c_state_t state; /**< I2C communication state */
__IO i2c_mode_t mode; /**< I2C communication mode */
@ -410,7 +412,7 @@ ald_status_t ald_i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uin
ald_status_t ald_i2c_mem_read_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
i2c_addr_size_t add_size, uint8_t *buf, uint32_t size);
#ifdef ALD_DMA
/** Non-Blocking mode: DMA */
ald_status_t ald_i2c_master_send_by_dma(i2c_handle_t *hperh, uint16_t dev_addr,
uint8_t *buf, uint8_t size, uint8_t channel);
@ -422,7 +424,7 @@ ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, ui
uint8_t *buf, uint8_t size, uint8_t channel);
ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
i2c_addr_size_t add_size, uint8_t *buf, uint8_t size, uint8_t channel);
#endif
/**
* @}
*/

View File

@ -8,6 +8,9 @@
* @date 13 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 13 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_I2S_H__
@ -226,10 +228,10 @@ typedef struct i2s_handle_s {
uint16_t *rx_buf; /**< Pointer to I2S Rx transfer buffer */
uint32_t rx_size; /**< I2S Rx Transfer size */
uint32_t rx_count; /**< I2S Rx Transfer Counter */
#ifdef ALD_DMA
dma_handle_t hdmatx; /**< I2S DMA handle parameters */
dma_handle_t hdmarx; /**< I2S DMA handle parameters */
#endif
lock_state_t lock; /**< Locking object */
i2s_state_t state; /**< I2S communication state */
uint8_t side; /**< I2S channel side */
@ -337,13 +339,13 @@ ald_status_t ald_i2s_master_send(i2s_handle_t *hperh, uint16_t *buf, uint32_t si
ald_status_t ald_i2s_master_recv(i2s_handle_t *hperh, uint16_t *buf, uint32_t size, uint32_t timeout);
ald_status_t ald_i2s_master_send_by_it(i2s_handle_t *hperh, uint16_t *buf, uint32_t size);
ald_status_t ald_i2s_master_recv_by_it(i2s_handle_t *hperh, uint16_t *buf, uint32_t size);
#ifdef ALD_DMA
ald_status_t ald_i2s_master_send_by_dma(i2s_handle_t *hperh, uint16_t *buf, uint32_t size, uint8_t channel);
ald_status_t ald_i2s_master_recv_by_dma(i2s_handle_t *hperh, uint16_t *buf, uint32_t size, uint8_t dma_ch, uint8_t _dma_ch);
ald_status_t ald_i2s_dma_pause(i2s_handle_t *hperh);
ald_status_t ald_i2s_dma_resume(i2s_handle_t *hperh);
ald_status_t ald_i2s_dma_stop(i2s_handle_t *hperh);
#endif
/**
* @}
*/

View File

@ -8,6 +8,9 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_IAP_H__

View File

@ -8,6 +8,9 @@
* @date 07 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_NAND_H_

View File

@ -8,6 +8,9 @@
* @date 07 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_NOR_LCD_H_

View File

@ -8,6 +8,9 @@
* @date 27 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 27 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_PIS_H__

View File

@ -8,6 +8,9 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_PMU_H__

View File

@ -4,9 +4,12 @@
* @version V1.0
* @date 09 Nov 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* @note
* Change Logs:
* Date Author Notes
* 09 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -21,8 +24,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_QSPI_H_
@ -276,9 +278,9 @@ typedef struct {
uint8_t *rx_buf; /**< Pointer to QSPI receive buffer */
uint16_t rx_size; /**< QSPI receive size */
uint16_t rx_cnt; /**< QSPI receive counter */
#ifdef ALD_DMA
dma_handle_t hdma; /**< QSPI Rx/Tx DMA Handle parameters*/
#endif
qspi_state_t state; /**< QSPI communication state */
__IO lock_state_t lock; /**< Locking object*/
} qspi_handle_t;

View File

@ -8,8 +8,11 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_RMU_H__

View File

@ -7,6 +7,9 @@
* @date 16 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 16 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -23,8 +26,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************
**********************************************************************************
*/
#ifndef __ALD_RTC_H__

View File

@ -7,6 +7,9 @@
* @date 16 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 16 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -23,8 +26,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************
**********************************************************************************
*/
#ifndef __ALD_RTCHW_H__
@ -35,7 +37,6 @@ extern "C" {
#endif
#include "utils.h"
#include "ald_rtc.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 13 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 13 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_SPI_H__
@ -248,10 +250,10 @@ typedef struct spi_handle_s {
uint8_t *rx_buf; /**< Pointer to SPI Rx transfer buffer */
uint16_t rx_size; /**< SPI Rx Transfer size */
uint16_t rx_count; /**< SPI Rx Transfer Counter */
#ifdef ALD_DMA
dma_handle_t hdmatx; /**< SPI Tx DMA handle parameters */
dma_handle_t hdmarx; /**< SPI Rx DMA handle parameters */
#endif
lock_state_t lock; /**< Locking object */
spi_state_t state; /**< SPI communication state */
uint32_t err_code; /**< SPI error code */
@ -400,14 +402,14 @@ ald_status_t ald_spi_send_recv(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx
ald_status_t ald_spi_send_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size);
ald_status_t ald_spi_recv_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size);
ald_status_t ald_spi_send_recv_by_it(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size);
#ifdef ALD_DMA
ald_status_t ald_spi_send_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
ald_status_t ald_spi_recv_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
ald_status_t ald_spi_send_recv_by_dma(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel);
ald_status_t ald_spi_dma_pause(spi_handle_t *hperh);
ald_status_t ald_spi_dma_resume(spi_handle_t *hperh);
ald_status_t ald_spi_dma_stop(spi_handle_t *hperh);
#endif
/**
* @}
*/

View File

@ -8,6 +8,9 @@
* @date 07 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_SRAM_H__
@ -70,10 +72,10 @@ typedef struct {
ald_ebi_nor_sram_init_t init; /**< SRAM device control configuration parameters */
lock_state_t lock; /**< SRAM locking object */
__IO ald_sram_state_t state; /**< SRAM device access state */
#ifdef ALD_DMA
dma_handle_t hdma; /**< SRAM DMA Handle parameters */
void(*cplt_cbk)(void *arg); /**< DMA transmit completely callback function */
#endif
} sram_handle_t;
/**
* @}

View File

@ -8,6 +8,9 @@
* @date 04 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_SYSCFG_H__

View File

@ -9,6 +9,9 @@
* @date 06 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 06 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -25,8 +28,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_TIMER_H__
@ -200,10 +202,8 @@ typedef struct timer_handle_s {
lock_state_t lock; /**< Locking object */
timer_state_t state; /**< TIMER operation state */
#ifdef ALD_DMA
dma_handle_t hdma1; /**< Timer DMA handle parameters */
dma_handle_t hdma2;
#endif
void (*period_elapse_cbk)(struct timer_handle_s *arg); /**< Period elapse callback */
void (*delay_elapse_cbk)(struct timer_handle_s *arg); /**< Delay_elapse callback */
@ -1011,11 +1011,11 @@ void ald_timer_base_start(timer_handle_t *hperh);
void ald_timer_base_stop(timer_handle_t *hperh);
void ald_timer_base_start_by_it(timer_handle_t *hperh);
void ald_timer_base_stop_by_it(timer_handle_t *hperh);
#ifdef ALD_DMA
ald_status_t ald_timer_base_start_by_dma(timer_handle_t *hperh,
uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_base_stop_by_dma(timer_handle_t *hperh);
#endif
/**
* @}
*/
@ -1029,11 +1029,11 @@ void ald_timer_oc_start(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_oc_stop(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_oc_start_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_oc_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_oc_start_by_dma(timer_handle_t *hperh, timer_channel_t ch,
uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_oc_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/
@ -1050,11 +1050,11 @@ void ald_timer_pwm_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint32_t freq);
void ald_timer_pwm_set_duty(timer_handle_t *hperh, timer_channel_t ch, uint16_t duty);
void ald_timer_pwm_set_input(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_pwm_start_by_dma(timer_handle_t *hperh, timer_channel_t ch,
uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_pwm_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/
@ -1068,11 +1068,11 @@ void ald_timer_ic_start(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ic_stop(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ic_start_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ic_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_ic_start_by_dma(timer_handle_t *hperh, timer_channel_t ch,
uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_ic_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/
@ -1099,12 +1099,12 @@ void ald_timer_encoder_start(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_encoder_stop(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_encoder_start_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_encoder_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_encoder_start_by_dma(timer_handle_t *hperh, timer_channel_t ch,
uint16_t *buf1, uint16_t *buf2, uint32_t len,
uint8_t dma_ch1, uint8_t dma_ch2);
void ald_timer_encoder_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/
@ -1118,11 +1118,11 @@ void ald_timer_hall_sensor_start(timer_handle_t *hperh);
void ald_timer_hall_sensor_stop(timer_handle_t *hperh);
void ald_timer_hall_sensor_start_by_it(timer_handle_t *hperh);
void ald_timer_hall_sensor_stop_by_it(timer_handle_t *hperh);
#ifdef ALD_DMA
ald_status_t ald_timer_hall_sensor_start_by_dma(timer_handle_t *hperh,
uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_hall_sensor_stop_by_dma(timer_handle_t *hperh);
#endif
/**
* @}
*/
@ -1135,11 +1135,11 @@ void ald_timer_ocn_start(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ocn_stop(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ocn_start_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_ocn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_ocn_start_by_dma(timer_handle_t *hperh,
timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_ocn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/
@ -1152,11 +1152,11 @@ void ald_timer_pwmn_start(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_pwmn_stop(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_pwmn_start_by_it(timer_handle_t *hperh, timer_channel_t ch);
void ald_timer_pwmn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch);
#ifdef ALD_DMA
ald_status_t ald_timer_pwmn_start_by_dma(timer_handle_t *hperh,
timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch);
void ald_timer_pwmn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch);
#endif
/**
* @}
*/

View File

@ -8,8 +8,11 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_TRNG_H__

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_TSENSE_H__

View File

@ -8,8 +8,11 @@
* @date 21 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 21 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_UART_H__
@ -190,10 +192,10 @@ typedef struct uart_handle_s {
uint8_t *rx_buf; /**< Pointer to UART Rx transfer Buffer */
uint16_t rx_size; /**< UART Rx Transfer size */
uint16_t rx_count; /**< UART Rx Transfer Counter */
#ifdef ALD_DMA
dma_handle_t hdmatx; /**< UART Tx DMA Handle parameters */
dma_handle_t hdmarx; /**< UART Rx DMA Handle parameters */
#endif
lock_state_t lock; /**< Locking object */
uart_state_t state; /**< UART communication state */
uart_error_t err_code; /**< UART Error code */
@ -485,13 +487,13 @@ ald_status_t ald_uart_recv_n_lock(uart_handle_t *hperh, uint8_t *buf, uint16_t s
ald_status_t ald_uart_send_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size);
ald_status_t ald_uart_recv_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size);
ald_status_t ald_uart_recv_frame_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t t_out);
#ifdef ALD_DMA
ald_status_t ald_uart_send_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
ald_status_t ald_uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
ald_status_t ald_uart_dma_pause(uart_handle_t *hperh);
ald_status_t ald_uart_dma_resume(uart_handle_t *hperh);
ald_status_t ald_uart_dma_stop(uart_handle_t *hperh);
#endif
void ald_uart_irq_handler(uart_handle_t *hperh);
void ald_uart_irq_handler_fast(uart_handle_t *hperh);
/**

View File

@ -8,8 +8,11 @@
* @date 25 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_USB_H__

View File

@ -7,9 +7,12 @@
* @version V1.0
* @date 18 Dec 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* @note
* Change Logs:
* Date Author Notes
* 18 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#ifndef __ALD_WDT_H__

View File

@ -8,6 +8,9 @@
* @date 17 Apr 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 17 Apr 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __TYPE_H__
@ -37,7 +39,6 @@ extern "C" {
#include <stdint.h>
#include "es_conf_info_select.h"
#if defined (__CC_ARM)
#define __INLINE__ __inline
#define __STATIC_INLINE__ static __inline

View File

@ -8,6 +8,9 @@
* @date 07 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#ifndef __UTILS_H__
@ -36,7 +38,6 @@
#endif
#include <stdlib.h>
#include "ald_conf.h"
#include "type.h"
#ifdef ES32F36xx
#include "es32f36xx.h"
@ -169,9 +170,9 @@ void ald_systick_interval_select(systick_interval_t value);
*/
/* Peripheral Control functions */
void ald_inc_tick(void);
void ald_systick_irq_cbk(void);
void ald_delay_us(__IO uint32_t delay);
void ald_systick_irq_cbk(void);
void ald_delay_ms(__IO uint32_t delay);
void ald_delay_us(__IO uint32_t delay);
uint32_t ald_get_tick(void);
void ald_suspend_tick(void);
void ald_resume_tick(void);

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_acmp.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -21,6 +21,9 @@
* @date 28 Jun 2019
* @author AE Team.
* @note
* Change Logs:
* Date Author Notes
* 28 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -37,14 +40,11 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_cmu.h"
#include "ald_adc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{
@ -73,7 +73,6 @@ static void adc_dma_error(void *arg);
* @}
*/
/** @defgroup ADC_Public_Functions ADC Public Functions
* @{
*/
@ -160,8 +159,7 @@ ald_status_t ald_adc_init(adc_handle_t *hperh)
SET_BIT(ADC0->CCR, ADC_CCR_TRMEN_MSK);
SET_BIT(ADC1->CCR, ADC_CCR_TRMEN_MSK);
MODIFY_REG(hperh->perh->CON1, ADC_CON1_NCHESEL_MSK, hperh->init.nche_sel << ADC_CON1_NCHESEL_POS);
MODIFY_REG(hperh->perh->CON1, ADC_CON1_NCHESEL_MSK, hperh->init.nche_sel << ADC_CON1_NCHESEL_POS);
ald_adc_interrupt_config(hperh, ADC_IT_OVR, ENABLE);
ADC_ENABLE(hperh);
@ -1131,33 +1129,33 @@ uint32_t ald_adc_get_error(adc_handle_t *hperh)
*/
void ald_adc_offset_adjust(uint32_t refmv)
{
uint32_t tmp = 0, os = 0;
if (refmv == 0) return;
*((volatile uint32_t *)(0x40080000)) = 0x55AA6996;
*((volatile uint32_t *)(0x40080100)) = 0x5A962814;
*((volatile uint32_t *)(0x40080100)) = 0xE7CB69A5;
tmp = INFO_ADC0DA;
os = tmp & 0x7F;
os = (uint32_t)((os * 5000) / refmv + 0.5);
tmp = tmp & 0xFF80;
tmp |= os;
tmp |= 0x55AA0000;
CFG_ADC0DA = tmp;
tmp = INFO_ADC1DA;
os = tmp & 0x7F;
os = (uint32_t)((os * 5000) / refmv + 0.5);
tmp = tmp & 0xFF80;
tmp |= os;
tmp |= 0x55AA0000;
CFG_ADC1DA = tmp;
*((volatile uint32_t *)(0x40080100)) = 0x123456;
*((volatile uint32_t *)(0x40080100)) = 0x123456;
*((volatile uint32_t *)(0x40080000)) = 0x123456;
uint32_t tmp = 0, os = 0;
if (refmv == 0) return;
*((volatile uint32_t *)(0x40080000)) = 0x55AA6996;
*((volatile uint32_t *)(0x40080100)) = 0x5A962814;
*((volatile uint32_t *)(0x40080100)) = 0xE7CB69A5;
tmp = INFO_ADC0DA;
os = tmp & 0x7F;
os = (uint32_t)((os * 5000) / refmv + 0.5);
tmp = tmp & 0xFF80;
tmp |= os;
tmp |= 0x55AA0000;
CFG_ADC0DA = tmp;
tmp = INFO_ADC1DA;
os = tmp & 0x7F;
os = (uint32_t)((os * 5000) / refmv + 0.5);
tmp = tmp & 0xFF80;
tmp |= os;
tmp |= 0x55AA0000;
CFG_ADC1DA = tmp;
*((volatile uint32_t *)(0x40080100)) = 0x123456;
*((volatile uint32_t *)(0x40080100)) = 0x123456;
*((volatile uint32_t *)(0x40080000)) = 0x123456;
}
/**

View File

@ -8,6 +8,9 @@
* @date 15 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 15 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,13 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_bkpc.h"
#include "ald_rtc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,8 +8,11 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_calc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -7,10 +7,15 @@
* + Initialization functions
* + IO operation functions
* + Peripheral Control functions
* + Peripheral Control functions
* + Peripheral State and Error functions
* @version V1.0
* @date 25 Apr 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Apr 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -27,8 +32,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -80,7 +84,7 @@
******************************************************************************
*/
#include "ald_can.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -443,8 +447,8 @@ ald_status_t ald_can_recv(can_handle_t *hperh, can_rx_fifo_t num, can_rx_msg_t *
}
}
// if (__can_rx_check(hperh, num))
// return ERROR;
if (__can_rx_check(hperh, num))
return ERROR;
stid = READ_BITS(hperh->perh->RxFIFO[num].RXFID, CAN_RXF0ID_STDID_MSK, CAN_RXF0ID_STDID_POSS);
exid = READ_BITS(hperh->perh->RxFIFO[num].RXFID, CAN_RXF0ID_EXID_MSK, CAN_RXF0ID_EXID_POSS);

View File

@ -8,8 +8,11 @@
* @date 22 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 22 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -138,9 +140,7 @@
******************************************************************************
*/
#include "ald_cmu.h"
#include "ald_flash.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,6 +8,9 @@
* @date 18 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 18 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_crc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -9,6 +9,9 @@
* @date 19 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 19 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -25,12 +28,11 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_crypt.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -7,6 +7,9 @@
* @date 28 Jun 2019
* @author AE Team.
* @note
* Change Logs:
* Date Author Notes
* 28 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -23,11 +26,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_dac.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 09 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 09 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -71,7 +73,6 @@
#include <string.h>
#include "ald_conf.h"
#include "ald_dma.h"
/** @addtogroup ES32FXXX_ALD
@ -183,21 +184,32 @@ static void dma_config_base(DMA_TypeDef *DMAx, dma_cycle_ctrl_t mode, dma_config
*/
void ald_dma_irq_handler(void)
{
uint32_t i, reg = DMA0->IFLAG;
uint32_t i, reg;
dma_descriptor_t *descr0, *descr1;
uint32_t p_addr, a_addr;
reg = DMA0->IFLAG;
p_addr = DMA0->CTRLBASE;
a_addr = DMA0->ALTCTRLBASE;
for (i = 0; i < DMA_CH_COUNT; ++i) {
if (READ_BIT(reg, (1U << i))) {
DMA0->ICFR = (1U << i);
DMA0->CHENCLR = (1U << i);
if (dma0_cbk[i].cplt_cbk != NULL)
dma0_cbk[i].cplt_cbk(dma0_cbk[i].cplt_arg);
DMA0->ICFR = (1U << i);
descr0 = (dma_descriptor_t *)(p_addr) + i;
descr1 = (dma_descriptor_t *)(a_addr) + i;
if ((descr0->ctrl.cycle_ctrl == DMA_CYCLE_CTRL_NONE)
&& (descr1->ctrl.cycle_ctrl == DMA_CYCLE_CTRL_NONE))
DMA0->CHENCLR = (1U << i);
}
}
if (READ_BIT(reg, (1U << DMA_ERR))) {
DMA0->ICFR = (1U << DMA_ERR);
for (i = 0; i < DMA_CH_COUNT; ++i) {
if (dma0_cbk[i].err_cbk != NULL)
dma0_cbk[i].err_cbk(dma0_cbk[i].err_arg);

View File

@ -8,6 +8,9 @@
* @date 20 Jan 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 20 Jan 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,10 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************
**********************************************************************************
*/
#include "ald_ebi.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,6 +8,9 @@
* @date 17 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 17 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,10 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### FLASH Peripheral features #####
@ -47,7 +47,7 @@
@endverbatim
*/
#include "ald_flash.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 17 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 17 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,10 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### FLASH Peripheral features #####
@ -60,7 +60,7 @@
*/
#include "ald_flash.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -13,6 +13,9 @@
* @date 07 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 07 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -29,8 +32,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### GPIO Peripheral features #####
@ -139,8 +141,6 @@
*/
#include "ald_conf.h"
#include "ald_gpio.h"
/** @addtogroup ES32FXXX_ALD
* @{
@ -199,7 +199,7 @@ void ald_gpio_init(GPIO_TypeDef *GPIOx, uint16_t pin, gpio_init_t *init)
for (i = 0; i < 16; ++i) {
if (((pin >> i) & 0x1) == 0)
continue;
/* Get position and 2-bits mask */
pos = i << 1;
mask = 0x3 << pos;

View File

@ -1,15 +1,18 @@
/**
*********************************************************************************
*
* @file ald_i2c.c
* @brief I2C module driver.
*
* @version V1.0
* @date 15 Nov 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*********************************************************************************
*
* @file ald_i2c.c
* @brief I2C module driver.
*
* @version V1.0
* @date 15 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 15 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -24,11 +27,12 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
@verbatim
==============================================================================
**********************************************************************************
*
@verbatim
===============================================================================
##### How to use this driver #####
==============================================================================
===============================================================================
[..]
The I2C driver can be used as follows:
@ -165,7 +169,7 @@
*********************************************************************************
*/
#include "ald_i2c.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{
@ -182,9 +186,9 @@
* @{
*/
#define I2C_TIMEOUT_FLAG (__systick_interval / 20 + 1)
#define I2C_TIMEOUT_ADDR_SLAVE (__systick_interval * 10)
#define I2C_TIMEOUT_BUSY_FLAG (__systick_interval * 10)
#define I2C_TIMEOUT_FLAG (10)
#define I2C_TIMEOUT_ADDR_SLAVE (10)
#define I2C_TIMEOUT_BUSY_FLAG (10)
#define I2C_MAX_DELAY 0xFFFFFFFF
/**
@ -262,65 +266,67 @@ static ald_status_t i2c_slave_stopf(i2c_handle_t *hperh);
* @brief I2C Configuration Speed function.
* @param hperh: Pointer to a i2c_handle_t structure that contains.
* the configuration information for the I2C speed.
* @param freqrange: I2C Peripheral bus clock
* @param clk: I2C Peripheral bus clock
* @retval Status, see @ref ald_status_t.
*/
ald_status_t i2c_speed_init(i2c_handle_t *hperh, uint32_t freqrange)
ald_status_t i2c_speed_init(i2c_handle_t *hperh, uint32_t clk)
{
float Tsync = 0;
float Tscl = 0;
float Tfre = 0;
uint32_t Tper = 0;
uint32_t presc = 0;
uint32_t tmp = 0;
int32_t t_scl, t_pre, tmp;
if (hperh->init.module == I2C_MODULE_SLAVE) {
hperh->init.clk_speed = 450000;
hperh->init.clk_speed = 450000UL;
}
if (hperh->init.clk_speed <= 100000) {
tmp = freqrange / 4000000;
freqrange = 4000000;
} else {
tmp = freqrange / 8000000;
freqrange = 8000000;
}
Tscl = 1000.0 / (hperh->init.clk_speed / 1000000.0);
Tfre = 1000.0 / I2C_FREQ_RANGE(freqrange);
Tsync = (READ_BITS(hperh->perh->CON2, I2C_CON1_DNF_MSK, I2C_CON1_DNF_POSS) + 2) * 2 * Tfre;
Tper = (uint32_t)((Tscl - Tsync) / Tfre);
while (Tper > 512) {
Tper = Tper - 512;
presc++;
}
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_PRESC_MSK, (presc + tmp ) << I2C_TIMINGR_PRESC_POSS);
if (hperh->init.clk_speed <= I2C_STANDARD_MODE_MAX_CLK) {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, 2 << I2C_TIMINGR_SDADEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, 4 << I2C_TIMINGR_SCLDEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLH_MSK, (((Tper - 2) / 2) - 4) << I2C_TIMINGR_SCLH_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, (((Tper - 2) / 2) + 4) << I2C_TIMINGR_SCLL_POSS);
if (hperh->init.clk_speed <= 100000UL) {
tmp = clk / 4000000UL;
clk = (tmp >= 16UL) ? (clk >> 4UL) : 4000000UL;
}
else {
if (hperh->init.clk_speed <= I2C_FAST_MODE_MAX_CLK) {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, 2 << I2C_TIMINGR_SDADEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, 3 << I2C_TIMINGR_SCLDEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLH_MSK, (((Tper - 2) / 2) - 6) << I2C_TIMINGR_SCLH_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, (((Tper - 2) / 2) + 6) << I2C_TIMINGR_SCLL_POSS);
}
else {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, 0 << I2C_TIMINGR_SDADEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, 1 << I2C_TIMINGR_SCLDEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLH_MSK, (((Tper - 2) / 2) - 3) << I2C_TIMINGR_SCLH_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, (((Tper - 2) / 2) + 3) << I2C_TIMINGR_SCLL_POSS);
}
tmp = clk / 8000000UL;
clk = (tmp >= 16UL) ? (clk >> 4UL) : 8000000UL;
}
tmp = tmp >= 16UL ? 15UL : tmp;
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_PRESC_MSK, tmp << I2C_TIMINGR_PRESC_POSS);
t_scl = 1000000000 / hperh->init.clk_speed;
t_pre = 1000000000 / clk;
tmp = (t_scl * 10) / (t_pre << 1UL);
tmp = (tmp % 10) >= 5 ? (tmp / 10 + 1) : tmp / 10;
tmp = tmp >= 255UL ? 255UL : tmp;
/* SCLDEL+1+SDADEL+0+SCLH+1 */
if ((long)(t_scl - ((tmp + 3UL) * t_pre)) < 0)
return ERROR;
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, (tmp - 1UL) << I2C_TIMINGR_SCLL_POSS);
if (hperh->init.clk_speed > 100000UL) {
if ((tmp - 1UL) > 3UL) {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, ((tmp - 1UL) / 3UL) << I2C_TIMINGR_SCLDEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, ((((tmp - 1UL) / 3UL) >= 3) ? 3 : (((tmp - 1UL) / 3UL) % 3)) << I2C_TIMINGR_SDADEL_POSS);
}
else {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, 1UL << I2C_TIMINGR_SCLDEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, 1UL << I2C_TIMINGR_SDADEL_POSS);
}
}
else {
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, 2UL << I2C_TIMINGR_SDADEL_POSS);
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, 4UL << I2C_TIMINGR_SCLDEL_POSS);
}
tmp = t_scl - (tmp + READ_BITS(hperh->perh->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, I2C_TIMINGR_SCLDEL_POSS) + \
READ_BITS(hperh->perh->TIMINGR, I2C_TIMINGR_SDADEL_MSK, I2C_TIMINGR_SDADEL_POSS) + 1UL) * t_pre;
if (tmp < 0)
return ERROR;
tmp = (tmp * 10) / t_pre;
tmp = (tmp % 10) >= 5 ? (tmp / 10 + 1) : tmp / 10;
tmp = tmp >= 255UL ? 255UL : tmp;
/* tscll >= 3*tsclh */
tmp = (tmp - 1) <= (READ_BITS(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, I2C_TIMINGR_SCLL_POSS) / 3) ? (READ_BITS(hperh->perh->TIMINGR, I2C_TIMINGR_SCLL_MSK, I2C_TIMINGR_SCLL_POSS) / 3) + 1: tmp;
MODIFY_REG(hperh->perh->TIMINGR, I2C_TIMINGR_SCLH_MSK, (tmp - 1UL) << I2C_TIMINGR_SCLH_POSS);
return OK;
}
/**
@ -351,7 +357,9 @@ ald_status_t ald_i2c_init(i2c_handle_t *hperh)
I2C_DISABLE(hperh);
i2c_speed_init(hperh, freqrange);
if (OK != i2c_speed_init(hperh, freqrange))
return ERROR;
MODIFY_REG(hperh->perh->CON1, I2C_CON1_NOSTRETCH_MSK, (hperh->init.no_stretch) << I2C_CON1_NOSTRETCH_POS);
MODIFY_REG(hperh->perh->CON1, I2C_CON1_GCEN_MSK, (hperh->init.general_call) << I2C_CON1_GCEN_POS);
@ -527,7 +535,6 @@ ald_status_t ald_i2c_master_send(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t
SET_BIT(hperh->perh->CON2, I2C_CON2_START_MSK);
while (size > 0) {
while(hperh->perh->STAT & (0x1 << 1));
hperh->perh->TXDATA = (*buf++);
size--;
hperh->xfer_count++;
@ -651,7 +658,7 @@ SUCCESS:
goto SUCCESS;
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
goto SUCCESS;
goto SUCCESS;
ERROR:
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
@ -701,11 +708,13 @@ ald_status_t ald_i2c_slave_send(i2c_handle_t *hperh, uint8_t *buf, uint32_t size
hperh->xfer_size = size;
hperh->xfer_count = 0;
MODIFY_REG(hperh->perh->FCON, I2C_FCON_TXFTH_MSK, 0x03 << I2C_FCON_TXFTH_POSS);
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
MODIFY_REG(hperh->perh->FCON, I2C_FCON_TXFTH_MSK, 0x03 << I2C_FCON_TXFTH_POSS);
for (i = 0; i < 16; i++) {
while(hperh->perh->STAT & (0x1 << 1));
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TXF, SET, timeout) != OK)
goto ERROR;
hperh->perh->TXDATA = (*buf++);
--size;
hperh->xfer_count++;
@ -722,7 +731,9 @@ ald_status_t ald_i2c_slave_send(i2c_handle_t *hperh, uint8_t *buf, uint32_t size
goto ERROR;
for (i = 0; i < 8; i++) {
while(hperh->perh->STAT & (0x1 << 1));
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TXF, SET, timeout) != OK)
goto ERROR;
hperh->perh->TXDATA = (*buf++);
--size;
hperh->xfer_count++;
@ -843,7 +854,7 @@ ald_status_t ald_i2c_master_send_by_it(i2c_handle_t *hperh, uint16_t dev_addr, u
i2c_master_req_write(hperh, dev_addr, I2C_TIMEOUT_FLAG);
if (size <= 0xff) {
if (size <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
}
else {
@ -1183,15 +1194,15 @@ ald_status_t ald_i2c_slave_send_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint8_
ald_dma_config_struct(&hperh->hdmatx.config);
hperh->hdmatx.config.burst = ENABLE;
hperh->hdmatx.config.src = (void *)buf;
hperh->hdmatx.config.dst = (void *)&hperh->perh->TXDATA;
hperh->hdmatx.config.size = size;
hperh->hdmatx.config.src = (void *)buf;
hperh->hdmatx.config.dst = (void *)&hperh->perh->TXDATA;
hperh->hdmatx.config.size = size;
hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE;
hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE;
hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE;
hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY;
hperh->hdmatx.config.channel = channel;
hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE;
hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE;
hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY;
hperh->hdmatx.config.channel = channel;
ald_dma_config_basic(&hperh->hdmatx);
if (i2c_wait_master_addr_to_timeout(hperh, I2C_IT_ADDR, I2C_TIMEOUT_ADDR_SLAVE) == ERROR) {
@ -1202,6 +1213,7 @@ ald_status_t ald_i2c_slave_send_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint8_
return ERROR;
}
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->CON1, I2C_CON1_TXDMAEN_MSK);
return OK;
@ -1249,15 +1261,15 @@ ald_status_t ald_i2c_slave_recv_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint8_
hperh->hdmarx.err_arg = (void *)hperh;
ald_dma_config_struct(&hperh->hdmarx.config);
hperh->hdmarx.config.src = (void *)&hperh->perh->RXDATA;
hperh->hdmarx.config.dst = (void *)buf;
hperh->hdmarx.config.size = size;
hperh->hdmarx.config.src = (void *)&hperh->perh->RXDATA;
hperh->hdmarx.config.dst = (void *)buf;
hperh->hdmarx.config.size = size;
hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE;
hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE;
hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE;
hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmarx.config.msigsel = DMA_MSIGSEL_I2C_RNR;
hperh->hdmarx.config.channel = channel;
hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE;
hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE;
hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmarx.config.msigsel = DMA_MSIGSEL_I2C_RNR;
hperh->hdmarx.config.channel = channel;
ald_dma_config_basic(&hperh->hdmarx);
if (i2c_wait_master_addr_to_timeout(hperh, I2C_IT_ADDR, I2C_TIMEOUT_ADDR_SLAVE) == ERROR) {
@ -1268,6 +1280,7 @@ ald_status_t ald_i2c_slave_recv_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint8_
return ERROR;
}
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
SET_BIT(hperh->perh->CON1, I2C_CON1_RXDMAEN_MSK);
return OK;
@ -1311,31 +1324,25 @@ ald_status_t ald_i2c_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t
hperh->xfer_size = size;
hperh->xfer_count = 0;
i2c_master_req_write(hperh, dev_addr, timeout);
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
if (add_size == I2C_MEMADD_SIZE_8BIT) {
nbyte = size + 1;
}
else {
nbyte = size + 2;
}
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
if (nbyte <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, timeout) != OK)
goto ERROR;
if (size <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
}
else {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, 0xFF << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
}
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK)
goto ERROR;
hperh->xfer_count += 2;
while (size > 0) {
while(hperh->perh->STAT & (0x1 << 1));
hperh->perh->TXDATA = (*buf++);
--size;
hperh->xfer_count++;
@ -1362,8 +1369,11 @@ ald_status_t ald_i2c_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t
if (READ_BIT(hperh->perh->CON2, I2C_CON2_AUTOEND_MSK))
goto SUCCESS;
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TC, RESET, timeout))
goto ERROR;
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
goto SUCCESS;
goto SUCCESS;
ERROR:
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
@ -1418,22 +1428,15 @@ ald_status_t ald_i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t m
hperh->xfer_count = 0;
hperh->xfer_size = size;
i2c_master_req_write(hperh, dev_addr, timeout);
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) {
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
hperh->state = I2C_STATE_READY;
hperh->mode = I2C_MODE_NONE;
__UNLOCK(hperh);
if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, timeout) != OK)
return ERROR;
}
if (size <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
@ -1455,7 +1458,7 @@ ald_status_t ald_i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t m
hperh->xfer_count++;
if (((hperh->xfer_count % 0xFF) == 0) && (READ_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK))) {
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TCR, RESET, I2C_TIMEOUT_FLAG) == OK) {
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TCR, RESET, timeout) == OK) {
if (size > 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, 0xFF << I2C_CON2_NBYTES_POSS);
}
@ -1474,7 +1477,7 @@ ald_status_t ald_i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t m
goto SUCCESS;
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
goto SUCCESS;
goto SUCCESS;
ERROR:
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
@ -1529,20 +1532,9 @@ ald_status_t ald_i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uin
hperh->xfer_size = size;
hperh->xfer_count = 0;
if (add_size == I2C_MEMADD_SIZE_8BIT) {
nbyte = size + 1;
}
else {
nbyte = size + 2;
}
if (nbyte <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
}
else {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, 0xFF << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
}
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
@ -1555,13 +1547,20 @@ ald_status_t ald_i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uin
return ERROR;
}
if (size <= 0xFF) {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
}
else {
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, 0xFF << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
}
I2C_CLEAR_IT(hperh , I2C_IT_TXTH);
I2C_CLEAR_IT(hperh , I2C_IT_NACK);
I2C_CLEAR_IT(hperh , I2C_IT_TC);
I2C_CLEAR_IT(hperh , I2C_IT_TCR);
while(hperh->perh->STAT & (0x1 << 1));
hperh->perh->TXDATA = (*hperh->p_buff++);
hperh->xfer_count++;
@ -1610,6 +1609,7 @@ ald_status_t ald_i2c_mem_read_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
@ -1681,33 +1681,13 @@ ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, ui
hperh->xfer_size = size;
hperh->xfer_count = 0;
if (hperh->hdmatx.perh == NULL)
hperh->hdmatx.perh = DMA0;
hperh->hdmatx.cplt_cbk = i2c_dma_mem_send_cplt;
hperh->hdmatx.cplt_arg = hperh;
hperh->hdmatx.err_cbk = i2c_dma_error;
hperh->hdmatx.err_arg = hperh;
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
ald_dma_config_struct(&hperh->hdmatx.config);
hperh->hdmatx.config.burst = ENABLE;
hperh->hdmatx.config.src = (void *)hperh->p_buff;
hperh->hdmatx.config.dst = (void *)&hperh->perh->TXDATA;
hperh->hdmatx.config.size = size;
hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE;
hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE;
hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE;
hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY;
hperh->hdmatx.config.channel = channel;
ald_dma_config_basic(&hperh->hdmatx);
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) {
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
hperh->state = I2C_STATE_READY;
@ -1717,9 +1697,29 @@ ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, ui
return ERROR;
}
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
CLEAR_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
if (hperh->hdmatx.perh == NULL)
hperh->hdmatx.perh = DMA0;
hperh->hdmatx.cplt_cbk = i2c_dma_mem_send_cplt;
hperh->hdmatx.cplt_arg = hperh;
hperh->hdmatx.err_cbk = i2c_dma_error;
hperh->hdmatx.err_arg = hperh;
ald_dma_config_struct(&hperh->hdmatx.config);
hperh->hdmatx.config.burst = ENABLE;
hperh->hdmatx.config.src = (void *)hperh->p_buff;
hperh->hdmatx.config.dst = (void *)&hperh->perh->TXDATA;
hperh->hdmatx.config.size = size;
hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE;
hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE;
hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE;
hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY;
hperh->hdmatx.config.channel = channel;
ald_dma_config_basic(&hperh->hdmatx);
CLEAR_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON1, I2C_CON1_TXDMAEN_MSK);
return OK;
@ -1740,6 +1740,8 @@ ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, ui
ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size,
uint8_t *buf, uint8_t size, uint8_t channel)
{
uint32_t nbyte = 0;
if (hperh->state != I2C_STATE_READY)
return BUSY;
@ -1759,6 +1761,20 @@ ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uin
hperh->xfer_size = size;
hperh->xfer_count = size;
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
SET_BIT(hperh->perh->FCON, I2C_FCON_RXFRST_MSK);
nbyte = (add_size == I2C_MEMADD_SIZE_8BIT) ? 1 : 2;
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, nbyte << I2C_CON2_NBYTES_POSS);
SET_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
if (i2c_req_mem_read(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) {
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
hperh->state = I2C_STATE_READY;
hperh->mode = I2C_MODE_NONE;
__UNLOCK(hperh);
}
if (hperh->hdmarx.perh == NULL)
hperh->hdmarx.perh = DMA0;
@ -1766,23 +1782,13 @@ ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uin
hperh->hdmarx.cplt_arg = (void *)hperh;
hperh->hdmarx.err_cbk = i2c_dma_error;
hperh->hdmarx.err_arg = (void *)hperh;
if (add_size == I2C_MEMADD_SIZE_16BIT) {
hperh->hdmatx.config.size = size + 2;
}
else {
hperh->hdmatx.config.size = size + 1;
}
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
hperh->hdmatx.config.size = size;
ald_dma_config_struct(&hperh->hdmarx.config);
hperh->hdmatx.config.burst = ENABLE;
hperh->hdmatx.config.burst = ENABLE;
hperh->hdmarx.config.src = (void *)&hperh->perh->RXDATA;
hperh->hdmarx.config.dst = (void *)buf;
hperh->hdmarx.config.data_width = DMA_DATA_SIZE_BYTE;
hperh->hdmarx.config.size = size;
hperh->hdmarx.config.size = size;
hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE;
hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE;
hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1;
@ -1790,20 +1796,8 @@ ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uin
hperh->hdmarx.config.channel = channel;
ald_dma_config_basic(&hperh->hdmarx);
if (!I2C_GET_FLAG(hperh, I2C_STAT_TXE)) {
SET_BIT(hperh->perh->FCON, I2C_FCON_TXFRST_MSK);
}
if (i2c_req_mem_read(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) {
if (hperh->error_code == I2C_ERROR_AF) {
__UNLOCK(hperh);
return ERROR;
}
else {
__UNLOCK(hperh);
return TIMEOUT;
}
}
MODIFY_REG(hperh->perh->CON2, I2C_CON2_NBYTES_MSK, size << I2C_CON2_NBYTES_POSS);
CLEAR_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
SET_BIT(hperh->perh->CON2, I2C_CON2_RD_WRN_MSK);
SET_BIT(hperh->perh->CON2, I2C_CON2_START_MSK);
@ -1922,7 +1916,6 @@ void ald_i2c_ev_irq_handler(i2c_handle_t *hperh)
ald_i2c_clear_flag_status(hperh, I2C_IT_TCR);
}
/**< Transmit FIFO empty interrupt */
if (ald_i2c_get_mask_flag_status(hperh, I2C_IT_TXE) == SET) {
ald_i2c_clear_flag_status(hperh, I2C_IT_TXE);
@ -1978,8 +1971,14 @@ void ald_i2c_er_irq_handler(i2c_handle_t *hperh)
/**< NACK interrupt */
if (ald_i2c_get_mask_flag_status(hperh, I2C_IT_NACK) == SET) {
if (hperh->xfer_count != hperh->xfer_size)
if (hperh->xfer_count != hperh->xfer_size) {
hperh->state |= I2C_ERROR_AF;
}
else {
I2C_DISABLE_IT(hperh, I2C_IT_TXTH | I2C_IT_NACK);
ald_i2c_clear_flag_status(hperh, I2C_IT_NACK);
return;
}
if ((hperh->mode == I2C_MODE_MASTER) || (hperh->mode == I2C_MODE_MEM))
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
@ -2366,14 +2365,20 @@ static ald_status_t i2c_req_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, ui
if (i2c_wait_txe_to_timeout(hperh, timeout) != OK)
return ERROR;
while(hperh->perh->STAT & (0x1 << 1));
hperh->perh->TXDATA = I2C_MEM_ADD_LSB(mem_addr);
}
if (i2c_wait_txe_to_timeout(hperh, timeout) != OK)
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TCR, RESET, timeout) != OK) {
CLEAR_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
ald_i2c_clear_flag_status(hperh, I2C_IT_TCR);
return ERROR;
}
CLEAR_BIT(hperh->perh->CON2, I2C_CON2_RELOAD_MSK);
ald_i2c_clear_flag_status(hperh, I2C_IT_TCR);
return OK;
}
#ifdef ALD_DMA
@ -2415,7 +2420,6 @@ static ald_status_t i2c_req_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uin
return TIMEOUT;
}
}
while(hperh->perh->STAT & (0x1 << 1));
hperh->perh->TXDATA = I2C_MEM_ADD_LSB(mem_addr);
}
@ -2426,6 +2430,7 @@ static ald_status_t i2c_req_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uin
if (tim_count > 0xFFFF)
return TIMEOUT;
}
return OK;
}
@ -2546,12 +2551,19 @@ static void i2c_dma_slave_recv_cplt(void *argv)
* @brief DMA I2C Memory Write process complete callback
* @param argv: I2C handle
* @retval None
*/
*/uint32_t ccct = 0;
static void i2c_dma_mem_send_cplt(void *argv)
{
i2c_handle_t* hperh = (i2c_handle_t*)argv;
uint32_t cnt = 0xFFFFFF;
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TC, RESET, I2C_TIMEOUT_FLAG) == ERROR)
i2c_handle_t* hperh = (i2c_handle_t*)argv;
ccct++;ccct = ccct;
while (cnt--) {
if ((hperh->perh->STAT & I2C_STAT_TC) != 0)
break;
}
if (cnt == 0)
hperh->error_code |= I2C_ERROR_TIMEOUT;
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);
@ -2579,9 +2591,16 @@ static void i2c_dma_mem_send_cplt(void *argv)
*/
static void i2c_dma_mem_recv_cplt(void *argv)
{
uint32_t cnt = 0xFFFFF;
i2c_handle_t* hperh = (i2c_handle_t*)argv;
if (i2c_wait_flag_change_to_timeout(hperh, I2C_STAT_TC, RESET, I2C_TIMEOUT_FLAG) == OK)
while (cnt--) {
if ((hperh->perh->STAT & I2C_STAT_TC) != 0)
break;
}
if (cnt == 0)
hperh->error_code |= I2C_ERROR_TIMEOUT;
SET_BIT(hperh->perh->CON2, I2C_CON2_STOP_MSK);

View File

@ -14,6 +14,9 @@
* @date 13 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 13 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -30,8 +33,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
@verbatim
==============================================================================
##### How to use this driver #####
@ -67,9 +69,7 @@
* @endverbatim
*/
#include "ald_i2s.h"
#include "ald_cmu.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,6 +8,9 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_iap.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -5,9 +5,12 @@
* @brief NAND module driver.
*
* @version V1.0
* @date 18 March 2019
* @date 18 Mar 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 18 Mar 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,8 +27,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -54,7 +56,7 @@
******************************************************************************
*/
#include "ald_nand.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -305,7 +307,8 @@ ald_status_t ald_nand_read_page_8b(nand_handle_t *hperh, nand_address_t *addr, u
*(__IO uint8_t *)((uint32_t)(deviceaddr | CMD_AREA)) = ((uint8_t)0x00);
}
ald_delay_us(25); /*延时25us,nand flash 手册中的最大值*/
/*延时25us,nand flash 手册中的最大值*/
ald_delay_us(25);
/* Get Data into Buffer */
for (; index < size; index++) {

View File

@ -8,6 +8,9 @@
* @date 25 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_nor_lcd.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 27 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 27 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_pis.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -8,6 +8,9 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,12 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_pmu.h"
#include "ald_bkpc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 09 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 09 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,10 +27,9 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_qspi.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -106,15 +108,13 @@ void ald_qspi_init(qspi_handle_t *hperh)
assert_param(IS_QSPI_CLOCK_PRESCALER(hperh->init.clkdiv));
assert_param(IS_QSPI_CLOCK_PHASE(hperh->init.chpa));
assert_param(IS_QSPI_CLOCK_POLARITY(hperh->init.cpol));
MODIFY_REG(hperh->perh->CR, QSPI_CR_BAUD_MSK | QSPI_CR_CPOL_MSK | QSPI_CR_CPHA_MSK | \
QSPI_CR_PSL_MSK | QSPI_CR_SWPP_MSK , (hperh->init.clkdiv << QSPI_CR_BAUD_POSS) | \
(hperh->init.cpol << QSPI_CR_CPOL_POS) | \
(hperh->init.chpa << QSPI_CR_CPHA_POS) | \
(hperh->init.chipsel << QSPI_CR_PSL_POSS) | \
(hperh->init.wrppin << QSPI_CR_SWPP_POS));
return;
}
/**
@ -329,7 +329,7 @@ ald_status_t qspi_dac_config(qspi_handle_t * hperh, qspi_dac_cfg_t * dcfg)
return ERROR;
if (ald_qspi_read_config(hperh, &dcfg->rdinit) != OK)
return ERROR;
if (dcfg->addrremap)
MODIFY_REG(hperh->perh->RAR, QSPI_RAR_READDR_MSK, dcfg->remapaddr);

View File

@ -8,6 +8,9 @@
* @date 04 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 04 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,12 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_rmu.h"
#include "ald_syscfg.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -15,6 +15,10 @@
* @version V1.0
* @date 25 Apr 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Apr 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -31,8 +35,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -130,10 +133,7 @@
******************************************************************************
*/
#include "ald_rtc.h"
#include "ald_bkpc.h"
#include "ald_tsense.h"
#include "ald_syscfg.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -1171,7 +1171,7 @@ flag_status_t ald_rtc_get_flag_status(rtc_flag_t flag)
{
assert_param(IS_RTC_IF(flag));
if (READ_BIT(RTC->IFR, flag))
if ((READ_BIT(RTC->IER, flag)) && (READ_BIT(RTC->ISR, flag)))
return SET;
return RESET;

View File

@ -8,6 +8,10 @@
* @version V1.0
* @date 25 Apr 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Apr 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +28,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************
**********************************************************************************
*/
#include "ald_rtchw.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -14,6 +14,9 @@
* @date 13 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 13 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -30,8 +33,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
@verbatim
==============================================================================
##### How to use this driver #####
@ -70,7 +72,7 @@
* @endverbatim
*/
#include "ald_spi.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -144,6 +146,7 @@ static void spi_dma_send_recv_cplt(void *arg);
*/
void ald_spi_reset(spi_handle_t *hperh)
{
SPI_DISABLE(hperh);
hperh->perh->CON1 = 0x0;
hperh->perh->CON2 = 0x0;
hperh->perh->CRCPOLY = 0x00000007;
@ -292,7 +295,7 @@ int32_t ald_spi_send_byte_fast(spi_handle_t *hperh, uint8_t data)
int32_t ald_spi_send_byte_fast_1line(spi_handle_t *hperh, uint8_t data)
{
uint16_t cnt = 5000;
while(hperh->perh->STAT & SPI_STAT_TXF_MSK);
hperh->perh->DATA = data;
while (((hperh->perh->STAT & SPI_STAT_TXE_MSK) == 0) && (--cnt));
@ -979,6 +982,23 @@ ald_status_t ald_spi_send_recv_by_it(spi_handle_t *hperh, uint8_t *tx_buf, uint8
if (tx_buf == NULL || rx_buf == NULL || size == 0)
return ERROR;
if (hperh->init.mode == SPI_MODE_SLAVER) {
if ((spi_get_status(hperh, SPI_STATUS_TXE) == RESET) || (spi_get_status(hperh, SPI_STATUS_RXE) == RESET)) {
if (hperh->perh == SPI0)
ald_rmu_reset_periperal(RMU_PERH_SPI0);
else if (hperh->perh == SPI1)
ald_rmu_reset_periperal(RMU_PERH_SPI1);
else if (hperh->perh == SPI2)
ald_rmu_reset_periperal(RMU_PERH_SPI2);
else
return ERROR;
ald_spi_reset(hperh);
ald_spi_init(hperh);
}
}
__LOCK(hperh);
hperh->state = SPI_STATE_BUSY_TX_RX;
hperh->err_code = SPI_ERROR_NONE;

View File

@ -8,6 +8,9 @@
* @date 25 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,10 +27,9 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_sram.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -9,6 +9,9 @@
* @date 06 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 06 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -25,13 +28,11 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include <string.h>
#include "ald_timer.h"
#include "ald_cmu.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,11 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_trng.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -8,6 +8,9 @@
* @date 26 Jun 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 26 Jun 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,12 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_tsense.h"
#include "ald_bkpc.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD

View File

@ -14,6 +14,9 @@
* @date 21 Nov 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 21 Nov 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -30,8 +33,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
* @verbatim
==============================================================================
##### How to use this driver #####
@ -100,8 +102,7 @@
******************************************************************************
*/
#include "ald_uart.h"
#include "ald_cmu.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
@ -541,7 +542,6 @@ ald_status_t ald_uart_send(uart_handle_t *hperh, uint8_t *buf, uint16_t size, ui
hperh->state = UART_STATE_READY;
return TIMEOUT;
}
while(hperh->perh->STAT & (0x1 << 17));
hperh->perh->TXBUF = (*buf++ & 0xFF);
hperh->tx_count++;
@ -669,7 +669,6 @@ ald_status_t ald_uart_send_n_lock(uart_handle_t *hperh, uint8_t *buf, uint16_t s
hperh->state = UART_STATE_READY;
return TIMEOUT;
}
while(hperh->perh->STAT & (0x1 << 17));
hperh->perh->TXBUF = (*buf++ & 0xFF);
hperh->tx_count++;
@ -1376,7 +1375,6 @@ ald_status_t ald_uart_rs485_send_addr(uart_handle_t *hperh, uint16_t addr, uint3
hperh->state = UART_STATE_READY;
return TIMEOUT;
}
while(hperh->perh->STAT & (0x1 << 17));
WRITE_REG(hperh->perh->TXBUF, (addr | 0x100));

View File

@ -8,6 +8,9 @@
* @date 25 Dec 2019
* @author AE Team
* @note
* Change Logs:
* Date Author Notes
* 25 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
@ -24,12 +27,10 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include "ald_usb.h"
#include "ald_syscfg.h"
#include "ald_conf.h"
/** @addtogroup ES32FXXX_ALD
* @{

View File

@ -7,29 +7,29 @@
* @version V1.0
* @date 18 Dec 2019
* @author AE Team
* @note
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
* @note
* Change Logs:
* Date Author Notes
* 18 Dec 2019 AE Team The first version
*
* Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**********************************************************************************
*/
#include "ald_conf.h"
#include "ald_wdt.h"
/** @addtogroup ES32FXXX_ALD
* @{
@ -130,7 +130,7 @@ void ald_wwdt_feed_dog(void)
WRITE_REG(WWDT->INTCLR, 0x1);
WWDT_LOCK();
for (i = 0; i < 0x2ff; ++i)
__nop();
__NOP();
return;
}

View File

@ -28,16 +28,11 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************************
**********************************************************************************
*/
#include <string.h>
#include "utils.h"
#include "ald_dma.h"
#include "ald_cmu.h"
#include "ald_iap.h"
#include "ald_conf.h"
/** @defgroup ES32FXXX_ALD EASTSOFT ES32F3xx ALD
* @brief Shanghai Eastsoft Microelectronics Cortex-M Chip Abstraction Layer Driver(ALD)
@ -253,9 +248,9 @@ __weak uint32_t ald_get_tick(void)
{
return lib_tick;
}
/**
* @brief This function provides accurate delay (in milliseconds) based
* @brief This function provides accurate delay (in microseconds) based
* on variable incremented.
* @note In the default implementation, SysTick timer is the source of time base.
* It is used to generate interrupts at regular time intervals where lib_tick

View File

@ -12,7 +12,7 @@ src += Glob('ES32F36xx_ALD_StdPeriph_Driver/Source/*.c')
#add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
src = src + ['CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.s']
src = src + ['CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.S']
elif rtconfig.CROSS_TOOL == 'keil':
src = src + ['CMSIS/Device/EastSoft/ES32F36xx/Startup/keil/startup_es32f36xx.s']
elif rtconfig.CROSS_TOOL == 'iar':