Home/Support / Knowledge Base / Why does NET+OS have multiple methods for enabling & disabling interrupts?

Why does NET+OS have multiple methods for enabling & disabling interrupts?

    While looking through the NET+OS BSP source code, you have
found multiple methods  for enabling and disabling interrupts. This
can be confusing if you are unfamiliar with the underlying rationale. 
This knowledge base article explains the rationale for multiple
methods for enabling and disabling interrupts.

    Very early in the bootstrap process, Threadx and the C library
may not be available. Also in the ROM-based portion of the
bootloader, calling any APIs that require the C library, will cause
the bootloader to increase beyond the default 64KB size limit. In
the early stages of the bootstrap process, assembly routines are
the more acceptable method for performing some tasks. For example
bsp_printf is included in NET+OS. It is an assembly version of 
printf allowing its use for debugging early in the bootstrap process.  
NET+OS provides two sets of assembly-based interrupt control
APIs. The macros TX_DISABLE and TX_RESTORE for disabling
and enabling interrupts were developed here at Digi.
tx_interrupt_control was provided as part of the Threadx distribution
and is included in the APIs included with NET+OS. They perform
similar operations and are used interchangeably in the
NET+OS code. The main difference I can see is that to use
tx_interrupt_control you'd need to link against the Threadx library. 
To use the macros TX_DISABLE/TX_RESTORE you only need to
include tx_port.h.

    For low level interrupt control, such as in early bootstrap
processing, you want to use TX_DISABLE/TX_RESTORE. Once
Threadx is up and certainly once you are in your application,
either interrupt control method is acceptable.
Last updated: Aug 08, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us