OSDN Git Service

ADSP-BF609への対応 experimental_30801_bf60x
authorMaduki Kanazawa <maduki@users.sourceforge.jp>
Sun, 17 Feb 2013 04:53:59 +0000 (13:53 +0900)
committerMaduki Kanazawa <maduki@users.sourceforge.jp>
Sun, 17 Feb 2013 04:53:59 +0000 (13:53 +0900)
18 files changed:
jsp/config/blackfin/_common_bf609/bf609_core0_elf.ld [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/chip_config.c [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/chip_config.h [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/chip_debugboot.c [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/chip_defs.h [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/chip_dump.c [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/hw_serial.cfg [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/hw_serial.h [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/hw_timer.h [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/sys_rename.def [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/sys_rename.h [new file with mode: 0644]
jsp/config/blackfin/_common_bf609/sys_unrename.h [new file with mode: 0644]
jsp/config/blackfin/ucb_bf609/Makefile.config [new file with mode: 0644]
jsp/config/blackfin/ucb_bf609/readme.txt [new file with mode: 0644]
jsp/config/blackfin/ucb_bf609/sys_config.h [new file with mode: 0644]
jsp/config/blackfin/ucb_bf609/sys_defs.h [new file with mode: 0644]
jsp/pdic/simple_sio/uart_bf6xx.c [new file with mode: 0644]
jsp/pdic/simple_sio/uart_bf6xx.h [new file with mode: 0644]

diff --git a/jsp/config/blackfin/_common_bf609/bf609_core0_elf.ld b/jsp/config/blackfin/_common_bf609/bf609_core0_elf.ld
new file mode 100644 (file)
index 0000000..7e9073b
--- /dev/null
@@ -0,0 +1,276 @@
+
+OUTPUT_FORMAT("elf32-bfin","elf32-bfin","elf32-bfin")
+OUTPUT_ARCH(bfin)
+
+PROVIDE (ldf_stack_end = 0xffb00FFC ) ;
+PROVIDE (hardware_init_hook = 0) ;
+PROVIDE (software_init_hook = 0) ;
+PROVIDE (software_term_hook = 0) ;
+PROVIDE (__kernel_boot_for_gdb = 0);
+
+ENTRY (start);
+
+MEMORY
+  {
+    MEM_SDRAM (XW)    : ORIGIN = 0x00000000, LENGTH = 256M
+    MEM_ASYNC_0 (XW)  : ORIGIN = 0xB0000000, LENGTH = 64M
+    MEM_ASYNC_1 (XW)  : ORIGIN = 0xB4000000, LENGTH = 64M
+    MEM_ASYNC_2 (XW)  : ORIGIN = 0xB8000000, LENGTH = 64M
+    MEM_ASYNC_3 (XW)  : ORIGIN = 0xBC000000, LENGTH = 64M
+
+    MEM_L1_DATA_A (W!X)  : ORIGIN = 0xFF800000, LENGTH = 16K
+    MEM_L1_DATA_A_C (R)  : ORIGIN = 0xFF804000, LENGTH = 16K    /* キャッシュ用 */
+    MEM_L1_DATA_B (W!X)  : ORIGIN = 0xFF900000, LENGTH = 16K
+    MEM_L1_DATA_B_C (R)  : ORIGIN = 0xFF904000, LENGTH = 16K    /* キャッシュ用 */
+    MEM_L1_CODE (XR)     : ORIGIN = 0xFFA00000, LENGTH = 64K
+    MEM_L1_INST_C (XR)   : ORIGIN = 0xFFA10000, LENGTH = 16K    /* キャッシュ用 */
+    MEM_L1_SCRATCH (W!X) : ORIGIN = 0xFFB00000, LENGTH = 4K
+
+    MEM_L2_SRAM (W!X)    : ORIGIN = 0xC8080000, LENGTH = 128K
+    MEM_L2_ROM (XR)      : ORIGIN = 0xC8000000, LENGTH = 32K
+
+    MEM_SYSMMR (W!X)  : ORIGIN = 0xffc00000, LENGTH = 2M
+    MEM_COREMMR (W!X) : ORIGIN = 0xffe00000, LENGTH = 2M
+  }
+
+SECTIONS
+{
+
+/* Read-only sections, merged into text segment: */
+  .interp         : { *(.interp) }
+  .hash           : { *(.hash) }
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+  .rel.init       : { *(.rel.init) }
+  .rela.init      : { *(.rela.init) }
+  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
+  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+  .rel.fini       : { *(.rel.fini) }
+  .rela.fini      : { *(.rela.fini) }
+  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
+  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
+  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
+  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
+  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
+  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
+  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
+  .rel.tbss   : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
+  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
+  .rel.ctors      : { *(.rel.ctors) }
+  .rela.ctors     : { *(.rela.ctors) }
+  .rel.dtors      : { *(.rel.dtors) }
+  .rela.dtors     : { *(.rela.dtors) }
+  .rel.got        : { *(.rel.got) }
+  .rela.got       : { *(.rela.got) }
+  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
+  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
+  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
+  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
+  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
+  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
+  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
+  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
+  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
+  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
+  .rel.plt        : { *(.rel.plt) }
+  .rela.plt       : { *(.rela.plt) }
+  .l2             :
+  {
+    *(.l2 .l2.*)
+  } >MEM_SDRAM
+  .start           :
+  {
+    KEEP (*(.start))
+  } >MEM_L1_CODE =0
+  .text           :
+  {
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+    KEEP (*(.text.*personality*))
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+  } >MEM_L1_CODE =0
+  
+  .init           :
+  {
+    KEEP (*(.init))
+  } >MEM_L1_CODE =0
+  .plt            : { *(.plt) } >MEM_L1_CODE
+  .fini           :
+  {
+    KEEP (*(.fini))
+  } >MEM_L1_CODE =0
+  
+  PROVIDE (__etext = .);
+  PROVIDE (_etext = .);
+  PROVIDE (etext = .);
+  
+  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >MEM_L1_DATA_A
+  .rodata1        : { *(.rodata1) } >MEM_L1_DATA_A
+  
+  .sdata2         :
+  {
+    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
+  } >MEM_L1_DATA_A
+  
+  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } >MEM_L1_DATA_A
+  .eh_frame_hdr : { *(.eh_frame_hdr) } >MEM_L1_DATA_A
+  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A
+  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } >MEM_L1_DATA_A
+  
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  . = ALIGN(0x1000) + (. & (0x1000 - 1));
+  /* Exception handling  */
+  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A
+  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } >MEM_L1_DATA_A
+  /* Thread Local Storage sections  */
+  .tdata      : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >MEM_L1_DATA_A
+  .tbss       : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >MEM_L1_DATA_A
+  .preinit_array     :
+  {
+    PROVIDE_HIDDEN (___preinit_array_start = .);
+    KEEP (*(.preinit_array))
+    PROVIDE_HIDDEN (___preinit_array_end = .);
+  } >MEM_L1_DATA_A
+  .init_array     :
+  {
+     PROVIDE_HIDDEN (___init_array_start = .);
+     KEEP (*(SORT(.init_array.*)))
+     KEEP (*(.init_array))
+     PROVIDE_HIDDEN (___init_array_end = .);
+  } >MEM_L1_DATA_A
+  .fini_array     :
+  {
+    PROVIDE_HIDDEN (___fini_array_start = .);
+    KEEP (*(.fini_array))
+    KEEP (*(SORT(.fini_array.*)))
+    PROVIDE_HIDDEN (___fini_array_end = .);
+  } >MEM_L1_DATA_A
+
+  .ctors          :
+  {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, so we make sure it is
+       first.  Because this is a wildcard, it
+       doesn't matter if the user does not
+       actually link against crtbegin.o; the
+       linker won't look for a file to match a
+       wildcard.  The wildcard also means that it
+       doesn't matter which directory crtbegin.o
+       is in.  */
+    KEEP (*crtbegin*.o(.ctors))
+    /* We don't want to include the .ctor section from
+       the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*crtend*.o(.ctors))
+  } >MEM_L1_DATA_A
+  .dtors          :
+  {
+    KEEP (*crtbegin*.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*crtend*.o(.dtors))
+  } >MEM_L1_DATA_A
+  .jcr            : { KEEP (*(.jcr)) } >MEM_L1_DATA_A
+  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } >MEM_L1_DATA_A
+  .dynamic        : { *(.dynamic) } >MEM_L1_DATA_A
+  .data           :
+  {
+    *(.data .data.* .gnu.linkonce.d.*)
+    KEEP (*(.gnu.linkonce.d.*personality*))
+    SORT(CONSTRUCTORS)
+  } >MEM_L1_DATA_A
+  .data1          : { *(.data1) } >MEM_L1_DATA_A
+  .got            : { *(.got.plt) *(.got) } >MEM_L1_DATA_A
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  .sdata          :
+  {
+    *(.sdata .sdata.* .gnu.linkonce.s.*)
+  } >MEM_L1_DATA_A
+  __edata = .; PROVIDE (_edata = .);
+  .sbss           :
+  {
+    __bss_start = .;
+    *(.dynsbss)
+    *(.sbss .sbss.* .gnu.linkonce.sb.*)
+    *(.scommon)
+  } >MEM_L1_DATA_A
+  .bss            :
+  {
+    *(.dynbss)
+    *(.bss .bss.* .gnu.linkonce.b.*)
+    *(COMMON)
+    /* Align here to ensure that the .bss section occupies space up to
+       _end.  Align after .bss to ensure correct alignment even if the
+       .bss section disappears because there are no input sections.
+       FIXME: Why do we need it? When there is no .bss section, we don't
+       pad the .data section.  */
+    . = ALIGN(. != 0 ? 32 / 8 : 1);
+    __bss_end = .;
+  } >MEM_L1_DATA_A
+  . = ALIGN(32 / 8);
+  . = ALIGN(32 / 8);
+  __end = .; PROVIDE (_end = .);
+  /* Stabs debugging sections.  */
+  .stab          0 : { *(.stab) }
+  .stabstr       0 : { *(.stabstr) }
+  .stab.excl     0 : { *(.stab.excl) }
+  .stab.exclstr  0 : { *(.stab.exclstr) }
+  .stab.index    0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment       0 : { *(.comment) }
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+
+  __stack_end = ORIGIN(MEM_L1_SCRATCH) + LENGTH(MEM_L1_SCRATCH);
+
+  __heap_start = ORIGIN(MEM_L1_DATA_B);
+  __heap_end = ORIGIN(MEM_L1_DATA_B) + LENGTH(MEM_L1_DATA_B);
+
+
+    PROVIDE (end = .) ;
+
+    .comment        0 : { *(.comment) }
+    .debug          0 : { *(.debug) }
+    .line           0 : { *(.line) }
+    .debug_srcinfo  0 : { *(.debug_srcinfo) }
+    .debug_sfnames  0 : { *(.debug_sfnames) }
+    .debug_aranges  0 : { *(.debug_aranges) }
+    .debug_pubnames 0 : { *(.debug_pubnames) }
+}
diff --git a/jsp/config/blackfin/_common_bf609/chip_config.c b/jsp/config/blackfin/_common_bf609/chip_config.c
new file mode 100644 (file)
index 0000000..7734e31
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2006 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ *
+ */
+
+/*
+ *  ターゲットシステム依存モジュール(ADSP-BF609用)
+ */
+
+#include "jsp_kernel.h"
+#include <sil.h>
+
+#include <cdefBF609.h>
+#include <sysreg.h>
+#include <builtins.h>
+
+#define REG_CGU0_DIV_VAL \
+       ((CSELVAL   << BITP_CGU_DIV_CSEL)   | \
+        (S0SELVAL  << BITP_CGU_DIV_S0SEL)  | \
+        (SYSSELVAL << BITP_CGU_DIV_SYSSEL) | \
+        (S1SELVAL  << BITP_CGU_DIV_S1SEL)  | \
+        (DSELVAL   << BITP_CGU_DIV_DSEL)   | \
+        (OSELVAL   << BITP_CGU_DIV_OSEL))
+
+#define REG_CGU0_CTL_VAL \
+       ((MSELVAL << BITP_CGU_CTL_MSEL) | (DFVAL << BITP_CGU_CTL_DF))
+
+#if SEC_ENABLE_LOCKING == 1
+#      define SEC_LOCK_REG(reg)      (*(reg) |=  (1u << 31))
+#      define SEC_UNLOCK_REG(reg)    (*(reg) &= ~(1u << 31))
+#else /* SEC_ENABLE_LOCKING == 1 */
+#      define SEC_LOCK_REG(reg)
+#      define SEC_UNLOCK_REG(reg)
+#endif /* SEC_ENABLE_LOCKING == 1 */
+
+#ifndef ik_hardware
+#define ik_ivg11 11
+#endif
+
+/* 割り込みマスク */
+static volatile unsigned int sec_imask[IMS_MASK_SIZE];
+
+
+/*
+ *  ターゲットシステム依存の初期化
+ */
+void
+sys_initialize()
+{
+    /*
+     * スプリアス割り込みハンドラの設定
+     *
+     * cpu_initialize()が行うダミーの割り込みハンドラの設定を上書きする。
+     * アプリケーションが割り込みハンドラを設定すると、以下の設定も上書き
+     * される。
+     */
+    int i;
+       unsigned int* p_reg;
+       unsigned int core_id;
+       
+    for ( i=0; i<(DEVICE_INTERRUPT_COUNT+CORE_EVENT_COUNT); i++ )
+        dev_vector[i] = &spurious_int_handler;
+
+    exc_vector = &spurious_exc_handler;
+
+    /*
+     *  PLLの設定
+     *
+     */
+    /*
+     *  PLLの値はboard_config.hにて定義。
+        *  FORCE_PLL_INITIALIZEはsys_config.hで必要に応じて宣言する。
+     */
+#ifndef FORCE_PLL_INITIALIZE
+     /* PLLが初期値のままであり、かつ、DDR2-SDRAMが利用中でなければPLLを初期化する */
+     if ( ( *pPLL_CTL == 0x00001000 ) && ( !(*pREG_DMC_STAT & BITM_DMC_STAT_MEMINITDONE ) ) )
+#endif
+     {
+               if((*pREG_CGU0_CTL & (BITM_CGU_CTL_MSEL | BITM_CGU_CTL_DF)) != REG_CGU0_CTL_VAL)
+               {
+                       *pREG_CGU0_DIV = REG_CGU0_DIV_VAL;
+                       *pREG_CGU0_CTL = REG_CGU0_CTL_VAL;
+                       while ((*pREG_CGU0_STAT & (BITM_CGU_STAT_CLKSALGN | BITM_CGU_STAT_PLLBP)) ||
+                                 !(*pREG_CGU0_STAT & BITM_CGU_STAT_PLOCK))
+                       {
+                               continue;
+                       }
+               }
+
+        /* PLLの分周器に値を設定する */
+               *pREG_CGU0_DIV = REG_CGU0_DIV_VAL | BITM_CGU_DIV_UPDT;
+               while(*pREG_CGU0_STAT & BITM_CGU_STAT_CLKSALGN)
+                       continue;
+
+               if((*pREG_DMC0_STAT & BITM_DMC_STAT_MEMINITDONE) != 0u)
+               {
+                       *pREG_DMC0_CTL &= ~BITP_DMC_CTL_SRREQ;
+                       asm volatile("ssync;\n");
+                       while((*pREG_DMC0_STAT & BITM_DMC_STAT_SRACK) != 0u)
+                               continue;
+               }
+    }
+
+    /*
+     *  SECの初期化
+     */
+       core_id = *pDSPID & BITM_DSPID_COREID;
+       if(0 == core_id)
+       {
+               /* Core-A */
+               /* Reset SCI */
+           SEC_UNLOCK_REG(pREG_SEC0_CCTL0);
+           *pREG_SEC0_CCTL0 |= ENUM_SEC_CCTL_RESET;
+           SEC_LOCK_REG(pREG_SEC0_CCTL0);
+               /* Clear NMI */
+               *pREG_SEC0_CSTAT0 |= ENUM_SEC_CSTAT_NMI;
+
+               /* Reset SEC */
+           SEC_UNLOCK_REG(pREG_SEC0_GCTL);
+           *pREG_SEC0_GCTL = ENUM_SEC_GCTL_RESET;
+           SEC_LOCK_REG(pREG_SEC0_GCTL);
+
+               /* Reset Fault controller */
+           SEC_UNLOCK_REG(pREG_SEC0_FCTL);
+           *pREG_SEC0_FCTL = ENUM_SEC_FCTL_RESET;
+           SEC_LOCK_REG(pREG_SEC0_FCTL);
+
+               /* Enable SEC */
+           SEC_UNLOCK_REG(pREG_SEC0_GCTL);
+           *pREG_SEC0_GCTL |= ENUM_SEC_GCTL_EN;
+           SEC_LOCK_REG(pREG_SEC0_GCTL);
+
+        /* Enable NMI & SCI */
+           SEC_UNLOCK_REG(pREG_SEC0_CCTL0);
+//         *pREG_SEC0_CCTL0 |= ENUM_SEC_CCTL_NMI_EN | ENUM_SEC_CCTL_EN;
+           *pREG_SEC0_CCTL0 |= ENUM_SEC_CCTL_EN;
+           SEC_LOCK_REG(pREG_SEC0_CCTL0);
+
+               /* Prioirty level depth is 16 (TOPPERS/JSP) */
+           SEC_UNLOCK_REG(pSEC0_CPLVL0);
+           *pREG_SEC0_CPLVL0 = 4;
+           SEC_LOCK_REG(pSEC0_CPLVL0);
+
+               /* Set default priorty level (7) */
+           for(i = 0; i < (DEVICE_INTERRUPT_COUNT * (REG_SEC0_SCTL1 - REG_SEC0_SCTL0)); i += (REG_SEC0_SCTL1 - REG_SEC0_SCTL0))
+               {
+                       p_reg = (unsigned int*)(REG_SEC0_SCTL0 + i);
+                   SEC_UNLOCK_REG(p_reg);
+                   *p_reg = 7 << BITP_SEC_SCTL_PRIO;
+                   SEC_LOCK_REG(p_reg);
+               }
+       }
+       else
+       {
+               /* Core-B */
+               /* Reset SCI */
+           SEC_UNLOCK_REG(pREG_SEC0_CCTL1);
+           *pREG_SEC0_CCTL1 |= ENUM_SEC_CCTL_RESET;
+           SEC_LOCK_REG(pREG_SEC0_CCTL1);
+               /* Clear NMI */
+               *pREG_SEC0_CSTAT1 |= ENUM_SEC_CSTAT_NMI;
+
+        /* Enable NMI & SCI */
+           SEC_UNLOCK_REG(pREG_SEC0_CCTL1);
+           *pREG_SEC0_CCTL1 |= ENUM_SEC_CCTL_NMI_EN | ENUM_SEC_CCTL_EN;
+           SEC_LOCK_REG(pREG_SEC0_CCTL1);
+
+               /* Prioirty level depth is 16 (TOPPERS/JSP) */
+           SEC_UNLOCK_REG(pSEC0_CPLVL1);
+           *pREG_SEC0_CPLVL1 = 4;
+           SEC_LOCK_REG(pSEC0_CPLVL1);
+       }
+        asm volatile("ssync;\n");
+
+    /*
+     *  UART分周比の設定
+     *
+     *  Logtaskが動作する前にsys_putc()を使うための設定を行う。以下の設定は
+     *  serial関連のタスクが起動したときに上書きされる。
+     */
+#if LOGTASK_PORTID == 1
+       *pREG_UART0_CTL = 0;
+        asm volatile("ssync;\n");
+       *pREG_UART0_CLK = UART0_DIVISOR;
+    /* モード設定, パリティ無し 8bit data, 1 stop bit */
+       *pREG_UART0_CTL = ENUM_UART_CTL_PARITY_DIS | ENUM_UART_CTL_NO_EXTRA_STB |
+               ENUM_UART_CTL_WL8BITS | ENUM_UART_CTL_UART_MODE | ENUM_UART_CTL_CLK_EN;
+    /* 割込み禁止 */
+       *pREG_UART0_IMSK_CLR = 0xFFFFFFFFu;
+       *pREG_UART0_STAT = *pREG_UART0_STAT;
+
+       *pREG_PORTD_FER_SET = BITM_PORT_FER_SET_PX8 | BITM_PORT_FER_SET_PX7;
+       *pREG_PORTD_MUX = (*pREG_PORTD_MUX & ~(BITM_PORT_MUX_MUX7 | BITM_PORT_MUX_MUX8)) |
+               (1 << BITP_PORT_MUX_MUX7) | (1 << BITP_PORT_MUX_MUX8);
+
+#elif LOGTASK_PORTID == 2
+       *pREG_UART1_CTL = 0;
+        asm volatile("ssync;\n");
+       *pREG_UART1_CLK = UART1_DIVISOR;
+    /* モード設定, パリティ無し 8bit data, 1 stop bit */
+       *pREG_UART1_CTL = ENUM_UART_CTL_PARITY_DIS | ENUM_UART_CTL_NO_EXTRA_STB |
+               ENUM_UART_CTL_WL8BITS | ENUM_UART_CTL_UART_MODE | ENUM_UART_CTL_CLK_EN;
+    /* 割込み禁止 */
+       *pREG_UART1_IMSK_CLR = 0xFFFFFFFFu;
+       *pREG_UART0_STAT = *pREG_UART0_STAT;
+
+       *pREG_PORTG_FER = BITM_PORT_FER_SET_PX14 | BITM_PORT_FER_SET_PX15;
+       *pREG_PORTG_MUX = (*pREG_PORTG_MUX & ~(BITM_PORT_MUX_MUX14 | BITM_PORT_MUX_MUX15));
+#else
+#      error LOGTASK_PORTID is invalid value
+#endif
+
+}
+
+/*
+ * BF6xxは割り込みコントローラがSICからSECに変わったため、priority_maskを作る必要がなくなった.
+ * この関数はuITRONのイニシャライザで使用することを想定しており、特に割り込みから保護していない。
+ */
+void make_priority_mask( void )
+{
+       int lc;
+       for(lc = 0; lc < IMS_MASK_SIZE; lc++)
+       {
+               sec_imask[lc] = 0u;
+       }
+}
+
+/*
+ * 割り込みの許可。ADSP-BF54xは効率的な割り込み処理と安全な割り込み禁止を両立する
+ * 手段を持たないため、禁止関数は置いていない。
+ *
+ * 不便ではあるが、プログラマに注意を促すためにそうしている。
+ */
+ER ena_int( INTNO intno )
+{
+       unsigned int ims_group;
+       unsigned int ims_index;
+
+    SIL_PRE_LOC;
+
+    if ( intno >= DEVICE_INTERRUPT_COUNT )
+       {
+        return E_PAR;
+       }
+    else
+       {
+        SIL_LOC_INT();
+               ims_group = intno >> 5;
+               ims_index = intno & 0x1Fu;
+               sec_imask[ims_group] |= (1u << ims_index);
+
+               /* SEC0_SCTLxのSENとIENをEnableに設定する */
+               SEC_UNLOCK_REG(pREG_SEC0_SCTL0[intno]);
+               *((unsigned int*)(REG_SEC0_SCTL0 + (REG_SEC0_SCTL1 - REG_SEC0_SCTL0) * intno)) |= 
+                       ENUM_SEC_SCTL_SRC_EN | ENUM_SEC_SCTL_INT_EN;
+               SEC_LOCK_REG(pREG_SEC0_SCTL0[intno]);
+               asm volatile("ssync;\n");
+        SIL_UNL_INT();
+        return 0;
+    }
+}
+
+
+/*
+ * 割り込みマスクの取得。ADSP-BF54xは効率的な割り込み処理と安全な割り込み禁止を両立する
+ * 手段を持たないため、禁止関数は置いていない。
+ *
+ * 不便ではあるが、プログラマに注意を促すためにそうしている。
+ */
+
+
+extern ER get_ims( IMS * p_ims )
+{
+    SIL_PRE_LOC;
+
+    SIL_LOC_INT();
+    p_ims->imask[0] = sec_imask[0];
+    p_ims->imask[1] = sec_imask[1];
+    p_ims->imask[2] = sec_imask[2];
+    p_ims->imask[3] = sec_imask[3];
+    p_ims->imask[4] = sec_imask[4];
+    SIL_UNL_INT();
+    return 0;
+}
+int a;
+
+/*
+ *  割り込みをデバイスに割り当てる。
+ *
+ *  この間数は割り込み発生時に共通割り込みハンドラの一部としてアセンブリ言語から割り込み禁止状態で
+ *  呼ばれる。実割り込みハンドラを割り込み可能にするため、asm文を使って途中で割り込み可能にしている。
+ *  割り込み禁止状態で呼ぶのは割り込み源の特定を安全におこなうためである。
+ *
+ */
+void device_dispatcher( unsigned int priority, unsigned int imask )
+{
+       unsigned int cec_sid;
+       unsigned int ims_group;
+       unsigned int ims_index;
+       unsigned int candidates;
+
+       /* CECのイベント発生源を特定 */
+       if(priority == ik_ivg11)
+       {
+               cec_sid = *pCEC_SID;
+               ims_group = cec_sid >> 5;
+               ims_index = cec_sid & 0x1F;
+               candidates = sec_imask[ims_group] & (1u << ims_index);
+
+               /* 割り込み禁止解除 */
+               *pCEC_SID = cec_sid;
+           asm volatile("sti %0;": : "d"(imask) );
+
+//             if(candidates != 0u)
+                   dev_vector[cec_sid]();
+
+               *pREG_SEC0_END = cec_sid;
+               asm volatile("ssync;\n");
+       }
+       else
+       {
+           asm volatile("sti %0;": : "d"(imask) );
+        if ( priority == ik_hardware_err )
+            dev_vector[INHNO_HW_ERROR]();
+        else if ( priority == ik_timer )
+            dev_vector[INHNO_TIMER]();
+        else
+            dev_vector[INHNO_RAISE]();      /* ソフトウェア割り込み */
+       }
+}
+
+
+
+/*
+ *  ターゲットシステムの終了。TOPPERS/JSPは対話型ROMモニタに戻ることを想定しているが、
+ *  このボードにROMはない。
+ */
+void
+sys_exit()
+{
+    while(1)
+        continue;
+}
+
+/*
+ *  ターゲットシステムの文字出力。割り込みが無効な状態でポーリングによる出力を行う。
+ */
+void
+sys_putc(char c)
+{
+    if ( c == 0x0A )        /* もし LF ならば */
+        sys_putc( 0x0D );   /* CRを一文字送信 */
+
+#if LOGTASK_PORTID == 1
+       while((*pREG_UART0_STAT & ENUM_UART_STAT_THR_EMPTY) == 0U)
+               asm volatile("ssync;\n");
+       *pREG_UART0_THR = c;
+
+#elif LOGTASK_PORTID == 2
+       while((*pREG_UART1_STAT & ENUM_UART_STAT_THR_EMPTY) == 0U)
+               asm volatile("ssync;\n");
+       *pREG_UART1_THR = c;
+
+#else
+#      error LOGTASK_PORTID is invalid value
+#endif
+}
+
+
+
diff --git a/jsp/config/blackfin/_common_bf609/chip_config.h b/jsp/config/blackfin/_common_bf609/chip_config.h
new file mode 100644 (file)
index 0000000..80b62c5
--- /dev/null
@@ -0,0 +1,514 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ *
+ */
+
+
+#ifndef _CHIP_CONFIG_H_
+#define _CHIP_CONFIG_H_
+
+
+/*
+ *  ターゲットシステム依存モジュール(ADSP-BF609用)
+ *
+ *  このインクルードファイルは,t_config.h のみからインクルードされる.
+ *  他のファイルから直接インクルードしてはならない.
+*/
+
+/*
+ *  ターゲットシステムのハードウェア資源の定義
+ *
+ *  DEVICE_INTERRUPT_COUNTはSIC_IMASKのビット数を与える。
+ *  ADSP-BF609のSECが管理する割り込み数は139
+ */
+
+#define DEVICE_INTERRUPT_COUNT (139)
+
+/*
+ * システムが管理するCEC(コアイベントコントローラ)の数
+ * HW_ERROR
+ * CORE_TIMER
+ * SOFTWARE RAISE
+ */
+#define CORE_EVENT_COUNT               (3)
+
+/*
+ *  PLLクロック周波数
+ */
+#if DFVAL == 0
+#      define PLLCLOCK  (CLKIN*MSELVAL)
+#else
+#      define PLLCLOCK  (CLKIN*MSELVAL/2)
+#endif
+#define SYS0CLOCK  (PLLCLOCK / SYSSELVAL / S0SELVAL)
+#define SYS1CLOCK  (PLLCLOCK / SYSSELVAL / S1SELVAL)
+#define SYSCLOCK   SYS0CLOCK
+#define CORECLOCK  (PLLCLOCK / CSELVAL)
+
+
+
+/*
+ *  TICの割込みハンドラのベクタ番号
+ */
+#ifdef USE_TIC_CORE
+#define INHNO_TIMER INHNO_CORE_TIMER
+#else
+#define INHNO_TIMER INHNO_TIMER0_TMR7
+#endif
+
+
+/*
+ *  微少時間待ちのための定義
+ *  sil_dly_nseの呼び出しオーバーヘッドとループボディーサイクルを
+ *  nSで表す。関数はcpu_support.asmに定義してある。
+ *  SIL_DLY_TIM1は24サイクル。32nS( 750MHz ), 40nS( 600MHz )
+ *  SIL_DLY_TIM2は12サイクル。16nS( 750MHz ), 20nS( 600MHz )
+ */
+
+
+#define SIL_DLY_TIM1    (24*1000000000/CORECLOCK)
+#define SIL_DLY_TIM2    (12*1000000000/CORECLOCK)
+
+/*************************************************************************
+ * uart_bf6xx.c用構成マクロ
+ */
+
+/* シリアルの割込みハンドラのベクタ番号 */
+#define INHNO_SIO0   INHNO_UART0_STAT
+#define INHNO_SIO1   INHNO_UART1_STAT
+
+/* UARTレジスタにsil_xxb_iop()を使ってアクセスするときにはUART_IOP_ACCESSを 宣言する。*/
+#define UART_IOP_ACCESS
+
+/* UARTレジスタのベースアドレス */
+#define UART0_ADDRESS 0xFFC02000    /* UART0_REVIDのアドレス */
+#define UART1_ADDRESS 0xFFC02400    /* UART1_REVIDのアドレス */
+
+/* UARTのボーレートジェネレータに設定すべき値. */
+#define UART0_DIVISOR   (SYSCLOCK/16/UART0_BAUD_RATE)
+#define UART1_DIVISOR   (SYSCLOCK/16/UART1_BAUD_RATE)
+
+/*
+ * uart_bf6xx.c用構成マクロ終わり
+ *************************************************************************/
+
+
+
+/*
+ *  割り込みベクトル番号
+ *
+ *  この定義はコンフィグレーションファイルでDEF_INHの引数として使う
+ *  SIC_ISRにおけるビット番号である。
+ *
+ */
+
+#define INHNO_SEC0_ERR                                 0           /* Error */
+#define INHNO_CGU0_EVT                                 1           /* Event */
+#define INHNO_WDOG0_EXP                                        2           /* Expiration */
+#define INHNO_WDOG1_EXP                                        3           /* Expiration */
+#define INHNO_L2CTL0_ECC_ERR                   4           /* ECC Error */
+#define INHNO_L2CTL0_ECC_WARNING               5           /* ECC Warning */
+#define INHNO_C0_DBL_FAULT                             6           /* Core 0 Double Fault */
+#define INHNO_C1_DBL_FAULT                             7           /* Core 1 Double Fault */
+#define INHNO_C0_HW_ERR                                        8           /* Core 0 Hardware Error */
+#define INHNO_C1_HW_ERR                                        9           /* Core 1 Hardware Error */
+#define INHNO_C0_NMI_L1_PARITY_ERR             10          /* Core 0 Unhandled NMI or L1 Memory Parity Error */
+#define INHNO_C1_NMI_L1_PARITY_ERR             11          /* Core 1 Unhandled NMI or L1 Memory Parity Error */
+#define INHNO_TIMER0_TMR0                              12          /* Timer 0 */
+#define INHNO_TIMER0_TMR1                              13          /* Timer 1 */
+#define INHNO_TIMER0_TMR2                              14          /* Timer 2 */
+#define INHNO_TIMER0_TMR3                              15          /* Timer 3 */
+#define INHNO_TIMER0_TMR4                              16          /* Timer 4 */
+#define INHNO_TIMER0_TMR5                              17          /* Timer 5 */
+#define INHNO_TIMER0_TMR6                              18          /* Timer 6 */
+#define INHNO_TIMER0_TMR7                              19          /* Timer 7 */
+#define INHNO_TIMER0_STAT                              20          /* Status */
+#define INHNO_PINT0_BLOCK                              21          /* Pin Interrupt Block */
+#define INHNO_PINT1_BLOCK                              22          /* Pin Interrupt Block */
+#define INHNO_PINT2_BLOCK                              23          /* Pin Interrupt Block */
+#define INHNO_PINT3_BLOCK                              24          /* Pin Interrupt Block */
+#define INHNO_PINT4_BLOCK                              25          /* Pin Interrupt Block */
+#define INHNO_PINT5_BLOCK                              26          /* Pin Interrupt Block */
+#define INHNO_CNT0_STAT                                        27          /* Status */
+#define INHNO_PWM0_SYNC                                        28          /* PWMTMR Group */
+#define INHNO_PWM0_TRIP                                        29          /* Trip */
+#define INHNO_PWM1_SYNC                                        30          /* PWMTMR Group */
+#define INHNO_PWM1_TRIP                                        31          /* Trip */
+#define INHNO_TWI0_DATA                                        32          /* Data Interrupt */
+#define INHNO_TWI1_DATA                                        33          /* Data Interrupt */
+#define INHNO_SOFT0                                            34          /* Software-driven Interrupt 0 */
+#define INHNO_SOFT1                                            35          /* Software-driven Interrupt 1 */
+#define INHNO_SOFT2                                            36          /* Software-driven Interrupt 2 */
+#define INHNO_SOFT3                                            37          /* Software-driven Interrupt 3 */
+#define INHNO_ACM0_EVT_MISS                            38          /* Event Miss */
+#define INHNO_ACM0_EVT_COMPLETE                        39          /* Event Complete */
+#define INHNO_CAN0_RX                                  40          /* Receive */
+#define INHNO_CAN0_TX                                  41          /* Transmit */
+#define INHNO_CAN0_STAT                                        42          /* Status */
+#define INHNO_SPORT0_A_DMA                             43          /* Channel A DMA */
+#define INHNO_SPORT0_A_STAT                            44          /* Channel A Status */
+#define INHNO_SPORT0_B_DMA                             45          /* Channel B DMA */
+#define INHNO_SPORT0_B_STAT                            46          /* Channel B Status */
+#define INHNO_SPORT1_A_DMA                             47          /* Channel A DMA */
+#define INHNO_SPORT1_A_STAT                            48          /* Channel A Status */
+#define INHNO_SPORT1_B_DMA                             49          /* Channel B DMA */
+#define INHNO_SPORT1_B_STAT                            50          /* Channel B Status */
+#define INHNO_SPORT2_A_DMA                             51          /* Channel A DMA */
+#define INHNO_SPORT2_A_STAT                            52          /* Channel A Status */
+#define INHNO_SPORT2_B_DMA                             53          /* Channel B DMA */
+#define INHNO_SPORT2_B_STAT                            54          /* Channel B Status */
+#define INHNO_SPI0_TXDMA                               55          /* TX DMA Channel */
+#define INHNO_SPI0_RXDMA                               56          /* RX DMA Channel */
+#define INHNO_SPI0_STAT                                        57          /* Status */
+#define INHNO_SPI1_TXDMA                               58          /* TX DMA Channel */
+#define INHNO_SPI1_RXDMA                               59          /* RX DMA Channel */
+#define INHNO_SPI1_STAT                                        60          /* Status */
+#define INHNO_RSI0_DMA                                 61          /* DMA Channel */
+#define INHNO_RSI0_INT0                                        62          /* Interrupt 0 */
+#define INHNO_RSI0_INT1                                        63          /* Interrupt 1 */
+#define INHNO_SDU0_DMA                                 64          /* DMA */
+/* reserved */
+/* reserved */
+/* reserved */
+#define INHNO_EMAC0_STAT                               68          /* Status */
+/* reserved */
+#define INHNO_EMAC1_STAT                               70          /* Status */
+/* reserved */
+#define INHNO_LP0_DMA                                  72          /* DMA Channel */
+#define INHNO_LP0_STAT                                 73          /* Status */
+#define INHNO_LP1_DMA                                  74          /* DMA Channel */
+#define INHNO_LP1_STAT                                 75          /* Status */
+#define INHNO_LP2_DMA                                  76          /* DMA Channel */
+#define INHNO_LP2_STAT                                 77          /* Status */
+#define INHNO_LP3_DMA                                  78          /* DMA Channel */
+#define INHNO_LP3_STAT                                 79          /* Status */
+#define INHNO_UART0_TXDMA                              80          /* Transmit DMA */
+#define INHNO_UART0_RXDMA                              81          /* Receive DMA */
+#define INHNO_UART0_STAT                               82          /* Status */
+#define INHNO_UART1_TXDMA                              83          /* Transmit DMA */
+#define INHNO_UART1_RXDMA                              84          /* Receive DMA */
+#define INHNO_UART1_STAT                               85          /* Status */
+#define INHNO_MDMA0_SRC                                        86          /* Memory DMA Stream 0 Source / CRC0 Input Channel */
+#define INHNO_MDMA0_DST                                        87          /* Memory DMA Stream 0 Destination / CRC0 Output Channel */
+#define INHNO_CRC0_DCNTEXP                             88          /* Datacount expiration */
+#define INHNO_CRC0_ERR                                 89          /* Error */
+#define INHNO_MDMA1_SRC                                        90          /* Memory DMA Stream 1 Source / CRC1 Input Channel */
+#define INHNO_MDMA1_DST                                        91          /* Memory DMA Stream 1 Destination / CRC1 Output Channel */
+#define INHNO_CRC1_DCNTEXP                             92          /* Datacount expiration */
+#define INHNO_CRC1_ERR                                 93          /* Error */
+#define INHNO_MDMA2_SRC                                        94          /* Memory DMA Stream 2 Source Channel */
+#define INHNO_MDMA2_DST                                        95          /* Memory DMA Stream 2 Destination Channel */
+#define INHNO_MDMA3_SRC                                        96          /* Memory DMA Stream 3 Source Channel */
+#define INHNO_MDMA3_DST                                        97          /* Memory DMA Stream 3 Destination Channel */
+#define INHNO_EPPI0_CH0_DMA                            98          /* Channel 0 DMA */
+#define INHNO_EPPI0_CH1_DMA                            99          /* Channel 1 DMA */
+#define INHNO_EPPI0_STAT                               100                     /* Status */
+#define INHNO_EPPI2_CH0_DMA                            101         /* Channel 0 DMA */
+#define INHNO_EPPI2_CH1_DMA                            102         /* Channel 1 DMA */
+#define INHNO_EPPI2_STAT                               103         /* Status */
+#define INHNO_EPPI1_CH0_DMA                            104         /* Channel 0 DMA */
+#define INHNO_EPPI1_CH1_DMA                            105         /* Channel 1 DMA */
+#define INHNO_EPPI1_STAT                               106         /* Status */
+#define INHNO_PIXC0_CH0_DMA                            107         /* Channel 0 DMA */
+#define INHNO_PIXC0_CH1_DMA                            108         /* Channel 1 DMA */
+#define INHNO_PIXC0_CH2_DMA                            109         /* Channel 2 DMA */
+#define INHNO_PIXC0_STAT                               110         /* Status */
+#define INHNO_PVP0_CPDOB_DMA                   111         /* Camera Pipe Data Out B DMA Channel */
+#define INHNO_PVP0_CPDOC_DMA                   112         /* Camera Pipe Data Out C DMA Channel */
+#define INHNO_PVP0_CPSTAT_DMA                  113         /* Camera Pipe Status Out DMA Channel */
+#define INHNO_PVP0_CPCI_DMA                            114         /* Camera Pipe Control In DMA Channel */
+#define INHNO_PVP0_STAT0                               115         /* Status 0 */
+#define INHNO_PVP0_MPDO_DMA                            116         /* Memory Pipe Data Out DMA Channel */
+#define INHNO_PVP0_MPDI_DMA                            117         /* Memory Pipe Data In DMA Channel */
+#define INHNO_PVP0_MPSTAT_DMA                  118         /* Memory Pipe Status Out DMA Channel */
+#define INHNO_PVP0_MPCI_DMA                            119         /* Memory Pipe Control In DMA Channel */
+#define INHNO_PVP0_CPDOA_DMA                   120         /* Camera Pipe Data Out A DMA Channel */
+#define INHNO_PVP0_STAT1                               121         /* Status 1 */
+#define INHNO_USB0_STAT                                        122         /* Status/FIFO Data Ready */
+#define INHNO_USB0_DATA                                        123         /* DMA Status/Transfer Complete */
+#define INHNO_TRU0_INT0                                        124         /* Interrupt 0 */
+#define INHNO_TRU0_INT1                                        125         /* Interrupt 1 */
+#define INHNO_TRU0_INT2                                        126         /* Interrupt 2 */
+#define INHNO_TRU0_INT3                                        127         /* Interrupt 3 */
+#define INHNO_DMAC_ERR                                 128         /* DMA Controller Error */
+#define INHNO_CGU0_ERR                                 129         /* Error */
+/* reserved */
+#define INHNO_DPM0_EVT                                 131         /* Event */
+/* reserved */
+#define INHNO_SWU0_EVT                                 133         /* Event */
+#define INHNO_SWU1_EVT                                 134         /* Event */
+#define INHNO_SWU2_EVT                                 135         /* Event */
+#define INHNO_SWU3_EVT                                 136         /* Event */
+#define INHNO_SWU4_EVT                                 137         /* Event */
+#define INHNO_SWU5_EVT                                 138         /* Event */
+#define INHNO_SWU6_EVT                                 139         /* Event */
+/* コアイベント */
+#define INHNO_HW_ERROR                         140
+#define INHNO_CORE_TIMER                               141
+#define INHNO_RAISE                                    142
+
+/*
+ *  SIC_ISRの割り込みのベクタ番号
+ *
+ *  この定義はena_int, dis_intの引数として使う。
+ */
+#define INTNO_SEC0_ERR                                 0           /* Error */
+#define INTNO_CGU0_EVT                                 1           /* Event */
+#define INTNO_WDOG0_EXP                                        2           /* Expiration */
+#define INTNO_WDOG1_EXP                                        3           /* Expiration */
+#define INTNO_L2CTL0_ECC_ERR                   4           /* ECC Error */
+#define INTNO_L2CTL0_ECC_WARNING               5           /* ECC Warning */
+#define INTNO_C0_DBL_FAULT                             6           /* Core 0 Double Fault */
+#define INTNO_C1_DBL_FAULT                             7           /* Core 1 Double Fault */
+#define INTNO_C0_HW_ERR                                        8           /* Core 0 Hardware Error */
+#define INTNO_C1_HW_ERR                                        9           /* Core 1 Hardware Error */
+#define INTNO_C0_NMI_L1_PARITY_ERR             10          /* Core 0 Unhandled NMI or L1 Memory Parity Error */
+#define INTNO_C1_NMI_L1_PARITY_ERR             11          /* Core 1 Unhandled NMI or L1 Memory Parity Error */
+#define INTNO_TIMER0_TMR0                              12          /* Timer 0 */
+#define INTNO_TIMER0_TMR1                              13          /* Timer 1 */
+#define INTNO_TIMER0_TMR2                              14          /* Timer 2 */
+#define INTNO_TIMER0_TMR3                              15          /* Timer 3 */
+#define INTNO_TIMER0_TMR4                              16          /* Timer 4 */
+#define INTNO_TIMER0_TMR5                              17          /* Timer 5 */
+#define INTNO_TIMER0_TMR6                              18          /* Timer 6 */
+#define INTNO_TIMER0_TMR7                              19          /* Timer 7 */
+#define INTNO_TIMER0_STAT                              20          /* Status */
+#define INTNO_PINT0_BLOCK                              21          /* Pin Interrupt Block */
+#define INTNO_PINT1_BLOCK                              22          /* Pin Interrupt Block */
+#define INTNO_PINT2_BLOCK                              23          /* Pin Interrupt Block */
+#define INTNO_PINT3_BLOCK                              24          /* Pin Interrupt Block */
+#define INTNO_PINT4_BLOCK                              25          /* Pin Interrupt Block */
+#define INTNO_PINT5_BLOCK                              26          /* Pin Interrupt Block */
+#define INTNO_CNT0_STAT                                        27          /* Status */
+#define INTNO_PWM0_SYNC                                        28          /* PWMTMR Group */
+#define INTNO_PWM0_TRIP                                        29          /* Trip */
+#define INTNO_PWM1_SYNC                                        30          /* PWMTMR Group */
+#define INTNO_PWM1_TRIP                                        31          /* Trip */
+#define INTNO_TWI0_DATA                                        32          /* Data Interrupt */
+#define INTNO_TWI1_DATA                                        33          /* Data Interrupt */
+#define INTNO_SOFT0                                            34          /* Software-driven Interrupt 0 */
+#define INTNO_SOFT1                                            35          /* Software-driven Interrupt 1 */
+#define INTNO_SOFT2                                            36          /* Software-driven Interrupt 2 */
+#define INTNO_SOFT3                                            37          /* Software-driven Interrupt 3 */
+#define INTNO_ACM0_EVT_MISS                            38          /* Event Miss */
+#define INTNO_ACM0_EVT_COMPLETE                        39          /* Event Complete */
+#define INTNO_CAN0_RX                                  40          /* Receive */
+#define INTNO_CAN0_TX                                  41          /* Transmit */
+#define INTNO_CAN0_STAT                                        42          /* Status */
+#define INTNO_SPORT0_A_DMA                             43          /* Channel A DMA */
+#define INTNO_SPORT0_A_STAT                            44          /* Channel A Status */
+#define INTNO_SPORT0_B_DMA                             45          /* Channel B DMA */
+#define INTNO_SPORT0_B_STAT                            46          /* Channel B Status */
+#define INTNO_SPORT1_A_DMA                             47          /* Channel A DMA */
+#define INTNO_SPORT1_A_STAT                            48          /* Channel A Status */
+#define INTNO_SPORT1_B_DMA                             49          /* Channel B DMA */
+#define INTNO_SPORT1_B_STAT                            50          /* Channel B Status */
+#define INTNO_SPORT2_A_DMA                             51          /* Channel A DMA */
+#define INTNO_SPORT2_A_STAT                            52          /* Channel A Status */
+#define INTNO_SPORT2_B_DMA                             53          /* Channel B DMA */
+#define INTNO_SPORT2_B_STAT                            54          /* Channel B Status */
+#define INTNO_SPI0_TXDMA                               55          /* TX DMA Channel */
+#define INTNO_SPI0_RXDMA                               56          /* RX DMA Channel */
+#define INTNO_SPI0_STAT                                        57          /* Status */
+#define INTNO_SPI1_TXDMA                               58          /* TX DMA Channel */
+#define INTNO_SPI1_RXDMA                               59          /* RX DMA Channel */
+#define INTNO_SPI1_STAT                                        60          /* Status */
+#define INTNO_RSI0_DMA                                 61          /* DMA Channel */
+#define INTNO_RSI0_INT0                                        62          /* Interrupt 0 */
+#define INTNO_RSI0_INT1                                        63          /* Interrupt 1 */
+#define INTNO_SDU0_DMA                                 64          /* DMA */
+/* reserved */
+/* reserved */
+/* reserved */
+#define INTNO_EMAC0_STAT                               68          /* Status */
+/* reserved */
+#define INTNO_EMAC1_STAT                               70          /* Status */
+/* reserved */
+#define INTNO_LP0_DMA                                  72          /* DMA Channel */
+#define INTNO_LP0_STAT                                 73          /* Status */
+#define INTNO_LP1_DMA                                  74          /* DMA Channel */
+#define INTNO_LP1_STAT                                 75          /* Status */
+#define INTNO_LP2_DMA                                  76          /* DMA Channel */
+#define INTNO_LP2_STAT                                 77          /* Status */
+#define INTNO_LP3_DMA                                  78          /* DMA Channel */
+#define INTNO_LP3_STAT                                 79          /* Status */
+#define INTNO_UART0_TXDMA                              80          /* Transmit DMA */
+#define INTNO_UART0_RXDMA                              81          /* Receive DMA */
+#define INTNO_UART0_STAT                               82          /* Status */
+#define INTNO_UART1_TXDMA                              83          /* Transmit DMA */
+#define INTNO_UART1_RXDMA                              84          /* Receive DMA */
+#define INTNO_UART1_STAT                               85          /* Status */
+#define INTNO_MDMA0_SRC                                        86          /* Memory DMA Stream 0 Source / CRC0 Input Channel */
+#define INTNO_MDMA0_DST                                        87          /* Memory DMA Stream 0 Destination / CRC0 Output Channel */
+#define INTNO_CRC0_DCNTEXP                             88          /* Datacount expiration */
+#define INTNO_CRC0_ERR                                 89          /* Error */
+#define INTNO_MDMA1_SRC                                        90          /* Memory DMA Stream 1 Source / CRC1 Input Channel */
+#define INTNO_MDMA1_DST                                        91          /* Memory DMA Stream 1 Destination / CRC1 Output Channel */
+#define INTNO_CRC1_DCNTEXP                             92          /* Datacount expiration */
+#define INTNO_CRC1_ERR                                 93          /* Error */
+#define INTNO_MDMA2_SRC                                        94          /* Memory DMA Stream 2 Source Channel */
+#define INTNO_MDMA2_DST                                        95          /* Memory DMA Stream 2 Destination Channel */
+#define INTNO_MDMA3_SRC                                        96          /* Memory DMA Stream 3 Source Channel */
+#define INTNO_MDMA3_DST                                        97          /* Memory DMA Stream 3 Destination Channel */
+#define INTNO_EPPI0_CH0_DMA                            98          /* Channel 0 DMA */
+#define INTNO_EPPI0_CH1_DMA                            99          /* Channel 1 DMA */
+#define INTNO_EPPI0_STAT                               100                     /* Status */
+#define INTNO_EPPI2_CH0_DMA                            101         /* Channel 0 DMA */
+#define INTNO_EPPI2_CH1_DMA                            102         /* Channel 1 DMA */
+#define INTNO_EPPI2_STAT                               103         /* Status */
+#define INTNO_EPPI1_CH0_DMA                            104         /* Channel 0 DMA */
+#define INTNO_EPPI1_CH1_DMA                            105         /* Channel 1 DMA */
+#define INTNO_EPPI1_STAT                               106         /* Status */
+#define INTNO_PIXC0_CH0_DMA                            107         /* Channel 0 DMA */
+#define INTNO_PIXC0_CH1_DMA                            108         /* Channel 1 DMA */
+#define INTNO_PIXC0_CH2_DMA                            109         /* Channel 2 DMA */
+#define INTNO_PIXC0_STAT                               110         /* Status */
+#define INTNO_PVP0_CPDOB_DMA                   111         /* Camera Pipe Data Out B DMA Channel */
+#define INTNO_PVP0_CPDOC_DMA                   112         /* Camera Pipe Data Out C DMA Channel */
+#define INTNO_PVP0_CPSTAT_DMA                  113         /* Camera Pipe Status Out DMA Channel */
+#define INTNO_PVP0_CPCI_DMA                            114         /* Camera Pipe Control In DMA Channel */
+#define INTNO_PVP0_STAT0                               115         /* Status 0 */
+#define INTNO_PVP0_MPDO_DMA                            116         /* Memory Pipe Data Out DMA Channel */
+#define INTNO_PVP0_MPDI_DMA                            117         /* Memory Pipe Data In DMA Channel */
+#define INTNO_PVP0_MPSTAT_DMA                  118         /* Memory Pipe Status Out DMA Channel */
+#define INTNO_PVP0_MPCI_DMA                            119         /* Memory Pipe Control In DMA Channel */
+#define INTNO_PVP0_CPDOA_DMA                   120         /* Camera Pipe Data Out A DMA Channel */
+#define INTNO_PVP0_STAT1                               121         /* Status 1 */
+#define INTNO_USB0_STAT                                        122         /* Status/FIFO Data Ready */
+#define INTNO_USB0_DATA                                        123         /* DMA Status/Transfer Complete */
+#define INTNO_TRU0_INT0                                        124         /* Interrupt 0 */
+#define INTNO_TRU0_INT1                                        125         /* Interrupt 1 */
+#define INTNO_TRU0_INT2                                        126         /* Interrupt 2 */
+#define INTNO_TRU0_INT3                                        127         /* Interrupt 3 */
+#define INTNO_DMAC_ERR                                 128         /* DMA Controller Error */
+#define INTNO_CGU0_ERR                                 129         /* Error */
+/* reserved */
+#define INTNO_DPM0_EVT                                 131         /* Event */
+/* reserved */
+#define INTNO_SWU0_EVT                                 133         /* Event */
+#define INTNO_SWU1_EVT                                 134         /* Event */
+#define INTNO_SWU2_EVT                                 135         /* Event */
+#define INTNO_SWU3_EVT                                 136         /* Event */
+#define INTNO_SWU4_EVT                                 137         /* Event */
+#define INTNO_SWU5_EVT                                 138         /* Event */
+#define INTNO_SWU6_EVT                                 139         /* Event */
+/* コアイベント */
+#define INTNO_HW_ERROR                         140
+#define INTNO_CORE_TIMER                               141
+#define INTNO_RAISE                                    142
+
+
+
+/*
+ * IMSで使用する配列数
+ */
+#define IMS_MASK_SIZE                                  ((DEVICE_INTERRUPT_COUNT + CORE_EVENT_COUNT + 31) / 32)
+
+#ifndef _MACRO_ONLY
+
+/*
+* SIC_IARxを解析して、イベント順位ごとに割り当てられている割り込み
+* のビットマップを作る。SIC_IARxのフィールド値は優先順位-7なので
+* その分補正する。
+*/
+void make_priority_mask( void );
+
+/*
+ *  ターゲットシステム依存の初期化
+ */
+extern void sys_initialize(void);
+
+/*
+ *  ターゲットシステムの終了
+ *
+ *  システムを終了する時に使う.ROMモニタ/GDB STUB呼出しで実現する.
+ */
+extern void sys_exit(void);
+
+/*
+ *  ターゲットシステムの文字出力
+ *
+ *  システムの低レベルの文字出力ルーチン.ROMモニタ/GDB STUB呼出しで実
+ *  現する.
+ */
+extern void sys_putc(char c);
+
+/*
+* SIC_IARxを解析して、イベント順位ごとに割り当てられている割り込み
+* のビットマップを作る。SIC_IARxのフィールド値は優先順位-7なので
+* その分補正する。
+*/
+void make_priority_mask( void );
+
+/*
+ * 割り込みの許可、禁止
+ *
+ */
+typedef unsigned int INTNO;
+extern ER ena_int( INTNO intno );
+extern ER dis_int( INTNO intno );
+
+/*
+ * 割り込みマスクの操作
+ *
+ *
+ */
+typedef struct
+{
+    unsigned int imask[IMS_MASK_SIZE];
+} IMS;
+extern ER chg_ims( IMS ims );
+extern ER get_ims( IMS * p_ims );
+
+/*
+ *  割り込みをデバイスに割り当てる
+ */
+extern void device_dispatcher( unsigned int priority, unsigned int imask );
+
+/**
+ * スプリアス・イベント・ハンドラ
+ */
+void spurious_exc_handler(VP p_excinf);
+void spurious_int_handler();
+
+#endif /* _MACRO_ONLY */
+#endif /* _SYS_CONFIG_H_ */
diff --git a/jsp/config/blackfin/_common_bf609/chip_debugboot.c b/jsp/config/blackfin/_common_bf609/chip_debugboot.c
new file mode 100644 (file)
index 0000000..8405edd
--- /dev/null
@@ -0,0 +1,26 @@
+#include "jsp_kernel.h"
+
+#ifdef __GNUC__
+#include "cdefBF609.h"       /* gnu tool chain */
+#elif defined(__ECC__)
+#error "Don't use sys_debugboot.c for VDSP "
+#else
+#error "Compiler is not supported"
+#endif
+
+
+/*
+* gdbserverがターゲットのリセット機能を提供しないため、gdb経由でターゲット
+* にアプリッケーションをダウンロードすると正しく動作しないことがある。
+* このルーチンはターゲットを一度だけリセットする。
+*/
+void boot_for_gdb( void )
+{
+    if ( enable_boot_for_gdb ){   /* ソフトウェアリセットが起きていないなら以下実行 */
+        enable_boot_for_gdb = 0;            /* リブートは一回だけ */
+        *pREG_RCU0_CTL = BITM_RCU_CTL_SYSRST;
+        asm volatile( "ssync;" );
+        while( 1 )
+            ;                               /*リセットが発生するまでループ*/
+    }
+}
diff --git a/jsp/config/blackfin/_common_bf609/chip_defs.h b/jsp/config/blackfin/_common_bf609/chip_defs.h
new file mode 100644 (file)
index 0000000..a80faaa
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ * 
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)縲鰀(4) の条件か,Free Software Foundation 
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ * 
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ * 
+ *  
+ */
+
+
+/*
+ *  ターゲットシステムに依存する定義(ADSP-BF609用)
+ *
+ *  このインクルードファイルは,kernel.h と sil.h でインクルードされる.
+ *  他のファイルから直接インクルードすることはない.このファイルをイン
+ *  クルードする前に,t_stddef.h と itron.h がインクルードされるので,
+ *  それらに依存してもよい.
+ */
+
+#ifndef _CHIP_DEFS_H_
+#define _CHIP_DEFS_H_
+
+/* チップ共通部略称  jsp/doc/config.txtの 2.(8)を参照 */ 
+#define _COMMON_BF609
+
+/*
+ *  タイムティックの定義
+ */
+#define TIC_NUME    1u  /* タイムティックの周期の分子 */
+#define TIC_DENO    1u  /* タイムティックの周期の分母 */
+
+/*
+ *  破壊性読み出しレジスタの判別式
+ *  与えられたアドレス iop が破壊性読み出しレジスタの
+ *  場合には真を返す。
+ */
+#ifndef DESTRUCTIVE_READ
+#define DESTRUCTIVE_READ( iop ) (iop<(VP)0xF0000000) 
+#endif
+
+#ifndef _MACRO_ONLY
+
+/*
+ *  システムの停止処理
+ */
+
+Inline void
+kernel_abort()
+{
+}
+
+#define COPYRIGHT_CHIP \
+"Copyright (C) 2010-2013 by Kaneko System Co., Ltd.\n"
+
+#endif /* _MACRO_ONLY */
+#endif /* _SYS_DEFS_H_ */
diff --git a/jsp/config/blackfin/_common_bf609/chip_dump.c b/jsp/config/blackfin/_common_bf609/chip_dump.c
new file mode 100644 (file)
index 0000000..1b67b61
--- /dev/null
@@ -0,0 +1,360 @@
+/**
+ * \file chip_dump.c
+ * \brief ADSP-BF609用のポストモーテムダンプルーチン群
+ *
+ * ハードウェアエラー用のハンドラと、例外用のハンドラからなる。いずれも呼び出されるとUARTから
+ * ポストモーテム出力を表示する。
+ */
+#include "jsp_kernel.h"
+#include <cdefBF609.h>
+
+/**
+ * \brief UARTおよび付随するDMAの動作を停止し、すべての割り込みを禁止する。
+ *
+ * 最後にUART_IERをクリアするのは、UART割り込みを禁止すると同時にDMAも禁止するため。
+ * UART DMAは、UARTの割り込み線で駆動されているので、割り込みを禁止すればDMAリクエスト
+ * も停止する。
+ *
+ * UARTの初期化をどうするか悩ましいが、ここではそのまま以前の設定を利用することにする。
+ *
+ * ポストモーテム・ダンプを目的としているので、この状態からの回復は考えない。
+ */
+static void pm_occupy_uart()
+{
+    /* すべてのコア割り込みを禁止する */
+    asm( "cli r0;" : : : "R0" );
+
+    /* すべてのシステム割り込みソースを禁止する */
+    *pREG_SEC0_GCTL = 0;
+    *pREG_UART0_IMSK_CLR = 0xFFFFFFFFU;
+    *pREG_UART1_IMSK_CLR = 0xFFFFFFFFU;
+}
+
+/**
+ * \brief 一文字出力
+ *
+ * UARTの送信レジスタが空になるのを待って一文字出力する。
+ */
+static void pm_putc( unsigned char c )
+{
+#if LOGTASK_PORTID == 1
+       while((*pREG_UART0_STAT & ENUM_UART_STAT_THR_EMPTY) == 0U)
+               asm volatile("ssync;\n");
+       *pREG_UART0_THR = c;
+
+#elif LOGTASK_PORTID == 2
+       while((*pREG_UART1_STAT & ENUM_UART_STAT_THR_EMPTY) == 0U)
+               asm volatile("ssync;\n");
+       *pREG_UART1_THR = c;
+
+#else
+#      error LOGTASK_PORTID is invalid value
+#endif
+}
+
+/**
+ * \brief コンソール入力監視
+ *
+ * UARTの受信レジスタにデータがあれば、読み込む。データが"!"なら真、
+ * それ以外なら偽を返す。
+ */
+static BOOL is_ready()
+{
+#if LOGTASK_PORTID == 1
+    /* 受信データはあるか。 */
+       if((*pREG_UART0_STAT & BITP_UART_STAT_DR) != 0U)
+       {
+        char c;
+        c = *pREG_UART0_RBR;
+        if( c == '!' )
+            return TRUE;
+    }
+    return FALSE;
+
+#elif LOGTASK_PORTID == 2
+    /* 受信データはあるか。 */
+       if((*pREG_UART1_STAT & BITP_UART_STAT_DR) != 0U)
+       {
+        char c;
+        c = *pREG_UART1_RBR;
+        if( c == '!' )
+            return TRUE;
+    }
+    return FALSE;
+
+#else
+#      error LOGTASK_PORTID is invalid value
+#endif
+}
+
+/**
+ * \brief 文字列出力
+ *
+ * 受け取った文字列をUARTに出力する。
+ */
+static void pm_putstr( char * s )
+{
+    int i;
+
+    i=0;
+    while( s[i] )   /* 末端のNULLが現れるまで出力 */
+        pm_putc(s[i++]);
+}
+
+/**
+ * \brief 1バイトをヘキサデシマルで出力する。
+ */
+static void pm_puthex1byte( unsigned int data )
+{
+    int i;
+    int nibble;
+
+    /* 8bit内のすべてのニブルを処理 */
+    for ( i=0; i<2; i++ )
+    {
+        /* 最上位ニブルを抽出 */
+        nibble = ( data >> 4 ) & 0xF;
+        /* 抽出したニブルを出力 */
+        if ( nibble < 10 )
+            pm_putc( nibble + '0' );
+        else
+            pm_putc( nibble - 10 + 'A' );
+        /* 次のニブル */
+        data <<= 4;
+    }
+}
+
+/*
+ * \brief 改行記号を出力する
+ */
+static void pm_putrtn()
+{
+    pm_putstr("\r\n");
+}
+
+/**
+ * \brief 4バイトをヘキサデシマルで出力する。
+ */
+static void pm_puthex4byte( unsigned int data )
+{
+    int i;
+    int nibble;
+
+        /* 32bit内のすべてのニブルを処理 */
+    for ( i=0; i<8; i++ )
+    {
+            /* 最上位ニブルを抽出 */
+        nibble = ( data >> 28 ) & 0xF;
+            /* 抽出したニブルを出力 */
+        if ( nibble < 10 )
+            pm_putc( nibble + '0' );
+        else
+            pm_putc( nibble - 10 + 'A' );
+            /* 次のニブル */
+        data <<= 4;
+    }
+
+}
+
+/**
+ * \brief 例外フラグ
+ *
+ * 例外が発生したときには真、そうでなければ偽。hwei_handler()に例外か否かを伝える。
+ *
+ * GCCが張り切ってlink/unlink命令の位置を最適化するため、hwei_hanlder()の
+ * 中で性格にfpを手繰れない。そのため、dummyをアクセスすることでlink/unlinkの位置
+ * 最適化の抑止を図る役目もある。効果があるかどうかは不明。
+ */
+static volatile int expFlag =0;
+/**
+ * \brief ハードウェア・エラー・ハンドラ
+ *
+ * ハードウェア・エラー時に呼び出されて、ハードウェア・エラー・割り込みのポストモーテム処理を行う。
+ * 最初にFPを手繰って、割り込みのスタックフレームを探す。次にすべての割り込みを禁止し、
+ * UART0を占有したあと、ポーリングを使ってスタックに保存された各レジスタのダンプを行う。
+ * DEF_INH(INHNO_HW_ERROR, { TA_HLNG, hwei_handler });
+ *
+ */
+void spurious_int_handler()
+{
+    unsigned int * fp, *ptr ;   /* フレーム・ポインタを手繰っていくための変数 */
+    unsigned int reg;   /* システムレジスタを受け取るための変数 */
+    unsigned int imask, sic_imask0, sic_imask1, sic_imask2; /*マスク記録レジスタ*/
+
+    /* あとで使う */
+    imask = *pIMASK;
+//    sic_imask0 = *pSIC_IMASK0;
+//    sic_imask1 = *pSIC_IMASK1;
+//    sic_imask2 = *pSIC_IMASK2;
+    /* UART0を初期化し、DMAと割り込みを禁止する */
+    pm_occupy_uart();
+
+    while (1)
+    {
+        int count = 0;
+
+        pm_putstr( "Type '!' to display post mortem dump" ); pm_putrtn();
+
+        while ( ! is_ready() )
+        {
+            int i;
+            for ( i=0; i<100000000; i++)
+                asm volatile ("nop;");
+            if ( count > 30 )
+            {
+                pm_putstr( "Type '!' to display post mortem dump" ); pm_putrtn();
+                count = 0;
+            }
+            else
+                count ++;
+        }
+        pm_putrtn();
+
+
+        /* 現在の関数のFPを取得する */
+        asm ( "%0=fp;" : "=d"((unsigned int)fp) );
+
+        /*
+         * この関数を呼び出した関数 ( interrupt_dispatcher ) のFPを取得する。
+         * FPは呼び出し関数のFPの格納番地を指していることを利用する
+         */
+        fp = (void *)*fp;
+        /*
+         * interrupt_dispatcher を呼び出した関数のFPを取得する。
+         * その関数は割り込みハンドラの入り口処理部に他ならない。
+         */
+        fp = (void *)*fp;
+
+        /* いまや、FPは割り込み受付時の保存されたレジスタ群を指している */
+
+        /* プッシュされた P0を指す */
+        ptr = fp + 2;
+        /*
+         * 上位
+         *      0   1   2   3   4   5   6   7   8   9
+         * -----------------------------------------------
+         *  00  P0  RTS FP  R0  R1  R2  R3  R4  R5  R6
+         *  10  R7  P1  P2  P3  P4  P5  I3  I2  I1  I0
+         *  20  M3  M2  M1  M0  B3  B2  B1  B0  L3  L2
+         *  30  L1  L0  A0x A0w A1x A1w LC1 LC0 LT1 LT0
+         *  40  LB1 LB0 AST RETI
+         * 下位
+         *
+        */
+        if ( expFlag )
+            pm_putstr( "Spurious Exception  !!" );
+        else
+            pm_putstr( "Spurious Interrupt  !!" );
+        pm_putrtn();
+
+        pm_putstr( "Registers On Stack :" );    pm_putrtn();
+        pm_putstr( "P0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "RETS " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "FP   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R4   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R5   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R6   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "R7   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "P1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "P2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "P3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "P4   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "P5   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "I3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "I2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "I1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "I0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "M3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "M2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "M1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "M0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "B3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "B2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "B1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "B0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "L3   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "L2   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "L1   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "L0   " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "A0   " );   pm_puthex1byte( *(ptr--) ); pm_putstr( ":" );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "A1   " );   pm_puthex1byte( *(ptr--) ); pm_putstr( ":" );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LC1  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LC0  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LT1  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LT0  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LB1  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "LB0  " );   pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "ASTAT " );  pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putstr( "RETI  " );  pm_puthex4byte( *(ptr--) ); pm_putrtn();
+        pm_putrtn();
+        pm_putstr( "System Registers :" );  pm_putrtn();
+//        pm_putstr( "SIC_IMASK2:1:0 " ); pm_puthex4byte( sic_imask2 );pm_puthex4byte( sic_imask1 );pm_putstr( " : " );pm_puthex4byte( sic_imask0 ); pm_putrtn();
+//        pm_putstr( "SIC_ISR1:0   " );   pm_puthex4byte( *pSIC_ISR1 );pm_putstr( " : " );pm_puthex4byte( *pSIC_ISR0 );  pm_putrtn();
+        pm_putstr( "IMASK        " );   pm_puthex4byte( imask ); pm_putrtn();
+        pm_putstr( "ILAT         " );   pm_puthex4byte( *pILAT ); pm_putrtn();
+        pm_putstr( "IPEND        " );   pm_puthex4byte( *pIPEND ); pm_putrtn();
+        asm( "%0=SEQSTAT;" : "=d"(reg) );
+        pm_putstr( "SEQSTAT      " );   pm_puthex4byte( reg ); pm_putrtn();
+        pm_putstr( "  EXCAUSE    " );   pm_puthex1byte( reg & 0x3F ); pm_putrtn();
+        pm_putstr( "  HWERRCAUSE " );   pm_puthex1byte( (reg>>14)&0x1F ); pm_putrtn();
+/*
+        pm_putstr( "DMA0_IRQ_STATUS    " ); pm_puthex4byte( *pDMA0_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA1_IRQ_STATUS    " ); pm_puthex4byte( *pDMA1_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA2_IRQ_STATUS    " ); pm_puthex4byte( *pDMA2_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA3_IRQ_STATUS    " ); pm_puthex4byte( *pDMA3_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA4_IRQ_STATUS    " ); pm_puthex4byte( *pDMA4_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA5_IRQ_STATUS    " ); pm_puthex4byte( *pDMA5_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA6_IRQ_STATUS    " ); pm_puthex4byte( *pDMA6_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA7_IRQ_STATUS    " ); pm_puthex4byte( *pDMA7_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA8_IRQ_STATUS    " ); pm_puthex4byte( *pDMA8_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA9_IRQ_STATUS    " ); pm_puthex4byte( *pDMA9_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA10_IRQ_STATUS    " );    pm_puthex4byte( *pDMA10_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "DMA11_IRQ_STATUS    " );    pm_puthex4byte( *pDMA11_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "MDMA_D0_IRQ_STATUS " ); pm_puthex4byte( *pMDMA_D0_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "MDMA_S0_IRQ_STATUS " ); pm_puthex4byte( *pMDMA_S0_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "MDMA_D1_IRQ_STATUS " ); pm_puthex4byte( *pMDMA_D1_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "MDMA_S1_IRQ_STATUS " ); pm_puthex4byte( *pMDMA_S1_IRQ_STATUS ); pm_putrtn();
+        pm_putstr( "SPI0_STAT          " ); pm_puthex4byte( *pSPI0_STAT ); pm_putrtn();
+        pm_putstr( "SPI1_STAT          " ); pm_puthex4byte( *pSPI1_STAT ); pm_putrtn();
+        pm_putstr( "SPI2_STAT          " ); pm_puthex4byte( *pSPI2_STAT ); pm_putrtn();
+        pm_putstr( "EPPI0_STATUS       " ); pm_puthex4byte( *pEPPI0_STATUS ); pm_putrtn();
+        pm_putstr( "EPPI1_STATUS       " ); pm_puthex4byte( *pEPPI1_STATUS ); pm_putrtn();
+        pm_putstr( "EPPI2_STATUS       " ); pm_puthex4byte( *pEPPI2_STATUS ); pm_putrtn();
+        pm_putstr( "SPORT0_STAT        " ); pm_puthex4byte( *pSPORT0_STAT ); pm_putrtn();
+        pm_putstr( "SPORT1_STAT        " ); pm_puthex4byte( *pSPORT1_STAT ); pm_putrtn();
+        pm_putstr( "SPORT2_STAT        " ); pm_puthex4byte( *pSPORT2_STAT ); pm_putrtn();
+        pm_putstr( "SPORT3_STAT        " ); pm_puthex4byte( *pSPORT3_STAT ); pm_putrtn();
+        pm_putstr( "TIMER_STATUS0      " ); pm_puthex4byte( *pTIMER_STATUS0 ); pm_putrtn();
+        pm_putstr( "TIMER_STATUS1      " ); pm_puthex4byte( *pTIMER_STATUS1 ); pm_putrtn();
+*/
+        pm_putrtn();
+        pm_putstr( "Calling Stack :" ); pm_putrtn();
+
+        while( fp )
+        {
+            pm_putstr( "Called from " );    pm_puthex4byte( *(fp+1) ); pm_putrtn();
+            fp = *fp;
+        }
+    }
+}
+
+/**
+ * \brief CPU例外ハンドラ
+ *
+ * CPU例外ハンドラとしてcfgファイルに登録する。 hwei_handler()は呼ばれたら戻ってこないが、
+ * そのあとにもexpFlagに値を代入しているのは、最適化によってunlink命令の値がルーチン呼び出しの
+ * 前に移動することを防ぐためである。
+ *
+ * DEF_EXC(CPUEXC1, { TA_HLNG, excp_handler} );
+ *
+ */
+void spurious_exc_handler(VP p_excinf)
+{
+    expFlag = TRUE;
+    spurious_int_handler();
+}
+
diff --git a/jsp/config/blackfin/_common_bf609/hw_serial.cfg b/jsp/config/blackfin/_common_bf609/hw_serial.cfg
new file mode 100644 (file)
index 0000000..aa6a9a4
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ *  SIOドライバ(ADSP-BF609用)のコンフィギュレーションファイル
+ */
+INCLUDE("\"hw_serial.h\"");
+DEF_INH(INHNO_SIO0, { TA_HLNG, sio0_handler });
diff --git a/jsp/config/blackfin/_common_bf609/hw_serial.h b/jsp/config/blackfin/_common_bf609/hw_serial.h
new file mode 100644 (file)
index 0000000..502d4b5
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ */
+
+/*
+ *  シリアルI/Oデバイス(SIO)ドライバ(Blackfin UART用)
+ *
+ *   このファイルは、TOPPERS/JSP 1.4.2の config/sh3/ms7727cp01/hw_serial.hを
+ *   リネームし、内部の識別子を変更したものである。
+ *
+ *   このファイルは下位のデバイス・アクセス・ルーチンを束ねて上位の層に渡す
+ *   ためのものである。Blackfinの外部にあるシリアルをTOPPERS/JSPで管理しない
+ *   のなら、変更する必要はない。
+ */
+
+#ifndef _HW_SERIAL_H_
+#define _HW_SERIAL_H_
+
+#include <s_services.h>
+
+#include "uart.h"
+
+#include <cdefBF609.h>
+/*
+ *  SIOドライバの初期化ルーチン
+ */
+#define sio_initialize  uart_initialize
+
+#ifndef _MACRO_ONLY
+/*
+ *  シリアルI/Oポートのオープン
+ */
+Inline SIOPCB *
+sio_opn_por(ID siopid, VP_INT exinf)
+{
+    SIOPCB  *siopcb;
+    UW regBase;
+
+    /*
+     *  デバイス依存のオープン処理.
+     */
+    siopcb = uart_opn_por(siopid, exinf);
+
+    /*
+    * Enable Corrensponding Interrupt at IMASK
+    */
+    regBase = siopcb->siopinib->reg_base;
+    if ( regBase == UART0_ADDRESS ) {       // UART0の場合
+               *pREG_PORTD_FER_SET = BITM_PORT_FER_SET_PX8 | BITM_PORT_FER_SET_PX7;
+               *pREG_PORTD_MUX = (*pREG_PORTD_MUX & ~(BITM_PORT_MUX_MUX7 | BITM_PORT_MUX_MUX8)) |
+                       (1 << BITP_PORT_MUX_MUX7) | (1 << BITP_PORT_MUX_MUX8);
+       *pREG_UART0_STAT = *pREG_UART0_STAT;
+        ena_int( INTNO_UART0_STAT );
+    }
+    else if ( regBase == UART1_ADDRESS ){      // uart1の場合
+               *pREG_PORTG_FER = BITM_PORT_FER_SET_PX14 | BITM_PORT_FER_SET_PX15;
+               *pREG_PORTG_MUX = (*pREG_PORTG_MUX & ~(BITM_PORT_MUX_MUX14 | BITM_PORT_MUX_MUX15));
+       *pREG_UART1_STAT = *pREG_UART1_STAT;
+        ena_int( INTNO_UART1_STAT );
+    }
+
+    return(siopcb);
+}
+
+/*
+ *  シリアルI/Oポートのクローズ
+ */
+Inline void
+sio_cls_por(SIOPCB *siopcb)
+{
+
+    /*
+     *  デバイス依存のクローズ処理.
+     */
+    uart_cls_por(siopcb);
+}
+
+
+/*
+ *  SIOの割込みハンドラ
+ */
+#define sio0_handler uart0_isr
+#define sio1_handler uart1_isr
+
+/*
+ *  シリアルI/Oポートへの文字送信
+ */
+#define sio_snd_chr uart_snd_chr
+
+/*
+ *  シリアルI/Oポートからの文字受信
+ */
+#define sio_rcv_chr uart_rcv_chr
+
+/*
+ *  シリアルI/Oポートからのコールバックの許可
+ */
+#define sio_ena_cbr uart_ena_cbr
+
+/*
+ *  シリアルI/Oポートからのコールバックの禁止
+ */
+#define sio_dis_cbr uart_dis_cbr
+
+/*
+ *  シリアルI/Oポートからの送信可能コールバック
+ */
+#define sio_ierdy_snd   uart_ierdy_snd
+
+/*
+ *  シリアルI/Oポートからの受信通知コールバック
+ */
+#define sio_ierdy_rcv   uart_ierdy_rcv
+
+#endif /* _MACRO_ONLY */
+#endif /* _HW_SERIAL_H_ */
diff --git a/jsp/config/blackfin/_common_bf609/hw_timer.h b/jsp/config/blackfin/_common_bf609/hw_timer.h
new file mode 100644 (file)
index 0000000..65ea29a
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ *
+ */
+
+/*
+ *  タイマドライバ(ADSP-BF609用)
+ *
+ */
+
+#ifndef _HW_TIMER_H_
+#define _HW_TIMER_H_
+
+#include <s_services.h>
+
+#ifndef _MACRO_ONLY
+
+#include <cdefBF609.h>
+#include <builtins.h>
+
+/**************************************************************
+ *  タイマの起動処理
+ *
+ *  タイマを初期化し,周期的なタイマ割込み要求を発生させる.
+ *
+ **************************************************************/
+Inline void
+hw_timer_initialize()
+{
+
+#ifdef USE_TIC_CORE
+    /* Core timer */
+    *pTCNTL = TMPWR;                    /* power up timer; */
+    *pTPERIOD = CORECLOCK/1000;         /* CORE CLOCK is defined in sys_config.h */
+    *pTCNTL = TMPWR | TMREN | TAUTORLD;
+#else
+    /* GPT7(General-purpose timer7) */
+    *pREG_TIMER0_RUN_CLR = BITM_TIMER_RUN_TMR07;
+    *pREG_TIMER0_STOP_CFG_SET = BITM_TIMER_STOP_CFG_TMR07;
+    ssync();
+    *pREG_TIMER0_TMR7_CFG = ENUM_TIMER_TMR_CFG_PADOUT_DIS | ENUM_TIMER_TMR_CFG_IRQMODE3 | ENUM_TIMER_TMR_CFG_PWMCONT_MODE;
+    *pREG_TIMER0_TMR7_PER = SYSCLOCK/1000;  /* SYSCLOCK is defined in sys_config.h */
+    *pREG_TIMER0_TMR7_WID = 1;              /* 0 < width < period */
+    *pREG_TIMER0_TMR7_DLY = 0;
+    *pREG_TIMER0_DATA_IMSK &= ~BITM_TIMER_STAT_IMSK_TMR07;
+    *pREG_TIMER0_STAT_IMSK |= BITM_TIMER_STAT_IMSK_TMR07;
+    ena_int( INHNO_TIMER );             /* enable Timer Interrupt */
+    *pREG_TIMER0_RUN_SET = BITM_TIMER_RUN_TMR07;
+
+#endif
+        asm volatile("ssync;\n");
+
+}
+
+/**************************************************************
+ *  タイマ割込み要求のクリア
+ **************************************************************/
+Inline void
+hw_timer_int_clear()
+{
+#ifdef USE_TIC_CORE
+    /* Core timer */
+    /* TINTはW1Cではないので、TINTのTINTビットは0を書き込む */
+    *pTCNTL = TMPWR | TMREN | TAUTORLD;
+#else
+    /* GPT7(General-purpose timer7) */
+       *pREG_TIMER0_DATA_ILAT = BITM_TIMER_DATA_ILAT_TMR07;
+#endif
+        asm volatile("ssync;\n");
+}
+
+/**************************************************************
+ *  タイマの停止処理
+ *
+ *  タイマの動作を停止させる.
+ **************************************************************/
+Inline void
+hw_timer_terminate()
+{
+    /*
+     *  タイマの動作を停止する.
+     */
+#ifdef USE_TIC_CORE
+    /* Core timer */
+    *pTCNTL = TMPWR | TAUTORLD;             /* 停止 */
+    *pTCNTL = 0;                            /* パワーダウンモード */
+#else
+    /* GPT7(General-purpose timer7) */
+    *pREG_TIMER0_RUN_CLR = BITM_TIMER_RUN_TMR07;
+    *pREG_TIMER0_STOP_CFG_SET = BITM_TIMER_STOP_CFG_TMR07;
+    ssync();
+    *pREG_TIMER0_TMR7_CFG = 0;
+#endif
+        asm volatile("ssync;\n");
+}
+
+
+#endif /* _MACRO_ONLY */
+#endif /* _HW_TIMER_H_ */
diff --git a/jsp/config/blackfin/_common_bf609/sys_rename.def b/jsp/config/blackfin/_common_bf609/sys_rename.def
new file mode 100644 (file)
index 0000000..6b882a6
--- /dev/null
@@ -0,0 +1,6 @@
+make_priority_mask
+device_dispatcher
+boot_for_gdb
+siopinib_table
+sprious_int_handler
+sprious_exp_handler
diff --git a/jsp/config/blackfin/_common_bf609/sys_rename.h b/jsp/config/blackfin/_common_bf609/sys_rename.h
new file mode 100644 (file)
index 0000000..5c47631
--- /dev/null
@@ -0,0 +1,27 @@
+/* This file is generated from sys_rename.def by genrename. */
+
+#ifndef _SYS_RENAME_H_
+#define _SYS_RENAME_H_
+
+#define make_priority_mask      _kernel_make_priority_mask
+#define device_dispatcher       _kernel_device_dispatcher
+#define boot_for_gdb            _kernel_boot_for_gdb
+#define siopinib_table          _kernel_siopinib_table
+#define sprious_int_handler _kernel_sprious_int_handler
+#define sprious_exp_handler _kernel_sprious_exp_handler
+
+
+
+
+
+#ifdef LABEL_ASM
+
+#define _make_priority_mask __kernel_make_priority_mask
+#define _device_dispatcher      __kernel_device_dispatcher
+#define _boot_for_gdb           __kernel_boot_for_gdb
+#define _siopinib_table     __kernel_siopinib_table
+#define _sprious_int_handler    __kernel_sprious_int_handler
+#define _sprious_exp_handler    __kernel_sprious_exp_handler
+
+#endif /* LABEL_ASM */
+#endif /* _SYS_RENAME_H_ */
diff --git a/jsp/config/blackfin/_common_bf609/sys_unrename.h b/jsp/config/blackfin/_common_bf609/sys_unrename.h
new file mode 100644 (file)
index 0000000..ee9dd28
--- /dev/null
@@ -0,0 +1,23 @@
+/* This file is generated from sys_rename.def by genrename. */
+
+#ifdef _SYS_UNRENAME_H_
+#undef _SYS_UNRENAME_H_
+
+#undef make_priority_mask
+#undef device_dispatcher
+#undef boot_for_gdb
+#undef siopinib_table
+#undef sprious_int_handler
+#undef sprious_exp_handler
+
+#ifdef LABEL_ASM
+
+#undef _make_priority_mask
+#undef _device_dispatcher
+#undef _boot_for_gdb
+#undef _siopinib_table
+#undef _sprious_int_handler
+#undef _sprious_exp_handler
+
+#endif /* LABEL_ASM */
+#endif /* _SYS_UNRENAME_H_ */
diff --git a/jsp/config/blackfin/ucb_bf609/Makefile.config b/jsp/config/blackfin/ucb_bf609/Makefile.config
new file mode 100644 (file)
index 0000000..1a6e895
--- /dev/null
@@ -0,0 +1,25 @@
+#
+#      Makefile のターゲットシステム依存部(UCB-BF609用)
+#
+
+#
+#  コンパイルオプション
+#
+INCLUDES := $(INCLUDES) -I$(SRCDIR)/config/$(CPU)/$(SYS)  -I$(SRCDIR)/config/$(CPU)/_common_bf609 \
+                       -I$(SRCDIR)/pdic/simple_sio
+COPTS := $(COPTS)
+LDFLAGS := $(LDFLAGS)
+
+#
+#  カーネルに関する定義
+#
+KERNEL_DIR := $(KERNEL_DIR):$(SRCDIR)/config/$(CPU)/$(SYS):$(SRCDIR)/config/$(CPU)/_common_bf609 \
+                               :$(SRCDIR)/pdic/simple_sio
+KERNEL_ASMOBJS := $(KERNEL_ASMOBJS)
+KERNEL_COBJS := $(KERNEL_COBJS) chip_config.o uart_bf6xx.o chip_debugboot.o chip_dump.o
+
+#
+#  リンカスクリプトの定義
+#
+LDSCRIPT = $(CPU)/_common_bf609/bf609_core0_elf.ld
+
diff --git a/jsp/config/blackfin/ucb_bf609/readme.txt b/jsp/config/blackfin/ucb_bf609/readme.txt
new file mode 100644 (file)
index 0000000..345c3d1
--- /dev/null
@@ -0,0 +1,13 @@
+Kaneko System製 UCB-BF609システム依存部。
+
+sys_config.hとsys_defs.hは、#include_nextを使って、それぞれblackfin/_common_bf609/sys_config.h
+とblackfin/_common_bf609/sys_defs.hを読み込んでいる。
+
+Makefile.configは、インクルード・パスおよびソースファイルへのパスとしてblackfin/_common_bf609も
+指定している。
+
+- Makefile.config : gnu環境のためのシステム依存部定義ファイル
+- readme.txt : このファイル
+- sys_config.h : システム依存部のうち、アプリケーションから見えない宣言
+- sys_defs.h : システム依存部のうち、アプリケーションから見える宣言
+
diff --git a/jsp/config/blackfin/ucb_bf609/sys_config.h b/jsp/config/blackfin/ucb_bf609/sys_config.h
new file mode 100644 (file)
index 0000000..e134eb2
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ *
+ */
+
+
+#ifndef _SYS_CONFIG_H_
+#define _SYS_CONFIG_H_
+
+
+/*
+ *  カーネルの内部識別名のリネーム
+ */
+#include <sys_rename.h>
+
+#include <chip_config.h>
+
+/*
+ *  ターゲットシステム依存モジュール(UCB-BF609用)
+ *
+ *  このインクルードファイルは,t_config.h のみからインクルードされる.
+ *  他のファイルから直接インクルードしてはならない.
+*/
+
+/*
+ * ADSP-BF609に依存せず、ボードへの実装によって決まるパラメータを
+ * ここで定義する。
+ */
+
+/*
+ * どのようなクロック入力にも対応できるよう、以下でCGUのレジスタの値
+ * とクロック入力周波数(Hz)を指定する。PLLのプログラムはsys_config.cの
+ * sys_initialize()関数で行われる。
+ * OSELはOUTCLKのディバイダの設定値を定義し、出力EN設定は管理しない
+ *
+ * 範囲
+ * MSELVAL  : 1~127
+ * CSELVAL  : 1~31
+ * S0SELVAL : 1~31
+ * S0SELVAL : 1~7
+ * S1SELVAL : 1~7
+ * DSELVAL  : 1~31
+ * OSELVAL  : 1~127
+ * DFVAL    : 0~1 (PLLの入力クロックを1/2にする場合1を設定)
+ * CLKINの単位はHz
+ *
+ * VCO   = 25MHz * 20 = 500MHz
+ * CCLK  = VCO / CSEL = 500MHz
+ * S0CLK = VCO / SSEL / S0SEL = 125MHz
+ * S1CLK = VCO / SSEL / S1SEL = 125MHz
+ * DCLK  = VCO / DSELL = 250MHz
+ * OCLK  = VCO / OSEL = 100MHz
+ */
+
+#define MSELVAL   20
+#define CSELVAL   1
+#define S0SELVAL  1
+#define SYSSELVAL 4
+#define S1SELVAL  1
+#define DSELVAL   2
+#define OSELVAL   5
+#define CLKIN     25000000
+#define DFVAL     0
+
+/*
+ * TIC用タイマーの選択
+ * USE_TIC_COREをdefineすると、COREタイマーが使用される
+ * コメントアウトすると、GP_TIMER_7を使用する
+ *
+ * COREタイマーはwakeup信号を生成しないため、ディスパッチャ
+ * はidle命令を使ってCOREタイマーイベントを待つことができない。
+ * そのため、USE_TIC_COREを使うとディスパッチャはidle命令を
+ * 使わずに割り込み発生をポーリングで待つ。これは消費電力の
+ * 点で不利である。
+ *
+ */
+//#define USE_TIC_CORE
+
+/*
+ * ハードウェア・エラー割り込みの許可
+ * QUICK_HW_ERRORをdefineすると、ハードウェア・エラー・イベント
+ * が即座に受理される。defineしない場合には、割り込み待ち状態で
+ * ハードウェア・エラー・割り込みが発生した場合、次の割り込みまで
+ * 待たされることになる。
+ *
+ */
+//#define QUICK_HW_ERROR
+
+
+/*
+ * 実行時初期化関数の使用
+ *
+ * マクロ USE_RUNTIME_INIT を定義すると、start.asmのなかで _mi_initialize
+ * を呼び出す。この関数はノーブートモードで起動するときにのみ必要になるので
+ * 通常は USE_RUNTIME_INITを使う必要はない。
+ * 詳細はADIのEE239に詳しい。http://tinyurl.com/2hpbk (tinyURL)
+ *
+*/
+//#define USE_RUNTIME_INIT
+
+/*
+ * カーネル管理外割り込みの宣言
+ *
+ * マクロUNMANAGED_INTはカーネル管理外割り込みを宣言する。この
+ * マクロは16ビットのビットマップになっており、以下にあるパターン
+ * のうちひとつを使う。なお、どのようなパターンを選んでもNMIは管理外
+ * 割込みとして扱われる。
+ * UNMANAGED_INTを宣言しない場合、NMIだけが管理外割込みとして扱われる。
+ *
+*/
+//#define UNMANAGED_INT 0x0020          // IVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x0060          // IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x00E0          // IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x01E0          // IVG8 ... IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x03E0          // IVG9 ... IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x07E0          // IVG10 ... IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x0FE0          // IVG11 ... IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x1FE0          // IVG12 ... IVG7, IVTMRとIVHWがカーネル管理外.
+//#define UNMANAGED_INT 0x3FE0          // IVG13 ... IVG7, IVTMRとIVHWがカーネル管理外.
+
+/*
+ * C++関連資源を用意する
+ *
+ * マクロINIT_C_PLUS_PLUSを定義すると、C++言語用のテーブルを
+ * 初期化コードを実行する。また、C++言語用のテーブルを宣言する
+ *
+*/
+//#define INIT_C_PLUS_PLUS
+
+/*
+ * SECの設定
+ */
+/* SECのLOCK機構を使用する場合1 */
+#define SEC_ENABLE_LOCKING             (0)
+
+
+/*
+ *  起動メッセージのターゲットシステム名
+ */
+#define TARGET_NAME "UCB-BF609"
+
+
+/*
+ *  シリアルポート数の定義
+ *  TNUM_SIOP_XXXは、UARTの種別ごとに宣言する。
+ *  TNUM_SIOP_UARTはBF548内蔵UARTのうち、PDICが使用するもの。
+ *  TNUM_PORTは、TNUM_SIOP_XXXのうち、GDICが使用するものの総和。
+ *  uart.cで使う。
+ */
+#define TNUM_PORT   2       /* GDICがサポートするシリアルポートの数 */
+#define TNUM_SIOP_UART  2   /* PIDCがサポートするシリアルポートの数 */
+
+/*
+ *  シリアルポート番号に関する定義
+ *  ログタスクがシリアルポートを使わない場合は無視していい。
+ */
+#define LOGTASK_PORTID  1   /* システムログに用いるシリアルポート番号 */
+
+/*  UART0のボーレート. */
+#define UART0_BAUD_RATE 57600       /* 57600 bps*/
+#define UART1_BAUD_RATE 57600       /* 57600 bps*/
+
+/*
+ * PLLの初期化の強制
+ * PLLは、PLL_CTLレジスタがデフォルト値で、かつ、SDRAMコントローラが
+ * ディセーブルのときに限り初期化を行うようになっている。これは、ブート
+ * ローダーなどの初期化ソフトがSDRAMを初期化したときにそれを保護するため
+ * である。一方でVisualDSP++のデバッガはSDRAMを自分で初期化するため、
+ * この機能とうまく折り合いがつかない場合がある。
+ * 上京に関わらず常に初期化したい時には FORCE_PLL_INITIALIZE マクロを
+ * 宣言する。
+ */
+#define FORCE_PLL_INITIALIZE
+
+#endif /* _SYS_CONFIG_H_ */
diff --git a/jsp/config/blackfin/ucb_bf609/sys_defs.h b/jsp/config/blackfin/ucb_bf609/sys_defs.h
new file mode 100644 (file)
index 0000000..6be3af2
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ *
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ *
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ *
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ *
+ *
+ */
+
+
+/*
+ *  ターゲットシステムに依存する定義(UCB-BF609用)
+ *
+ *  このインクルードファイルは,kernel.h と sil.h でインクルードされる.
+ *  他のファイルから直接インクルードすることはない.このファイルをイン
+ *  クルードする前に,t_stddef.h と itron.h がインクルードされるので,
+ *  それらに依存してもよい.
+ */
+
+#ifndef _SYS_DEFS_H_
+#define _SYS_DEFS_H_
+
+#include <chip_defs.h>
+
+ /* システム略称 */
+#define UCB_BF609
+
+
+/*
+ *  破壊性読み出しレジスタの判別式
+ *  与えられたアドレス iop が破壊性読み出しレジスタの
+ *  場合には真を返す。
+ *
+ *  ADSP-BF609の内蔵ペリフェラルについて考慮する必要はない
+ *  宣言しない場合は、デフォルトで外部ペリフェラルはすべて
+ *  破壊性読み出しとして扱われる
+ */
+// #define DESTRUCTIVE_READ( iop ) (iop<(VP)0xF0000000) 
+
+
+#endif /* _SYS_DEFS_H_ */
diff --git a/jsp/pdic/simple_sio/uart_bf6xx.c b/jsp/pdic/simple_sio/uart_bf6xx.c
new file mode 100644 (file)
index 0000000..eb93174
--- /dev/null
@@ -0,0 +1,508 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ * 
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ * 
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation 
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ * 
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ * 
+ */
+
+/*
+ *   ADSP-BF60x UART用 簡易SIOドライバ
+ *
+ *   このファイルは、TOPPERS/JSP for Blackfin の pdic/simple_sio/uart.cを
+ *   リネームし、ADSP-BF6xx用に修正したものである。
+ *   BF5xxからの変更が大きいため、ドライバファイルを分けた。
+ *   8250, 16450, 16550と構成が違うため、互換性は考慮していない。
+ */
+#include <s_services.h>
+#include "uart_bf6xx.h"
+
+/*
+ * BF6xx UARTレジスタのアドレス・オフセット。UART_REVIDを基点とする。
+ * uart.cで使用されていたUART_BOUNDARYは廃止する。
+ */
+#define REG_UART_REVID                 0x00000000
+#define REG_UART_CTL                   0x00000004
+#define REG_UART_STAT                  0x00000008
+#define REG_UART_SCR                   0x0000000C
+#define REG_UART_CLK                   0x00000010
+#define REG_UART_IMSK                  0x00000014
+#define REG_UART_IMSK_SET              0x00000018
+#define REG_UART_IMSK_CLR              0x0000001C
+#define REG_UART_RBR                   0x00000020
+#define REG_UART_THR                   0x00000024
+#define REG_UART_TAIP                  0x00000028
+#define REG_UART_TSR                   0x0000002C
+#define REG_UART_RSR                   0x00000030
+#define REG_UART_TXCNT                 0x00000034
+#define REG_UART_RXCNT                 0x00000038
+
+/*
+ * レジスタのビットマスク。特殊機能を追加しない限り、書き換えなくてよい。
+ */
+
+#define ISR_TX            0x00000020           /* Transmit Finished (ETFI) */
+#define IER_TX            0x00000020           /* Transmit Buffer Empty (ETBEI) */
+#define ISR_RX            0x00000040           /* Receive FIFO Count interrupt(BRFCI) */
+#define IER_RX            0x00000040           /* Receive FIFO Count interrupt(BRFCI) */
+
+#define LCR_NP_8_1        0x00000301        /* 8bit,1stop,Noparity,No break */
+#define LSR_RX_DATA_READY 0x00000001
+#define LSR_TX_EMPTY      0x00000020
+
+
+/*
+ * TNUM_SIOP_UART, UART0_ADDRESS, UART0_DIVISOR はsys_config.hで定義する。
+ *  TNUM_SIOP_UART : PDICが管理するUARTの個数
+ *  以下、PDICが管理する最初のUARTの情報
+ *      UART0_ADDRESS :         UARTx_REVIDのアドレス
+ *      UART0_DIVISOR :         UARTx_CLKの初期値(16bit表記)
+ *  二つ目以降のUARTがあるなら以下のように続ける。
+ *      UART1_ADDRESS :         UARTx_REVIDのアドレス
+ *      UART1_DIVISOR :         UARTx_CLKの初期値(16bit表記)
+ *  ...
+ */
+
+
+/******************************************************************************************
+ * シリアルI/Oポート初期化ブロック
+ */
+#if TNUM_SIOP_UART == 0 
+#error "If you don't use UART, please remove this file from your make file" 
+#endif
+
+#if TNUM_SIOP_UART > 3
+#error "Only TNUM_SIOP_UART < 4 is supported" 
+#endif /* TNUM_SIOP_UART >= 2 */    
+
+SIOPINIB siopinib_table[TNUM_SIOP_UART] = {
+/*-----------------------------------------------------------------
+ *          PDICが管理する最初のUARTの初期化パラメータ 
+ */
+    {UART0_ADDRESS,  UART0_DIVISOR}
+
+/*-----------------------------------------------------------------
+ *          PDICが管理する2番目のUARTの初期化パラメータ 
+ */
+
+#if TNUM_SIOP_UART > 1
+    ,{UART1_ADDRESS,    UART1_DIVISOR}
+#endif /* if TNUM_SIOP_UART > 1*/
+
+/*-----------------------------------------------------------------
+ *          PDICが管理する3番目のUARTの初期化パラメータ 
+ */
+#if TNUM_SIOP_UART > 2
+    ,{UART2_ADDRESS,    UART2_DIVISOR}
+#endif /* if TNUM_SIOP_UART > 2*/
+
+};
+
+/*
+ * シリアルI/Oポート初期化ブロックここまで。
+ ******************************************************************************************/
+
+
+
+/*
+ *  シリアルI/Oポート初期化ブロックの取出し
+ */
+#define INDEX_SIOPINIB(siopid)  ((UINT)((siopid) - 1))
+#define get_siopinib(siopid)  (&(siopinib_table[INDEX_SIOPINIB(siopid)]))
+
+
+/*
+ *  シリアルI/Oポート管理ブロックのエリア
+ */
+static SIOPCB  siopcb_table[TNUM_SIOP_UART];
+
+/*
+ *  シリアルI/OポートIDから管理ブロックを取り出すためのマクロ
+ */
+#define INDEX_SIOP(siopid)  ((UINT)((siopid) - 1))
+#define get_siopcb(siopid)  (&(siopcb_table[INDEX_SIOP(siopid)]))
+
+Inline void
+uart_write(UW addr, UW offset, UW val)
+{
+#ifdef UART_IOP_ACCESS
+    sil_wrw_iop((VP)(addr + offset),val);
+#else
+    sil_wrw_mem((VP)(addr + offset),val);
+#endif
+}
+
+Inline UW
+uart_read(UW addr, UW offset)
+{
+#ifdef UART_IOP_ACCESS
+    return sil_rew_iop((VP)(addr + offset));
+#else
+    return sil_rew_mem((VP)(addr + offset));
+#endif
+}
+
+
+/*
+ * 文字を受信したか?
+ */ 
+Inline BOOL
+uart_getready(SIOPCB *siopcb)
+{
+    UW status;
+
+    status = uart_read(siopcb->siopinib->reg_base, REG_UART_STAT);
+    
+    return (status & LSR_RX_DATA_READY);
+}
+
+/*
+ * 文字を送信できるか?
+ */
+Inline BOOL
+uart_putready(SIOPCB *siopcb)
+{
+    UW status;
+
+    status = uart_read(siopcb->siopinib->reg_base, REG_UART_STAT);
+    
+    return (status & LSR_TX_EMPTY);
+}
+
+/*
+ *  受信した文字の取り出し
+ */
+Inline UB
+uart_getchar(SIOPCB *siopcb)
+{
+    return uart_read(siopcb->siopinib->reg_base, REG_UART_RBR);
+}
+
+/*
+ *  送信する文字の書き込み
+ */
+Inline void
+uart_putchar(SIOPCB *siopcb, UB c)
+{
+    uart_write(siopcb->siopinib->reg_base, REG_UART_THR, c);
+}
+
+/*
+ *  送信割込み許可
+ */
+Inline void
+uart_enable_send(SIOPCB *siopcb)
+{
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_SET, IER_TX);
+}
+
+/*
+ *  送信割込み禁止
+ */
+Inline void
+uart_disable_send(SIOPCB *siopcb)
+{
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_CLR, IER_TX);
+}
+
+/*
+ *  受信割込み許可
+ */
+Inline void
+uart_enable_rcv(SIOPCB *siopcb)
+{
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_SET, IER_RX);
+}
+
+/*
+ *  受信割込み禁止
+ */
+Inline void
+uart_disable_rcv(SIOPCB *siopcb)
+{
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_CLR, IER_RX);
+}
+
+
+/*
+ *  SIOドライバの初期化ルーチン
+ */
+void
+uart_initialize()
+{
+    SIOPCB  *siopcb;
+    UINT    i;
+
+    /*
+     *  シリアルI/Oポート管理ブロックの初期化
+     */
+    for (siopcb = siopcb_table, i = 0; i < TNUM_SIOP_UART; siopcb++, i++) {
+        siopcb->siopinib = &(siopinib_table[i]);
+        siopcb->openflag = FALSE;
+        siopcb->sendflag = FALSE;
+    }
+}
+
+    
+/*
+ *
+ */
+void
+uart_init_siopinib(const SIOPINIB *siopinib)
+{
+
+    /*
+     *  分周比の設定
+     */
+    uart_write(siopinib->reg_base, REG_UART_CLK, siopinib->clk_div_val);
+
+    /* モード設定, パリティ無し 8bit data, 1 stop bit */
+    uart_write(siopinib->reg_base, REG_UART_CTL, LCR_NP_8_1);
+
+    /* 割込み禁止 */
+    uart_write(siopinib->reg_base, REG_UART_IMSK_CLR, 0xFFFFFFFFu);
+}
+
+
+/*
+ *  カーネル起動時のバナー出力用の初期化
+ */
+void 
+uart_init(void)
+{
+    int i;
+    /*
+     * すべてのuartを初期化する。id は1からTNUM_SIOP_UARTまで。
+     */
+    for ( i=1; i<=TNUM_SIOP_UART; i++ )
+        uart_init_siopinib(get_siopinib(i));
+}
+
+/*
+ * オープンしているポートがあるか
+ */
+BOOL
+uart_openflag(void)
+{
+    int i;
+    
+    /*
+     * 開いているポートがあれば0を返す。なければ0を返す。
+     */
+    for ( i=0; i<TNUM_SIOP_UART; i++ )
+        if (siopcb_table[0].openflag)
+            return 1;
+    return 0;
+}
+
+
+/*
+ * シリアルI/Oポートのオープン
+ */
+SIOPCB *
+uart_opn_por(ID siopid, VP_INT exinf)
+{
+    SIOPCB      *siopcb;
+    const SIOPINIB  *siopinib;
+
+    siopcb = get_siopcb(siopid);
+    siopinib = siopcb->siopinib;
+    
+    /*
+     * 初期化
+     */
+    uart_init_siopinib(siopcb->siopinib);
+
+    /* 受信割込み許可 */
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_SET, IER_RX);
+
+    siopcb->exinf = exinf;
+    siopcb->getready = siopcb->putready = FALSE;
+    siopcb->openflag = TRUE;
+
+    return siopcb;
+}
+
+/*
+ *  シリアルI/Oポートのクローズ
+ */
+void
+uart_cls_por(SIOPCB *siopcb)
+{
+    /* 割込み禁止 */
+    uart_write(siopcb->siopinib->reg_base, REG_UART_IMSK_CLR, 0xFFFFFFFFU);
+    siopcb->openflag = FALSE;
+}
+
+
+/*
+ *  シリアルI/Oポートへのポーリングでの出力
+ */
+void
+uart_pol_putc(char c, ID siopid)
+{
+    const SIOPINIB *siopinib;
+    
+    siopinib = get_siopinib(siopid);
+    
+    while((uart_read(siopinib->reg_base, REG_UART_STAT) & LSR_TX_EMPTY)
+          != LSR_TX_EMPTY)
+        ;
+    uart_write(siopinib->reg_base, REG_UART_THR, c);
+}
+
+
+/*
+ *  シリアルI/Oポートへの文字送信
+ */
+BOOL
+uart_snd_chr(SIOPCB *siopcb, char c)
+{
+    if (uart_putready(siopcb)){
+        uart_putchar(siopcb, c);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+/*
+ *  シリアルI/Oポートからの文字受信
+ */
+INT
+uart_rcv_chr(SIOPCB *siopcb)
+{
+    if (uart_getready(siopcb)) {
+        return (INT)(UB) uart_getchar(siopcb);
+    }
+    return -1;
+}
+
+
+
+
+
+/*
+ *  シリアルI/Oポートからのコールバックの許可
+ */
+void
+uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn)
+{
+
+    switch (cbrtn) {
+        case SIO_ERDY_SND:
+            uart_enable_send(siopcb);
+            break;
+        case SIO_ERDY_RCV:
+            uart_enable_rcv(siopcb);
+            break;
+    }
+}
+
+/*
+ *  シリアルI/Oポートからのコールバックの禁止
+ */
+void
+uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn)
+{
+    switch (cbrtn) {
+        case SIO_ERDY_SND:
+            uart_disable_send(siopcb);
+            break;
+        case SIO_ERDY_RCV:
+            uart_disable_rcv(siopcb);
+            break;
+    }
+}
+
+/*
+ *  シリアルI/Oポートに対する割込み処理
+ */
+static void
+uart_rx_isr_siop(SIOPCB *siopcb)
+{
+    if (uart_getready(siopcb)) {
+        /*
+         *  受信通知コールバックルーチンを呼び出す.
+         */
+        uart_ierdy_rcv(siopcb->exinf);
+    }
+}
+
+static void
+uart_tx_isr_siop(SIOPCB *siopcb)
+{
+    if (uart_putready(siopcb)) {
+        /*
+         *  送信可能コールバックルーチンを呼び出す.
+         */
+        uart_ierdy_snd(siopcb->exinf);
+    }
+}
+
+/*
+ *  SIOの割込みサービスルーチン
+ */
+void uart0_isr()
+{
+       unsigned int uart_stat = uart_read(siopcb_table[0].siopinib->reg_base, REG_UART_STAT);
+    /* 下位の受信処理を呼ぶ */
+    uart_rx_isr_siop(&(siopcb_table[0]));
+    /* 下位の送信処理を呼ぶ */
+    uart_tx_isr_siop(&(siopcb_table[0]));
+    uart_write(siopcb_table[0].siopinib->reg_base, REG_UART_STAT, uart_stat);
+}
+
+void uart1_isr()
+{
+       unsigned int uart_stat = uart_read(siopcb_table[1].siopinib->reg_base, REG_UART_STAT);
+    /* 下位の受信処理を呼ぶ */
+    uart_rx_isr_siop(&(siopcb_table[1]));
+    /* 下位の送信処理を呼ぶ */
+    uart_tx_isr_siop(&(siopcb_table[1]));
+    uart_write(siopcb_table[1].siopinib->reg_base, REG_UART_STAT, uart_stat);
+}
+
+void uart2_isr()
+{
+       unsigned int uart_stat = uart_read(siopcb_table[2].siopinib->reg_base, REG_UART_STAT);
+    /* 下位の受信処理を呼ぶ */
+    uart_rx_isr_siop(&(siopcb_table[2]));
+    /* 下位の送信処理を呼ぶ */
+    uart_tx_isr_siop(&(siopcb_table[2]));
+    uart_write(siopcb_table[2].siopinib->reg_base, REG_UART_STAT, uart_stat);
+}
diff --git a/jsp/pdic/simple_sio/uart_bf6xx.h b/jsp/pdic/simple_sio/uart_bf6xx.h
new file mode 100644 (file)
index 0000000..c01a044
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ *  TOPPERS/JSP Kernel
+ *      Toyohashi Open Platform for Embedded Real-Time Systems/
+ *      Just Standard Profile Kernel
+ * 
+ *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+ *                              Toyohashi Univ. of Technology, JAPAN
+ * 
+ *  TOPPERS/JSP for Blackfin
+ *
+ *  Copyright (C) 2004,2006,2009 by Takemasa Nakamura
+ *  Copyright (C) 2004 by Ujinosuke
+ *  Copyright (C) 2010-2013 by Kaneko System Co., Ltd.
+ *
+ *  上記著作権者は,以下の (1)縲鰀(4) の条件か,Free Software Foundation 
+ *  によって公表されている GNU General Public License の Version 2 に記
+ *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
+ *  を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
+ *  利用と呼ぶ)することを無償で許諾する.
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
+ *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
+ *      スコード中に含まれていること.
+ *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
+ *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
+ *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
+ *      の無保証規定を掲載すること.
+ *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
+ *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
+ *      と.
+ *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
+ *        作権表示,この利用条件および下記の無保証規定を掲載すること.
+ *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
+ *        報告すること.
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
+ * 
+ *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
+ *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
+ *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
+ *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
+ * 
+ */
+
+/*
+ *   ADSP-BF60x UART用 簡易SIOドライバ
+ *
+ *   このファイルは、TOPPERS/JSP for Blackfin の pdic/simple_sio/uart.cを
+ *   リネームし、ADSP-BF6xx用に修正したものである。
+ *   BF5xxからの変更が大きいため、ドライバファイルを分けた。
+ *   8250, 16450, 16550と構成が違うため、互換性は考慮していない。
+ */
+#ifndef _UART_H_
+#define _UART_H_
+
+#include <t_config.h>
+
+/*
+ *  シリアルI/Oポート初期化ブロック
+ */
+typedef struct sio_port_initialization_block {
+    UW reg_base;        /* レジスタのベースアドレス */
+       UW clk_div_val;     /* ボーレート(UARTx_CLK)の設定値   */
+} SIOPINIB;
+
+/*
+ *  シリアルI/Oポート管理ブロック
+ */
+typedef struct sio_port_control_block {
+    const SIOPINIB  *siopinib; /* シリアルI/Oポート初期化ブロック */
+    VP_INT          exinf;     /* 拡張情報 */
+    BOOL    openflag;          /* オープン済みフラグ */
+    BOOL    sendflag;          /* 送信割込みイネーブルフラグ */
+    BOOL    getready;          /* 文字を受信した状態 */
+    BOOL    putready;          /* 文字を送信できる状態 */
+}SIOPCB;
+
+
+/*
+ *  コールバックルーチンの識別番号
+ */
+#define SIO_ERDY_SND    1u      /* 送信可能コールバック */
+#define SIO_ERDY_RCV    2u      /* 受信通知コールバック */
+
+
+/*
+ * カーネル起動時用の初期化(sys_putcを使用するため)
+ */
+extern void uart_init(void);
+
+/*
+ *  シリアルI/Oポートへのポーリングでの出力
+ */
+extern void uart_pol_putc(char c, ID siopid);
+
+
+/*
+ *  SIOドライバの初期化ルーチン
+ */
+extern void uart_initialize(void);
+
+
+/*
+ *  オープンしているポートがあるか?
+ */
+extern BOOL uart_openflag(void);
+
+
+/*
+ *  シリアルI/Oポートのオープン
+ */
+extern SIOPCB   *uart_opn_por(ID siopid, VP_INT exinf);
+
+
+/*
+ *  シリアルI/Oポートのクローズ
+ */
+extern void uart_cls_por(SIOPCB *siopcb);
+
+
+/*
+ *  シリアルI/Oポートへの文字送信
+ */
+extern BOOL uart_snd_chr(SIOPCB *siopcb, char c);
+
+
+/*
+ *  シリアルI/Oポートからの文字受信
+ */
+extern INT  uart_rcv_chr(SIOPCB *siopcb);
+
+
+/*
+ *  シリアルI/Oポートからのコールバックの許可
+ */
+extern void uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn);
+
+
+/*
+ *  シリアルI/Oポートからのコールバックの禁止
+ */
+extern void uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn);
+
+
+/*
+ *  SIOの割込みサービスルーチン
+ */
+extern void uart0_tx_isr(void);
+extern void uart0_rx_isr(void);
+
+
+/*
+ *  シリアルI/Oポートからの送信可能コールバック
+ */
+extern void uart_ierdy_snd(VP_INT exinf);
+
+
+/*
+ *  シリアルI/Oポートからの受信通知コールバック
+ */
+extern void uart_ierdy_rcv(VP_INT exinf);
+
+
+#endif