Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
0d33ac29
Commit
0d33ac29
authored
Feb 03, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/netconsole: make netconsole to use console API not simple_uart
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
9d5ed1ee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
20 deletions
+33
-20
board.h
boards/generic/board.h
+4
-1
console.c
dev/console.c
+22
-0
simple_uart.c
dev/simple_uart.c
+0
-18
netconsole.h
include/netconsole.h
+6
-0
netconsole.c
lib/netconsole.c
+1
-1
No files found.
boards/generic/board.h
View file @
0d33ac29
...
...
@@ -3,6 +3,9 @@
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include <netconsole.h>
#ifndef __BOARD_WRC_H
#define __BOARD_WRC_H
/*
...
...
@@ -61,7 +64,7 @@
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_MAX_CONSOLE_DEVICES
1
#define BOARD_MAX_CONSOLE_DEVICES
(1 + HAS_NETCONSOLE)
#define CONSOLE_UART_BAUDRATE 115200
...
...
dev/console.c
View file @
0d33ac29
...
...
@@ -13,6 +13,7 @@
#include "board.h"
#include "dev/simple_uart.h"
#include "dev/console.h"
#include <netconsole.h>
static
int
puts_direct
=
0
;
...
...
@@ -30,6 +31,7 @@ struct console_uart_priv_data
static
struct
console_uart_priv_data
console_uart_priv
;
struct
console_device
console_uart_dev
;
struct
console_device
*
console_devs
[
BOARD_MAX_CONSOLE_DEVICES
];
static
struct
console_device
console_netconsole_dev
;
#define CON_ESCAPE_CODE 0x1b
#define CON_SWITCH_BINARY_CODE 'B'
...
...
@@ -271,6 +273,23 @@ void console_ipmi_init( )
#endif
static
int
con_netconsole_getc
(
struct
console_device
*
dev
)
{
return
netconsole_read_byte
();
}
static
int
con_netconsole_put_string
(
struct
console_device
*
dev
,
const
char
*
s
)
{
return
netconsole_write_string
(
s
);
}
static
void
console_netconsole_init
(
void
)
{
console_netconsole_dev
.
get_char
=
con_netconsole_getc
;
console_netconsole_dev
.
put_string
=
con_netconsole_put_string
;
console_register_device
(
&
console_netconsole_dev
);
}
int
puts
(
const
char
*
s
)
{
if
(
puts_direct
)
...
...
@@ -334,6 +353,9 @@ void console_init()
console_ipmi_init
();
#endif
if
(
HAS_NETCONSOLE
)
console_netconsole_init
();
pp_printf
(
"Console UART FIFO:: %d
\n
"
,
suart_is_fifo_supported
(
&
console_uart_priv
.
uart_dev
)
);
}
...
...
dev/simple_uart.c
View file @
0d33ac29
...
...
@@ -18,16 +18,6 @@
( ((( (unsigned long long)baudrate * 8ULL) << (16 - 7)) + \
(CPU_CLOCK >> 8)) / (CPU_CLOCK >> 7) )
#ifdef CONFIG_NETCONSOLE
#define HAS_NETCONSOLE 1
int
netconsole_read_byte
(
void
);
int
netconsole_write_string
(
const
char
*
);
#else
#define HAS_NETCONSOLE 0
static
int
netconsole_read_byte
(
void
)
{
return
-
1
;}
static
int
netconsole_write_string
(
const
char
*
s
)
{
return
-
1
;}
#endif
static
inline
uint32_t
suart_calc_baud
(
int
baudrate
)
{
uint64_t
n
=
(((
uint64_t
)
(
baudrate
))
<<
12
)
+
(
CPU_CLOCK
>>
8
);
...
...
@@ -59,8 +49,6 @@ int suart_write_string(struct simple_uart_device *dev, const char *s)
{
const
char
*
t
=
s
;
if
(
HAS_NETCONSOLE
)
netconsole_write_string
(
s
);
while
(
*
s
)
suart_write_byte
(
dev
,
*
(
s
++
));
return
s
-
t
;
...
...
@@ -85,12 +73,6 @@ int suart_poll(struct simple_uart_device *dev)
int
suart_read_byte
(
struct
simple_uart_device
*
dev
)
{
int
ret
;
/* check if there is anything from netconsole first */
if
(
HAS_NETCONSOLE
&&
(
ret
=
netconsole_read_byte
())
>=
0
)
return
ret
;
if
(
!
suart_poll
(
dev
))
return
-
1
;
...
...
include/netconsole.h
View file @
0d33ac29
...
...
@@ -6,6 +6,12 @@
#ifndef __NETCONSOLE_H__
#define __NETCONSOLE_H__
#ifdef CONFIG_NETCONSOLE
#define HAS_NETCONSOLE 1
#else
#define HAS_NETCONSOLE 0
#endif
#define NETCONSOLE_ENABLED 1
#define NETCONSOLE_DISABLED 2
#define NETCONSOLE_WAIT 3
...
...
lib/netconsole.c
View file @
0d33ac29
...
...
@@ -36,7 +36,7 @@ struct wr_sockaddr netconsole_sock_addr;
int
netconsole_status
=
NETCONSOLE_DEF_VAL
;
struct
wr_udp_addr
netconsole_udp_addr
;
/* init for netconsole task */
void
netconsole_init
(
void
)
{
netconsole_socket
=
ptpd_netif_create_socket
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment