FreeBSD/sys/dev/isci/isci_timer.c
/**
 * @brief This callback method asks the user to create a timer and provide
 *        a handle for this timer for use in further timer interactions.
 *
 * @warning The "timer_callback" method should be executed in a mutually
 *          exlusive manner from the controller completion handler
 *          handler (refer to scic_controller_get_handler_methods()).
 *
 * @param[in]  timer_callback This parameter specifies the callback method
 *             to be invoked whenever the timer expires.
 * @param[in]  controller This parameter specifies the controller with
 *             which this timer is to be associated.
 * @param[in]  cookie This parameter specifies a piece of information that
 *             the user must retain.  This cookie is to be supplied by the
 *             user anytime a timeout occurs for the created timer.
 *
 * @return This method returns a handle to a timer object created by the
 *         user.  The handle will be utilized for all further interactions
 *         relating to this timer.
 */
@brief This callback method asks the user to create a timer and provide
a handle for this timer for use in further timer interactions.

@warning The "timer_callback" method should be executed in a mutually
exlusive manner from the controller completion handler
handler (refer to scic_controller_get_handler_methods()).

@param[in]  timer_callback This parameter specifies the callback method
to be invoked whenever the timer expires.
@param[in]  controller This parameter specifies the controller with
which this timer is to be associated.
@param[in]  cookie This parameter specifies a piece of information that
the user must retain.  This cookie is to be supplied by the
user anytime a timeout occurs for the created timer.

@return This method returns a handle to a timer object created by the
user.  The handle will be utilized for all further interactions
relating to this timer.
@brief This callback method asks the user to create a timer and provide a handle for this timer for use in further timer interactions . @warning The " timer_callback " method should be executed in a mutually exlusive manner from the controller completion handler handler ( refer to scic_controller_get_handler_methods () ) . @param [ in ] timer_callback This parameter specifies the callback method to be invoked whenever the timer expires . @param [ in ] controller This parameter specifies the controller with which this timer is to be associated . @param [ in ] cookie This parameter specifies a piece of information that the user must retain . This cookie is to be supplied by the user anytime a timeout occurs for the created timer . @return This method returns a handle to a timer object created by the user . The handle will be utilized for all further interactions relating to this timer .
void *
scif_cb_timer_create(SCI_CONTROLLER_HANDLE_T scif_controller,
    SCI_TIMER_CALLBACK_T timer_callback, void *cookie)
{
	struct ISCI_CONTROLLER *isci_controller = (struct ISCI_CONTROLLER *)
	    sci_object_get_association(scif_controller);
	struct ISCI_TIMER *timer;
	sci_pool_get(isci_controller->timer_pool, timer);
	callout_init_mtx(&timer->callout, &isci_controller->lock, FALSE);
	timer->callback = timer_callback;
	timer->cookie = cookie;
	timer->is_started = FALSE;
	isci_log_message(3, "TIMER", "create %p %p %p\n", timer, timer_callback, cookie);
	return (timer);
}
void * scif_cb_timer_create ( SCI_CONTROLLER_HANDLE_T scif_controller , SCI_TIMER_CALLBACK_T timer_callback , void * cookie ) { struct ISCI_CONTROLLER * isci_controller = ( struct ISCI_CONTROLLER * ) sci_object_get_association ( scif_controller ) ; struct ISCI_TIMER * timer ; sci_pool_get ( isci_controller -> timer_pool , timer ) ; callout_init_mtx ( & timer -> callout , & isci_controller -> lock , FALSE ) ; timer -> callback = timer_callback ; timer -> cookie = cookie ; timer -> is_started = FALSE ; isci_log_message ( 3 , " " , " \n " , timer , timer_callback , cookie ) ; return ( timer ) ; }
@brief This callback method asks the user to create a timer and provide
        a handle for this timer for use in further timer interactions.
@brief This callback method asks the user to create a timer and provide a handle for this timer for use in further timer interactions .