[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')
|
||||||
|
|
|
@ -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,12 +115,6 @@ 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)
|
|
||||||
{
|
|
||||||
LPSPI_MasterTransferBlocking(spi->LPSPIx, &transfer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t block, remain;
|
uint32_t block, remain;
|
||||||
block = message->length / DMA_MAX_TRANSFER_SIZE;
|
block = message->length / DMA_MAX_TRANSFER_SIZE;
|
||||||
remain = message->length % DMA_MAX_TRANSFER_SIZE;
|
remain = message->length % DMA_MAX_TRANSFER_SIZE;
|
||||||
|
@ -149,8 +138,6 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
|
||||||
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
LPSPI_MasterTransferEDMA(spi->LPSPIx, &spi->spi_dma_handle, &transfer);
|
||||||
rt_sem_take(spi->sem, RT_WAITING_FOREVER);
|
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