Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * "Hello World" example.
- *
- * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
- * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
- * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
- * device in your system's hardware.
- * The memory footprint of this hosted application is ~69 kbytes by default
- * using the standard reference design.
- *
- * For a reduced footprint version of this template, and an explanation of how
- * to reduce the memory footprint for a given application, see the
- * "small_hello_world" template.
- *
- */
- #include <stdio.h>
- #include <io.h>
- #include "definition.h"
- #include <system.h>
- #include <altera_avalon_mutex.h>
- #define ZERO SEGA | SEGB | SEGC | SEGD |SEGE | SEGF
- #define ONE SEGB | SEGC
- #define TWO SEGA | SEGB | SEGG | SEGE | SEGD
- #define THREE SEGA | SEGB | SEGC | SEGD | SEGG
- #define FOUR SEGB | SEGC | SEGF | SEGG
- #define FIVE SEGG | SEGC | SEGA | SEGD | SEGF
- #define SIX SEGA | SEGC | SEGD | SEGE | SEGF | SEGG
- #define SEVEN SEGB | SEGC | SEGA
- #define EIGHT SEGB | SEGC | SEGA | SEGD | SEGE | SEGF | SEGG
- #define NINE SEGB | SEGC | SEGA | SEGD | SEGF | SEGG
- #define E SEGA | SEGD | SEGE | SEGF | SEGG
- #define R SEGE | SEGG
- int main()
- {
- alt_mutex_dev* mutex = altera_avalon_mutex_open("/dev/mutex_0");
- int sw = 0;
- while(1){
- altera_avalon_mutex_lock(mutex, 1);
- sw = IORD(SHARED_MEMORY_BASE,0);
- printf("sw = %d\n", sw);
- altera_avalon_mutex_unlock(mutex);
- IOWR(LEDS_BASE, 0, sw);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement