<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 30, 2019 at 9:35 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de">list@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 30/06/2019 17:29, Vijay Kumar Banerjee wrote:<br>
> ---<br>
>  freebsd/sys/dev/fb/fbd.c                      | 11 ++++++<br>
>  libbsd.py                                     |  4 +++<br>
>  rtemsbsd/include/bsp/nexus-devices.h          |  1 +<br>
>  .../machine/rtems-bsd-kernel-namespace.h      | 35 +++++++++++++++++++<br>
>  rtemsbsd/include/rtems/bsd/local/opt_fb.h     |  0<br>
>  5 files changed, 51 insertions(+)<br>
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_fb.h<br>
> <br>
> diff --git a/freebsd/sys/dev/fb/fbd.c b/freebsd/sys/dev/fb/fbd.c<br>
> index 60ce4bc3..1d303e67 100644<br>
> --- a/freebsd/sys/dev/fb/fbd.c<br>
> +++ b/freebsd/sys/dev/fb/fbd.c<br>
> @@ -82,7 +82,9 @@ static d_close_t    fb_close;<br>
>  static d_read_t              fb_read;<br>
>  static d_write_t     fb_write;<br>
>  static d_ioctl_t     fb_ioctl;<br>
> +#ifndef __rtems__<br>
>  static d_mmap_t              fb_mmap;<br>
> +#endif /* __rtems__ */<br>
<br>
Like discussed and like you most likely will tell in your summary: Most<br>
likely you'll need mmap or an alternative read / write implementation<br>
because read / write is quite empty for the fbd. I don't think that we<br>
should merge anything before that is done although of course it is great<br>
that this much already works and you get an fb0 device.<br>
<br></blockquote><div>OK. Will start with the mmap work next and hopefully will get something working</div><div>on the screen.  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>  <br>
>  static struct cdevsw fb_cdevsw = {<br>
>       .d_version =    D_VERSION,<br>
> @@ -92,7 +94,9 @@ static struct cdevsw fb_cdevsw = {<br>
>       .d_read =       fb_read,<br>
>       .d_write =      fb_write,<br>
>       .d_ioctl =      fb_ioctl,<br>
> +#ifndef __rtems__<br>
>       .d_mmap =       fb_mmap,<br>
> +#endif /* __rtems__ */<br>
>       .d_name =       "fb",<br>
>  };<br>
>  <br>
> @@ -257,11 +261,13 @@ fbd_register(struct fb_info* info)<br>
>       err = fb_init(entry, framebuffer_dev_unit++);<br>
>       if (err)<br>
>               return (err);<br>
> +#ifndef __rtems__<br>
>       if (first) {<br>
>               err = vt_fb_attach(info);<br>
>               if (err)<br>
>                       return (err);<br>
>       }<br>
> +#endif /* __rtems__ */<br>
>  <br>
>       return (0);<br>
>  }<br>
> @@ -274,8 +280,10 @@ fbd_unregister(struct fb_info* info)<br>
>       LIST_FOREACH_SAFE(entry, &fb_list_head, fb_list, tmp) {<br>
>               if (entry->fb_info == info) {<br>
>                       LIST_REMOVE(entry, fb_list);<br>
> +#ifndef __rtems__<br>
>                       if (LIST_EMPTY(&fb_list_head))<br>
>                               vt_fb_detach(info);<br>
> +#endif /* __rtems__ */<br>
>                       free(entry, M_DEVBUF);<br>
>                       return (0);<br>
>               }<br>
> @@ -366,6 +374,9 @@ driver_t fbd_driver = {<br>
>  devclass_t   fbd_devclass;<br>
>  <br>
>  DRIVER_MODULE(fbd, fb, fbd_driver, fbd_devclass, 0, 0);<br>
> +#ifdef __rtems__<br>
> +DRIVER_MODULE(fbd, am335x_lcd, fbd_driver, fbd_devclass, 0, 0);<br>
<br>
Why is this necessary in this case? I don't see a similar connection in<br>
FreeBSD.<br>
<br></blockquote><div>the fbd needs to be linked to the am335x_lcd which provides the fb0 device</div><div>and the fbd needs to attach to fb0. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +#endif /* __rtems__ */<br>
>  DRIVER_MODULE(fbd, drmn, fbd_driver, fbd_devclass, 0, 0);<br>
>  DRIVER_MODULE(fbd, udl, fbd_driver, fbd_devclass, 0, 0);<br>
>  MODULE_VERSION(fbd, 1);<br>
> diff --git a/libbsd.py b/libbsd.py<br>
> index bce1d268..43b06e1b 100644<br>
> --- a/libbsd.py<br>
> +++ b/libbsd.py<br>
> @@ -807,6 +807,8 @@ class display(builder.Module):<br>
>                  'sys/sys/fbio.h',<br>
>                  'sys/sys/consio.h',<br>
>                  'sys/sys/terminal.h',<br>
> +                'sys/dev/vt/hw/fb/vt_fb.h',<br>
> +                'sys/dev/vt/colors/vt_termcolors.h',<br>
>              ]<br>
>          )<br>
>          self.addKernelSpaceSourceFiles(<br>
> @@ -822,6 +824,8 @@ class display(builder.Module):<br>
>                  'sys/arm/ti/am335x/am335x_lcd.c',<br>
>                  'sys/arm/ti/am335x/am335x_pwmss.c',<br>
>                  'sys/arm/ti/am335x/am335x_ecap.c',<br>
> +                'sys/dev/fb/fb.c',<br>
> +                'sys/dev/fb/fbd.c',<br>
>              ],<br>
>              mm.generator['source']()<br>
>          )<br>
> diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h<br>
> index 2c718295..6765b10d 100644<br>
> --- a/rtemsbsd/include/bsp/nexus-devices.h<br>
> +++ b/rtemsbsd/include/bsp/nexus-devices.h<br>
> @@ -63,6 +63,7 @@ SYSINIT_DRIVER_REFERENCE(cpsw, cpswss);<br>
>  SYSINIT_DRIVER_REFERENCE(ukphy, miibus);<br>
>  SYSINIT_DRIVER_REFERENCE(am335x_lcd, simplebus);<br>
>  SYSINIT_DRIVER_REFERENCE(am335x_pwmss, simplebus);<br>
> +SYSINIT_DRIVER_REFERENCE(fbd, am335x_lcd);<br>
>  SYSINIT_DRIVER_REFERENCE(rtems_i2c, simplebus);<br>
>  SYSINIT_DRIVER_REFERENCE(ofw_iicbus, rtems_i2c);<br>
>  SYSINIT_DRIVER_REFERENCE(iic, iicbus);<br>
> diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h<br>
> index 3951da79..d796d3d1 100644<br>
> --- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h<br>
> +++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h<br>
> @@ -1266,6 +1266,16 @@<br>
>  #define      eventhandler_find_list _bsd_eventhandler_find_list<br>
>  #define      eventhandler_prune_list _bsd_eventhandler_prune_list<br>
>  #define      eventhandler_register _bsd_eventhandler_register<br>
> +#define      fb_commonioctl _bsd_fb_commonioctl<br>
> +#define      fbd_devclass _bsd_fbd_devclass<br>
> +#define      fbd_driver _bsd_fbd_driver<br>
> +#define      fbd_list _bsd_fbd_list<br>
> +#define      fbd_register _bsd_fbd_register<br>
> +#define      fb_dump_adp_info _bsd_fb_dump_adp_info<br>
> +#define      fb_dump_mode_info _bsd_fb_dump_mode_info<br>
> +#define      fbd_unregister _bsd_fbd_unregister<br>
> +#define      fb_list_head _bsd_fb_list_head<br>
> +#define      fb_type _bsd_fb_type<br>
>  #define      fdt_addrsize_cells _bsd_fdt_addrsize_cells<br>
>  #define      fdt_data_get _bsd_fdt_data_get<br>
>  #define      fdt_data_to_res _bsd_fdt_data_to_res<br>
> @@ -5515,8 +5525,18 @@<br>
>  #define      vht80_chan_ranges _bsd_vht80_chan_ranges<br>
>  #define      vesagtf_mode _bsd_vesagtf_mode<br>
>  #define      vesagtf_mode_params _bsd_vesagtf_mode_params<br>
> +#define      vid_allocate _bsd_vid_allocate<br>
> +#define      vid_configure _bsd_vid_configure<br>
>  #define      videomode_count _bsd_videomode_count<br>
>  #define      videomode_list _bsd_videomode_list<br>
> +#define      vid_find_adapter _bsd_vid_find_adapter<br>
> +#define      vid_get_adapter _bsd_vid_get_adapter<br>
> +#define      vid_get_switch _bsd_vid_get_switch<br>
> +#define      vid_init_struct _bsd_vid_init_struct<br>
> +#define      vid_register _bsd_vid_register<br>
> +#define      vid_release _bsd_vid_release<br>
> +#define      vidsw _bsd_vidsw<br>
> +#define      vid_unregister _bsd_vid_unregister<br>
>  #define      vlan_cookie_p _bsd_vlan_cookie_p<br>
>  #define      vlan_devat_p _bsd_vlan_devat_p<br>
>  #define      vlan_input_p _bsd_vlan_input_p<br>
> @@ -5533,6 +5553,21 @@<br>
>  #define      vsnprintf _bsd_vsnprintf<br>
>  #define      vsnrprintf _bsd_vsnrprintf<br>
>  #define      vsprintf _bsd_vsprintf<br>
> +#define      vt_fb_attach _bsd_vt_fb_attach<br>
> +#define      vt_fb_bitblt_bitmap _bsd_vt_fb_bitblt_bitmap<br>
> +#define      vt_fb_bitblt_text _bsd_vt_fb_bitblt_text<br>
> +#define      vt_fb_blank _bsd_vt_fb_blank<br>
> +#define      vt_fb_detach _bsd_vt_fb_detach<br>
> +#define      vt_fb_drawrect _bsd_vt_fb_drawrect<br>
> +#define      vt_fb_fini _bsd_vt_fb_fini<br>
> +#define      vt_fb_init _bsd_vt_fb_init<br>
> +#define      vt_fb_invalidate_text _bsd_vt_fb_invalidate_text<br>
> +#define      vt_fb_ioctl _bsd_vt_fb_ioctl<br>
> +#define      vt_fb_mmap _bsd_vt_fb_mmap<br>
> +#define      vt_fb_postswitch _bsd_vt_fb_postswitch<br>
> +#define      vt_fb_resume _bsd_vt_fb_resume<br>
> +#define      vt_fb_setpixel _bsd_vt_fb_setpixel<br>
> +#define      vt_fb_suspend _bsd_vt_fb_suspend<br>
>  #define      wakeup _bsd_wakeup<br>
>  #define      wakeup_one _bsd_wakeup_one<br>
>  #define      window_deflate _bsd_window_deflate<br>
> diff --git a/rtemsbsd/include/rtems/bsd/local/opt_fb.h b/rtemsbsd/include/rtems/bsd/local/opt_fb.h<br>
> new file mode 100644<br>
> index 00000000..e69de29b<br>
> <br>
</blockquote></div></div>