134 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			134 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
							 | 
						||
| 
								 | 
							
								be copied by any method or incorporated into another program without
							 | 
						||
| 
								 | 
							
								the express written consent of Aerospace C.Power. This Information or any portion
							 | 
						||
| 
								 | 
							
								thereof remains the property of Aerospace C.Power. The Information contained herein
							 | 
						||
| 
								 | 
							
								is believed to be accurate and Aerospace C.Power assumes no responsibility or
							 | 
						||
| 
								 | 
							
								liability for its use in any way and conveys no license or title under
							 | 
						||
| 
								 | 
							
								any patent or copyright and makes no representation or warranty that this
							 | 
						||
| 
								 | 
							
								Information is free from patent or copyright infringement.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								****************************************************************************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef IOT_IRQ_H
							 | 
						||
| 
								 | 
							
								#define IOT_IRQ_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "irq.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_create() - create an interrupt for vector
							 | 
						||
| 
								 | 
							
								 * vector - interrupt vector
							 | 
						||
| 
								 | 
							
								 * priority - interrupt priority
							 | 
						||
| 
								 | 
							
								 * data - isr's data
							 | 
						||
| 
								 | 
							
								 * isr  - isr function
							 | 
						||
| 
								 | 
							
								 * return: 
							 | 
						||
| 
								 | 
							
								 *      NULL or interrupt handle
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								iot_irq_t iot_interrupt_create(uint32_t vector,
							 | 
						||
| 
								 | 
							
								                                uint32_t priority, 
							 | 
						||
| 
								 | 
							
								                                iot_addrword_t data,
							 | 
						||
| 
								 | 
							
								                                iot_isr_t *isr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_delete() - delete an interrupt for vector
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_delete( iot_irq_t interrupt );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_attach() - attach this interrupt. It attached isr into table.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_attach( iot_irq_t interrupt );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_detach() - deatach this interrupt. It detach isr form table.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_detach( iot_irq_t interrupt );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_mask() - mask this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_mask( iot_irq_t interrupt );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_unmask() - unmask this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_unmask( iot_irq_t interrupt);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_acknowldege() - acknowledge this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_acknowledge( iot_irq_t interrupt);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_configure() - configure this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * level  -- level trigger
							 | 
						||
| 
								 | 
							
								 * up   -- edge trigger
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_configure( iot_irq_t interrupt, uint32_t level, uint32_t up);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_priority() - set this interrupt's priority.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_priority( iot_irq_t interrupt, uint32_t priority);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_set_cpu() - set cpu's id for this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_interrupt_set_cpu( iot_irq_t interrupt, uint32_t cpu);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_get_cpu() - get cpu's id for this interrupt.
							 | 
						||
| 
								 | 
							
								 * interrupt - interrupt handle
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      cpu id
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_interrupt_get_cpu( iot_irq_t interrupt );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * iot_interrupt_init() - init interrupt controller and install default isr.
							 | 
						||
| 
								 | 
							
								 * return:
							 | 
						||
| 
								 | 
							
								 *      0 -- OK
							 | 
						||
| 
								 | 
							
								 */ 
							 | 
						||
| 
								 | 
							
								uint32_t iot_interrupt_init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* IOT_IRQ_H */
							 |