Nios II ソフトウェア開発ハンドブック Version 1.2 第6章. 例外処理 ver.1.2



Similar documents
Nios IIプロセッサ・リファレンス・ハンドブック、セクション I. Nios IIプロセッサ Ver. 1.2

Nios II - Vectored Interrupt Controller の実装

プロセッサ・アーキテクチャ

Nios® II HAL API を使用したソフトウェア・サンプル集 「Modular Scatter-Gather DMA Core」

Nios II IDE によるソフトウェア開発 セクション 2

Nios II ハードウェア・チュートリアル

Nios II ソフトウェア開発ハンドブック Version 1.2 セクション IV. 付録 

Nios II ソフトウェア開発ハンドブック Version 1.2 第5章. HAL用デバイス・ドライバの開発 ver.1.1

Nios II IDE によるソフトウェア開発 - セクション 1

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

Nios II 簡易チュートリアル

:30 12:00 I. I VI II. III. IV. a d V. VI

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

tuat1.dvi

untitled

Java演習(4) -- 変数と型 --

SystemC 2.0を用いた簡易CPUバスモデルの設計

PowerPoint Presentation

main

新・明解Java入門

Java

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル

102

01_OpenMP_osx.indd

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=


アルゴリズムとデータ構造1

FreeBSD 1

新版明解C言語 実践編

SystemC言語概論

untitled

8 if switch for while do while 2


,,,,., C Java,,.,,.,., ,,.,, i

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

WinHPC ppt

tutorial_lc.dvi

ID010-2

2


喀痰吸引

平成18年度「商品先物取引に関する実態調査」報告書

MPI MPI MPI.NET C# MPI Version2

目 目 用方 用 用 方

P03.ppt

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç


サービス付き高齢者向け住宅賠償責任保険.indd

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

C言語によるアルゴリズムとデータ構造

r02.dvi

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

: : : TSTank 2

r07.dvi

IO-PCIソフト仕様書3版.PDF

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

ohp07.dvi

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

Nios II カスタム・インストラクションによるキャスト(型変換)の高速化

untitled

複数の Nios II を構成する際の注意事項

第3章 OpenGL の基礎

アルゴリズムとデータ構造1

1.ppt

【注意事項】RXファミリ 組み込み用TCP/IP M3S-T4-Tiny

橡Pro PDF


Transcription:

6. NII52006-1.2 Nios II ISR HAL Hardware Abstraction Layer Nios II HAL ISR ISR HAL API Application Programming Interface ISR ISR C ISR ISR ISR Nios II Nios II Nios II Nios II RISC 1 1 Nios II Altera Corporation 6 1 2004 12 Preliminary

HAL status ctl0 estatus ctl1 status PIE ea r29 HAL HAL HAL ISR HAL API Application Programming Interface ISR 6 6 ISR HAL estatus EPIE ipending ipending 3 _irq_entry() alt_irq_handler() software_exception() 6 2 Altera Corporation Nios II 2004 12

_irq_entry Nios II _irq_entry software_exception alt_irq_handler <Nios II >/components/altera_nios2/hal/inc/sys/alt_irq_entry.h objdump _irq_entry _irq_entry _irq_entry: if EPIE = 0 // goto software_exception handler assembly. else if ipending = 0 // goto software_exception handler assembly. else // store pre-exception processor state // alt_irq_handler ISR call the alt_irq_handler routine restore the pre-exception processor state // issue the exception return instruction, eret.. alt_irq_handler() alt_irq_handler() HAL IRQ IRQ0 IRQ31 Altera Corporation 6 3 2004 12 Nios II

HAL alt_irq_handler() alt_irq_handler() alt_irq_handler(void) // 0 31 IRQ // ipending 1 // for i from 0 to 31: // ipending 1 if ipending[i] == 1 : // // alt_irq_arg[i] i // // void* context id // alt_irq[] ISR alt_irq[i]( alt_irq_arg[i], i ) // // break; <Nios II > /components/altera_hal/hal/src/alt_irq_register.c software_exception software_exception software_exception Nios II software_exception _irq_entry alt_irq_handler OP OPX OP OPX Nios II 6 4 Altera Corporation Nios II 2004 12

software_exception software_exception software_excetion: if encoding = trap instruction // // nop goto trap_handler else // case op / opx muli:goto mul_immed // mul:goto multiply // mulxss:goto mulxss // mulxsu:goto mulxsu // mulxuu:goto mulxuu // div:goto divide // divu:goto unsigned_division // <Nios II > /components/altera_nios2/hal/src/alt_exceptions.s alt_exceptions.s software_exception Nios II Nios II Nios II Nios II Nios II Altera Corporation 6 5 2004 12 Nios II

ISR Nios II OP OPX software_exception OP OPX Nios II Nios II Nios II software_exception null alt_exceptions.s OP OPX trap_handler Nios II software_exception HAL ISR IRQ ISR HAL 6 6 Altera Corporation Nios II 2004 12

ISR HAL API HAL ISR API MicroC/OS-II HAL API API MicroC/OS-II HAL API alt_irq_register() alt_irq_disable_all() alt_irq_enable_all() alt_irq_interruptible() alt_irq_non_interruptible() alt_irq_enabled() ISR HAL API 2 alt_irq_register() ISR HAL alt_irq_enable_all() alt_irq_disable_all() alt_irq_register() ISR HAL IRQ HAL IRQ ISR alt_irq_register() int alt_irq_register (alt_u32 id, void* context, void (*isr)(void*, alt_u32)); Altera Corporation 6 7 2004 12 Nios II

ISR id system.h IRQ IRQ 0 IRQ 31 context ISR ISR context HAL ISR isr IRQ ID 2 context id isr null ISR id alt_irq_register() alt_irq_register() 10 1 HAL API ISR ISR alt_irq_register() ISR void isr (void* context, alt_u32 id) context id alt_irq_register() ISR ISR HAL API ISR HAL ISR 6 8 Altera Corporation Nios II 2004 12

ISR ANSI C C I/O API ISR API ISR printf() stdout printf() ISR printf() ISR ISR ISR ISR ISR ISR ISR ISR ISR 70 Altera Corporation 6 9 2004 12 Nios II

ISR alt_irq_interruptible() alt_irq_non_interruptible() ISR ISR ISR MicroC/OS-II RTOS ISR MicroC/OS II HAL ISR ISR HAL alt_irq_disable_all() alt_irq_enable_all() alt_irq_enable() alt_irq_disable_all() context alt_irq_enable_all() context alt_irq_disable_all() alt_irq_enabled() 6 10 Altera Corporation Nios II 2004 12

C C ISR HAL API 4 PIO Nios II IRQ ISR PIO context ISR PIO ISR PIO IRQ ISR #include "system.h" #include "altera_avalon_pio_regs.h" #include "alt_types.h" static void handle_button_interrupts(void* context, alt_u32 id) { /* context */ volatile int* edge_capture_ptr = (volatile int*) context; /* * PIO * */ *edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE); /* */ IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE, 0); /* PIO */ IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_BASE, 0xf); } ISR HAL HAL PIO ISR #include "sys/alt_irq.h" #include "system.h"... /* */ volatile int edge_capture;... /* */ alt_irq_register(button_pio_irq, (void*) &edge_capture, handle_button_interrupts); Altera Corporation 6 11 2004 12 Nios II

ISR 1. IRQ 2. HAL handle_button_interrupts() ISR 3. handle_button_interrupts() 4. edge_capture count_binary ISR Nios II ISR ISR SDRAM RAM Nios II CPU ISR 4 34 ISR HAL ISR ISR alt_irq_entry alt_irq_handler 6 12 Altera Corporation Nios II 2004 12

ISR Nios II ISR 3 ISR ISR ISR Nios II Nios II ISR HAL -O3 6 1 Nios II 6 1. Nios II/f 8 129 78 Nios II/s 8 146 165 Nios II/e 15 362 260 6 1 (1) CPU ISR 6 1 -O3 -O2 Altera Corporation 6 13 2004 12 Nios II

ISR Nios II Nios II/f Nios II/e HAL IRQ C IRQ CPU ISR ISR HAL ISR ISR ISR ISR Nios II IDE ISR IRQ ISR ipending ctl4 IRQ ipending _irq_entry alt_irq_handler() IRQ ipending IRQ ISR 6 14 Altera Corporation Nios II 2004 12

ISR HAL ISR HAL API alt_irq_register() ISR ISR void isr (void* context, alt_u32 id) ISR ISR ISR ISR printf() C I/O alt_irq_interruptible() alt_irq_non_interruptible() ISR ISR ISR ISR Altera Corporation 6 15 2004 12 Nios II

ISR 6 16 Altera Corporation Nios II 2004 12