iPXE
serial.h
Go to the documentation of this file.
1 #ifndef _IPXE_SERIAL_H
2 #define _IPXE_SERIAL_H
3 
4 /** @file
5  *
6  * Serial console
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/api.h>
13 #include <ipxe/uart.h>
14 #include <config/serial.h>
15 
16 #ifdef SERIAL_NULL
17 #define SERIAL_PREFIX_null
18 #else
19 #define SERIAL_PREFIX_null __null_
20 #endif
21 
22 /**
23  * Calculate static inline serial API function name
24  *
25  * @v _prefix Subsystem prefix
26  * @v _api_func API function
27  * @ret _subsys_func Subsystem API function
28  */
29 #define SERIAL_INLINE( _subsys, _api_func ) \
30  SINGLE_API_INLINE ( SERIAL_PREFIX_ ## _subsys, _api_func )
31 
32 /**
33  * Provide a serial API implementation
34  *
35  * @v _prefix Subsystem prefix
36  * @v _api_func API function
37  * @v _func Implementing function
38  */
39 #define PROVIDE_SERIAL( _subsys, _api_func, _func ) \
40  PROVIDE_SINGLE_API ( SERIAL_PREFIX_ ## _subsys, _api_func, _func )
41 
42 /**
43  * Provide a static inline serial API implementation
44  *
45  * @v _prefix Subsystem prefix
46  * @v _api_func API function
47  */
48 #define PROVIDE_SERIAL_INLINE( _subsys, _api_func ) \
49  PROVIDE_SINGLE_API_INLINE ( SERIAL_PREFIX_ ## _subsys, _api_func )
50 
51 /**
52  * Get null serial console UART
53  *
54  * @ret uart Serial console UART, or NULL
55  */
56 static inline __always_inline struct uart *
58  return NULL;
59 }
60 
61 /**
62  * Get serial console UART
63  *
64  * @ret uart Serial console UART, or NULL
65  */
66 struct uart * default_serial_console ( void );
67 
68 extern struct uart *serial_console;
69 
70 extern struct uart * fixed_serial_console ( void );
71 
72 #endif /* _IPXE_SERIAL_H */
Generic UART.
iPXE internal APIs
A generic UART.
Definition: uart.h:17
struct uart * default_serial_console(void)
Get serial console UART.
struct uart * serial_console
Active serial console UART.
Definition: serial.c:69
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
Serial port configuration.
FILE_LICENCE(GPL2_OR_LATER)
struct uart * fixed_serial_console(void)
Get fixed serial console UART.
Definition: serial.c:76
#define SERIAL_INLINE(_subsys, _api_func)
Calculate static inline serial API function name.
Definition: serial.h:29
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321