[bsp][nxp/mcxa153]添加spi缺失的文件路径
This commit is contained in:
parent
836865f404
commit
fd111e7af4
|
@ -49,6 +49,10 @@ src += ['MCXA153/drivers/fsl_waketimer.c']
|
||||||
src += ['MCXA153/drivers/fsl_wuu.c']
|
src += ['MCXA153/drivers/fsl_wuu.c']
|
||||||
src += ['MCXA153/drivers/fsl_wwdt.c']
|
src += ['MCXA153/drivers/fsl_wwdt.c']
|
||||||
|
|
||||||
|
if GetDepend('BSP_USING_SPI'):
|
||||||
|
src += ['MCXA153/drivers/fsl_lpspi.c']
|
||||||
|
src += ['MCXA153/drivers/fsl_lpspi_edma.c']
|
||||||
|
|
||||||
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path)
|
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path)
|
||||||
|
|
||||||
Return('group')
|
Return('group')
|
||||||
|
|
|
@ -7,34 +7,34 @@ src = []
|
||||||
if GetDepend('BSP_USING_PIN'):
|
if GetDepend('BSP_USING_PIN'):
|
||||||
src += ['drv_pin.c']
|
src += ['drv_pin.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_UART'):
|
if GetDepend('BSP_USING_UART'):
|
||||||
src += ['drv_uart.c']
|
src += ['drv_uart.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_RTC'):
|
if GetDepend('BSP_USING_RTC'):
|
||||||
src += ['drv_rtc.c']
|
src += ['drv_rtc.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_SPI'):
|
if GetDepend('BSP_USING_SPI'):
|
||||||
src += ['drv_spi.c']
|
src += ['drv_spi.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_SDIO'):
|
if GetDepend('BSP_USING_SDIO'):
|
||||||
src += ['drv_sdio.c']
|
src += ['drv_sdio.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_I2C'):
|
if GetDepend('BSP_USING_I2C'):
|
||||||
src += ['drv_i2c.c']
|
src += ['drv_i2c.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_ADC'):
|
if GetDepend('BSP_USING_ADC'):
|
||||||
src += ['drv_adc.c']
|
src += ['drv_adc.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_HWTIMER'):
|
if GetDepend('BSP_USING_HWTIMER'):
|
||||||
src += ['drv_hwtimer.c']
|
src += ['drv_hwtimer.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_WDT'):
|
if GetDepend('BSP_USING_WDT'):
|
||||||
src += ['drv_wdt.c']
|
src += ['drv_wdt.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_PWM'):
|
if GetDepend('BSP_USING_PWM'):
|
||||||
src += ['drv_pwm.c']
|
src += ['drv_pwm.c']
|
||||||
|
|
||||||
if GetDepend('BSP_USING_FLASH'):
|
if GetDepend('BSP_USING_FLASH'):
|
||||||
src += ['drv_chipflash.c']
|
src += ['drv_chipflash.c']
|
||||||
|
|
||||||
path = [cwd,cwd + '/config']
|
path = [cwd,cwd + '/config']
|
||||||
|
|
|
@ -36,6 +36,7 @@ static mcx_pwm_obj_t mcx_pwm_list[]=
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
volatile uint32_t g_pwmPeriod = 0U;
|
volatile uint32_t g_pwmPeriod = 0U;
|
||||||
volatile uint32_t g_pulsePeriod = 0U;
|
volatile uint32_t g_pulsePeriod = 0U;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
*/
|
*/
|
||||||
#include "rtdevice.h"
|
#include "rtdevice.h"
|
||||||
#include "drv_spi.h"
|
#include "drv_spi.h"
|
||||||
#include "fsl_common.h"
|
|
||||||
#include "fsl_lpspi.h"
|
#include "fsl_lpspi.h"
|
||||||
#include "fsl_lpspi_edma.h"
|
#include "fsl_lpspi_edma.h"
|
||||||
|
|
||||||
|
@ -43,7 +42,6 @@ struct lpc_spi
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct lpc_spi lpc_obj[] =
|
static struct lpc_spi lpc_obj[] =
|
||||||
{
|
{
|
||||||
#ifdef BSP_USING_SPI0
|
#ifdef BSP_USING_SPI0
|
||||||
|
@ -83,13 +81,11 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static rt_err_t spi_configure(struct rt_spi_device *device, struct rt_spi_configuration *cfg)
|
static rt_err_t spi_configure(struct rt_spi_device *device, struct rt_spi_configuration *cfg)
|
||||||
{
|
{
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData)
|
static void LPSPI_MasterUserCallback(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData)
|
||||||
{
|
{
|
||||||
struct lpc_spi *spi = (struct lpc_spi *)userData;
|
struct lpc_spi *spi = (struct lpc_spi *)userData;
|
||||||
|
@ -106,7 +102,6 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
|
||||||
RT_ASSERT(device->bus != RT_NULL);
|
RT_ASSERT(device->bus != RT_NULL);
|
||||||
RT_ASSERT(device->bus->parent.user_data != RT_NULL);
|
RT_ASSERT(device->bus->parent.user_data != RT_NULL);
|
||||||
|
|
||||||
|
|
||||||
struct lpc_spi *spi = (struct lpc_spi *)(device->bus->parent.user_data);
|
struct lpc_spi *spi = (struct lpc_spi *)(device->bus->parent.user_data);
|
||||||
struct lpc_sw_spi_cs *cs = device->parent.user_data;
|
struct lpc_sw_spi_cs *cs = device->parent.user_data;
|
||||||
|
|
||||||
|
@ -120,37 +115,29 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
|
||||||
transfer.txData = (uint8_t *)(message->send_buf);
|
transfer.txData = (uint8_t *)(message->send_buf);
|
||||||
|
|
||||||
/* if(message->length < MAX_DMA_TRANSFER_SIZE)*/
|
/* if(message->length < MAX_DMA_TRANSFER_SIZE)*/
|
||||||
if (0)
|
uint32_t block, remain;
|
||||||
|
block = message->length / DMA_MAX_TRANSFER_SIZE;
|
||||||
|
remain = message->length % DMA_MAX_TRANSFER_SIZE;
|
||||||
|
|
||||||
|
for (i = 0; i < block; i++)
|
||||||
{
|
{
|
||||||
LPSPI_MasterTransferBlocking(spi->LPSPIx, &transfer);
|
transfer.dataSize = DMA_MAX_TRANSFER_SIZE;
|
||||||
}
|
if (message->recv_buf) transfer.rxData = (uint8_t *)(message->recv_buf + i * DMA_MAX_TRANSFER_SIZE);
|
||||||
else
|
if (message->send_buf) transfer.txData = (uint8_t *)(message->send_buf + i * DMA_MAX_TRANSFER_SIZE);
|
||||||
{
|
|
||||||
uint32_t block, remain;
|
|
||||||
block = message->length / DMA_MAX_TRANSFER_SIZE;
|
|
||||||
remain = message->length % DMA_MAX_TRANSFER_SIZE;
|
|
||||||
|
|
||||||
for (i = 0; i < block; i++)
|
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
||||||
{
|
rt_sem_take(spi->sem, RT_WAITING_FOREVER);
|
||||||
transfer.dataSize = DMA_MAX_TRANSFER_SIZE;
|
|
||||||
if (message->recv_buf) transfer.rxData = (uint8_t *)(message->recv_buf + i * DMA_MAX_TRANSFER_SIZE);
|
|
||||||
if (message->send_buf) transfer.txData = (uint8_t *)(message->send_buf + i * DMA_MAX_TRANSFER_SIZE);
|
|
||||||
|
|
||||||
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
|
||||||
rt_sem_take(spi->sem, RT_WAITING_FOREVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remain)
|
|
||||||
{
|
|
||||||
transfer.dataSize = remain;
|
|
||||||
if (message->recv_buf) transfer.rxData = (uint8_t *)(message->recv_buf + i * DMA_MAX_TRANSFER_SIZE);
|
|
||||||
if (message->send_buf) transfer.txData = (uint8_t *)(message->send_buf + i * DMA_MAX_TRANSFER_SIZE);
|
|
||||||
|
|
||||||
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
|
||||||
rt_sem_take(spi->sem, RT_WAITING_FOREVER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (remain)
|
||||||
|
{
|
||||||
|
transfer.dataSize = remain;
|
||||||
|
if (message->recv_buf) transfer.rxData = (uint8_t *)(message->recv_buf + i * DMA_MAX_TRANSFER_SIZE);
|
||||||
|
if (message->send_buf) transfer.txData = (uint8_t *)(message->send_buf + i * DMA_MAX_TRANSFER_SIZE);
|
||||||
|
|
||||||
|
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
||||||
|
rt_sem_take(spi->sem, RT_WAITING_FOREVER);
|
||||||
|
}
|
||||||
|
|
||||||
if (message->cs_release)
|
if (message->cs_release)
|
||||||
{
|
{
|
||||||
|
@ -160,16 +147,12 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
|
||||||
return message->length;
|
return message->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct rt_spi_ops lpc_spi_ops =
|
static struct rt_spi_ops lpc_spi_ops =
|
||||||
{
|
{
|
||||||
.configure = spi_configure,
|
.configure = spi_configure,
|
||||||
.xfer = spixfer
|
.xfer = spixfer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int rt_hw_spi_init(void)
|
int rt_hw_spi_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -27,7 +27,6 @@ processor_version: 0.14.3
|
||||||
#include "fsl_ctimer.h"
|
#include "fsl_ctimer.h"
|
||||||
#include "pin_mux.h"
|
#include "pin_mux.h"
|
||||||
|
|
||||||
|
|
||||||
void BOARD_InitBootPins(void)
|
void BOARD_InitBootPins(void)
|
||||||
{
|
{
|
||||||
BOARD_InitPins();
|
BOARD_InitPins();
|
||||||
|
|
Loading…
Reference in New Issue