void SetPinInCap(int pin, int incap_num, int enable) { log_printf("SetPinInCap(%d, %d, %d)", pin, incap_num, enable); int rpin = enable ? PinToRpin(pin) : 0x3F; switch (incap_num) { #define CASE(num, unused) \ case num - 1: \ _IC##num##R = rpin; \ break; REPEAT_1B(CASE, NUM_INCAP_MODULES); } }
#define RX_PRIORITY 4 typedef struct { volatile int num_tx_since_last_report; BYTE_QUEUE rx_queue; BYTE_QUEUE tx_queue; BYTE rx_buffer[RX_BUF_SIZE]; BYTE tx_buffer[TX_BUF_SIZE]; } UART_STATE; static UART_STATE uarts[NUM_UART_MODULES]; #define _UARTREG_REF_COMMA(num, dummy) (volatile UART*) &U##num##MODE, volatile UART* uart_reg[NUM_UART_MODULES] = { REPEAT_1B(_UARTREG_REF_COMMA, NUM_UART_MODULES, 0) }; static void UARTConfigInternal(int uart_num, int rate, int speed4x, int two_stop_bits, int parity, int external); void UARTInit() { int i; for (i = 0; i < NUM_UART_MODULES; ++i) { UARTConfigInternal(i, 0, 0, 0, 0, 0); AssignUxRXIP(i, RX_PRIORITY); // RX int. priority AssignUxTXIP(i, TX_PRIORITY); // TX int. priority } } static inline void UARTSendStatus(int uart_num, int enabled) { OUTGOING_MESSAGE msg;