2015-04-10 16:44:37 -07:00
|
|
|
/* taskDevInt.h - APIs for managing task IRQ objects */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-2014 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-06 11:00:37 -05:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-10 16:44:37 -07:00
|
|
|
*
|
2015-10-06 11:00:37 -05:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-10 16:44:37 -07:00
|
|
|
*
|
2015-10-06 11:00:37 -05:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-10 16:44:37 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TASK_IRQ_H
|
|
|
|
#define TASK_IRQ_H
|
|
|
|
|
2015-09-13 19:03:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Microkernel Interrupt Services
|
|
|
|
* @defgroup microkernel_irq Microkernel Interrupt Services
|
|
|
|
* @ingroup microkernel_services
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-06-19 09:55:51 -04:00
|
|
|
#include <microkernel/base_api.h>
|
2015-05-11 10:46:39 -04:00
|
|
|
|
|
|
|
#define INVALID_VECTOR 0xFFFFFFFF
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-08-29 13:58:07 -04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Register a task IRQ object
|
|
|
|
*
|
|
|
|
* This routine connects a task IRQ object to a system interrupt based
|
|
|
|
* upon the specified IRQ and priority values.
|
|
|
|
*
|
|
|
|
* IRQ allocation is done via the microkernel server fiber so that simultaneous
|
|
|
|
* allocation requests are single-threaded.
|
|
|
|
*
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
* @param irq Request IRQ
|
2015-10-04 10:01:56 -04:00
|
|
|
* @param priority Requested interrupt priority
|
2015-08-29 13:58:07 -04:00
|
|
|
*
|
|
|
|
* @return assigned interrupt vector if successful, INVALID_VECTOR if not
|
|
|
|
*/
|
2015-10-04 10:01:56 -04:00
|
|
|
extern uint32_t task_irq_alloc(kirq_t irq_obj, uint32_t irq, uint32_t priority);
|
2015-09-13 19:03:22 -04:00
|
|
|
/**
|
|
|
|
* @cond internal
|
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
extern int _task_irq_test(kirq_t irq_ob, int32_t time);
|
2015-08-29 13:58:07 -04:00
|
|
|
|
2015-09-13 19:03:22 -04:00
|
|
|
/**
|
|
|
|
* @endcond
|
|
|
|
*/
|
|
|
|
|
2015-08-29 13:58:07 -04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Re-enable a task IRQ object's interrupt
|
|
|
|
*
|
|
|
|
* This re-enables the interrupt for a task IRQ object.
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
* @return N/A
|
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
extern void task_irq_ack(kirq_t irq_obj);
|
2015-08-29 13:58:07 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Free a task IRQ object
|
|
|
|
*
|
|
|
|
* The task IRQ object's interrupt is disabled, and the associated event
|
|
|
|
* is flushed; the object's interrupt vector is then freed, and the object's
|
|
|
|
* global array entry is marked as unused.
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
* @return N/A
|
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
extern void task_irq_free(kirq_t irq_obj);
|
|
|
|
|
2015-08-29 13:58:07 -04:00
|
|
|
/**
|
|
|
|
* @brief Determine if a task IRQ object has had an interrupt
|
|
|
|
*
|
|
|
|
* This tests a task IRQ object to see if it has signaled an interrupt.
|
|
|
|
* It fails immediately if no interrupt has occurred.
|
|
|
|
*
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
*
|
|
|
|
* @return RC_OK, RC_FAIL
|
|
|
|
*/
|
2015-05-11 10:46:39 -04:00
|
|
|
#define task_irq_test(irq_obj) _task_irq_test(irq_obj, TICKS_NONE)
|
2015-08-29 13:58:07 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Determine if a task IRQ object has had an interrupt and wait
|
|
|
|
*
|
|
|
|
* This tests a task IRQ object to see if it has signaled an interrupt.
|
|
|
|
* It waits forever for a interrupt to happen.
|
|
|
|
*
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
*
|
|
|
|
* @return RC_OK
|
|
|
|
*/
|
2015-05-11 10:46:39 -04:00
|
|
|
#define task_irq_test_wait(irq_obj) _task_irq_test(irq_obj, TICKS_UNLIMITED)
|
|
|
|
|
2015-05-12 09:01:47 -04:00
|
|
|
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
2015-08-29 13:58:07 -04:00
|
|
|
/**
|
|
|
|
* @brief Determine if a task IRQ object has had an interrupt and timeout
|
|
|
|
*
|
|
|
|
* This tests a task IRQ object to see if it has signaled an interrupt
|
|
|
|
* with a timeout option.
|
|
|
|
*
|
|
|
|
* @param irq_obj IRQ object identifier
|
|
|
|
* @param time Time to wait (in ticks)
|
|
|
|
*
|
|
|
|
* @return RC_OK, RC_FAIL, or RC_TIME
|
|
|
|
*/
|
2015-05-11 10:46:39 -04:00
|
|
|
#define task_irq_test_wait_timeout(irq_obj, time) _task_irq_test(irq_obj, time)
|
|
|
|
#endif
|
|
|
|
|
2015-09-13 19:03:22 -04:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
#endif /* TASK_IRQ_H */
|