[PATCH 1/5] shutdown: add board call back

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Sep 19 09:20:22 EDT 2013


so if we need to do something switch in the board we can fill this function
pointer (as example on Animeo IP shutdown some rs232 & rs485)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 common/startup.c | 4 ++++
 include/common.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/common/startup.c b/common/startup.c
index 9b33a92..ece852c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -159,6 +159,8 @@ void __noreturn hang (void)
 	for (;;);
 }
 
+void (*board_shutdown)(void);
+
 /* Everything needed to cleanly shutdown barebox.
  * Should be called before starting an OS to get
  * the devices into a clean state
@@ -169,4 +171,6 @@ void shutdown_barebox(void)
 #ifdef ARCH_SHUTDOWN
 	arch_shutdown();
 #endif
+	if (board_shutdown)
+		board_shutdown();
 }
diff --git a/include/common.h b/include/common.h
index 066827f..0f0ba08 100644
--- a/include/common.h
+++ b/include/common.h
@@ -152,6 +152,7 @@ extern int (*barebox_main)(void);
 
 void __noreturn start_barebox(void);
 void shutdown_barebox(void);
+extern void (*board_shutdown)(void);
 
 /*
  * architectures which have special calling conventions for
-- 
1.8.4.rc1




More information about the barebox mailing list