Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum TN_RCode _tn_timer_start(struct TN_Timer *timer, TN_Timeout timeout)
- {
- /* ... real job is done here ... */
- }
- /*
- * Function to be called from task
- */
- enum TN_RCode tn_timer_start(struct TN_Timer *timer, TN_Timeout timeout)
- {
- TN_INTSAVE_DATA; //-- define the variable to store interrupt status,
- // it is used by TN_INT_DIS_SAVE()
- // and TN_INT_RESTORE()
- enum TN_RCode rc = TN_RC_OK;
- //-- check that function is called from right context
- if (!tn_is_task_context()){
- rc = TN_RC_WCONTEXT;
- goto out;
- }
- //-- disable interrupts
- TN_INT_DIS_SAVE();
- //-- perform real job, after all
- rc = _tn_timer_start(timer, timeout);
- //-- restore interrupts state
- TN_INT_RESTORE();
- out:
- return rc;
- }
- /*
- * Function to be called from ISR
- */
- enum TN_RCode tn_timer_istart(struct TN_Timer *timer, TN_Timeout timeout)
- {
- TN_INTSAVE_DATA_INT; //-- define the variable to store interrupt status,
- // it is used by TN_INT_DIS_SAVE()
- // and TN_INT_RESTORE()
- enum TN_RCode rc = TN_RC_OK;
- //-- check that function is called from right context
- if (!tn_is_isr_context()){
- rc = TN_RC_WCONTEXT;
- goto out;
- }
- //-- disable interrupts
- TN_INT_IDIS_SAVE();
- //-- perform real job, after all
- rc = _tn_timer_start(timer, timeout);
- //-- restore interrupts state
- TN_INT_IRESTORE();
- out:
- return rc;
- }
Add Comment
Please, Sign In to add comment