summaryrefslogtreecommitdiff
path: root/libcpu/mips/gs232
diff options
context:
space:
mode:
authorMeco Jianting Man <[email protected]>2021-03-31 14:44:02 +0800
committerGitHub <[email protected]>2021-03-31 14:44:02 +0800
commitebe9d15d6f3760455e479546c829b7a4e25cddba (patch)
treea082cb39a09e0d26e97b07edc1cb5170f64a7bdb /libcpu/mips/gs232
parent1ba020f3c89fbf2ac2a5b58424852e501fd59a91 (diff)
parenta225ca8014aae63f2d6ef46811fe8d689981e54a (diff)
Merge pull request #32 from RT-Thread/master
pr
Diffstat (limited to 'libcpu/mips/gs232')
-rw-r--r--libcpu/mips/gs232/cache.c20
-rw-r--r--libcpu/mips/gs232/cache.h54
-rw-r--r--libcpu/mips/gs232/cpuport.c10
-rw-r--r--libcpu/mips/gs232/gs232.h62
-rw-r--r--libcpu/mips/gs232/interrupt.c16
-rw-r--r--libcpu/mips/gs232/ls1b.h88
-rw-r--r--libcpu/mips/gs232/ls1c.h4
-rw-r--r--libcpu/mips/gs232/mipscfg.c16
-rw-r--r--libcpu/mips/gs232/timer.c22
9 files changed, 146 insertions, 146 deletions
diff --git a/libcpu/mips/gs232/cache.c b/libcpu/mips/gs232/cache.c
index 484d3816f4..bcbf2aba49 100644
--- a/libcpu/mips/gs232/cache.c
+++ b/libcpu/mips/gs232/cache.c
@@ -1,7 +1,7 @@
/*
* Cache Ops For Loongson GS232
*
- * Copyright (c) 2006-2019, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -15,8 +15,8 @@
#include <rtthread.h>
#include <mips.h>
-#define K0BASE 0x80000000
-#define PRID_LS1C 0x4220
+#define K0BASE 0x80000000
+#define PRID_LS1C 0x4220
extern void Clear_TagLo (void);
extern void Invalidate_Icache_Ls1c(unsigned int);
@@ -27,10 +27,10 @@ extern void enable_cpu_cache(void);
typedef struct cacheinfo_t
{
- unsigned int icache_size;
- unsigned int dcache_size;
- unsigned int icacheline_size;
- unsigned int dcacheline_size;
+ unsigned int icache_size;
+ unsigned int dcache_size;
+ unsigned int icacheline_size;
+ unsigned int dcacheline_size;
} cacheinfo_t ;
typedef struct cacheop_t
@@ -183,12 +183,12 @@ void rt_hw_cache_init(void)
end = (start + pcacheinfo->icache_size);
/*
- * 2. clear CP0 taglo/taghi register;
+ * 2. clear CP0 taglo/taghi register;
*/
pcacheop->Clear_TagLo();
/*
- * 3. invalidate instruction cache;
+ * 3. invalidate instruction cache;
*/
while (start < end)
{
@@ -197,7 +197,7 @@ void rt_hw_cache_init(void)
}
/*
- * 4. invalidate data cache;
+ * 4. invalidate data cache;
*/
start = K0BASE;
end = (start + pcacheinfo->dcache_size);
diff --git a/libcpu/mips/gs232/cache.h b/libcpu/mips/gs232/cache.h
index 381298e4df..b47db90814 100644
--- a/libcpu/mips/gs232/cache.h
+++ b/libcpu/mips/gs232/cache.h
@@ -1,8 +1,8 @@
/*
* Cache Ops For Loongson GS232
- *
- * Copyright (c) 2006-2019, RT-Thread Development Team
- *
+ *
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
@@ -12,8 +12,8 @@
* 2015-07-08 chinesebear modified for loongson 1c
*/
-#ifndef __CACHE_H__
-#define __CACHE_H__
+#ifndef __CACHE_H__
+#define __CACHE_H__
/*
* Cache Operations
*/
@@ -21,31 +21,31 @@
#define Index_Writeback_Inv_D 0x01
#define Index_Invalidate_SI 0x02
#define Index_Writeback_Inv_SD 0x03
-#define Index_Load_Tag_I 0x04
-#define Index_Load_Tag_D 0x05
-#define Index_Load_Tag_SI 0x06
-#define Index_Load_Tag_SD 0x07
-#define Index_Store_Tag_I 0x08
-#define Index_Store_Tag_D 0x09
-#define Index_Store_Tag_SI 0x0A
-#define Index_Store_Tag_SD 0x0B
-#define Create_Dirty_Excl_D 0x0d
-#define Create_Dirty_Excl_SD 0x0f
-#define Hit_Invalidate_I 0x10
-#define Hit_Invalidate_D 0x11
-#define Hit_Invalidate_SI 0x12
-#define Hit_Invalidate_SD 0x13
-#define Fill 0x14
-#define Hit_Writeback_Inv_D 0x15
+#define Index_Load_Tag_I 0x04
+#define Index_Load_Tag_D 0x05
+#define Index_Load_Tag_SI 0x06
+#define Index_Load_Tag_SD 0x07
+#define Index_Store_Tag_I 0x08
+#define Index_Store_Tag_D 0x09
+#define Index_Store_Tag_SI 0x0A
+#define Index_Store_Tag_SD 0x0B
+#define Create_Dirty_Excl_D 0x0d
+#define Create_Dirty_Excl_SD 0x0f
+#define Hit_Invalidate_I 0x10
+#define Hit_Invalidate_D 0x11
+#define Hit_Invalidate_SI 0x12
+#define Hit_Invalidate_SD 0x13
+#define Fill 0x14
+#define Hit_Writeback_Inv_D 0x15
/* 0x16 is unused */
-#define Hit_Writeback_Inv_SD 0x17
-#define Hit_Writeback_I 0x18
-#define Hit_Writeback_D 0x19
+#define Hit_Writeback_Inv_SD 0x17
+#define Hit_Writeback_I 0x18
+#define Hit_Writeback_D 0x19
/* 0x1a is unused */
-#define Hit_Writeback_SD 0x1b
+#define Hit_Writeback_SD 0x1b
/* 0x1c is unused */
/* 0x1e is unused */
-#define Hit_Set_Virtual_SI 0x1e
-#define Hit_Set_Virtual_SD 0x1f
+#define Hit_Set_Virtual_SI 0x1e
+#define Hit_Set_Virtual_SD 0x1f
#endif
diff --git a/libcpu/mips/gs232/cpuport.c b/libcpu/mips/gs232/cpuport.c
index e3c078241f..e22d9bc14d 100644
--- a/libcpu/mips/gs232/cpuport.c
+++ b/libcpu/mips/gs232/cpuport.c
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2006-2019, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
- *
+ *
* Change Logs:
* Date Author Notes
* 2010-07-09 Bernard first version
@@ -26,9 +26,9 @@
RT_WEAK void rt_hw_cpu_reset(void)
{
/* open the watch-dog */
- WDT_EN = 0x01; /* watch dog enable */
- WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */
- WDT_SET = 0x01; /* watch dog start */
+ WDT_EN = 0x01; /* watch dog enable */
+ WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */
+ WDT_SET = 0x01; /* watch dog start */
rt_kprintf("reboot system...\n");
while (1);
diff --git a/libcpu/mips/gs232/gs232.h b/libcpu/mips/gs232/gs232.h
index 95c81cf93e..cbc660c874 100644
--- a/libcpu/mips/gs232/gs232.h
+++ b/libcpu/mips/gs232/gs232.h
@@ -1,8 +1,8 @@
/*
* Misc define for GS232
- *
- * Copyright (c) 2006-2019, RT-Thread Development Team
- *
+ *
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
@@ -15,47 +15,47 @@
#include <mips.h>
-#define INTC_BASE 0xBFD01040
+#define INTC_BASE 0xBFD01040
#ifdef SOC_LS1B
-#define GS232_INTC_CELLS 4
+#define GS232_INTC_CELLS 4
#endif
#ifdef SOC_LS1C300
-#define GS232_INTC_CELLS 5
+#define GS232_INTC_CELLS 5
#endif
-#define GS232_NR_IRQS (32 * GS232_INTC_CELLS)
+#define GS232_NR_IRQS (32 * GS232_INTC_CELLS)
-#define GMAC0_BASE 0xBFE10000
-#define GMAC0_DMA_BASE 0xBFE11000
-#define GMAC1_BASE 0xBFE20000
-#define GMAC1_DMA_BASE 0xBFE21000
-#define I2C0_BASE 0xBFE58000
-#define PWM0_BASE 0xBFE5C000
-#define PWM1_BASE 0xBFE5C010
-#define PWM2_BASE 0xBFE5C020
-#define PWM3_BASE 0xBFE5C030
-#define WDT_BASE 0xBFE5C060
-#define RTC_BASE 0xBFE64000
-#define I2C1_BASE 0xBFE68000
-#define I2C2_BASE 0xBFE70000
-#define AC97_BASE 0xBFE74000
-#define NAND_BASE 0xBFE78000
-#define SPI_BASE 0xBFE80000
-#define CAN1_BASE 0xBF004300
-#define CAN0_BASE 0xBF004400
+#define GMAC0_BASE 0xBFE10000
+#define GMAC0_DMA_BASE 0xBFE11000
+#define GMAC1_BASE 0xBFE20000
+#define GMAC1_DMA_BASE 0xBFE21000
+#define I2C0_BASE 0xBFE58000
+#define PWM0_BASE 0xBFE5C000
+#define PWM1_BASE 0xBFE5C010
+#define PWM2_BASE 0xBFE5C020
+#define PWM3_BASE 0xBFE5C030
+#define WDT_BASE 0xBFE5C060
+#define RTC_BASE 0xBFE64000
+#define I2C1_BASE 0xBFE68000
+#define I2C2_BASE 0xBFE70000
+#define AC97_BASE 0xBFE74000
+#define NAND_BASE 0xBFE78000
+#define SPI_BASE 0xBFE80000
+#define CAN1_BASE 0xBF004300
+#define CAN0_BASE 0xBF004400
#ifndef __ASSEMBLY__
#include <rthw.h>
/* Watch Dog registers */
-#define WDT_EN HWREG32(WDT_BASE + 0x00)
-#define WDT_SET HWREG32(WDT_BASE + 0x04)
-#define WDT_TIMER HWREG32(WDT_BASE + 0x08)
+#define WDT_EN HWREG32(WDT_BASE + 0x00)
+#define WDT_SET HWREG32(WDT_BASE + 0x04)
+#define WDT_TIMER HWREG32(WDT_BASE + 0x08)
-#define PLL_FREQ HWREG32(0xbfe78030)
-#define PLL_DIV_PARAM HWREG32(0xbfe78034)
+#define PLL_FREQ HWREG32(0xbfe78030)
+#define PLL_DIV_PARAM HWREG32(0xbfe78034)
struct gs232_intc_regs
{
@@ -65,7 +65,7 @@ struct gs232_intc_regs
volatile unsigned int int_clr; /* offset 0x10*/
volatile unsigned int int_pol;
volatile unsigned int int_edge; /* offset 0 */
-};
+};
extern void rt_hw_timer_init(void);
diff --git a/libcpu/mips/gs232/interrupt.c b/libcpu/mips/gs232/interrupt.c
index 66abea379d..fb80a8c1ec 100644
--- a/libcpu/mips/gs232/interrupt.c
+++ b/libcpu/mips/gs232/interrupt.c
@@ -1,17 +1,17 @@
/*
* Interrupt handle for GS232
- *
- * Copyright (c) 2006-2019, RT-Thread Development Team
- *
+ *
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-10-15 Bernard first version
- * 2010-10-15 lgnq modified for LS1B
+ * 2010-10-15 lgnq modified for LS1B
* 2013-03-29 aozima Modify the interrupt interface implementations.
- * 2015-07-06 chinesebear modified for loongson 1c
- * 2019-12-04 Jiaxun Yang Generialize
+ * 2015-07-06 chinesebear modified for loongson 1c
+ * 2019-12-04 Jiaxun Yang Generialize
*/
#include <rtthread.h>
@@ -52,7 +52,7 @@ void rt_hw_interrupt_init(void)
/* Disable */
(gs232_hw0_icregs+i)->int_en = 0x0;
/* Trigger active low */
- (gs232_hw0_icregs+i)->int_pol = -1; /* Must be done here */
+ (gs232_hw0_icregs+i)->int_pol = -1; /* Must be done here */
/* Make all interrupts level triggered */
(gs232_hw0_icregs+i)->int_edge = 0x00000000;
/* Mask all interrupts */
@@ -113,7 +113,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
/**
- * ִ Call ISR
+ * Call ISR
* @IRQn ID of IRQ
*/
void gs232_do_IRQ(int IRQn)
diff --git a/libcpu/mips/gs232/ls1b.h b/libcpu/mips/gs232/ls1b.h
index a6f244ef4f..cf32bd5f02 100644
--- a/libcpu/mips/gs232/ls1b.h
+++ b/libcpu/mips/gs232/ls1b.h
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2006-2019, RT-Thread Development Team
- *
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
@@ -13,44 +13,44 @@
#include <gs232.h>
-#define LS1B_ACPI_IRQ 0
-#define LS1B_HPET_IRQ 1
-#define LS1B_UART0_IRQ 2
-#define LS1B_UART1_IRQ 3
-#define LS1B_UART2_IRQ 4
-#define LS1B_UART3_IRQ 5
-#define LS1B_UART4_IRQ 29
-#define LS1B_UART5_IRQ 30
-#define LS1B_UART6_IRQ 2 //共享LS1B_UART0_IRQ
-#define LS1B_UART7_IRQ 2
-#define LS1B_UART8_IRQ 2
-#define LS1B_UART9_IRQ 3 //共享LS1B_UART1_IRQ
-#define LS1B_UART10_IRQ 3
-#define LS1B_UART11_IRQ 3
+#define LS1B_ACPI_IRQ 0
+#define LS1B_HPET_IRQ 1
+#define LS1B_UART0_IRQ 2
+#define LS1B_UART1_IRQ 3
+#define LS1B_UART2_IRQ 4
+#define LS1B_UART3_IRQ 5
+#define LS1B_UART4_IRQ 29
+#define LS1B_UART5_IRQ 30
+#define LS1B_UART6_IRQ 2 //共享LS1B_UART0_IRQ
+#define LS1B_UART7_IRQ 2
+#define LS1B_UART8_IRQ 2
+#define LS1B_UART9_IRQ 3 //共享LS1B_UART1_IRQ
+#define LS1B_UART10_IRQ 3
+#define LS1B_UART11_IRQ 3
-#define LS1B_CAN0_IRQ 6
-#define LS1B_CAN1_IRQ 7
-#define LS1B_SPI0_IRQ 8
-#define LS1B_SPI1_IRQ 9
-#define LS1B_AC97_IRQ 10
-#define LS1B_MS_IRQ 11
-#define LS1B_KB_IRQ 12
-#define LS1B_DMA0_IRQ 13
-#define LS1B_DMA1_IRQ 14
-#define LS1B_NAND_IRQ 15
-#define LS1B_I2C0_IRQ 16
-#define LS1B_I2C1_IRQ 17
-#define LS1B_PWM0_IRQ 18
-#define LS1B_PWM1_IRQ 19
-#define LS1B_PWM2_IRQ 20
-#define LS1B_PWM3_IRQ 21
-#define LS1B_LPC_IRQ 22
-#define LS1B_EHCI_IRQ 32
-#define LS1B_OHCI_IRQ 33
-#define LS1B_GMAC1_IRQ 34
-#define LS1B_GMAC2_IRQ 35
-#define LS1B_SATA_IRQ 36
-#define LS1B_GPU_IRQ 37
+#define LS1B_CAN0_IRQ 6
+#define LS1B_CAN1_IRQ 7
+#define LS1B_SPI0_IRQ 8
+#define LS1B_SPI1_IRQ 9
+#define LS1B_AC97_IRQ 10
+#define LS1B_MS_IRQ 11
+#define LS1B_KB_IRQ 12
+#define LS1B_DMA0_IRQ 13
+#define LS1B_DMA1_IRQ 14
+#define LS1B_NAND_IRQ 15
+#define LS1B_I2C0_IRQ 16
+#define LS1B_I2C1_IRQ 17
+#define LS1B_PWM0_IRQ 18
+#define LS1B_PWM1_IRQ 19
+#define LS1B_PWM2_IRQ 20
+#define LS1B_PWM3_IRQ 21
+#define LS1B_LPC_IRQ 22
+#define LS1B_EHCI_IRQ 32
+#define LS1B_OHCI_IRQ 33
+#define LS1B_GMAC1_IRQ 34
+#define LS1B_GMAC2_IRQ 35
+#define LS1B_SATA_IRQ 36
+#define LS1B_GPU_IRQ 37
#define LS1B_PCI_INTA_IRQ 38
#define LS1B_PCI_INTB_IRQ 39
#define LS1B_PCI_INTC_IRQ 40
@@ -61,13 +61,13 @@
#define LS1B_GPIO_IRQ_COUNT 64
#define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1)
-#define INT_PCI_INTA (1<<6)
-#define INT_PCI_INTB (1<<7)
-#define INT_PCI_INTC (1<<8)
-#define INT_PCI_INTD (1<<9)
+#define INT_PCI_INTA (1<<6)
+#define INT_PCI_INTB (1<<7)
+#define INT_PCI_INTC (1<<8)
+#define INT_PCI_INTD (1<<9)
#define LS1B_LAST_IRQ 159
-#define MIPS_CPU_TIMER_IRQ 167
+#define MIPS_CPU_TIMER_IRQ 167
#define LS1B_INTREG_BASE 0xbfd01040
#define LS1B_DMA_IRQ_BASE 168
diff --git a/libcpu/mips/gs232/ls1c.h b/libcpu/mips/gs232/ls1c.h
index 54c7e36e99..6b8e3fc512 100644
--- a/libcpu/mips/gs232/ls1c.h
+++ b/libcpu/mips/gs232/ls1c.h
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2006-2019, RT-Thread Development Team
- *
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
diff --git a/libcpu/mips/gs232/mipscfg.c b/libcpu/mips/gs232/mipscfg.c
index 85e0e633ea..6b37abb895 100644
--- a/libcpu/mips/gs232/mipscfg.c
+++ b/libcpu/mips/gs232/mipscfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2019, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -12,13 +12,13 @@
mips32_core_cfg_t g_mips_core =
{
- 16, /* icache_line_size */
- 256, /* icache_lines_per_way */
- 4, /* icache_ways */
- 16, /* dcache_line_size */
- 256, /* dcache_lines_per_way */
- 4, /* dcache_ways */
- 16, /* max_tlb_entries */
+ 16, /* icache_line_size */
+ 256, /* icache_lines_per_way */
+ 4, /* icache_ways */
+ 16, /* dcache_line_size */
+ 256, /* dcache_lines_per_way */
+ 4, /* dcache_ways */
+ 16, /* max_tlb_entries */
};
static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n)
diff --git a/libcpu/mips/gs232/timer.c b/libcpu/mips/gs232/timer.c
index 8879b82ccf..4df02a1b62 100644
--- a/libcpu/mips/gs232/timer.c
+++ b/libcpu/mips/gs232/timer.c
@@ -1,7 +1,7 @@
/*
* Assembly Macros For MIPS
*
- * Copyright (c) 2006-2019, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -20,14 +20,14 @@
*/
void rt_hw_timer_handler(void)
{
- unsigned int count;
+ unsigned int count;
- count = read_c0_compare();
- write_c0_compare(count);
- write_c0_count(0);
+ count = read_c0_compare();
+ write_c0_compare(count);
+ write_c0_count(0);
- /* increase a OS tick */
- rt_tick_increase();
+ /* increase a OS tick */
+ rt_tick_increase();
}
/**
@@ -35,7 +35,7 @@ void rt_hw_timer_handler(void)
*/
void rt_hw_timer_init(void)
{
- write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
- write_c0_count(0);
- mips_unmask_cpu_irq(7);
-} \ No newline at end of file
+ write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
+ write_c0_count(0);
+ mips_unmask_cpu_irq(7);
+}