/* Function for allocating a new operations queue entry.  */
static timer_user_op_t* user_op_alloc(timer_user_t *p_user, uint8_t *p_last_index)
/* Function for allocating a new operations queue entry.  */
static timer_user_op_t* user_op_alloc(timer_user_t *p_user, uint8_t *p_last_index)
{        
    uint8_t           last;
    timer_user_op_t * p_user_op;
    last = p_user->last + 1;
    if (last == p_user->user_op_queue_size)
    {
        last = 0;
    }
    if (last == p_user->first)
    {
        return NULL;
    }
    *p_last_index = last;    
    p_user_op     = &p_user->p_user_op_queue[p_user->last];
    return p_user_op;
}