msp_rtprio_thread.h File Reference

API and external data structure definitions for msp rtprio threads. More...


Data Structures

struct  msp_rtprio_thread_params
 Data structure parameters for creating the rtprio thread. More...
struct  msp_rtprio_thread_args
 Data structure passed to the application's rtprio thread call back function. More...
struct  msp_rtprio_result_s
 Results of rtprio thread creation passed back the rtprio thread creater. More...

Typedefs

typedef msp_rtprio_thread_params msp_rtprio_thread_params_t
 Data structure parameters for creating the rtprio thread.
typedef msp_rtprio_thread_args msp_rtprio_thread_args_t
 Data structure passed to the application's rtprio thread call back function.
typedef msp_rtprio_result_s msp_rtprio_thread_result_t
 Results of rtprio thread creation passed back the rtprio thread creater.
typedef void *(* msp_rtprio_thread_t )(msp_rtprio_thread_args_t *)
 Syntax for the rtprio thread handler function.

Functions

int msp_rtprio_thread_create (int cpu_num, msp_rtprio_thread_t rtprio_thread_func, msp_rtprio_thread_params_t *thread_params_in, msp_rtprio_thread_result_t *thread_result)
 Install a rtprio thread on a hardware thread.
int msp_rtprio_thread_cancel (msp_rtprio_thread_result_t *thread_result)
 Cancels a rtprio thread.


Detailed Description

API and external data structure definitions for msp rtprio threads.

The msp rtprio threads are tied to one of the user CPUS on the ms-pic. They are created with SCHED_FIFO scheduling policy, and can not be preemted by the scheduler while running. There may be more than one rtprio threads attached to the same user core thread. The downside is the user application has to define, yield points while running on the context of the rtprio thread, to avoid performance penalty for other rtprio threads running on the same user CPU.


Function Documentation

int msp_rtprio_thread_cancel msp_rtprio_thread_result_t thread_result  ) 
 

Cancels a rtprio thread.

This API stops a rtprio thread tied to a user hardware thread The User CPU information will be updated accordingly, for scheduling other rtprio threads.

Parameters:
[in] *thread_result A Pointer of type msp_rtprio_thread_result_t. contains the rtprio thread specific information
Returns:
MSP_OK on success; otherwise, return the error code. MSP_INVALID_ARG - An invalid argument was passed

int msp_rtprio_thread_create int  cpu_num,
msp_rtprio_thread_t  rtprio_thread_func,
msp_rtprio_thread_params_t thread_params_in,
msp_rtprio_thread_result_t thread_result
 

Install a rtprio thread on a hardware thread.

This API intalls a rtprio thread Loop(rtprio_thread) on a user hardware thread

o A pthread which actually runs the "thread".

o The above pthread is bound to a user hardware thread

o It runs with SCHED_FIFO scheduling policy, with min priority set

All the above will automatically be taken care by the rtprio thread creation APIs.

Parameters:
[in] cpu_num Provide a user CPU number, or MSP_CPU_NONE to pick the least loaded user CPU in the pic
[in] rtprio_thread_func The function that implements the rtprio thread.
[in] *thread_params_in A Pointer of type msp_rtprio_thread_params_t. Any application-specific data can be passed in the app_data field of thread_params_in.
[out] *thread_result A Pointer of type msp_rtprio_thread_result_t. Upon success thread_result contains the useful information about the newly created rtprio thread
Returns:
MSP_OK on success; otherwise, return the error code. MSP_INVALID_ARG - A invalid argument passed MSP_MEM_ALLOC_FAIL - Could not allocate resources MSP_RTPRIO_THREAD_CREATE_FAIL - rtprio thread creation failed. MSP_RTPRIO_THREAD_INVALID_CPU - No valid CPUs MSP_ERROR - IOCTL related errors


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:47 2010 for libmp-sdk by Doxygen 1.4.5