mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 02:06:14 +08:00
@@ -21,6 +21,7 @@
|
||||
#include <mmu.h>
|
||||
#include <mm_aspace.h> /* TODO: why need application space when RT_SMART off */
|
||||
#include <mm_page.h>
|
||||
#include "phytium_interrupt.h"
|
||||
|
||||
#ifdef RT_USING_SMART
|
||||
#include <page.h>
|
||||
@@ -157,7 +158,7 @@ void rt_hw_board_aarch64_init(void)
|
||||
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
||||
#endif
|
||||
|
||||
rt_hw_interrupt_init();
|
||||
phytium_interrupt_init();
|
||||
|
||||
rt_hw_gtimer_init();
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
|
||||
#include "phytium_cpu.h"
|
||||
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
|
||||
/**
|
||||
@name: phytium_cpu_id_mapping
|
||||
@msg: Map Phytium CPU ID
|
||||
@@ -30,48 +27,6 @@
|
||||
@param {int} cpu_id Input CPU ID
|
||||
@return {int} Mapped CPU ID
|
||||
*/
|
||||
int phytium_cpu_id_mapping(int cpu_id)
|
||||
{
|
||||
#if defined(TARGET_E2000Q) || defined(TARGET_PHYTIUMPI)
|
||||
#if RT_CPUS_NR <= 2
|
||||
switch (cpu_id)
|
||||
{
|
||||
case 0:
|
||||
return 2;
|
||||
case 1:
|
||||
return 3;
|
||||
case 2:
|
||||
return 0;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
RT_ASSERT(0);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
return (int)cpu_id;
|
||||
#endif
|
||||
#else
|
||||
return (int)cpu_id;
|
||||
#endif
|
||||
}
|
||||
|
||||
int rt_hw_cpu_id(void)
|
||||
{
|
||||
FError ret;
|
||||
u32 cpu_id;
|
||||
ret = GetCpuId(&cpu_id);
|
||||
|
||||
if (ret != ERR_SUCCESS)
|
||||
{
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int phytium_cpu_id_mapping(int cpu_id)
|
||||
{
|
||||
#if defined(TARGET_E2000Q) || defined(TARGET_PHYTIUMPI)
|
||||
@@ -105,10 +60,11 @@ int rt_hw_cpu_id(void)
|
||||
{
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
}
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH32)
|
||||
|
||||
rt_uint64_t get_main_cpu_affval(void)
|
||||
{
|
||||
#if defined(TARGET_E2000Q) || defined(TARGET_PHYTIUMPI)
|
||||
|
||||
@@ -48,17 +48,12 @@ rt_inline rt_uint32_t platform_get_gic_dist_base(void)
|
||||
/* the basic constants and interfaces needed by gic */
|
||||
rt_inline rt_uint32_t platform_get_gic_redist_base(void)
|
||||
{
|
||||
#if RT_CPUS_NR <= 2
|
||||
return GICV3_RD_BASE_ADDR + 2 * GICV3_RD_OFFSET;
|
||||
#else
|
||||
return GICV3_RD_BASE_ADDR;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
|
||||
{
|
||||
return 0U; /* unused in gicv3 */
|
||||
return 0; /* unused in gicv3 */
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -66,6 +61,4 @@ rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
|
||||
|
||||
int phytium_cpu_id_mapping(int cpu_id);
|
||||
|
||||
|
||||
|
||||
#endif // !
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
rt_uint64_t rt_cpu_mpidr_early[] =
|
||||
{
|
||||
|
||||
#if defined(TARGET_E2000D)
|
||||
[0] = 0x80000200,
|
||||
[1] = 0x80000201,
|
||||
@@ -78,7 +79,7 @@ void rt_hw_secondary_cpu_up(void)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cpu_mask = 1 << phytium_cpu_id_mapping(i);
|
||||
cpu_mask = 1<<phytium_cpu_id_mapping(i);
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
/* code */
|
||||
@@ -103,7 +104,6 @@ void rt_hw_secondary_cpu_up(void)
|
||||
*/
|
||||
extern size_t MMUTable[];
|
||||
|
||||
|
||||
void rt_hw_secondary_cpu_bsp_start(void)
|
||||
{
|
||||
/* spin lock init */
|
||||
@@ -125,7 +125,7 @@ void rt_hw_secondary_cpu_bsp_start(void)
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
arm_gic_cpu_init(0, 0);
|
||||
|
||||
arm_gic_redist_init(0, 0);
|
||||
phytium_aarch64_arm_gic_redist_init();
|
||||
rt_kprintf("arm_gic_redist_init is over rt_hw_cpu_id() is %d \r\n", rt_hw_cpu_id());
|
||||
#else
|
||||
arm_gic_cpu_init(0);
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
#include "rtconfig.h"
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include "interrupt.h"
|
||||
#include "gic.h"
|
||||
#include "gicv3.h"
|
||||
#include "ioremap.h"
|
||||
#include "phytium_cpu.h"
|
||||
#include "ftypes.h"
|
||||
#include "fparameters.h"
|
||||
|
||||
struct arm_gic *phytium_gic_table;
|
||||
|
||||
extern struct rt_irq_desc isr_table[MAX_HANDLERS];
|
||||
|
||||
int arm_gic_redist_address_set(rt_uint64_t index, rt_uint64_t redist_addr, int cpu_id)
|
||||
{
|
||||
RT_ASSERT(index < ARM_GIC_MAX_NR);
|
||||
|
||||
if (cpu_id == 0)
|
||||
{
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, &cpu_id, sizeof(cpu_id));
|
||||
}
|
||||
|
||||
phytium_gic_table[index].redist_hw_base[cpu_id] = redist_addr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int arm_gicv3_wait_rwp(rt_uint64_t index, rt_uint64_t irq)
|
||||
{
|
||||
rt_uint64_t rwp_bit;
|
||||
rt_uint64_t base;
|
||||
|
||||
RT_ASSERT(index < ARM_GIC_MAX_NR);
|
||||
|
||||
if (irq < 32)
|
||||
{
|
||||
rt_int32_t cpu_id = rt_hw_cpu_id();
|
||||
|
||||
base = phytium_gic_table[index].redist_hw_base[cpu_id];
|
||||
rwp_bit = GICR_CTLR_RWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
base = phytium_gic_table[index].dist_hw_base;
|
||||
rwp_bit = GICD_CTLR_RWP;
|
||||
}
|
||||
|
||||
while (HWREG32(base) & rwp_bit)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int phytium_aarch64_arm_gic_redist_init()
|
||||
{
|
||||
rt_uint64_t cpu_id = rt_hw_cpu_id();
|
||||
rt_uint64_t redist_base = phytium_gic_table[0].redist_hw_base[cpu_id];
|
||||
|
||||
/* redistributor enable */
|
||||
GIC_RDIST_WAKER(redist_base) &= ~(1 << 1);
|
||||
while (GIC_RDIST_WAKER(redist_base) & (1 << 2))
|
||||
{
|
||||
}
|
||||
|
||||
/* Disable all sgi and ppi interrupt */
|
||||
GIC_RDISTSGI_ICENABLER0(redist_base) = 0xffffffff;
|
||||
arm_gicv3_wait_rwp(0, 0);
|
||||
|
||||
/* Clear all inetrrupt pending */
|
||||
GIC_RDISTSGI_ICPENDR0(redist_base) = 0xffffffff;
|
||||
|
||||
/* the corresponding interrupt is Group 1 or Non-secure Group 1. */
|
||||
GIC_RDISTSGI_IGROUPR0(redist_base, 0) = 0xffffffff;
|
||||
GIC_RDISTSGI_IGRPMODR0(redist_base, 0) = 0xffffffff;
|
||||
|
||||
/* Configure default priorities for SGI 0:15 and PPI 16:31. */
|
||||
for (int i = 0; i < 32; i += 4)
|
||||
{
|
||||
GIC_RDISTSGI_IPRIORITYR(redist_base, i) = 0xa0a0a0a0U;
|
||||
}
|
||||
|
||||
/* Trigger level for PPI interrupts*/
|
||||
GIC_RDISTSGI_ICFGR1(redist_base) = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void phytium_interrupt_init(void)
|
||||
{
|
||||
rt_uint64_t gic_cpu_base;
|
||||
rt_uint64_t gic_dist_base;
|
||||
rt_uint64_t gic_irq_start;
|
||||
rt_uint64_t redist_addr;
|
||||
|
||||
phytium_gic_table = (struct arm_gic *)arm_gic_get_gic_table_addr();
|
||||
/* initialize vector table */
|
||||
rt_hw_vector_init();
|
||||
|
||||
/* initialize exceptions table */
|
||||
rt_memset(isr_table, 0x00, sizeof(isr_table));
|
||||
|
||||
#if defined(RT_USING_SMART)
|
||||
gic_dist_base = (rt_uint64_t)rt_ioremap((void *)platform_get_gic_dist_base(), 0x40000);
|
||||
gic_cpu_base = (rt_uint64_t)rt_ioremap((void*)platform_get_gic_cpu_base(), 0x1000);
|
||||
redist_addr = (rt_uint64_t)rt_ioremap(GICV3_RD_BASE_ADDR, 4 * GICV3_RD_OFFSET);
|
||||
#else
|
||||
gic_dist_base = platform_get_gic_dist_base();
|
||||
gic_cpu_base = platform_get_gic_cpu_base();
|
||||
redist_addr = GICV3_RD_BASE_ADDR;
|
||||
#endif
|
||||
|
||||
gic_irq_start = 0;
|
||||
arm_gic_dist_init(0, gic_dist_base, gic_irq_start);
|
||||
arm_gic_cpu_init(0, gic_cpu_base);
|
||||
arm_gic_redist_address_set(0, redist_addr + 2 * GICV3_RD_OFFSET, 0);
|
||||
|
||||
#if defined(TARGET_E2000Q) || defined(TARGET_PHYTIUMPI)
|
||||
#if RT_CPUS_NR == 2
|
||||
arm_gic_redist_address_set(0, redist_addr + 3 * GICV3_RD_OFFSET, 1);
|
||||
#elif RT_CPUS_NR == 3
|
||||
arm_gic_redist_address_set(0, redist_addr + 3 * GICV3_RD_OFFSET, 1);
|
||||
arm_gic_redist_address_set(0, redist_addr, 2);
|
||||
#elif RT_CPUS_NR == 4
|
||||
arm_gic_redist_address_set(0, redist_addr + 3 * GICV3_RD_OFFSET, 1);
|
||||
arm_gic_redist_address_set(0, redist_addr, 2);
|
||||
arm_gic_redist_address_set(0, redist_addr + GICV3_RD_OFFSET, 3);
|
||||
#endif
|
||||
#else
|
||||
#if defined(TARGET_E2000D)
|
||||
rt_uint32_t cpu_offset = 2;
|
||||
#endif
|
||||
#if RT_CPUS_NR == 2
|
||||
arm_gic_redist_address_set(0, redist_addr + (1 + cpu_offset) * GICV3_RD_OFFSET, 1);
|
||||
#elif RT_CPUS_NR == 3
|
||||
arm_gic_redist_address_set(0, redist_addr + (1 + cpu_offset) * GICV3_RD_OFFSET, 1);
|
||||
arm_gic_redist_address_set(0, redist_addr + (2 + cpu_offset) * GICV3_RD_OFFSET, 2);
|
||||
#elif RT_CPUS_NR == 4
|
||||
arm_gic_redist_address_set(0, redist_addr + (1 + cpu_offset) * GICV3_RD_OFFSET, 1);
|
||||
arm_gic_redist_address_set(0, redist_addr + (2 + cpu_offset) * GICV3_RD_OFFSET, 2);
|
||||
arm_gic_redist_address_set(0, redist_addr + (3 + cpu_offset) * GICV3_RD_OFFSET, 3);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
phytium_aarch64_arm_gic_redist_init();
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef PHYTIUM_INTERRUPT_H
|
||||
#define PHYTIUM_INTERRUPT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "rtconfig.h"
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
void phytium_interrupt_init(void);
|
||||
|
||||
int phytium_aarch64_arm_gic_redist_init(void);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -166,7 +166,7 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg)
|
||||
struct phytium_can *drv_can;
|
||||
drv_can = (struct phytium_can *)can->parent.user_data;
|
||||
RT_ASSERT(drv_can != RT_NULL);
|
||||
rt_uint32_t cpu_id;
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
FCanIntrEventConfig intr_event;
|
||||
FError status = FT_SUCCESS;
|
||||
|
||||
@@ -177,7 +177,6 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg)
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
GetCpuId(&cpu_id);
|
||||
rt_hw_interrupt_set_target_cpus(drv_can->can_handle.config.irq_num, cpu_id);
|
||||
argval = (rt_uint32_t) arg;
|
||||
/*Open different interrupts*/
|
||||
|
||||
@@ -63,10 +63,9 @@ extern FIOPadCtrl iopad_ctrl;
|
||||
/*******************************Api Functions*********************************/
|
||||
static void FGpioOpsSetupCtrlIRQ(FGpio *ctrl)
|
||||
{
|
||||
u32 cpu_id;
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
u32 irq_num = ctrl->config.irq_num[0];
|
||||
|
||||
GetCpuId(&cpu_id);
|
||||
LOG_D("In FGpioOpsSetupCtrlIRQ() -> cpu_id %d, irq_num %d\r\n", cpu_id, irq_num);
|
||||
rt_hw_interrupt_set_target_cpus(irq_num, cpu_id);
|
||||
rt_hw_interrupt_set_priority(irq_num, ctrl->config.irq_priority); /* setup interrupt */
|
||||
@@ -78,10 +77,9 @@ static void FGpioOpsSetupCtrlIRQ(FGpio *ctrl)
|
||||
/* setup gpio pin interrupt */
|
||||
static void FGpioOpsSetupPinIRQ(FGpio *ctrl, FGpioPin *const pin, FGpioOpsPinConfig *config)
|
||||
{
|
||||
u32 cpu_id;
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
u32 irq_num = ctrl->config.irq_num[pin->index.pin];
|
||||
|
||||
GetCpuId(&cpu_id);
|
||||
LOG_D("in FGpioOpsSetupPinIRQ() -> cpu_id %d, irq_num %d", cpu_id, irq_num);
|
||||
rt_hw_interrupt_set_target_cpus(irq_num, cpu_id);
|
||||
rt_hw_interrupt_set_priority(irq_num, ctrl->config.irq_priority); /* setup interrupt */
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include <ioremap.h>
|
||||
#endif
|
||||
|
||||
/*Please define the length of the mem_addr of the device*/
|
||||
#ifndef FI2C_DEVICE_MEMADDR_LEN
|
||||
#define FI2C_DEVICE_MEMADDR_LEN 1
|
||||
#endif
|
||||
#define FI2C_DEFAULT_ID 0
|
||||
#define I2C_USE_MIO
|
||||
#if defined(I2C_USE_MIO)
|
||||
@@ -167,15 +171,19 @@ static rt_ssize_t i2c_master_xfer(struct rt_i2c_bus_device *device, struct rt_i2
|
||||
struct rt_i2c_msg *pmsg;
|
||||
struct phytium_i2c_bus *i2c_bus;
|
||||
i2c_bus = (struct phytium_i2c_bus *)(device);
|
||||
u8 mem_addr = msgs->buf[0];
|
||||
u32 mem_addr;
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
pmsg = i2c_bus->msg = &msgs[i];
|
||||
pmsg = &msgs[i];
|
||||
for (u32 j = 0; j <FI2C_DEVICE_MEMADDR_LEN; j++)
|
||||
{
|
||||
mem_addr |= msgs[i].buf[j] << (8 * (FI2C_DEVICE_MEMADDR_LEN - 1 - j));
|
||||
}
|
||||
i2c_bus->i2c_handle.config.slave_addr = pmsg->addr;
|
||||
if (pmsg->flags & RT_I2C_RD)
|
||||
{
|
||||
ret = FI2cMasterReadPoll(&i2c_bus->i2c_handle, mem_addr, 1, &pmsg->buf[0], sizeof(pmsg->buf));
|
||||
ret = FI2cMasterReadPoll(&i2c_bus->i2c_handle, mem_addr, FI2C_DEVICE_MEMADDR_LEN, &pmsg->buf[0], pmsg->len);
|
||||
if (ret != FI2C_SUCCESS)
|
||||
{
|
||||
LOG_E("I2C master read failed!\n");
|
||||
@@ -184,7 +192,7 @@ static rt_ssize_t i2c_master_xfer(struct rt_i2c_bus_device *device, struct rt_i2
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = FI2cMasterWritePoll(&i2c_bus->i2c_handle, mem_addr, 1, &pmsg->buf[1], sizeof(pmsg->buf) - 1);
|
||||
ret = FI2cMasterWritePoll(&i2c_bus->i2c_handle, mem_addr, FI2C_DEVICE_MEMADDR_LEN, &pmsg->buf[FI2C_DEVICE_MEMADDR_LEN], pmsg->len);
|
||||
if (ret != FI2C_SUCCESS)
|
||||
{
|
||||
LOG_E("I2C master write failed!\n");
|
||||
|
||||
@@ -320,14 +320,16 @@ static rt_ssize_t phytium_qspi_xfer(struct rt_spi_device *device, struct rt_spi_
|
||||
{
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(message != RT_NULL);
|
||||
FError ret = FT_SUCCESS;
|
||||
phytium_qspi_bus *qspi_bus;
|
||||
struct rt_qspi_message *qspi_message = (struct rt_qspi_message *)message;
|
||||
|
||||
rt_uint32_t cmd = qspi_message->instruction.content;
|
||||
rt_uint32_t flash_addr = qspi_message->address.content;
|
||||
rt_uint32_t len = message->length;
|
||||
|
||||
const void *rcvb = message->recv_buf;
|
||||
const void *sndb = message->send_buf;
|
||||
FError ret = FT_SUCCESS;
|
||||
|
||||
qspi_bus = (phytium_qspi_bus *)(struct phytium_qspi_bus *) device->bus->parent.user_data;
|
||||
|
||||
@@ -345,8 +347,6 @@ static rt_ssize_t phytium_qspi_xfer(struct rt_spi_device *device, struct rt_spi_
|
||||
/*Distinguish the write mode according to different commands*/
|
||||
if (cmd == FQSPI_FLASH_CMD_PP || cmd == FQSPI_FLASH_CMD_QPP || cmd == FQSPI_FLASH_CMD_4PP || cmd == FQSPI_FLASH_CMD_4QPP)
|
||||
{
|
||||
rt_uint8_t len = message->length;
|
||||
|
||||
rt_memcpy(&wr_buf, (char *)message->send_buf, len);
|
||||
ret = FQspiFlashErase(&(qspi_bus->fqspi), FQSPI_FLASH_CMD_SE, flash_addr);
|
||||
if (FT_SUCCESS != ret)
|
||||
@@ -381,22 +381,20 @@ static rt_ssize_t phytium_qspi_xfer(struct rt_spi_device *device, struct rt_spi_
|
||||
return -RT_ERROR;
|
||||
}
|
||||
/* read norflash data */
|
||||
size_t read_len = QspiFlashReadData(&(qspi_bus->fqspi), addr, (u8 *)&rd_buf, DAT_LENGTH);
|
||||
message->length = read_len;
|
||||
if (read_len != DAT_LENGTH)
|
||||
size_t read_len = QspiFlashReadData(&(qspi_bus->fqspi), addr, (u8 *)&rd_buf, len);
|
||||
if (read_len != len)
|
||||
{
|
||||
rt_kprintf("Failed to read mem, read len = %d.\r\n", read_len);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Read successfully!!!\r\n");
|
||||
rt_kprintf("Read successfully!!!, read_len = %d\r\n", read_len);
|
||||
message->recv_buf = &rd_buf;
|
||||
|
||||
}
|
||||
FtDumpHexByte(message->recv_buf, read_len);
|
||||
|
||||
return RT_EOK;
|
||||
return read_len;
|
||||
}
|
||||
|
||||
if (rcvb)
|
||||
@@ -411,7 +409,7 @@ static rt_ssize_t phytium_qspi_xfer(struct rt_spi_device *device, struct rt_spi_
|
||||
}
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sndb)
|
||||
@@ -430,8 +428,9 @@ static rt_ssize_t phytium_qspi_xfer(struct rt_spi_device *device, struct rt_spi_
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
rt_kprintf("cmd not found!!!\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -129,9 +129,8 @@ static void fsdif_ctrl_setup_interrupt(struct rt_mmcsd_host *host)
|
||||
fsdif_info_t *private_data = (fsdif_info_t *)host->private_data;
|
||||
FSdif *mmcsd_instance = private_data->mmcsd_instance;
|
||||
FSdifConfig *config_p = &mmcsd_instance->config;
|
||||
rt_uint32_t cpu_id = 0;
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
|
||||
GetCpuId((u32 *)&cpu_id);
|
||||
rt_hw_interrupt_set_target_cpus(config_p->irq_num, cpu_id);
|
||||
rt_hw_interrupt_set_priority(config_p->irq_num, 0xd0);
|
||||
|
||||
|
||||
@@ -54,9 +54,8 @@ static FError FSpimSetupInterrupt(FSpim *instance_p)
|
||||
FASSERT(instance_p);
|
||||
FSpimConfig *config_p = &instance_p->config;
|
||||
uintptr base_addr = config_p->base_addr;
|
||||
u32 cpu_id = 0;
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
|
||||
GetCpuId(&cpu_id);
|
||||
LOG_D("cpu_id is %d, irq_num is %d\n", cpu_id, config_p->irq_num);
|
||||
config_p->irq_prority = 0xd0;
|
||||
rt_hw_interrupt_set_target_cpus(config_p->irq_num, cpu_id);
|
||||
|
||||
@@ -1001,8 +1001,7 @@ static void FxmacOsIntrHandler(s32 vector, void *args)
|
||||
|
||||
static void FXmacSetupIsr(FXmacOs *instance_p)
|
||||
{
|
||||
u32 cpu_id;
|
||||
GetCpuId(&cpu_id);
|
||||
rt_uint32_t cpu_id = rt_hw_cpu_id();
|
||||
|
||||
/* Setup callbacks */
|
||||
FXmacSetHandler(&instance_p->instance, FXMAC_HANDLER_DMARECV, FXmacRecvSemaphoreHandler, instance_p);
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
/* cache */
|
||||
void FDriverDCacheRangeFlush(uintptr_t adr, size_t len)
|
||||
{
|
||||
__asm_flush_dcache_range(adr, len);
|
||||
__asm_flush_dcache_range((void *)adr, len);
|
||||
}
|
||||
|
||||
void FDriverDCacheRangeInvalidate(uintptr_t adr, size_t len)
|
||||
{
|
||||
rt_hw_cpu_dcache_invalidate(adr, len);
|
||||
rt_hw_cpu_dcache_invalidate((void *)adr, len);
|
||||
}
|
||||
|
||||
void FDriverICacheRangeInvalidate(uintptr_t adr, size_t len)
|
||||
@@ -42,37 +42,26 @@ void FDriverICacheRangeInvalidate(uintptr_t adr, size_t len)
|
||||
__asm_invalidate_icache_all();
|
||||
}
|
||||
|
||||
void FDriverMdelay(u32 msec)
|
||||
{
|
||||
for(rt_uint32_t wait = 0; wait < 10000000; wait ++);
|
||||
}
|
||||
|
||||
#else
|
||||
#include "rthw.h"
|
||||
/* cache */
|
||||
void FDriverDCacheRangeFlush(uintptr_t adr, size_t len)
|
||||
{
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, adr, len);
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, (void *)adr, len);
|
||||
}
|
||||
|
||||
void FDriverDCacheRangeInvalidate(uintptr_t adr, size_t len)
|
||||
{
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, adr, len);
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, (void *)adr, len);
|
||||
}
|
||||
|
||||
void FDriverICacheRangeInvalidate(uintptr_t adr, size_t len)
|
||||
{
|
||||
rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, adr, len);
|
||||
}
|
||||
|
||||
void FDriverMdelay(u32 msec)
|
||||
{
|
||||
rt_thread_mdelay(msec);
|
||||
rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, (void *)adr, len);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* time delay */
|
||||
|
||||
void FDriverUdelay(u32 usec)
|
||||
@@ -85,3 +74,8 @@ void FDriverSdelay(u32 sec)
|
||||
u32 msec = sec * 1000;
|
||||
rt_thread_mdelay(msec);
|
||||
}
|
||||
|
||||
void FDriverMdelay(u32 msec)
|
||||
{
|
||||
rt_thread_mdelay(msec);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user