Ignore:
Timestamp:
Nov 20, 2020, 12:04:01 AM (3 years ago)
Author:
alain
Message:

1) Introduce up to 4 command lines arguments in the KSH "load" command.
These arguments are transfered to the user process through the
argc/argv mechanism, using the user space "args" vseg.

2) Introduce the named and anonymous "pipes", for inter-process communication
through the pipe() and mkfifo() syscalls.

3) Introduce the "chat" application to validate the two above mechanisms.

4) Improve printk() and assert() fonctions in printk.c.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_fbf.h

    r657 r674  
    3939 * This device provide access to an external graphic display, that is seen
    4040 * as a fixed size frame buffer, mapped in the kernel address space.
    41  * The only pixel encoding type in the current implementation is one byte per pixel
    42  * (256 levels of gray).
     41 * The only pixel encoding type in the current ALMOS-MKH implementation (oct 2020)
     42 * is one byte per pixel (256 levels of gray).
    4343 *
    4444 * It supports a first API, for the user syscalls, implementing a simple windows manager.
     
    7878 * - FBF_DIRECT_WRITE   : move synchronously pixels from an user buffer to the FBF.
    7979 * - FBF_DIRECT_READ    : move synchronously pixels from the FBF to an user buffer.
    80  *
    8180 * For these deprecated operations, the client thread calls
    8281 * directly the driver to move data between the user buffer and the FBF.
     
    105104    bitmap_t        windows_bitmap[CONFIG_FBF_WINDOWS_MAX_NR >> 5]; /*! wid allocator    */
    106105
    107     uint32_t        width;               /*! number of pixels per line.                  */
    108     uint32_t        height;              /*! total number of lines.                      */
    109     uint32_t        subsampling;         /*! pixel encoding type.                        */
     106    uint32_t        width;               /*! Frame Buffer number of pixels per line.     */
     107    uint32_t        height;              /*! Frame Buffer total number of lines.         */
     108    uint32_t        subsampling;         /*! Frame Buffer pixel encoding type.           */
    110109}
    111110fbf_extend_t;
     
    169168fbf_window_t;
    170169
     170
    171171/******************************************************************************************
    172172 * This function returns a printable string for a given FBF user command  <cmd_type>.
     
    177177 *****************************************************************************************/
    178178char * dev_fbf_cmd_str( uint32_t cmd_type );
     179
     180/******************************************************************************************
     181 * This function checks that the calling process is the owner of the window identified
     182 * by the <wid> argument, and returns an extended pointer on the window descriptor.
     183 * It can be called by a thread running in any cluster.
     184 ******************************************************************************************
     185 * @ wid        :  FBF window kernel identifier.
     186 * @ returns XPTR on the window if success / return XPT_NULL if not owner or undefined.
     187 *****************************************************************************************/
     188xptr_t dev_fbf_get_xptr_from_wid( uint32_t wid );
    179189
    180190/******************************************************************************************
     
    208218 * The window index <wid> is dynamically allocated. The owner is the calling process.
    209219 * The FBF window is defined by the <nlines>, <npixels>, <l_min>, <p_min> arguments.
    210  * It can be called by any thread running in any cluster. As this vseg is not directly
     220 * It can be called by any thread running in any cluster. As the vseg is not directly
    211221 * mapped to the frame buffer, the owner process can access this private buffer without
    212222 * syscall. As for any vseg, the physical memory is allocated on demand at each page fault.
    213 * The created vseg base address in user space is returned in the <user_base> argument.
    214  *
    215  * Implementation note:
    216  * 1. it allocates memory in the local cluster for the window,
     223 * The created vseg base address in user space is returned in the <user_base> argument.
     224 * The created window is set in "hidden" mode.
     225 ******************************************************************************************
     226 * Implementation note:
     227 * 1. it allocates memory in the local cluster for the window descriptor,
    217228 * 2. it creates in the associated vseg,
    218229 * 3. it initializes the window descriptor,
     
    220231 * 5. it allocates a new  <wid>,
    221232 * 6. it registers the window in the window_tbl[] array,
    222  * 7. it registers the window in the windows list,
     233 * 7. it registers the window in the FBF rooted windows list,
    223234 * 8. it releases the lock protecting windows.
    224  * It does not call the FBF driver.
    225235 ******************************************************************************************
    226236 * @ nlines      : [in]  number of lines in window.
    227237 * @ npixels     : [in]  number of pixels per line in window.
    228  * @ l_min       : [in]  first pixel index in FBF.
    229  * @ p_min       : [in]  first line index in FBF.
     238 * @ l_min       : [in]  first pixel index in FBF reference.
     239 * @ p_min       : [in]  first line index in FBF reference.
    230240 * @ user_base   : [out] pointer on allocated buffer base in user space.
    231241 * @ return the <wid> index if success / returns -1 if failure
     
    237247                                intptr_t * user_base );
    238248
     249
     250/******************************************************************************************
     251 * This function implements the fbf_active_wiindow syscall. It set or reset the "hidden"
     252*  flag for the window identified by the <wid> argument as specified by <active> argument.
     253 ******************************************************************************************
     254 * @ wid       : [in] window index in window_tbl[].
     255 * @ active    : [in] set hidden flag if zero / rest hidden flag if non zero.
     256 * @ returns 0 if success / returns -1 if wid not registered.
     257 *****************************************************************************************/
     258error_t dev_fbf_active_window( uint32_t wid,
     259                               uint32_t active );
     260
    239261/******************************************************************************************
    240262 * This function implements the fbf_delete_window() syscall to delete a FBF window,
     
    242264 * releases the memory allocated for the window buffer and for the window descriptor.
    243265 * It can be called by any thread running in any cluster.
    244  *
    245  * Implementation note:
    246  * 1. it takes the lock protecting windows in write mode,
    247  * 2. it set the hidden flag in deleted window descriptor,
    248  * 3. it refresh the FBF window,
     266 ******************************************************************************************
     267 * Implementation note:
     268 * 1. it set the "hidden" flag in the window descriptor,
     269 * 2. it refresh the window in FBF,
     270 * 3. it takes the lock protecting windows in write mode,
    249271 * 4. it removes the window from windows_tbl[] array,
    250272 * 5. it removes the window from xlist,     
    251273 * 6. it releases the wid to bitmap,
    252  * 7. it releases the lock protecting windows,
     274 * 7. it releases the lock protecting windows from write mode,
    253275 * 8. it releases the memory allocated for window descriptor,
    254276 * 9. it deletes the associated vseg in all clusters
    255  * It does not call directly the FBF driver.
    256277 ******************************************************************************************
    257278 * @ wid       : [in] window index in window_tbl[].
     
    265286 * defined by the <l_min> and <p_min> arguments.
    266287 * It can be called by any thread running in any cluster.
    267  *
    268  * Implementation note:
    269  * 1. it takes the lock protecting windows in write mode,
    270  * 2. it gives the modified window the lowest priority,
    271  * 3. it set the "hidden" flag in window descriptor,
    272  * 4. it refresh the FBF for the current window position,
    273  * 5. it set the new coordinates in the window descriptor,
    274  * 6. it gives the modified window the highest priority,
     288 ******************************************************************************************
     289 * Implementation note:
     290 * 1. it set the "hidden" flag in window descriptor,
     291 * 2. it refresh the FBF for the current window position,
     292 * 3. it takes the lock protecting windows in write mode,
     293 * 4. it set the new coordinates in the window descriptor,
     294 * 5. it gives the modified window the highest priority,
     295 * 6. it releases the lock protecting windows,
    275296 * 7. it reset the "hidden" flag in window descriptor,
    276297 * 8. it refresh the FBF for the new window position,
    277  * 9. it releases the lock protecting windows,
    278  * It does not call directly the FBF driver.
    279298 ******************************************************************************************
    280299 * @ wid       : [in] window index in window_tbl[].
    281  * @ l_min     : [in] new first pixel index in FBF.
    282  * @ p_min     : [in] new first line index in FBF.
     300 * @ l_min     : [in] new first pixel index in FBF reference.
     301 * @ p_min     : [in] new first line index in FBF reference.
    283302 * @ returns 0 if success / returns -1 if illegal arguments.
    284303 *****************************************************************************************/
     
    293312 * When the new window buffer is larger than the existing one, it is 0 filled.
    294313 * It can be called by any thread running in any cluster.
    295  *
    296  * Implementation note:
    297  * 1.  it takes the lock protecting windows in write mode,
    298  * 2.  it gives the modified window the lowest priority,
    299  * 3.  it set the "hidden" flag in window descriptor,
    300  * 4.  it refresh the FBF for the current window,
    301  * 5.  it set the new size in the window descriptor,
    302  * 6.  it resizes the associated vseg if required,
    303  * 7.  if fill the window buffer extension with 0 if required,
    304  * 8.  it gives the modified window the highest priority,
     314 ******************************************************************************************
     315 * Implementation note:
     316 * 1.  it set the "hidden" flag in window descriptor,
     317 * 2.  it refresh the FBF for the current window,
     318 * 3.  it takes the lock protecting windows in write mode,
     319 * 4.  it set the new size in the window descriptor,
     320 * 5.  it resizes the associated vseg if required,
     321 * 6.  it fill the user buffer with zero if required,
     322 * 7.  it gives the modified window the highest priority,
     323 * 8.  it releases the lock protecting windows,
    305324 * 9.  it reset the "hidden" flag in window descriptor,
    306325 * 10. it refresh the FBF for the new window,
    307  * 11. it releases the lock protecting windows,
    308  * It does not call directly the FBF driver.
    309326 ******************************************************************************************
    310327 * @ wid       : [in] window index in window_tbl[].
     
    321338 * It allows an owner process to signal the windows manager that some lines of a window
    322339 * identified by the <wid>, <line_min>, and <line_max> argument have been modified, and
    323  * must be refreshed in the FBF. It scans all the registered FBF windows to respect the
    324  * overlap order defined by the windows xlist.
    325  * It can be called by any thread running in any cluster.
    326  *
    327  * Implementation note:
    328  * 1. it takes the lock protecting windows in read mode,
    329  * 2. it refresh the FBF,
    330  * 3. it releases the lock protecting windows,
    331  * It does not call directly the FBF driver.
     340 * must be refreshed in the FBF.
     341 * It can be called by any thread running in any cluster.
     342 ******************************************************************************************
     343 * Implementation note:
     344 * it simply checks the arguments, and calls the fbf_update() function.
    332345 ******************************************************************************************
    333346 * @ wid        : [in] window index in window_tbl[]
    334  * @ line_first : [in] first line index in window.
    335  * @ line_last  : [in] last line index (excluded).
     347 * @ line_min   : [in] first line index in window in window referencd.
     348 * @ line_max   : [in] last line index in window in window reference (excluded).
    336349 * @ returns 0 if success / returns -1 if wid not registered.
    337350 *****************************************************************************************/
    338351error_t dev_fbf_refresh_window( uint32_t wid,
    339                                 uint32_t line_first,
    340                                 uint32_t line_last );
    341 
    342 /******************************************************************************************
    343  * WARNING : This function is deprecated ( january 2020 [AG] ). It was defined
     352                                uint32_t line_min,
     353                                uint32_t line_max );
     354
     355/******************************************************************************************
     356 * This function implements the fbf_front_window() syscall.
     357 * It gives the highest priority to the window identified by the <wid> argument,
     358 * and refresh the FBF accordingly.
     359 * It can be called by any thread running in any cluster.
     360 ******************************************************************************************
     361 * Implementation note:
     362 * 1. it takes the lock protecting windows in write mode,
     363 * 2. it modify the xlist of windows rooted in FBF,
     364 * 3. it releases the lock from write mode,
     365 * 4. it refresh the window in FBF,
     366 ******************************************************************************************
     367 * @ wid        : [in] window index in window_tbl[]
     368 * @ returns 0 if success / returns -1 if wid not registered.
     369 *****************************************************************************************/
     370error_t dev_fbf_front_window( uint32_t wid );
     371
     372/******************************************************************************************
     373 * This function displays on the TXT0 kernel terminal the list of registered FBF windows
     374 * rooted in the FBF device - in decreasing priority order - owned by the process
     375 * identified by the <pid> argument. It displays all windows when pid value is 0.
     376 * It can be called by any thread running in any cluster.
     377 ******************************************************************************************
     378 * @ pid       : [in] target process identifier / all processes when pid == 0
     379 *****************************************************************************************/
     380void dev_fbf_display_windows( pid_t pid );
     381
     382/******************************************************************************************
     383 * This function deletes all FBF windows owned by the process identified by
     384 * the <pid> argument. It can be called by any thread running in any cluster.
     385 ******************************************************************************************
     386 * @ pid       : [in] target process identifier.
     387 *****************************************************************************************/
     388void dev_fbf_cleanup( pid_t pid );
     389
     390
     391
     392
     393
     394
     395
     396/******************************************************************************************
     397 * TODO : This function is deprecated ( january 2020 [AG] ). It was defined
    344398 * to implement the fbf_read() and fbf_write() deprecated syscalls.
    345  *
     399 ******************************************************************************************
    346400 * It  moves <length> bytes between the frame buffer, starting from pixel defined
    347401 * by the <offset> argument, and an user buffer defined by the <user_buffer> argument.
Note: See TracChangeset for help on using the changeset viewer.