init: Change _InitHardware() to be called from init system
Change the function signature of _InitHarware() function and rename the function to a platform specific name now that it will be called via a function pointer and not by name. Call the platform *_init() function at PURE_INIT time. Change-Id: I5168dfea81f406da135d491a2b4a24e8255f418a Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
This commit is contained in:
parent
a88cd0fc34
commit
fce979ef3e
8 changed files with 43 additions and 21 deletions
|
@ -37,6 +37,8 @@ for the fsl_frdm_k64f BSP.
|
|||
*/
|
||||
|
||||
#include <nanokernel.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <board.h>
|
||||
#include <drivers/k20_mcg.h>
|
||||
#include <drivers/uart.h>
|
||||
|
@ -302,11 +304,12 @@ static void consoleInit(void)
|
|||
* Kinetis UART device driver.
|
||||
* Also initialize the timer device driver, if required.
|
||||
*
|
||||
* @return N/A
|
||||
* @return 0
|
||||
*/
|
||||
|
||||
void _InitHardware(void)
|
||||
static int fsl_frdm_k64f_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
/* System Integration module */
|
||||
K20_SIM_t *sim_p = (K20_SIM_t *)PERIPH_ADDR_BASE_SIM;
|
||||
|
||||
|
@ -370,4 +373,8 @@ void _InitHardware(void)
|
|||
|
||||
/* restore interrupt state */
|
||||
irq_unlock(oldLevel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(fsl_frdm_0, "", fsl_frdm_k64f_init, NULL);
|
||||
pure_early_init(fsl_frdm_0, NULL);
|
||||
|
|
|
@ -37,6 +37,8 @@ for the ti_lm3s6965 BSP.
|
|||
*/
|
||||
|
||||
#include <nanokernel.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <board.h>
|
||||
#include <drivers/uart.h>
|
||||
|
||||
|
@ -133,11 +135,12 @@ static void bluetooth_init(void)
|
|||
* integrated 16550-compatible UART device driver.
|
||||
* Also initialize the timer device driver, if required.
|
||||
*
|
||||
* @return N/A
|
||||
* @return 0
|
||||
*/
|
||||
|
||||
void _InitHardware(void)
|
||||
static int ti_lm3s6965_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
consoleInit(); /* NOP if not needed */
|
||||
bluetooth_init(); /* NOP if not needed */
|
||||
|
||||
|
@ -145,4 +148,8 @@ void _InitHardware(void)
|
|||
* if configured in the kernel, NOP otherwise
|
||||
*/
|
||||
NMI_INIT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(ti_lm3_0, "", ti_lm3s6965_init, NULL);
|
||||
pure_early_init(ti_lm3_0, NULL);
|
||||
|
|
|
@ -40,6 +40,8 @@ for the generic_pc BSP.
|
|||
#include "board.h"
|
||||
#include <drivers/uart.h>
|
||||
#include <drivers/pic.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
|
||||
#if defined(CONFIG_PIC) || defined(CONFIG_SHUTOFF_PIC)
|
||||
#define picInit() _i8259_init()
|
||||
|
@ -145,15 +147,15 @@ static void bluetooth_init(void)
|
|||
*
|
||||
* @brief Perform basic hardware initialization
|
||||
*
|
||||
* Initialize the Intel 8259A interrupt controller device driver and the
|
||||
* Intel 8250 UART device driver.
|
||||
* Also initialize the timer device driver, if required.
|
||||
* Initialize the interrupt controller and UARTs present in the
|
||||
* platform.
|
||||
*
|
||||
* @return N/A
|
||||
* @return 0
|
||||
*/
|
||||
|
||||
void _InitHardware(void)
|
||||
static int pc_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
|
||||
picInit(); /* NOP if not needed */
|
||||
loapicInit(); /* NOP if not needed */
|
||||
|
||||
|
@ -165,4 +167,8 @@ void _InitHardware(void)
|
|||
ioapicInit(); /* NOP if not needed */
|
||||
consoleInit(); /* NOP if not needed */
|
||||
bluetooth_init(); /* NOP if not needed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(pc_0, "", pc_init, NULL);
|
||||
pure_early_init(pc_0, NULL);
|
||||
|
|
|
@ -40,6 +40,8 @@ Handlers for the secondary serial port have not been added.
|
|||
*/
|
||||
|
||||
#include <nanokernel.h>
|
||||
#include <init.h>
|
||||
#include <device.h>
|
||||
#include <misc/printk.h>
|
||||
#include <misc/__assert.h>
|
||||
#include "board.h"
|
||||
|
@ -100,11 +102,12 @@ static void consoleInit(void)
|
|||
* Intel 8250 UART device driver.
|
||||
* Also initialize the timer device driver, if required.
|
||||
*
|
||||
* @return N/A
|
||||
* @return 0
|
||||
*/
|
||||
|
||||
void _InitHardware(void)
|
||||
static int quark_init(struct device *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
_loapic_init();
|
||||
_ioapic_init();
|
||||
|
||||
|
@ -129,4 +132,8 @@ void _InitHardware(void)
|
|||
info.bar = PCI_BAR_ANY;
|
||||
}
|
||||
#endif /* CONFIG_PCI_DEBUG */
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(quark_0, "", quark_init, NULL);
|
||||
pure_early_init(quark_0, NULL);
|
||||
|
|
|
@ -34,7 +34,7 @@ This is the UART driver for the Freescale K20 Family of microprocessors.
|
|||
|
||||
USAGE
|
||||
An _K20_UART_t structure is used to describe the UART.
|
||||
The BSP's _InitHardware() routine initializes all the
|
||||
The platform init routine initializes all the
|
||||
values in the uart_init_info structure before calling uart_init().
|
||||
|
||||
INCLUDE FILES: drivers/serial/k20_uart.h
|
||||
|
|
|
@ -38,7 +38,7 @@ It uses the SCCs in asynchronous mode only.
|
|||
|
||||
USAGE
|
||||
An ns16550 structure is used to describe the chip.
|
||||
The BSP's _InitHardware() routine initializes all the
|
||||
The platform init routine initializes all the
|
||||
values in the uart_init_info structure before calling uart_init().
|
||||
|
||||
A board support package's board.h header must provide definitions for:
|
||||
|
|
|
@ -105,10 +105,6 @@ char __noinit _interrupt_stack[CONFIG_ISR_STACK_SIZE];
|
|||
|
||||
extern void main(void);
|
||||
|
||||
/* hardware initialization routine provided by BSP */
|
||||
|
||||
extern void _InitHardware(void);
|
||||
|
||||
/* constructor initialization */
|
||||
|
||||
extern void _Ctors(void);
|
||||
|
@ -184,7 +180,7 @@ static void nano_init(tCCS *dummyOutContext)
|
|||
* handlers are installed into the interrupt table to catch spurious
|
||||
* interrupts. This must be performed before other nanokernel subsystems
|
||||
* install bonafide handlers, or before hardware device drivers are
|
||||
* initialized (in the BSPs' _InitHardware).
|
||||
* initialized.
|
||||
*/
|
||||
|
||||
_IntLibInit();
|
||||
|
@ -281,7 +277,6 @@ FUNC_NORETURN void _Cstart(void)
|
|||
|
||||
/* perform basic hardware initialization */
|
||||
|
||||
_InitHardware();
|
||||
_sys_device_do_config_level(PURE_EARLY);
|
||||
_sys_device_do_config_level(PURE_LATE);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ done.
|
|||
APIs tested in this test set
|
||||
============================
|
||||
|
||||
nano_timer_init (implicitly done--called as part of _InitHardware)
|
||||
nano_timer_init (implicitly done--called as part of platform init)
|
||||
nano_fiber_timer_start
|
||||
nano_task_timer_start
|
||||
nano_fiber_timer_stop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue