Commit 21a38f50 authored by Adam Wujek's avatar Adam Wujek

lib/events: use events only if enabled in board's configuration

Saves for wrpc 536B
Signed-off-by: 's avatarAdam Wujek <adam.wujek@creotech.pl>
parent 5e656056
......@@ -90,6 +90,8 @@ int board_update(void);
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_USE_EVENTS 0
#define BOARD_MAX_CONSOLE_DEVICES 1
#define CONSOLE_UART_BAUDRATE 115200
......
......@@ -25,6 +25,8 @@
#define BOARD_MAX_CONSOLE_DEVICES 2
#define BOARD_USE_EVENTS 1
/* Board-specific parameters */
#define TICS_PER_SECOND 1000
......
......@@ -64,6 +64,8 @@
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_USE_EVENTS 0
#define BOARD_MAX_CONSOLE_DEVICES (1 + HAS_NETCONSOLE)
#define CONSOLE_UART_BAUDRATE 115200
......
......@@ -54,6 +54,8 @@
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_USE_EVENTS 0
#define BOARD_MAX_CONSOLE_DEVICES 1
#define CONSOLE_UART_BAUDRATE 115200
......
......@@ -54,6 +54,8 @@
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_USE_EVENTS 0
#define BOARD_MAX_CONSOLE_DEVICES 1
#define CONSOLE_UART_BAUDRATE 115200
......
......@@ -33,4 +33,6 @@
#define CONSOLE_UART_BAUDRATE 115200
#define BOARD_MAX_CONSOLE_DEVICES 1
#define BOARD_USE_EVENTS 0
#endif
......@@ -104,6 +104,8 @@ int event_handler_enable( int id, int enable )
int event_post( int event )
{
int i;
if (!BOARD_USE_EVENTS)
return 0;
for(i = 0; i < event_handler_count; i++ )
{
struct event_handler *eh = &handlers[i];
......
......@@ -85,6 +85,12 @@ int wrc_events_ptp_poll(void)
void wrc_events_ptp_link_down(void)
{
/* TODO: do boards need events NETIF_LINK_WENT_DOWN and
* WRC_EVENT_TIMING_DOWN? Isn't enough to have link down?
*/
if (!BOARD_USE_EVENTS)
return;
prev_timing_ok = 0;
}
......
......@@ -266,7 +266,8 @@ int main(void)
// run all pending tasks
wrc_poll_all_tasks();
// call all event handlers
events_dispatch();
if (BOARD_USE_EVENTS)
events_dispatch();
/* better safe than sorry */
check_stack();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment