简体   繁体   中英

Define with curly braces

I've been trying to look up information on this to no avail. Can someone explain what the curly braces do here? I'm trying to find or create the ISR function for the transmit/receive IRQ, however I am stuck here.

/** Interrupt vectors for the ENET peripheral type */
#define ENET_Transmit_IRQS                       { ENET_Transmit_IRQn }
#define ENET_Receive_IRQS                        { ENET_Receive_IRQn }

In this case ENET_Transmit_IRQn is the 83rd vector in the IRQ vector and the Rx is consecutively, 84th.

What are the curly braces for? My only logical argument is that these vectors are in a typedef enum IRQ (structure? It doesn't say struct though), and essentially it is the same as

#define ENET_Transmit_IRQS 83

PS This is for a Kinetis K66

EDIT: I just found 1 line where it is being used.

/*! @brief Pointers to enet transmit IRQ number for each instance. */
static const IRQn_Type s_enetTxIrqId[] = ENET_Transmit_IRQS;

Where IRQn_Type is

typedef enum IRQn {
...
  ENET_1588_Timer_IRQn         = 82,               /**< Ethernet MAC IEEE 1588 Timer Interrupt */
  ENET_Transmit_IRQn           = 83,               /**< Ethernet MAC Transmit Interrupt */
  ENET_Receive_IRQn            = 84,               /**< Ethernet MAC Receive Interrupt */
  ENET_Error_IRQn              = 85,               /**< Ethernet MAC Error and miscelaneous Interrupt */
...
} IRQn_Type;

I think I understand this now with the help of Eugene (thanks!!). It has curly braces because it is being used as an initializer for an array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM