Altera Nios II C2H Compiler Bedienungsanleitung Seite 122

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 138
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 121
6–4 9.1 Altera Corporation
Nios II C2H Compiler User Guide November 2009
Interrupt Pragma
Interrupt
Pragma
To use a hardware accelerator in interrupt mode, add the following line
to your function source code:
#pragma altera_accelerate \
enable_interrupt_for_function <function name>
At the next software compilation, the C2H Compiler creates a new header
file containing all the macros needed to use the accelerator and service the
interrupts it generates.
This pragma causes the function (which is assumed to be a top-level
accelerated function, not an accelerated subfunction) to be an interrupt-
mode accelerator. Specifically, the following things change:
The accelerator's control slave has an IRQ signal, which is asserted
every time the function has completed execution.
The polling loop in the generated driver file is removed. When the
function is called, the CPU immediately returns after launching the
accelerator.
A header file is generated, providing macros and definitions
required for you to write an ISR. The macros are summarized in
Table 6–1.
An example of this header file is shown in Example 6–4 for an
accelerated function called coprocess() in a Nios II IDE project
called my_project. The file is generated in <Project Path>/
<Configuration>, where <Project Path> is the software project
directory, and <Configuration> is the project configuration name
(Release or Debug). The file name is ACCELERATOR_<Project
Name>_<Function Name>_IRQ.h, where <Project Name> is the name
of the project (usually the same as <Project Path>), and <Function
Name> is the name of the function you are accelerating.
Table 6–1. C2H Accelerator Interrupt Macros
Purpose Macro Name
Return value
ACCELERATOR_<Project Name>_<Function Name>_GET_RETURN_VALUE()
Interrupt clear
ACCELERATOR_<Project Name>_<Function Name>_CLEAR_IRQ()
Check status
ACCELERATOR_<Project Name>_<Function Name>_BUSY()
Seitenansicht 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 137 138

Kommentare zu diesen Handbüchern

Keine Kommentare