[PATCH v2] bsps: Add BSP_FLUSH_KERNEL_CHAR_OUTPUT BSP option

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Mar 20 15:11:32 UTC 2024


On 19.03.24 18:44, Chris Johns wrote:
> On 20/3/2024 2:03 am, Sebastian Huber wrote:
>> On 19.03.24 14:50, Kinsey Moore wrote:
>>> The xilinx-zynqmp-rpu bsp_reset() is modified, but not included in the spec
>>> file for the new option. Its family differs from the arm/xilinx-zynqmp BSP
>>> family with a -rpu suffix.
>> Yes, but this BSP is quite new. I would prefer to let it not flush anything by
>> default to carry out a reset.
>>
>>> I'd be fine with this being enabled for the AArch64 BSPs as well, but I
>>> imagine that's better as a separate patch.
>> Why should it be enabled by default? The arm/xilinx-zynq and arm/xilinx-zynqmp
>> BSPs were the only ones doing an UART flush in the general termination
>> procedure. It probably was done to address a specific use case (maybe test runs).
> Is the issue the flush is before an infinite loop which means the UART FIFO
> should drain?
> 
>> I don't really like the new bsp_flush_kernel_char_output() function. Another
>> approach could be an API change of
>>
>> /**
>>   * @ingroup RTEMSAPIKernelCharIO
>>   *
>>   * @brief Polled character output functions shall have this type.
>>   */
>> typedef void ( *BSP_output_char_function_type )( char );
>>
>> to something like this
>>
>> typedef int ( *BSP_output_char_function_type )( int action );
>>
>> If action in {0, ..., 255}, then print out the character. If 0x100 is set, then
>> flush the output device. If 0x200 is set, then do Y... The return value could be
>> used to give a status indication.
>>
>> This could then be use for example by test runs, to flush the test output after
>> the end of the test.
> This also requires a code change so is a flush function that bad an option?

You can change the character output handler since this is only a global 
variable (BSP_output_char). So, this bsp_flush_kernel_char_output() may 
not flush the device used by BSP_output_char. Doing a flush through the 
output handler lets you do the flush for the currently used device.

If we change the function type to

typedef int ( *BSP_output_char_function_type )( int action );

then we can add more features later if needed. Another feature which 
could be useful is: Output char immediately if possible and return 0, 
otherwise do nothing and return -1. This can be used to implement a 
full-duplex transfer in polling mode for the kernel I/O stream.

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list