From ad917d90109a8e628ab7ea440acbbfaa8273d780 Mon Sep 17 00:00:00 2001 From: GFWisshit Date: Wed, 21 Oct 2020 15:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86license=20header?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86sconscipt=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86board.c=E6=8C=87=E9=92=88=E7=9A=84=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E8=BD=AC=E6=8D=A2=E7=B1=BB=E5=9E=8B=EF=BC=8Cinterrupt?= =?UTF-8?q?.c=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=96=B0=E7=9A=84=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/bm3803/applications/board.c | 28 ++++++++--------------- bsp/bm3803/applications/board.h | 26 +++++++-------------- bsp/bm3803/applications/main.c | 26 +++++++-------------- bsp/bm3803/drivers/uart.c | 26 +++++++-------------- bsp/bm3803/drivers/uart.h | 26 +++++++-------------- bsp/bm3803/drivers/uart_reg.h | 26 +++++++-------------- libcpu/sparc-v8/bm3803/bm3803.h | 26 +++++++-------------- libcpu/sparc-v8/bm3803/context_gcc.S | 26 +++++++-------------- libcpu/sparc-v8/bm3803/interrupt.c | 34 +++++++++++++--------------- libcpu/sparc-v8/bm3803/interrupt.h | 31 ++++++++----------------- libcpu/sparc-v8/bm3803/stack.c | 26 +++++++-------------- libcpu/sparc-v8/bm3803/start_gcc.S | 26 +++++++-------------- libcpu/sparc-v8/bm3803/trap.c | 26 +++++++-------------- libcpu/sparc-v8/bm3803/vector_gcc.S | 26 +++++++-------------- libcpu/sparc-v8/common/SConscript | 6 ----- 15 files changed, 122 insertions(+), 263 deletions(-) diff --git a/bsp/bm3803/applications/board.c b/bsp/bm3803/applications/board.c index ee400cc0e1..37460f268f 100644 --- a/bsp/bm3803/applications/board.c +++ b/bsp/bm3803/applications/board.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include #include @@ -58,7 +48,7 @@ INIT_BOARD_EXPORT(rt_hw_timer_init); */ void rt_hw_board_init(void) { - rt_system_heap_init((void *)&__bss_end, (void *)&__bss_end + 0x01000000); + rt_system_heap_init((void *)&__bss_end, (unsigned char *)&__bss_end + 0x01000000); rt_components_board_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); } diff --git a/bsp/bm3803/applications/board.h b/bsp/bm3803/applications/board.h index 88d477e492..e12389331f 100644 --- a/bsp/bm3803/applications/board.h +++ b/bsp/bm3803/applications/board.h @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #ifndef __BOARD_H__ #define __BOARD_H__ diff --git a/bsp/bm3803/applications/main.c b/bsp/bm3803/applications/main.c index e24fdf2b90..047393b2cf 100644 --- a/bsp/bm3803/applications/main.c +++ b/bsp/bm3803/applications/main.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include #include diff --git a/bsp/bm3803/drivers/uart.c b/bsp/bm3803/drivers/uart.c index 4f07c26123..d43b660d1a 100644 --- a/bsp/bm3803/drivers/uart.c +++ b/bsp/bm3803/drivers/uart.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include #include diff --git a/bsp/bm3803/drivers/uart.h b/bsp/bm3803/drivers/uart.h index a16ea99913..11923d24fe 100644 --- a/bsp/bm3803/drivers/uart.h +++ b/bsp/bm3803/drivers/uart.h @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #ifndef __SERIAL_H__ #define __SERIAL_H__ diff --git a/bsp/bm3803/drivers/uart_reg.h b/bsp/bm3803/drivers/uart_reg.h index 3edd98a6f7..179f767b3e 100644 --- a/bsp/bm3803/drivers/uart_reg.h +++ b/bsp/bm3803/drivers/uart_reg.h @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #ifndef SERIAL_REG_H #define SERIAL_REG_H diff --git a/libcpu/sparc-v8/bm3803/bm3803.h b/libcpu/sparc-v8/bm3803/bm3803.h index 4a4c750975..17a9882eb2 100644 --- a/libcpu/sparc-v8/bm3803/bm3803.h +++ b/libcpu/sparc-v8/bm3803/bm3803.h @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #ifndef __BM3803_H__ #define __BM3803_H__ diff --git a/libcpu/sparc-v8/bm3803/context_gcc.S b/libcpu/sparc-v8/bm3803/context_gcc.S index 478793588e..c0344a81d5 100644 --- a/libcpu/sparc-v8/bm3803/context_gcc.S +++ b/libcpu/sparc-v8/bm3803/context_gcc.S @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #define SPARC_PSR_PIL_MASK 0x00000F00 #define SPARC_PSR_ET_MASK 0x00000020 diff --git a/libcpu/sparc-v8/bm3803/interrupt.c b/libcpu/sparc-v8/bm3803/interrupt.c index 8ce03dd4c0..b3625862b4 100644 --- a/libcpu/sparc-v8/bm3803/interrupt.c +++ b/libcpu/sparc-v8/bm3803/interrupt.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include #include @@ -98,3 +88,11 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, return old_handler; } + +void rt_hw_interrupt_clear(int vector) +{ + if (vector > 0x1F || vector < 0x11) + return; + volatile struct lregs *regs = (struct lregs *)PREGS; + regs->irqclear |= 1 << (vector - 0x10); +} diff --git a/libcpu/sparc-v8/bm3803/interrupt.h b/libcpu/sparc-v8/bm3803/interrupt.h index 5c97d5caa5..666d5268f5 100644 --- a/libcpu/sparc-v8/bm3803/interrupt.h +++ b/libcpu/sparc-v8/bm3803/interrupt.h @@ -1,30 +1,17 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + * 2020-10-21 Dystopia Add new function + */ #ifndef __INTERRUPT_H__ #define __INTERRUPT_H__ -void rt_hw_interrupt_control(int vector, int priority, int route); -int rt_hw_interrupt_get_active(int fiq_irq); -void rt_hw_interrupt_ack(int fiq_irq); -void rt_hw_interrupt_trigger(int vector); void rt_hw_interrupt_clear(int vector); #endif diff --git a/libcpu/sparc-v8/bm3803/stack.c b/libcpu/sparc-v8/bm3803/stack.c index 70c1b60d8c..2fdc37b539 100644 --- a/libcpu/sparc-v8/bm3803/stack.c +++ b/libcpu/sparc-v8/bm3803/stack.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include diff --git a/libcpu/sparc-v8/bm3803/start_gcc.S b/libcpu/sparc-v8/bm3803/start_gcc.S index fd613375c9..0f87aa17db 100644 --- a/libcpu/sparc-v8/bm3803/start_gcc.S +++ b/libcpu/sparc-v8/bm3803/start_gcc.S @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #define PSR_INIT 0x10C0 #define PREGS 0x80000000 diff --git a/libcpu/sparc-v8/bm3803/trap.c b/libcpu/sparc-v8/bm3803/trap.c index 545073ed18..b896a0d941 100644 --- a/libcpu/sparc-v8/bm3803/trap.c +++ b/libcpu/sparc-v8/bm3803/trap.c @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #include #include diff --git a/libcpu/sparc-v8/bm3803/vector_gcc.S b/libcpu/sparc-v8/bm3803/vector_gcc.S index 114fe45536..0d243bee33 100644 --- a/libcpu/sparc-v8/bm3803/vector_gcc.S +++ b/libcpu/sparc-v8/bm3803/vector_gcc.S @@ -1,22 +1,12 @@ /* -Copyright 2020 Shenzhen Academy of Aerospace Technology - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Change Logs: -Date Author Notes -2020-10-16 Dystopia the first version -*/ + * Copyright (c) 2020, Shenzhen Academy of Aerospace Technology + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-10-16 Dystopia the first version + */ #define TRAPL(H) mov %g0, %l0; sethi %hi(H), %l4; jmp %l4 + %lo(H); nop; #define TRAP(H) mov %psr, %l0; sethi %hi(H), %l4; jmp %l4 + %lo(H); nop; diff --git a/libcpu/sparc-v8/common/SConscript b/libcpu/sparc-v8/common/SConscript index 9ff30a796b..1e96ff5837 100644 --- a/libcpu/sparc-v8/common/SConscript +++ b/libcpu/sparc-v8/common/SConscript @@ -8,16 +8,10 @@ cwd = GetCurrentDir() src = Glob('*.c') + Glob('*.cpp') CPPPATH = [cwd] -if rtconfig.PLATFORM == 'armcc': - src += Glob('*_rvds.S') - if rtconfig.PLATFORM == 'gcc': src += Glob('*_init.S') src += Glob('*_gcc.S') -if rtconfig.PLATFORM == 'iar': - src += Glob('*_iar.S') - group = DefineGroup('cpu', src, depend = [''], CPPPATH = CPPPATH) Return('group')