So I was reviewing the Microchip's dsPIC MCU header file and stumbled upon this construct:
/* Generic structure of entire SFR area for each UART module */
typedef struct tagUART {
uint16_t uxmode;
uint16_t uxsta;
uint16_t uxtxreg;
uint16_t uxrxreg;
uint16_t uxbrg;
} UART, *PUART;
I cannot seem to figure out what is a type or instance here (and for what end was this designed like that):
It's a kind of all-in-one form of
struct tagUART { // the structure itself with all its details
uint16_t uxmode;
uint16_t uxsta;
uint16_t uxtxreg;
uint16_t uxrxreg;
uint16_t uxbrg;
};
typedef struct tagUART UART; // UART is a shorter name for struct tagUART
typedef struct tagUART *PUART; // PUART is a pointer-type to such a struct