source: rtems/c/src/lib/libbsp/powerpc/shared/console/console.inl @ 2d5c486

4.115
Last change on this file since 2d5c486 was 2d5c486, checked in by Nick Withers <nick.withers@…>, on Nov 27, 2014 at 6:39:36 AM

Use fixed-width C99 types for PowerPC in_be16() and co.

Also use the const qualifier on the address pointer's target in in_*()

Closes #2128

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* inline routines for console i/o
2 *
3 * The purpose of this file is to provide generic inline functions,
4 * i.e. not using hardcoded base addresses. These are provided by
5 * the BSP header.
6 */
7
8#include <bsp.h>
9#include <stdint.h>
10
11#define INL_IN_DECL(name,base) \
12static inline unsigned char name(int off) \
13{ \
14        return in_8((uint8_t*)(((unsigned long)base) + off)); \
15}
16
17#define INL_OUT_DECL(name,base) \
18static inline void name(int off, unsigned int val) \
19{ \
20        out_8((uint8_t*)(((unsigned long)base) + off), val); \
21}
22
23#ifdef BSP_UART_IOBASE_COM1
24INL_IN_DECL(com1_inb,   BSP_UART_IOBASE_COM1)
25INL_OUT_DECL(com1_outb, BSP_UART_IOBASE_COM1)
26#endif
27#ifdef BSP_UART_IOBASE_COM2
28INL_IN_DECL(com2_inb,   BSP_UART_IOBASE_COM2)
29INL_OUT_DECL(com2_outb, BSP_UART_IOBASE_COM2)
30#endif
31
32#if defined(BSP_CONSOLE_PORT)
33#if   (BSP_CONSOLE_PORT == BSP_UART_COM1) && defined(BSP_UART_IOBASE_COM1)
34#define INL_CONSOLE_INB         com1_inb
35#define INL_CONSOLE_OUTB        com1_outb
36#elif (BSP_CONSOLE_PORT == BSP_UART_COM2) && defined(BSP_UART_IOBASE_COM2)
37#define INL_CONSOLE_INB         com2_inb
38#define INL_CONSOLE_OUTB        com2_outb
39#endif
40#endif
41
42#ifdef BSP_KBD_IOBASE
43INL_IN_DECL(kbd_inb,    BSP_KBD_IOBASE)
44INL_OUT_DECL(kbd_outb,  BSP_KBD_IOBASE)
45#endif
46
47#ifdef BSP_VGA_IOBASE
48INL_OUT_DECL(vga_outb,  BSP_VGA_IOBASE)
49#endif
Note: See TracBrowser for help on using the repository browser.