## NAME

checkIstack - Interrupt stack information

## SYNOPSIS

#include <sys.h>

int _isrStackFill;
void checkIstack(stackinfo_t *info);

## DESCRIPTION

The checkIstack() function returns the interrupt stack information in the pointer info. This pointer fields are discribed here: pthread_stackinfo().
To utilize checkIstack(), the interrupt stack must be initalized to known values through the use of the _isrStackFill initialization variable. This variable is assigned a non-zero value before kernel initialization to enable stack monitoring.

## EXAMPLE

During the initial startup (typically within setup.c), the control flag to fill the interrupt stack may be set to a non-zero value to enable monitoring.

Enabling a flag causes that particular stack area to be filled with a known value ("I" for the interrupt stack) when it is created subsequently by the kernel.

After the kernel has started and the initial user thread is established a call can be made to checkIstack() to fill the interrupt stack information in info stucture.

Additionally, the RTOS Viewer can be used to visualize either stack fills and is aware of the convention.

    #include <sys.h>

    /* the inital startup function. */
    int main()

    {
        /*disable all interrupt in interrupt controller */
        __disable_irq();

        /* 1 - fill the task stack with 'S' during initialization for debugging. */
        pthreadStackFill = 1;

        /* 2 - fill the isr stack with 'I' during initialization for debugging. */
        _isrStackFill = 1;

        /* ... the rest of the initialization code ... */
    }

After the kernel has been established, any arbitrary thread may then call checkIstack() to get interrupt stack information.

    /* some arbitarty thread. */
    THREAD threadx ()
    {
        stackinfo_t info;

        /* call checkIstack to get interrupt stack information. */
        checkIstack (&info);

        /* print interrupt stack information. */
        xprintf("ISR stack:\n");
        xprintf("  base: 0x%x\n", info.si_base);
        xprintf("  current: 0x%x\n", info.si_current);
        xprintf("  size: %d\n", info.si_size);
        xprintf("  used: %d\n\n", info.si_used);

        /* ... other code... */
    }

The following result (or similar) will be printed:

    ISR stack:
      base: 0x2004FC00
      current: 0x2004FFE0
      size: 1024
      used: 216

## RETURN VALUES

None.

## ERRORS

There are no errors defined.

## SEE ALSO

pthread_stackinfo()

#### Home page (Kernel)

## < Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >