Forked repo of Platform Drivers- Analog Devices
irq_extra.h@20:26b1a4570f4b, 2021-11-22 (annotated)
- Committer:
- Janani Sunil
- Date:
- Mon Nov 22 22:26:51 2021 +0530
- Revision:
- 20:26b1a4570f4b
- Parent:
- 17:af1f2416dd26
The following changes were made:
1.) Modified udelay() function for generating more accurate smaller usec delays
2.) Implemented the irq_enable and irq_disable functions
3.) Removed the confusion b/w application created peripheral object and interrupt specific object
4.) Created PWM extra init structure and added PWM pin as it's member for multiplatform project compatibility
5.) Added a module for timer and its related header file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file irq_extra.h |
mahphalke |
17:af1f2416dd26 | 3 | * @brief: Header containing extra types required for IRQ drivers |
mahphalke |
17:af1f2416dd26 | 4 | ******************************************************************************** |
mahphalke |
17:af1f2416dd26 | 5 | * Copyright (c) 2020-2021 Analog Devices, Inc. |
mahphalke |
17:af1f2416dd26 | 6 | * All rights reserved. |
mahphalke |
17:af1f2416dd26 | 7 | * |
mahphalke |
17:af1f2416dd26 | 8 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
17:af1f2416dd26 | 9 | * By using this software you agree to the terms of the associated |
mahphalke |
17:af1f2416dd26 | 10 | * Analog Devices Software License Agreement. |
mahphalke |
17:af1f2416dd26 | 11 | *******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 12 | |
mahphalke |
17:af1f2416dd26 | 13 | #ifndef IRQ_EXTRA_H |
mahphalke |
17:af1f2416dd26 | 14 | #define IRQ_EXTRA_H |
mahphalke |
17:af1f2416dd26 | 15 | |
mahphalke |
17:af1f2416dd26 | 16 | |
mahphalke |
17:af1f2416dd26 | 17 | // Platform support needs to be C-compatible to work with other drivers |
mahphalke |
17:af1f2416dd26 | 18 | #ifdef __cplusplus |
mahphalke |
17:af1f2416dd26 | 19 | extern "C" |
mahphalke |
17:af1f2416dd26 | 20 | { |
mahphalke |
17:af1f2416dd26 | 21 | #endif |
mahphalke |
17:af1f2416dd26 | 22 | |
mahphalke |
17:af1f2416dd26 | 23 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 24 | /***************************** Include Files **********************************/ |
mahphalke |
17:af1f2416dd26 | 25 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 26 | |
mahphalke |
17:af1f2416dd26 | 27 | #include <stdbool.h> |
mahphalke |
17:af1f2416dd26 | 28 | |
mahphalke |
17:af1f2416dd26 | 29 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 30 | /********************** Macros and Constants Definitions **********************/ |
mahphalke |
17:af1f2416dd26 | 31 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 32 | |
mahphalke |
17:af1f2416dd26 | 33 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 34 | /*************************** Types Declarations *******************************/ |
mahphalke |
17:af1f2416dd26 | 35 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 36 | |
mahphalke |
17:af1f2416dd26 | 37 | /** |
mahphalke |
17:af1f2416dd26 | 38 | * @enum irq_id |
mahphalke |
17:af1f2416dd26 | 39 | * @brief Interrupts IDs supported by the mbed irq driver |
mahphalke |
17:af1f2416dd26 | 40 | */ |
mahphalke |
17:af1f2416dd26 | 41 | enum irq_id { |
mahphalke |
17:af1f2416dd26 | 42 | /** External interrupt ID1 */ |
mahphalke |
17:af1f2416dd26 | 43 | EXTERNAL_INT_ID1, |
mahphalke |
17:af1f2416dd26 | 44 | /** External interrupt ID2 */ |
mahphalke |
17:af1f2416dd26 | 45 | EXTERNAL_INT_ID2, |
mahphalke |
17:af1f2416dd26 | 46 | /** External interrupt ID3 */ |
mahphalke |
17:af1f2416dd26 | 47 | EXTERNAL_INT_ID3, |
mahphalke |
17:af1f2416dd26 | 48 | /** External interrupt ID4 */ |
mahphalke |
17:af1f2416dd26 | 49 | EXTERNAL_INT_ID4, |
mahphalke |
17:af1f2416dd26 | 50 | /** External interrupt ID5 */ |
mahphalke |
17:af1f2416dd26 | 51 | EXTERNAL_INT_ID5, |
mahphalke |
17:af1f2416dd26 | 52 | /** UART Rx interrupt ID1 */ |
mahphalke |
17:af1f2416dd26 | 53 | UART_RX_INT_ID1, |
mahphalke |
17:af1f2416dd26 | 54 | /** Ticker interrupt ID */ |
mahphalke |
17:af1f2416dd26 | 55 | TICKER_INT_ID, |
mahphalke |
17:af1f2416dd26 | 56 | /* Number of available interrupts */ |
mahphalke |
17:af1f2416dd26 | 57 | NB_INTERRUPTS |
mahphalke |
17:af1f2416dd26 | 58 | }; |
mahphalke |
17:af1f2416dd26 | 59 | |
mahphalke |
17:af1f2416dd26 | 60 | /* |
mahphalke |
17:af1f2416dd26 | 61 | * External IRQ events |
mahphalke |
17:af1f2416dd26 | 62 | * */ |
mahphalke |
17:af1f2416dd26 | 63 | typedef enum { |
mahphalke |
17:af1f2416dd26 | 64 | EXT_IRQ_NONE, |
mahphalke |
17:af1f2416dd26 | 65 | EXT_IRQ_RISE, |
mahphalke |
17:af1f2416dd26 | 66 | EXT_IRQ_FALL |
mahphalke |
17:af1f2416dd26 | 67 | } ext_irq_event; |
mahphalke |
17:af1f2416dd26 | 68 | |
mahphalke |
17:af1f2416dd26 | 69 | /** |
mahphalke |
17:af1f2416dd26 | 70 | * @struct mbed_irq_init_param |
mahphalke |
17:af1f2416dd26 | 71 | * @brief Structure holding the extra parameters for Interrupt Request. |
mahphalke |
17:af1f2416dd26 | 72 | */ |
mahphalke |
17:af1f2416dd26 | 73 | typedef struct { |
mahphalke |
17:af1f2416dd26 | 74 | uint32_t int_mode; // Interrupt mode (falling/rising etc) |
mahphalke |
17:af1f2416dd26 | 75 | uint32_t ext_int_pin; // External Interrupt pin |
mahphalke |
17:af1f2416dd26 | 76 | uint32_t ticker_period_usec; // Time period in usec for ticker event |
Janani Sunil | 20:26b1a4570f4b | 77 | /* Application created peripheral object to attach/generate interrupt for (e.g. UART) */ |
Janani Sunil | 20:26b1a4570f4b | 78 | void *int_obj_type; |
mahphalke |
17:af1f2416dd26 | 79 | } mbed_irq_init_param; |
mahphalke |
17:af1f2416dd26 | 80 | |
mahphalke |
17:af1f2416dd26 | 81 | /** |
mahphalke |
17:af1f2416dd26 | 82 | * @struct mbed_irq_desc |
mahphalke |
17:af1f2416dd26 | 83 | * @brief Structure holding the platform descriptor for Interrupt Request. |
mahphalke |
17:af1f2416dd26 | 84 | */ |
mahphalke |
17:af1f2416dd26 | 85 | typedef struct { |
mahphalke |
17:af1f2416dd26 | 86 | uint32_t int_mode; // Interrupt mode (falling/rising etc) |
mahphalke |
17:af1f2416dd26 | 87 | uint32_t ext_int_pin; // External Interrupt pin |
mahphalke |
17:af1f2416dd26 | 88 | uint32_t ticker_period_usec; // Time period in usec for ticker event |
Janani Sunil | 20:26b1a4570f4b | 89 | void *int_obj; // Interrupt specific object (e.g. InterruptIn, Ticker) |
mahphalke |
17:af1f2416dd26 | 90 | } mbed_irq_desc; |
mahphalke |
17:af1f2416dd26 | 91 | |
mahphalke |
17:af1f2416dd26 | 92 | #ifdef __cplusplus // Closing extern c |
mahphalke |
17:af1f2416dd26 | 93 | } |
mahphalke |
17:af1f2416dd26 | 94 | #endif |
mahphalke |
17:af1f2416dd26 | 95 | |
mahphalke |
17:af1f2416dd26 | 96 | #endif // IRQ_EXTRA_H_ |