Altera Home Page
Literature Licensing
Buy On-Line Download

  Home   |   Products   |   Support   |   End Markets   |   Technology Center   |   Education & Events   |   Corporate   |   Buy On-Line  
  Knowledge Database   |   Devices   |   Design Software   |   Intellectual Property   |   Design Examples   |   mySupport   |   Reference Designs  

 Products
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 Functionality
      Arithmetic
      Memory
      Bus & I/O
      Logic
      Interfaces & Peripherals
      DSP
      Communications
      PLL & Clocking
  
 Design Entry
      Quartus II Project
      Tcl
      VHDL
      Verilog HDL
      C Code Examples
      DSP Builder
      TimeQuest
   On-Chip Debugging
  
 Simulation Tools
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 Legacy Examples
      Graphic Editor
      AHDL
  

MicroC/OS-II Mutex Example

The MicroC/OS-II Mutex design example demonstrates the use of MicroC/OS-II mutual exclusion semaphores (mutex). It also serves as a good starting point for designs using MicroC/OS-II with Nios® II processors. MicroC/OS-II Mutexes are very similar to semaphores and are generally used to protect shared resources and/or facilitate task synchronization. The main difference between a mutex and a regular semaphore is that a mutex has the concept of raising the priority of a task that owns the mutex.

In this MicroC/OS-II Mutex design example, two different tasks are accessing a shared resource, which, in this case, is an LCD display.

The task called task1() prints out the status of the Joint Task Action Group (JTAG) UART connection on the top line of the LCD. A "1" signifies that the JTAG UART detects a valid connection to the nios2-terminal program. A "0" signifies that the JTAG UART no longer has an connection with the nios2-terminal program. Upon start-up with STDOUT set to the JTAG UART, a valid connection is detected. If the nios2-terminal program is stopped, or the JTAG cable is disconnected, the state of the connection will change a few seconds later. The task called task2() prints out how long the system has been running on the bottom line of the LCD.

Using This Design Example

Ensure that you have installed a Nios II development kit. Download the MicroC/OS-II Mutex design example and unzip the files into a directory under <Nios II kit path>/examples/software (for example, <Nios II kit path>/examples/software/ucosII_mutex).  If installed in this directory, the design example will be available as a Nios II integrated development environment (IDE) project template. The MicroC/OS-II Mutex design example includes the project settings required to run this design example on the supported target hardware configuration. To use the MicroC/OS-II Mutex design example, simply create a new C/C++ application project in the IDE, and choose the desired project template.

Hardware Requirements

The MicroC/OS-II design example requires the following devices to be present in the target hardware design:

  • LCD character display
  • JTAG UART
  • Timer

You can run this design example on the following Nios II hardware design examples:

  • Stratix® design examples
    • Standard
    • Full Featured
  • Cyclone™ design examples
    • Standard
    • Full Featured

Feedback

Did this information help you?

If not, please log onto mySupport to file a technical request or enhancement.


These Web Site Design Examples may be used within Altera Corporation devices only and remain the property of Altera. They are being provided on an "as-is" basis and as an accommodation, and therefore all warranties, representations, or guarantees of any kind (whether express, implied or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.

 
Nios II Literature

Nios II IDE Tutorial

  Please Give Us Feedback