diff options
Diffstat (limited to 'bsps/or1k/generic_or1k/include')
-rw-r--r-- | bsps/or1k/generic_or1k/include/bsp.h | 45 | ||||
-rw-r--r-- | bsps/or1k/generic_or1k/include/bsp/generic_or1k.h | 118 | ||||
-rw-r--r-- | bsps/or1k/generic_or1k/include/bsp/irq.h | 45 | ||||
-rw-r--r-- | bsps/or1k/generic_or1k/include/bsp/uart.h | 42 | ||||
-rw-r--r-- | bsps/or1k/generic_or1k/include/tm27.h | 1 |
5 files changed, 251 insertions, 0 deletions
diff --git a/bsps/or1k/generic_or1k/include/bsp.h b/bsps/or1k/generic_or1k/include/bsp.h new file mode 100644 index 0000000000..16839930a4 --- /dev/null +++ b/bsps/or1k/generic_or1k/include/bsp.h @@ -0,0 +1,45 @@ +/** + * @file + * + * @ingroup generic_or1k + * + * @brief Global BSP definitions. + */ + +/* + * COPYRIGHT (c) 2014-2015 Hesham ALMatary <heshamelmatary@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE + */ + +#ifndef LIBBSP_GENERIC_OR1K_H +#define LIBBSP_GENERIC_OR1K_H + +#include <bspopts.h> +#include <rtems.h> +#include <bsp/generic_or1k.h> + +#include <bsp/default-initial-extension.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define BSP_FEATURE_IRQ_EXTENSION + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_GENERIC_OR1K_H */ + +/** + * @defgroup generic_or1k support + * + * @ingroup bsp_or1k + * + * @brief generic_or1k support package + * + */ diff --git a/bsps/or1k/generic_or1k/include/bsp/generic_or1k.h b/bsps/or1k/generic_or1k/include/bsp/generic_or1k.h new file mode 100644 index 0000000000..e4d9760640 --- /dev/null +++ b/bsps/or1k/generic_or1k/include/bsp/generic_or1k.h @@ -0,0 +1,118 @@ +/** + * @file + * + * @ingroup generic_or1k_reg + * + * @brief Register definitions. + */ + +/* + * COPYRIGHT (c) 2014-2015 Hesham ALMatary <heshamelmatary@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE + */ + +#ifndef LIBBSP_GENERIC_OR1K_H +#define LIBBSP_GENERIC_OR1K_H + +#include <stdint.h> + +/** + * @defgroup generic_or1k_reg Register Definitions + * + * @ingroup generic_or1k + * + * @brief Shared register definitions for or1k systems. + * + * @{ + */ + +/** + * @name Register Macros + * + * @{ + */ + + #define OR1K_REG(x) (*((volatile unsigned char *) (x))) + #define OR1K_BIT(n) (1 << (n)) + +/** @} */ + +/** + * @name Internal OR1K UART Registers + * + * @{ + */ +#define OR1K_BSP_CLOCK_FREQ 50000000UL +#define OR1K_BSP_UART_BASE 0x90000000 + +#define OR1K_BSP_UART_REG_TX (OR1K_BSP_UART_BASE+0) +#define OR1K_BSP_UART_REG_RX (OR1K_BSP_UART_BASE+0) +#define OR1K_BSP_UART_REG_DEV_LATCH_LOW (OR1K_BSP_UART_BASE+0) +#define OR1K_BSP_UART_REG_DEV_LATCH_HIGH (OR1K_BSP_UART_BASE+1) +#define OR1K_BSP_UART_REG_INT_ENABLE (OR1K_BSP_UART_BASE+1) +#define OR1K_BSP_UART_REG_INT_ID (OR1K_BSP_UART_BASE+2) +#define OR1K_BSP_UART_REG_FIFO_CTRL (OR1K_BSP_UART_BASE+2) +#define OR1K_BSP_UART_REG_LINE_CTRL (OR1K_BSP_UART_BASE+3) +#define OR1K_BSP_UART_REG_MODEM_CTRL (OR1K_BSP_UART_BASE+4) +#define OR1K_BSP_UART_REG_LINE_STATUS (OR1K_BSP_UART_BASE+5) +#define OR1K_BSP_UART_REG_MODEM_STATUS (OR1K_BSP_UART_BASE+6) +#define OR1K_BSP_UART_REG_SCRATCH (OR1K_BSP_UART_BASE+7) + +/* FIFO Control Register */ +#define OR1K_BSP_UART_REG_FIFO_CTRL_TRIGGER_1 (0x00) +#define OR1K_BSP_UART_REG_FIFO_CTRL_ENABLE_FIFO (0x01) +#define OR1K_BSP_UART_REG_FIFO_CTRL_CLEAR_RCVR (0x02) +#define OR1K_BSP_UART_REG_FIFO_CTRL_CLEAR_XMIT (0x03) +#define OR1K_BSP_UART_REG_FIFO_CTRL_DMA_SELECT (0x08) +#define OR1K_BSP_UART_REG_FIFO_CTRL_TRIGGER_4 (0x40) +#define OR1K_BSP_UART_REG_FIFO_CTRL_TRIGGER_8 (0x80) +#define OR1K_BSP_UART_REG_FIFO_CTRL_TRIGGER_14 (0xC0) +#define OR1K_BSP_UART_REG_FIFO_CTRL_TRIGGER_MASK (0xC0) + +/* Line Control Register */ +#define OR1K_BSP_UART_REG_LINE_CTRL_WLEN5 (0x00) +#define OR1K_BSP_UART_REG_LINE_CTRL_WLEN6 (0x01) +#define OR1K_BSP_UART_REG_LINE_CTRL_WLEN7 (0x02) +#define OR1K_BSP_UART_REG_LINE_CTRL_WLEN8 (0x03) +#define OR1K_BSP_UART_REG_LINE_CTRL_STOP (0x04) +#define OR1K_BSP_UART_REG_LINE_CTRL_PARITY (0x08) +#define OR1K_BSP_UART_REG_LINE_CTRL_EPAR (0x10) +#define OR1K_BSP_UART_REG_LINE_CTRL_SPAR (0x20) +#define OR1K_BSP_UART_REG_LINE_CTRL_SBC (0x40) +#define OR1K_BSP_UART_REG_LINE_CTRL_DLAB (0x80) + +/* Line Status Register */ +#define OR1K_BSP_UART_REG_LINE_STATUS_DR (0x01) +#define OR1K_BSP_UART_REG_LINE_STATUS_OE (0x02) +#define OR1K_BSP_UART_REG_LINE_STATUS_PE (0x04) +#define OR1K_BSP_UART_REG_LINE_STATUS_FE (0x08) +#define OR1K_BSP_UART_REG_LINE_STATUS_BI (0x10) +#define OR1K_BSP_UART_REG_LINE_STATUS_THRE (0x20) +#define OR1K_BSP_UART_REG_LINE_STATUS_TEMT (0x40) + +/* Modem Control Register */ +#define OR1K_BSP_UART_REG_MODEM_CTRL_DTR (0x01) +#define OR1K_BSP_UART_REG_MODEM_CTRL_RTS (0x02) +#define OR1K_BSP_UART_REG_MODEM_CTRL_OUT1 (0x04) +#define OR1K_BSP_UART_REG_MODEM_CTRL_OUT2 (0x08) +#define OR1K_BSP_UART_REG_MODEM_CTRL_LOOP (0x10) + +/* Modem Status Register */ +#define OR1K_BSP_UART_REG_MODEM_STATUS_DCTS (0x01) +#define OR1K_BSP_UART_REG_MODEM_STATUS_DDSR (0x02) +#define OR1K_BSP_UART_REG_MODEM_STATUS_TERI (0x04) +#define OR1K_BSP_UART_REG_MODEM_STATUS_DDCD (0x08) +#define OR1K_BSP_UART_REG_MODEM_STATUS_CTS (0x10) +#define OR1K_BSP_UART_REG_MODEM_STATUS_DSR (0x20) +#define OR1K_BSP_UART_REG_MODEM_STATUS_RI (0x40) +#define OR1K_BSP_UART_REG_MODEM_STATUS_DCD (0x80) +#define OR1K_BSP_UART_REG_MODEM_STATUS_ANY_DELTA (0x0F) + +/** @} */ + +/** @} */ + +#endif /* LIBBSP_GENERIC_OR1K_H */ diff --git a/bsps/or1k/generic_or1k/include/bsp/irq.h b/bsps/or1k/generic_or1k/include/bsp/irq.h new file mode 100644 index 0000000000..791aefcae0 --- /dev/null +++ b/bsps/or1k/generic_or1k/include/bsp/irq.h @@ -0,0 +1,45 @@ +/** + * @file + * + * @ingroup OR1K_IRQ + * + * @brief Interrupt definitions. + */ + +/** + * COPYRIGHT (c) 2014-2015 Hesham ALMatary <heshamelmatary@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE + */ + +#ifndef LIBBSP_GENERIC_OR1K_IRQ_H +#define LIBBSP_GENERIC_OR1K_IRQ_H + +#ifndef ASM + +#include <rtems.h> +#include <rtems/irq.h> +#include <rtems/irq-extension.h> + +#define BSP_INTERRUPT_VECTOR_MIN 0x100 +#define BSP_INTERRUPT_VECTOR_MAX 0x1F00 + +/* Interrupt Identification Register */ +#define OR1K_BSP_UART_REG_INT_ID_MSI (0x00) +#define OR1K_BSP_UART_REG_INT_ID_NO_INT (0x01) +#define OR1K_BSP_UART_REG_INT_ID_THRI (0x02) +#define OR1K_BSP_UART_REG_INT_ID_RDI (0x04) +#define OR1K_BSP_UART_REG_INT_ID_ID (0x06) +#define OR1K_BSP_UART_REG_INT_ID_RLSI (0x06) +#define OR1K_BSP_UART_REG_INT_ID_TOI (0x0c) + +/* Interrupt Enable Register */ +#define OR1K_BSP_UART_REG_INT_ENABLE_RDI (0x01) +#define OR1K_BSP_UART_REG_INT_ENABLE_THRI (0x02) +#define OR1K_BSP_UART_REG_INT_ENABLE_RLSI (0x04) +#define OR1K_BSP_UART_REG_INT_ENABLE_MSI (0x08) + +#endif /* ASM */ +#endif /* LIBBSP_GENERIC_OR1K_IRQ_H */ diff --git a/bsps/or1k/generic_or1k/include/bsp/uart.h b/bsps/or1k/generic_or1k/include/bsp/uart.h new file mode 100644 index 0000000000..dbf3bbf9ef --- /dev/null +++ b/bsps/or1k/generic_or1k/include/bsp/uart.h @@ -0,0 +1,42 @@ +/** + * @file + * + * @ingroup generic_or1k_uart + * + * @brief UART support. + */ + +/* + * COPYRIGHT (c) 2014-2015 Hesham ALMatary <heshamelmatary@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE + */ + +/** + * @defgroup generic_or1k_uart UART Support + * + * @ingroup generic_or1k + * + * @brief Universal Asynchronous Receiver/Transmitter (UART) Support + */ + +#ifndef LIBBSP_GENERIC_OR1K_UART_H +#define LIBBSP_GENERIC_OR1K_UART_H + +#include <libchip/serial.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define OR1K_UART_DEFAULT_BAUD 115200 +#define OR1K_BSP_UART_IRQ 2 +extern const console_fns generic_or1k_uart_fns; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_GENERIC_OR1K_UART_H */ diff --git a/bsps/or1k/generic_or1k/include/tm27.h b/bsps/or1k/generic_or1k/include/tm27.h new file mode 100644 index 0000000000..0dfa7bf628 --- /dev/null +++ b/bsps/or1k/generic_or1k/include/tm27.h @@ -0,0 +1 @@ +#include <rtems/tm27-default.h> |