change bsp

Gedare Bloom gedare at rtems.org
Wed Jan 10 15:36:21 UTC 2018


Hello,

On Tue, Jan 2, 2018 at 8:35 AM, bin.wang at qkmtech.com
<bin.wang at qkmtech.com> wrote:
> hi
>
> 1:i want to change the bsp according to the zynq zedboard。it only has
> console driver and i2c driver。 so i want to add some drviers i used in
> bare-metal software before (such as gpio)。i do not know how to start。
>
You can add the drivers to the BSP. Probably you can just make your
baremetal drivers work correctly by initializing them at the right
time.

> please give me some advice。
>
> i find the function in bootcard.c       "rtems_initialize_device_drivers"
> i think i need add code here, but the bsp i used installed as lib.    so ,
> can i  change the source code?
>
> i do not understand the RTEMS_DRVMGR_STARTUP level 1,2,3,4   ,is there a
> example to add my device driver to the rtems architecture?
>
This DRVMGR stuff interacts with the cpukit/libdrvmgr, which is from
Gaisler folks and mostly supports Sparc targets.

What version of rtems do you use? I guess it is 4.11.x?

You could initialize baremetal drivers at any point even in your
application itself.

> void rtems_initialize_device_drivers(void)
> {
>   /*
>    *  Initialize all the device drivers and initialize the MPCI layer.
>    *
>    *  NOTE:  The MPCI may be build upon a device driver.
>    */
>
>   #ifdef RTEMS_DRVMGR_STARTUP
>   /* BSPs has already registered their "root bus" driver in the
>    * bsp_predriver hook or so.
>    *
>    * Init Drivers to Level 1, constraints:
>    *   - Interrupts and system clock timer does not work.
>    *   - malloc() work, however other memory services may not
>    *     have been initialized yet.
>    *   - initializes most basic stuff
>    *
>    * Typical setup in Level 1:
>    *   - Find most devices in system, do PCI scan and configuration.
>    *   - Reset hardware if needed.
>    *   - Install IRQ driver
>    *   - Install Timer driver
>    *   - Install console driver and debug printk()
>    *   - Install extra memory.
>    */
>   _DRV_Manager_init_level(1);
>   bsp_driver_level_hook(1);
>   #endif
>
>   /* Initialize I/O drivers.
>    *
>    * Driver Manager note:
>    * All drivers may not be registered yet. Drivers will dynamically
>    * be initialized when registered in level 2,3 and 4.
>    */
>   _IO_Initialize_all_drivers();
>
>   #ifdef RTEMS_DRVMGR_STARTUP
>   /* Init Drivers to Level 2, constraints:
>    *  - Interrupts can be registered and enabled.
>    *  - System Clock is running
>    *  - Console may be used.
>    *
>    * This is typically where drivers are initialized
>    * for the first time.
>    */
>   _DRV_Manager_init_level(2);
>   bsp_driver_level_hook(2);
>
>   /* Init Drivers to Level 3
>    *
>    * This is typically where normal drivers are initialized
>    * for the second time, they may depend on other drivers
>    * API inited in level 2
>    */
>   _DRV_Manager_init_level(3);
>   bsp_driver_level_hook(3);
>
>   /* Init Drivers to Level 4,
>    * Init drivers that depend on services initialized in Level 3
>    */
>   _DRV_Manager_init_level(4);
>   bsp_driver_level_hook(4);
>   #endif
>
>   #if defined(RTEMS_MULTIPROCESSING)
>     if ( _System_state_Is_multiprocessing ) {
>       _MPCI_Initialization();
>       _MPCI_Internal_packets_Send_process_packet(
> MPCI_PACKETS_SYSTEM_VERIFY
>       );
>     }
>   #endif
>
>   /*
>    *  Run the APIs and BSPs postdriver hooks.
>    *
>    *  The API extensions are supposed to create user initialization tasks.
>    */
>   _API_extensions_Run_postdriver();
> }
>
>
>
>
> 2:another question is how can i enable the interrupt? in the init task is
> ok?
>
Interrupts will be already enabled when Init() is called. They get
turned on during the RTEMS initialization sequence.

>
> ________________________________
> bin.wang at qkmtech.com
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users



More information about the users mailing list