[BSP]Add more drivers and fix some problem

This commit is contained in:
lin
2017-12-04 18:52:02 +08:00
parent c17ddf1430
commit 2706bccbdd
32 changed files with 3760 additions and 310 deletions
+6
View File
@@ -11,15 +11,21 @@ hal/am_hal_debug.c
hal/am_hal_cachectrl.c
hal/am_hal_pwrctrl.c
hal/am_hal_sysctrl.c
hal/am_hal_reset.c
hal/am_hal_stimer.c
hal/am_hal_ctimer.c
hal/am_hal_rtc.c
hal/am_hal_interrupt.c
hal/am_hal_queue.c
hal/am_hal_iom.c
hal/am_hal_ios.c
hal/am_hal_vcomp.c
hal/am_hal_flash.c
hal/am_hal_gpio.c
hal/am_hal_uart.c
hal/am_hal_adc.c
hal/am_hal_pdm.c
hal/am_hal_i2c_bit_bang.c
""")
path = [cwd]
@@ -49,7 +49,7 @@
#include <stdbool.h>
#include "am_mcu_apollo.h"
#include "am_util.h"
//#include "am_util.h"
#include "am_hal_i2c_bit_bang.h"
// Max number of clock cycles to wait for clock stretch
@@ -133,7 +133,7 @@ static am_hal_i2c_bit_bang_priv_t am_hal_i2c_bit_bang_priv;
// Wait for any stretched clock to go high
// If it times out - return failure
//
static inline bool
static bool
i2c_pull_and_wait_scl_hi(void)
{
// Maximum time to wait for clock stretching
@@ -284,7 +284,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
//! returns the byte received
//
//*****************************************************************************
static inline am_hal_i2c_bit_bang_enum_t
static am_hal_i2c_bit_bang_enum_t
i2c_receive_byte(uint8_t *pRxByte, bool bNack)
{
int i;
@@ -389,7 +389,7 @@ i2c_receive_byte(uint8_t *pRxByte, bool bNack)
//! }
//
//*****************************************************************************
static inline am_hal_i2c_bit_bang_enum_t
static am_hal_i2c_bit_bang_enum_t
i2c_send_byte(uint8_t one_byte)
{
int i;
+17 -1
View File
@@ -49,7 +49,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "am_mcu_apollo.h"
#include "am_util_delay.h"
//#include "am_util_delay.h"
#ifdef __IAR_SYSTEMS_ICC__
#define AM_INSTR_CLZ(n) __CLZ(n)
@@ -62,6 +62,22 @@
#define AM_ASSERT_INVALID_THRESHOLD (1)
#endif
uint32_t am_util_wait_status_change(uint32_t ui32Iterations, uint32_t ui32Address, uint32_t ui32Mask, uint32_t ui32Value)
{
int i;
for (i = 0; i < ui32Iterations; i++)
{
// Check the status
if (((*(uint32_t *)ui32Address) & ui32Mask) == ui32Value)
{
return 1;
}
// Call the BOOTROM cycle delay function to get about 1 usec @ 48MHz
am_hal_flash_delay(16);
}
return 0;
}
//*****************************************************************************
//
// Forcing optimizations