Re: [GSoC 2021] Beagle BSP USB OTG Support

2021-05-12 Thread Ahamed Husni
Hi,

I couldn't set up the JTAG using Launchpad as it requires some adapters.
While discussing

in the Element14 forum, it seems it would require a lot of
work to set up JTAG using the Launchpad.
I can get the standard JTAG hardwares required  by ordering online before
the coding period begins.

Until that I did the hardware mod 
required for Libdebugger on the BBB

.
I don't know how to use the libdebugger. If anyone could point me in the
right direction, that would be great.

I tried booting the FreeBSD on BBB. The serial over usb is working.
Ethernet and mass storage might require some configuration in FreeBSD.

Best regards,
Husni Faiz.

On Mon, May 10, 2021 at 12:04 PM Christian MAUDERER <
christian.maude...@embedded-brains.de> wrote:

> Hello Ahamed,
>
> I'm using a J-Link to debug Beagle. I think that it doesn't have a EMU
> pin either. Only difference: It has an additional TRST. I would suggest
> to just try it.
>
> I think on OpenOCD there are a few options regarding RST. You can have
> SRST only, TRST only, both connected together and both as separate pins.
>
> Best regards
>
> Christian
>
> Am 10.05.21 um 06:09 schrieb Ahamed Husni:
> > Hi all,
> >
> > I need to debug the Beaglebone Black using JTAG. I got a TI LaunchPad
> > CC1310. Launchpad has a XDS110 debugger with a (ARM - not sure) 10 pin
> > JTAG out which can be used to debug external targets. The Beaglebone has
> > a cTI 20 pin JTAG interface. Pin layouts for the ARM10 and cTI20 is
> > given here.
> >
> >
> http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_jtag_connectors.html#connector-information
> > <
> http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_jtag_connectors.html#connector-information
> >
> >
> > Can we map the pins, point to point without adapters to debug the BBB
> > using Launchpads's XDS110?
> >
> > Following is what I came up with just refering the above given pin
> layouts.
> >
> > *ARM10 to cTI20*
> >
> > 1==5 (VTRef/VCC)
> > 2==1 (SWDIO/TMS)
> > 3==8(GND)
> > 4==9  (SWCLK/TCLK) SWDCLK(9) and TCK(11) are separate in cTI
> > 5==10  (GND)
> > 6==7(SWO/TDO)
> > 7 KEYED
> > 8==3 (NC/TDI)
> > 9==12   (GNDDetect)
> > 10==15  (nRESET)
> >
> > Will this work? (EMU pins are not used here)
> >
> > Also I found a discussion in TI' forum which says,
> >
> > "Controlling the EMU0 and EMU1 signals, which are mandatory to place the
> > AM335x in debug mode."
> >
> >
> https://e2e.ti.com/support/processors-group/processors/f/processors-forum/777331/am3358-how-to-evaluate-if-a-jtag-chain-works-correctly
> > <
> https://e2e.ti.com/support/processors-group/processors/f/processors-forum/777331/am3358-how-to-evaluate-if-a-jtag-chain-works-correctly
> >
> >
> > Also the hardware Mod for libdebugger in RTEMS connects the SWO/TDO(7)
> > to the EMU0(13).
> >
> >
> https://docs.rtems.org/branches/master/user/bsps/bsps-arm.html#debugging-using-libdebugger
> > <
> https://docs.rtems.org/branches/master/user/bsps/bsps-arm.html#debugging-using-libdebugger
> >
> >
> > My Project Proposal:
> >
> https://docs.google.com/document/d/1CN3ri7g6NJeFPb5h8y4smr1aziGWyXbiiXUsFMhdUu4/edit?usp=sharing
> > <
> https://docs.google.com/document/d/1CN3ri7g6NJeFPb5h8y4smr1aziGWyXbiiXUsFMhdUu4/edit?usp=sharing
> >
> >
> > Best regards,
> > Husni Faiz.
> >
>
> --
> 
> embedded brains GmbH
> Herr Christian MAUDERER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: christian.maude...@embedded-brains.de
> phone: +49-89-18 94 741 - 18
> 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/
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v2] rtems: Constify rtems_task_wake_when()

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 1:28 PM Sebastian Huber
 wrote:
>
> On 12/05/2021 18:46, Gedare Bloom wrote:
> > I understand the efficiency, but the interface is awkward. At least
> > maybe put UINT32_MAX behind a macro to make the intent more clear
> > #define RTEMS_TICKS_MASK 0xU
> > or UINT32_MAX is fine there too, equivalent.
> >
> > Otherwise, go ahead.
>
> I added two constants for the ticks mask:
>
> https://git.rtems.org/rtems/commit/?id=523867de9d274d2bdc29ce649d764b42a9167c0e
>
Great, thanks!

> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: code review: help implementing clock_montonic

2021-05-12 Thread zack_on_the_speed_chanel
> This ticket mostly references the need for a test. Have you tried to
> write a test for the missing functionality?
>
How I made a test for it was to create the timer using timer_create() . It also 
said to use a previous test with timer_realtime and i tested it with  sometime 
similar to PSXtimer02 test. I  got a invalid argument error when I tried it. 
Joel told me i also have to impliment the monotonic clock


>his math doesn't make sense to me. explain what you're trying to do?

I wanted calculate the remaining time with the timespec. I assumed that the 
timespec contained the total time seconds+miliseconds. I knew that a cpu tick 
is an uint32. So i converted to timspec

  remaining = (uint32_t) ( ptimer->Timer.expire - now );

to something like
expire->tv.nsec+expire->tv.sec  - spec->tv.nsec+spec->tv.sec);


> > Yes, settime is an important function to distinguish between MONOTONIC
> and REALTIME cases. That is going to be tricky to think through.

Where do you want to check the clock type. I though I only need to distinguish 
between both when getting the value of the clock. I don't exactly know what 
needs to be done me being really new to posix and operating system development.



Zack


‐‐‐ Original Message ‐‐‐
On Tuesday, May 11, 2021 6:23 AM, Gedare Bloom  wrote:

> On Fri, May 7, 2021 at 12:53 PM zack_on_the_speed_chanel
> zack_on_the_speed_cha...@protonmail.ch wrote:
>
> > hello,
> > Currenttly i'm trying to implement the clock_monotonic which was part of 
> > ticket #3889. So far these are the changes are as follows
>
> This ticket mostly references the need for a test. Have you tried to
> write a test for the missing functionality?
>
> > ptimer->clock_type= _id;
> > in the timer create i added a field for the timer id and saved it when the 
> > timer was made. Then in getttime I used the appropriate timers to get the 
> > time.
> > for example.
> > if (ptimer->clock_type ==CLOCK_REALTIME) {
> > Per_CPU_Control *cpu;
> > struct timespec spec;
> > struct timespec expire;
> >
> > cpu = _POSIX_Timer_Acquire_critical( ptimer, _context );
> >
>
> Maybe move the clock_type check to here?
>
> > _TOD_Get(spec);
> >   _Timespec_From_ticks( expire, >Timer.expire);
> >
> >
> > if (spec->tv.nsec+spec->tv.sec > expire->tv.nsec+expire->tv.sec ) {
> >
> >   remaining = (uint32_t) (expire->tv.nsec+expire->tv.sec  - 
> > spec->tv.nsec+spec->tv.sec);
> >
>
> this math doesn't make sense to me. explain what you're trying to do?
>
> > } else {
> >   remaining = 0;
> > }
> >
> > _Timespec_From_ticks( remaining, >it_value );
> > value->it_interval = ptimer->timer_data.it_interval;
> >
> > _POSIX_Timer_Release( cpu, _context );
> > return 0;
> >
> >
> > }
> > Here i made two separate cases for getting the time. Also joel told me to I 
> > feel that it is a bit redundant to call everything using timespec to 
> > calculating remaining time and then just use timespec_From_ticks to get the 
> > time. It was a recommendation from Joel. Did I make the correct change. 
> > Also I assume that Delete does not need any changes because It does not 
> > require any measuring of time. Is there anything i need to change for 
> > timer_settime?
>
> Yes, settime is an important function to distinguish between MONOTONIC
> and REALTIME cases. That is going to be tricky to think through.
>
> > Thanks
> > Zack
> >
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: GSoC - Code Formatting and Style Checking for RTEMS score

2021-05-12 Thread Ida Delphine
Hello everyone,
Still waiting for some feedback :)

Cheers,
Ida.

On Mon, 10 May 2021, 5:59 am Ida Delphine,  wrote:

> Hello everyone,
> Went through some previous emails and it turns out Sebastian already came
> up with a configuration for clang format which works well for RTEMS except
> for the fact that some configurations haven't been implemented into
> clang-format yet. Using
>
> AlignConsecutiveDeclarations: false
> PointerAlignment: Right
>
> Doesn't seem to work.
> For example in the cpukit/score/src/threadq.c file, something like
>
> RTEMS_STATIC_ASSERT(
> offsetof( Thread_queue_Syslock_queue, Queue.name )
> == offsetof( struct _Thread_queue_Queue, _name ),
> THREAD_QUEUE_SYSLOCK_QUEUE_NAME
> );
>
> RTEMS_STATIC_ASSERT(
> sizeof( Thread_queue_Syslock_queue )
> == sizeof( struct _Thread_queue_Queue ),
> THREAD_QUEUE_SYSLOCK_QUEUE_SIZE
> );
>
> #if defined(RTEMS_SMP)
> void _Thread_queue_Do_acquire_critical(
> Thread_queue_Control *the_thread_queue,
> ISR_lock_Context *lock_context
> )
> {
> _Thread_queue_Queue_acquire_critical(
> _thread_queue->Queue,
> _thread_queue->Lock_stats,
> lock_context
> );
>
> becomes this after using the given configuration
>
> RTEMS_STATIC_ASSERT(sizeof(Thread_queue_Syslock_queue) ==
> sizeof(struct _Thread_queue_Queue),
> THREAD_QUEUE_SYSLOCK_QUEUE_SIZE);
>
> #if defined(RTEMS_SMP)
> void _Thread_queue_Do_acquire_critical(Thread_queue_Control *
> the_thread_queue,
> ISR_lock_Context *lock_context) {
> _Thread_queue_Queue_acquire_critical(
> _thread_queue->Queue, _thread_queue->Lock_stats, lock_context);
>
> Everything seems manageable except for this alignment issue...
> This also throws more light on the changes using clang-format (
> https://lists.rtems.org/pipermail/devel/2018-December/024145.html)
>
> On Thu, May 6, 2021 at 8:05 PM Joel Sherrill  wrote:
>
>>
>>
>> On Thu, May 6, 2021 at 12:47 PM Christian Mauderer 
>> wrote:
>>
>>> Hello Ida and Gedare,
>>>
>>> On 06/05/2021 06:26, Gedare Bloom wrote:
>>> > hi Ida,
>>> >
>>> > On Wed, May 5, 2021 at 3:21 PM Ida Delphine  wrote:
>>> >>
>>> >> Hello everyone,
>>> >>
>>> >> Regarding this project (https://devel.rtems.org/ticket/3860) I went
>>> with clang-format as we all agreed. I have tested it on some "score" files
>>> and it made some changes which I don't think are very much in line with the
>>> RTEMS coding style. However, it wasn't really clear if we will chage the
>>> RTEMS coding style or try to make changes to clang-format to fit the style.
>>> >> Please will love to know the best option.
>>> >>
>>> > We will likely need to consider our choices carefully. If we can find
>>> > a suitably close style that is already well-supported by clang, and
>>> > get consensus from the maintainers on a change, then that might be the
>>> > best route forward.
>>>
>>> +1
>>>
>>> > I think the first thing to do is take the examples
>>> > that have been shown by Sebastian that are "close" but not quite
>>> > perfect, and identify the cases where they differ with RTEMS style in
>>> > order to present for discussion here. If consensus can't be reached to
>>> > change the style, then we would need to have a plan for how to improve
>>> > the existing tools for what we have.
>>>
>>> I also found the following tool quite useful to play with the clang
>>> style config:
>>>
>>> https://zed0.co.uk/clang-format-configurator/
>>>
>>> Maybe it can help a bit to find out what certain options mean.
>>>
>>> >
>>> > However, I think there is interest in doing less work on the tool
>>> > side, and more work on how to integrate it into our workflows better.
>>>
>>> +1
>>>
>>
>> I agree with all of this from the student perspective. But we will have
>> to come to some agreement on a machine producible format to
>> be able to use the integration. A report on what doesn't match would
>> give us something to chew on while Ida works the integration.
>>
>> --joel
>>
>>>
>>> >
>>> >> Cheers,
>>> >> Ida.
>>> >> ___
>>> >> devel mailing list
>>> >> devel@rtems.org
>>> >> http://lists.rtems.org/mailman/listinfo/devel
>>> > ___
>>> > devel mailing list
>>> > devel@rtems.org
>>> > http://lists.rtems.org/mailman/listinfo/devel
>>> >
>>> ___
>>> devel mailing list
>>> devel@rtems.org
>>> http://lists.rtems.org/mailman/listinfo/devel
>>>
>>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v2] rtems: Constify rtems_task_wake_when()

2021-05-12 Thread Sebastian Huber

On 12/05/2021 18:46, Gedare Bloom wrote:

I understand the efficiency, but the interface is awkward. At least
maybe put UINT32_MAX behind a macro to make the intent more clear
#define RTEMS_TICKS_MASK 0xU
or UINT32_MAX is fine there too, equivalent.

Otherwise, go ahead.


I added two constants for the ticks mask:

https://git.rtems.org/rtems/commit/?id=523867de9d274d2bdc29ce649d764b42a9167c0e

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH v6] rtems-debugger: Fixed 32bit pointers

2021-05-12 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures. Added hex_decode_uintptr
function to rtems-debugger.
---
 cpukit/include/rtems/shellconfig.h |  8 ++
 cpukit/libdebugger/rtems-debugger-server.c | 32 ++
 cpukit/libdebugger/rtems-debugger-target.c |  2 +-
 cpukit/libdebugger/rtems-debugger-target.h |  2 +-
 4 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/cpukit/include/rtems/shellconfig.h 
b/cpukit/include/rtems/shellconfig.h
index c5fcf4a45e..07860fbbc3 100644
--- a/cpukit/include/rtems/shellconfig.h
+++ b/cpukit/include/rtems/shellconfig.h
@@ -98,6 +98,7 @@ extern rtems_shell_cmd_t rtems_shell_RTRACE_Command;
   extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
   extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
   extern rtems_shell_cmd_t rtems_shell_PING_Command;
+  extern rtems_shell_cmd_t rtems_shell_TTCP_Command;
 #endif
 
 /*
@@ -516,6 +517,13 @@ extern rtems_shell_alias_t * const 
rtems_shell_Initial_aliases[];
   defined(CONFIGURE_SHELL_COMMAND_PING)
 _shell_PING_Command,
   #endif
+
+  #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \
+   !defined(CONFIGURE_SHELL_NO_COMMAND_TTCP)) || \
+  defined(CONFIGURE_SHELL_COMMAND_TTCP)
+_shell_TTCP_Command,
+  #endif
+
 #endif
 
 /* Miscanellous shell commands */
diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..c82ced2aa9 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline uintptr_t
+hex_decode_uintptr(const uint8_t* data)
+{
+  uintptr_t ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (uintptr_t) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1519,9 +1539,9 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
 comma2 = strchr(comma1 + 1, ',');
 if (comma2 != NULL) {
   uint32_t capabilities;
-  DB_UINT  addr;
+  uintptr_t  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_uintptr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0


Re: [PATCH 2/5] bsps/imxrt: Reduce devicetree size

2021-05-12 Thread Christian Mauderer

Hello Gedare,

thanks for the review.

On 12/05/2021 18:49, Gedare Bloom wrote:

is it already clear in the related doco that overlays and adding stuff
during run-time are not supported?


the device tree for this BSP is linked in. So adding an overlay would 
need support from libfdt. To be exact: The fdt_overlay_apply function. 
That function is not implemented in RTEMS. This has multiple reasons. I 
think the main reason is that we don't have support for re-parsing an 
FDT in any BSP. So at the moment it's just not possible to even try 
applying an overlay.


The method to replace the FDT with an application specific one for this 
BSP is to re-define the imxrt_dtb in the application. This is 
documented. But you reminded me that I should change the commands for 
building the FDT in the documentation too. I'll create an extra patch 
for that in the next days (most likely on Monday).


Best regards

Christian



On Wed, May 12, 2021 at 3:49 AM Christian Mauderer
 wrote:


Remove symbols that would be necessary for overlays and decrease padding
that would be necessary for adding stuff during run-time.

Update #4180
---
  bsps/arm/imxrt/dts/imxrt1050-evkb.c   | 1235 ++---
  bsps/arm/imxrt/dts/imxrt1050-evkb.dts |2 +-
  2 files changed, 472 insertions(+), 765 deletions(-)

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c 
b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
index 4842f1b85d..b93dcd775b 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
@@ -7,10 +7,10 @@
  #include 

  const unsigned char imxrt_dtb[] = {
-  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x2b, 0x36, 0x00, 0x00, 0x00, 0x38,
-  0x00, 0x00, 0x24, 0xd4, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11,
-  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x62,
-  0x00, 0x00, 0x24, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x1d, 0x73, 0x00, 0x00, 0x00, 0x38,
+  0x00, 0x00, 0x1b, 0xcc, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11,
+  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x67,
+  0x00, 0x00, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
@@ -20,252 +20,236 @@ const unsigned char imxrt_dtb[] = {
0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75,
0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x75,
0x61, 0x72, 0x74, 0x40, 0x34, 0x30, 0x31, 0x38, 0x34, 0x30, 0x30, 0x30,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
-  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x01, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00,
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2f,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+  0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00, 0x00, 0x00, 0x00, 0x03,
+  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x2f, 0x73, 0x6f, 0x63,
+  0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30,
+  0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40,
+  0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2d,
0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75,
0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67,
-  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30,
+  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x63, 0x30, 0x30, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25,
-  0x00, 0x00, 0x00, 0x35, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70,
+  0x00, 0x00, 0x00, 0x33, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70,
0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30,
-  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62,
-  0x63, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
-  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3b, 0x2f, 0x73, 0x6f, 0x63,
+  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x63,
+  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x39, 0x2f, 0x73, 0x6f, 0x63,
0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30,
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40,
-  0x34, 0x30, 0x31, 0x63, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x41,
+  0x34, 0x30, 0x31, 0x63, 0x34, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x03, 0x00, 

Re: [PATCH] c-user: Add task priority glossary terms

2021-05-12 Thread Sebastian Huber

On 12/05/2021 18:54, Gedare Bloom wrote:

+eligible priority
+An eligible priority of a :term:`task` is the :term:`task priority` 
with
+respect to the corresponding :term:`eligible scheduler` of the task.  
An
+eligible priority is either the :term:`current priority` and a

  "and" should be "or" ?


Thanks for spotting this, it should be "or".

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v3 1/5] libcsupport: Added futimens() and utimensat()

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 11:33 AM Gedare Bloom  wrote:
>
> On Wed, May 12, 2021 at 7:33 AM Ryan Long  wrote:
> >
> > Created futimens.c and utimensat.c to add support for the POSIX
> > methods futimens() and utimensat().
> >
> > utime() and utimes() are considered obsolote by POSIX, but RTEMS
> > will continue to support them.
> >
> > Closes #4396
> > ---
> >  cpukit/Makefile.am   |   2 +
> >  cpukit/include/rtems/libio_.h|  64 -
> >  cpukit/include/rtems/score/timespec.h|  16 ++-
> >  cpukit/libcsupport/src/futimens.c|  87 
> >  cpukit/libcsupport/src/utimensat.c   | 224 
> > +++
> >  cpukit/score/src/timespecisnonnegative.c |  35 +
> >  spec/build/cpukit/librtemscpu.yml|   3 +
> >  7 files changed, 426 insertions(+), 5 deletions(-)
> >  create mode 100644 cpukit/libcsupport/src/futimens.c
> >  create mode 100644 cpukit/libcsupport/src/utimensat.c
> >  create mode 100644 cpukit/score/src/timespecisnonnegative.c
> >
> > diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> > index b0df610..29b4207 100644
> > --- a/cpukit/Makefile.am
> > +++ b/cpukit/Makefile.am
> > @@ -262,6 +262,8 @@ librtemscpu_a_SOURCES += libcsupport/src/unmount.c
> >  librtemscpu_a_SOURCES += libcsupport/src/__usrenv.c
> >  librtemscpu_a_SOURCES += libcsupport/src/utime.c
> >  librtemscpu_a_SOURCES += libcsupport/src/utimes.c
> > +librtemscpu_a_SOURCES += libcsupport/src/futimens.c
> > +librtemscpu_a_SOURCES += libcsupport/src/utimensat.c
> >  librtemscpu_a_SOURCES += libcsupport/src/utsname.c
> >  librtemscpu_a_SOURCES += libcsupport/src/vprintk.c
> >  librtemscpu_a_SOURCES += libcsupport/src/write.c
> > diff --git a/cpukit/include/rtems/libio_.h b/cpukit/include/rtems/libio_.h
> > index e9eb462..b7455ef 100644
> > --- a/cpukit/include/rtems/libio_.h
> > +++ b/cpukit/include/rtems/libio_.h
> > @@ -2,13 +2,12 @@
> >   * @file
> >   *
> >   * @brief LibIO Internal Interface
> > - *
> > + *
> >   * This file is the libio internal interface.
> >   */
> >
> >  /*
> > - *  COPYRIGHT (c) 1989-2011.
> > - *  On-Line Applications Research Corporation (OAR).
> > + *  COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation 
> > (OAR).
> >   *
> >   *  Modifications to support reference counting in the file system are
> >   *  Copyright (c) 2012 embedded brains GmbH.
> > @@ -30,6 +29,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #ifdef __cplusplus
> >  extern "C" {
> > @@ -357,6 +357,64 @@ static inline void rtems_filesystem_instance_unlock(
> >(*mt_entry->ops->unlock_h)( mt_entry );
> >  }
> >
> > +/**
> > + * @brief Checks the tv_nsec member of a timespec struct
> > + *
> > + * This function is used with utimensat() and futimens() only. This ensures
> > + * that the value in the tv_nsec member is equal to either UTIME_NOW,
> > + * UTIME_OMIT, or a value greater-than or equal to zero and less than a
> > + * billion.
> > + *
> > + * @param[in] time The timespec struct to be validated
> > + *
> > + * @retval Returns true if tv_nsec member is a valid value, otherwise 
> > false.
> > + */
> > +bool rtems_filesystem_utime_tv_nsec_valid( struct timespec time );
> > +
> > +/**
> > + * @brief Determines if the process has write permissions to a file
> I think it is more specific than that.  Also, missing period.
>
> > + *
> > + * The timespec at index 0 is the access time, the timespec at index 1 is 
> > the
> > + * modification time.
> Should this note be on the @param[in] times below?
>
> > + *
> > + * This function is only used with utimensat() and futimens(). This checks
> > + * whether the process has write access to a file, and checks for EACCES
> > + * and EPERM errors depending on what values are in @times and if the 
> > process
> > + * has write permissions to the file.
> > + *
> > + * @param[in] currentloc The current location to a file
> > + * @param[in] times The timespec instance that will update the timestamps
> update? nothing about this function seems to be an update?
>
> > + *
> > + * @retval Returns 0 if the process has write permissions, otherwise -1.
> > + */
> > +int rtems_filesystem_utime_check_permissions(
> > +  const rtems_filesystem_location_info_t *currentloc,
> > +  const struct timespec times[2]
> > +);
> > +
> > +/**
> > + * @brief Checks @times and fills @new_times with the time to be written
> > + *
> > + * For each of the arguments, the timespec at index 0 is the access time, 
> > and
> > + * the timespec at index 1 is the modification time.
> > + *
> > + * This function is only used with utimensat() and futimens(). @times 
> > contains
> > + * the constant values passed into utimensat/futimens. @new_times contains 
> > the
> > + * values that will be written to the file. These values depend on @times. 
> > If
> > + * @times is NULL, or either of its elements' tv_nsec members are 
> > UTIME_NOW,
> > + * the current elapsed time in nanoseconds will be saved in the 
> > 

Re: [PATCH v3 3/5] libcsupport: Implement utimes() in terms of utimensat()

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 7:34 AM Ryan Long  wrote:
>
> utimes() now calls utimensat() to update file access
> and modification timestamps.
>
> Updated license.
>
> Closes #4398
> ---
>  cpukit/libcsupport/src/utimes.c | 53 
> +++--
>  1 file changed, 40 insertions(+), 13 deletions(-)
>
> diff --git a/cpukit/libcsupport/src/utimes.c b/cpukit/libcsupport/src/utimes.c
> index 3dc47c0..f16e6cf 100644
> --- a/cpukit/libcsupport/src/utimes.c
> +++ b/cpukit/libcsupport/src/utimes.c
> @@ -1,38 +1,65 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
>  /**
>   *  @file
>   *
> - *  @brief Change File Last Access and Modification Times
>   *  @ingroup libcsupport
> + *
> + *  @brief Set file access and modification times in milliseconds.
>   */
>
>  /*
> - *  Written by: Vinu Rajashekhar 
> + * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
>   *
> - *  The license and distribution terms for this file may be
> - *  found in the file LICENSE in this distribution or at
> - *  http://www.rtems.org/license/LICENSE.
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
>   */
>
>  #ifdef HAVE_CONFIG_H
>  #include "config.h"
>  #endif
>
> -#include 
> -#include 
>  #include 
>
> +#include 
> +
> +/**
> + *  
> https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/futimens.html
> + *
> + *  Set file access and modification times
> + */
>  int utimes(
>const char   *path,
>const struct timeval  times[2]
> -)
> +)
>  {
> -  struct utimbuf timeinsecs;
> +  struct timespec timeinsecs[2];
>
>if ( times == NULL )
> -return utime( path, NULL );
> +return utimensat( AT_FDCWD, path, NULL , 0 );
>
> -  timeinsecs.actime  = times[0].tv_sec;
> -  timeinsecs.modtime = times[1].tv_sec;
> +  timeinsecs[0].tv_sec = times[0].tv_sec;
> +  timeinsecs[0].tv_nsec = times[0].tv_usec * 1000;
Same concerns as previouus patch, but also here, you should consider
using TOD_NANOSECONDS_PER_MICROSECOND instead of hard-coding.

> +  timeinsecs[1].tv_sec = times[1].tv_sec;
> +  timeinsecs[1].tv_nsec = times[1].tv_usec * 1000;
>
> -  return utime( path,  );
> +  return utimensat( AT_FDCWD, path, timeinsecs, 0 );
>  }
> --
> 1.8.3.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v3 2/5] libcsupport: Implement utime() in terms of utimensat()

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 7:34 AM Ryan Long  wrote:
>
> utime() now calls utimensat() to update file access
> and modification timestamps.
>
> Updated license.
>
> Closes #4397
> ---
>  cpukit/libcsupport/src/utime.c | 77 
> +++---
>  1 file changed, 43 insertions(+), 34 deletions(-)
>
> diff --git a/cpukit/libcsupport/src/utime.c b/cpukit/libcsupport/src/utime.c
> index e2d8883..884d227 100644
> --- a/cpukit/libcsupport/src/utime.c
> +++ b/cpukit/libcsupport/src/utime.c
> @@ -1,58 +1,67 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
>  /**
>   *  @file
>   *
> - *  @brief Set File Access and Modification Times
>   *  @ingroup libcsupport
> + *
> + *  @brief Set file access and modification times in seconds.
>   */
>
>  /*
> - *  COPYRIGHT (c) 1989-1999.
> - *  On-Line Applications Research Corporation (OAR).
> + * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
>   *
> - *  The license and distribution terms for this file may be
> - *  found in the file LICENSE in this distribution or at
> - *  http://www.rtems.org/license/LICENSE.
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
>   */
>
>  #ifdef HAVE_CONFIG_H
>  #include "config.h"
>  #endif
>
> -/* FIXME: This include is a workaround for a broken  in Newlib */
> -#include 
> +#include 
> +#include 
>
> +#include 
>  #include 
>
> -#include 
> -
>  /**
> - *  POSIX 1003.1b 5.5.6 - Set File Access and Modification Times
> + *  https://pubs.opengroup.org/onlinepubs/009604599/functions/utime.html
> + *
> + *  Set file access and modification times
>   */
> -int utime( const char *path, const struct utimbuf *times )
> +int utime(
> +  const char *path,
> +  const struct utimbuf *times
> +)
>  {
> -  int rv = 0;
> -  rtems_filesystem_eval_path_context_t ctx;
> -  int eval_flags = RTEMS_FS_FOLLOW_LINK;
> -  const rtems_filesystem_location_info_t *currentloc =
> -rtems_filesystem_eval_path_start( , path, eval_flags );
> -  struct utimbuf now_times;
> -
> -  if ( times == NULL ) {
> -time_t now = time( NULL );
> -
> -now_times.actime = now;
> -now_times.modtime = now;
> -
> -times = _times;
> -  }
> +  struct timespec new_times[2];
>
> -  rv = (*currentloc->mt_entry->ops->utime_h)(
> -currentloc,
> -times->actime,
> -times->modtime
> -  );
> +  if ( times == NULL )
add {
> +return utimensat(AT_FDCWD, path, NULL, 0);
and }

>
> -  rtems_filesystem_eval_path_cleanup(  );
> +  new_times[0].tv_sec = times->actime;
> +  new_times[0].tv_nsec = 0;
Why not using _Timespec_Set() helper?

> +  new_times[1].tv_sec = times->modtime;
> +  new_times[1].tv_nsec = 0;
>
> -  return rv;
> +  return utimensat(AT_FDCWD, path, new_times, 0);
>  }
> --
> 1.8.3.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v3 1/5] libcsupport: Added futimens() and utimensat()

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 7:33 AM Ryan Long  wrote:
>
> Created futimens.c and utimensat.c to add support for the POSIX
> methods futimens() and utimensat().
>
> utime() and utimes() are considered obsolote by POSIX, but RTEMS
> will continue to support them.
>
> Closes #4396
> ---
>  cpukit/Makefile.am   |   2 +
>  cpukit/include/rtems/libio_.h|  64 -
>  cpukit/include/rtems/score/timespec.h|  16 ++-
>  cpukit/libcsupport/src/futimens.c|  87 
>  cpukit/libcsupport/src/utimensat.c   | 224 
> +++
>  cpukit/score/src/timespecisnonnegative.c |  35 +
>  spec/build/cpukit/librtemscpu.yml|   3 +
>  7 files changed, 426 insertions(+), 5 deletions(-)
>  create mode 100644 cpukit/libcsupport/src/futimens.c
>  create mode 100644 cpukit/libcsupport/src/utimensat.c
>  create mode 100644 cpukit/score/src/timespecisnonnegative.c
>
> diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> index b0df610..29b4207 100644
> --- a/cpukit/Makefile.am
> +++ b/cpukit/Makefile.am
> @@ -262,6 +262,8 @@ librtemscpu_a_SOURCES += libcsupport/src/unmount.c
>  librtemscpu_a_SOURCES += libcsupport/src/__usrenv.c
>  librtemscpu_a_SOURCES += libcsupport/src/utime.c
>  librtemscpu_a_SOURCES += libcsupport/src/utimes.c
> +librtemscpu_a_SOURCES += libcsupport/src/futimens.c
> +librtemscpu_a_SOURCES += libcsupport/src/utimensat.c
>  librtemscpu_a_SOURCES += libcsupport/src/utsname.c
>  librtemscpu_a_SOURCES += libcsupport/src/vprintk.c
>  librtemscpu_a_SOURCES += libcsupport/src/write.c
> diff --git a/cpukit/include/rtems/libio_.h b/cpukit/include/rtems/libio_.h
> index e9eb462..b7455ef 100644
> --- a/cpukit/include/rtems/libio_.h
> +++ b/cpukit/include/rtems/libio_.h
> @@ -2,13 +2,12 @@
>   * @file
>   *
>   * @brief LibIO Internal Interface
> - *
> + *
>   * This file is the libio internal interface.
>   */
>
>  /*
> - *  COPYRIGHT (c) 1989-2011.
> - *  On-Line Applications Research Corporation (OAR).
> + *  COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
>   *
>   *  Modifications to support reference counting in the file system are
>   *  Copyright (c) 2012 embedded brains GmbH.
> @@ -30,6 +29,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #ifdef __cplusplus
>  extern "C" {
> @@ -357,6 +357,64 @@ static inline void rtems_filesystem_instance_unlock(
>(*mt_entry->ops->unlock_h)( mt_entry );
>  }
>
> +/**
> + * @brief Checks the tv_nsec member of a timespec struct
> + *
> + * This function is used with utimensat() and futimens() only. This ensures
> + * that the value in the tv_nsec member is equal to either UTIME_NOW,
> + * UTIME_OMIT, or a value greater-than or equal to zero and less than a
> + * billion.
> + *
> + * @param[in] time The timespec struct to be validated
> + *
> + * @retval Returns true if tv_nsec member is a valid value, otherwise false.
> + */
> +bool rtems_filesystem_utime_tv_nsec_valid( struct timespec time );
> +
> +/**
> + * @brief Determines if the process has write permissions to a file
I think it is more specific than that.  Also, missing period.

> + *
> + * The timespec at index 0 is the access time, the timespec at index 1 is the
> + * modification time.
Should this note be on the @param[in] times below?

> + *
> + * This function is only used with utimensat() and futimens(). This checks
> + * whether the process has write access to a file, and checks for EACCES
> + * and EPERM errors depending on what values are in @times and if the process
> + * has write permissions to the file.
> + *
> + * @param[in] currentloc The current location to a file
> + * @param[in] times The timespec instance that will update the timestamps
update? nothing about this function seems to be an update?

> + *
> + * @retval Returns 0 if the process has write permissions, otherwise -1.
> + */
> +int rtems_filesystem_utime_check_permissions(
> +  const rtems_filesystem_location_info_t *currentloc,
> +  const struct timespec times[2]
> +);
> +
> +/**
> + * @brief Checks @times and fills @new_times with the time to be written
> + *
> + * For each of the arguments, the timespec at index 0 is the access time, and
> + * the timespec at index 1 is the modification time.
> + *
> + * This function is only used with utimensat() and futimens(). @times 
> contains
> + * the constant values passed into utimensat/futimens. @new_times contains 
> the
> + * values that will be written to the file. These values depend on @times. If
> + * @times is NULL, or either of its elements' tv_nsec members are UTIME_NOW,
> + * the current elapsed time in nanoseconds will be saved in the corresponding
> + * location in @new_times.
> + *
> + * @param[in] times The timespecs to be checked
> + * @param[in,out] new_times The timespecs containing the time to be written
I don't think new_times is an 'in' param?

> + *
> + * @retval Returns 0 if @times is valid, otherwise -1.
> + */
> +int rtems_filesystem_utime_check_times(

Re: [PATCH] c-user: Add task priority glossary terms

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 8:50 AM Joel Sherrill  wrote:
>
> Looks good.
>
> On Wed, May 12, 2021 at 8:07 AM Sebastian Huber 
>  wrote:
>>
>> ---
>>  c-user/glossary.rst | 41 ++---
>>  1 file changed, 38 insertions(+), 3 deletions(-)
>>
>> diff --git a/c-user/glossary.rst b/c-user/glossary.rst
>> index b3527a7..5a06c10 100644
>> --- a/c-user/glossary.rst
>> +++ b/c-user/glossary.rst
>> @@ -194,6 +194,14 @@ Glossary
>>  This term is an acronym for Cathode Ray Tube.  Normally used in 
>> reference to
>>  the man-machine interface.
>>
>> +current priority
>> +The current priority of a :term:`task` is the :term:`task priority` 
>> with
>> +respect to the :term:`home scheduler` of the task.  It is an 
>> aggregation of
>> +the :term:`real priority` and temporary priority adjustments due to 
>> locking
>> +protocols, the rate-monotonic period objects on some schedulers 
>> such as EDF,
>> +and the :term:`POSIX` sporadic server.  The current priority is an
>> +:term:`eligible priority`.
>> +
>>  deadline
>>  A fixed time limit by which a task must have completed a set of 
>> actions.
>>  Beyond this point, the results are of reduced value and may even be
>> @@ -246,6 +254,12 @@ Glossary
>>  This term is an acronym for
>>  `Executable and Linkable Format 
>> `_.
>>
>> +eligible priority
>> +An eligible priority of a :term:`task` is the :term:`task priority` 
>> with
>> +respect to the corresponding :term:`eligible scheduler` of the 
>> task.  An
>> +eligible priority is either the :term:`current priority` and a
 "and" should be "or" ?

>> +:term:`helping priority` of a task.
>> +
>>  eligible scheduler
>>  An eligible scheduler of a :term:`task` is a :term:`scheduler` 
>> which can be
>>  used by the task to allocate a processor for the task.
>> @@ -366,6 +380,11 @@ Glossary
>>  dispatch is marked as necessary, then the next thread dispatch will 
>> make
>>  the heir task the executing task.
>>
>> +helping priority
>> +A helping priority of a :term:`task` is the :term:`task priority` 
>> with
>> +respect to the corresponding :term:`helping scheduler` of the task. 
>>  A
>> +helping priority is an :term:`eligible priority`.
>> +
>>  helping scheduler
>>  A helping scheduler of a :term:`task` is a :term:`scheduler` which 
>> is a
>>  :term:`eligible scheduler` and which is not the :term:`home 
>> scheduler` of
>> @@ -632,9 +651,9 @@ Glossary
>>  another task.
>>
>>  priority
>> -A mechanism used to represent the relative importance of an element 
>> in a
>> -set of items.  RTEMS uses priority to determine which task should
>> -execute.
>> +The priority is a mechanism used to represent the relative 
>> importance of an
>> +element in a set of items.  RTEMS uses :term:`task priorities > priority>` to determine
>> +which :term:`task` should execute.
>>
>>  priority boosting
>>  A simple approach to extend the priority inheritance protocol for
>> @@ -686,6 +705,14 @@ Glossary
>>  decided that other tasks are currently more important.  A task that 
>> is
>>  ready to execute and has a processor assigned is called scheduled.
>>
>> +real priority
>> +Each :term:`task` has exactly one real priority.  The real priority 
>> is
>> +always with respect to the :term:`home scheduler` of a task.  It is 
>> defined
>> +during task initialization.  It may be changed by directives such as
>> +:c:func:`rtems_task_set_priority` and
>> +:c:func:`rtems_task_set_scheduler`.  The real priority is the 
>> foundation
>> +of the :term:`current priority`.
>> +
>>  real-time
>>  A term used to describe systems which are characterized by requiring
>>  deterministic response times to external stimuli.  The external 
>> stimuli
>> @@ -959,6 +986,14 @@ Glossary
>>  Task migration happens in case a task stops execution on one 
>> processor
>>  and resumes execution on another processor.
>>
>> +task priority
>> +A task priority of a :term:`task` determines its importance with 
>> respect to
>> +other tasks.  The scheduler use task priorities to determine which
>> +:term:`ready task` gets a processor allocated.  The
>> +:term:`eligible priorities ` of a task define 
>> the position of the task in a
>> +:term:`wait queue` which uses the priority discipline.  Each task 
>> has at
>> +least the :term:`real priority`.
>> +
>>  task processor affinity
>>  The set of processors on which a task is allowed to execute.
>>
>> --
>> 2.26.2
>>
>> ___
>> devel mailing 

Re: [PATCH] c-user: Document rtems_task_set_scheduler() errors

2021-05-12 Thread Gedare Bloom
ok

On Wed, May 12, 2021 at 7:06 AM Sebastian Huber
 wrote:
>
> ---
>  c-user/task/directives.rst | 24 ++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst
> index 2bfb8af..c0ef4e7 100644
> --- a/c-user/task/directives.rst
> +++ b/c-user/task/directives.rst
> @@ -1702,12 +1702,32 @@ This directive sets the :term:`home scheduler` to the 
> scheduler specified by
>  ``scheduler_id``.
>
>  :c:macro:`RTEMS_INVALID_PRIORITY`
> -There task priority specified in ``priority`` was invalid with respect to
> -the scheduler specified by ``scheduler_id``.
> +The task priority specified by ``priority`` was invalid with respect to 
> the
> +scheduler specified by ``scheduler_id``.
>
>  :c:macro:`RTEMS_INVALID_ID`
>  There was no task associated with the identifier specified by 
> ``task_id``.
>
> +:c:macro:`RTEMS_RESOURCE_IN_USE`
> +The task specified by ``task_id`` was enqueued on a :term:`wait queue`.
> +
> +:c:macro:`RTEMS_RESOURCE_IN_USE`
> +The task specified by ``task_id`` had a :term:`current priority` which
> +consisted of more than the :term:`real priority`.
> +
> +:c:macro:`RTEMS_RESOURCE_IN_USE`
> +The task specified by ``task_id`` had a :term:`helping scheduler`.
> +
> +:c:macro:`RTEMS_RESOURCE_IN_USE`
> +The task specified by ``task_id`` was pinned.
> +
> +:c:macro:`RTEMS_UNSATISFIED`
> +The scheduler specified by ``scheduler_id`` owned no processor.
> +
> +:c:macro:`RTEMS_UNSATISFIED`
> +The scheduler specified by ``scheduler_id`` did not support the affinity
> +set of the task specified by ``task_id``.
> +
>  :c:macro:`RTEMS_ILLEGAL_ON_REMOTE_OBJECT`
>  The task resided on a remote node.
>
> --
> 2.26.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 5/5] bsps/imxrt: Enable DMA clock

2021-05-12 Thread Gedare Bloom
the patch set is fine with the minor nit.

On Wed, May 12, 2021 at 3:49 AM Christian Mauderer
 wrote:
>
> The EDMA is intialized so make sure the the clock is initialized too.
>
> Update #4180
> ---
>  bsps/arm/imxrt/start/bspstarthooks.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/bsps/arm/imxrt/start/bspstarthooks.c 
> b/bsps/arm/imxrt/start/bspstarthooks.c
> index 2b6b59f66b..b8149691e7 100644
> --- a/bsps/arm/imxrt/start/bspstarthooks.c
> +++ b/bsps/arm/imxrt/start/bspstarthooks.c
> @@ -48,4 +48,7 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
>
>/* Reduce frequency for I2C */
>CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 5);
> +
> +  /* Enable EDMA clock. We initialize the EDMA so we need the clock. */
> +  CLOCK_EnableClock(kCLOCK_Dma);
>  }
> --
> 2.26.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/5] bsps/imxrt: Reduce devicetree size

2021-05-12 Thread Gedare Bloom
is it already clear in the related doco that overlays and adding stuff
during run-time are not supported?

On Wed, May 12, 2021 at 3:49 AM Christian Mauderer
 wrote:
>
> Remove symbols that would be necessary for overlays and decrease padding
> that would be necessary for adding stuff during run-time.
>
> Update #4180
> ---
>  bsps/arm/imxrt/dts/imxrt1050-evkb.c   | 1235 ++---
>  bsps/arm/imxrt/dts/imxrt1050-evkb.dts |2 +-
>  2 files changed, 472 insertions(+), 765 deletions(-)
>
> diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c 
> b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
> index 4842f1b85d..b93dcd775b 100644
> --- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
> +++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
> @@ -7,10 +7,10 @@
>  #include 
>
>  const unsigned char imxrt_dtb[] = {
> -  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x2b, 0x36, 0x00, 0x00, 0x00, 0x38,
> -  0x00, 0x00, 0x24, 0xd4, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11,
> -  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x62,
> -  0x00, 0x00, 0x24, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x1d, 0x73, 0x00, 0x00, 0x00, 0x38,
> +  0x00, 0x00, 0x1b, 0xcc, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11,
> +  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x67,
> +  0x00, 0x00, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
> @@ -20,252 +20,236 @@ const unsigned char imxrt_dtb[] = {
>0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75,
>0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x75,
>0x61, 0x72, 0x74, 0x40, 0x34, 0x30, 0x31, 0x38, 0x34, 0x30, 0x30, 0x30,
> -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
> -  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02,
> -  0x00, 0x00, 0x00, 0x01, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00,
> -  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2f,
> +  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
> +  0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00, 0x00, 0x00, 0x00, 0x03,
> +  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x2f, 0x73, 0x6f, 0x63,
> +  0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30,
> +  0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40,
> +  0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
> +  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2d,
>0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75,
>0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67,
> -  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30,
> +  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x63, 0x30, 0x30, 0x30,
>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25,
> -  0x00, 0x00, 0x00, 0x35, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70,
> +  0x00, 0x00, 0x00, 0x33, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70,
>0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30,
> -  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62,
> -  0x63, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
> -  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3b, 0x2f, 0x73, 0x6f, 0x63,
> +  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x63,
> +  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
> +  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x39, 0x2f, 0x73, 0x6f, 0x63,
>0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30,
>0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40,
> -  0x34, 0x30, 0x31, 0x63, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
> -  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x41,
> +  0x34, 0x30, 0x31, 0x63, 0x34, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
> +  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3f,
>0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75,
> -  0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67,
> -  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x63, 0x34, 0x30, 0x30, 0x30,
> -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25,
> -  0x00, 0x00, 0x00, 0x47, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70,
> -  0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30,
> -  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x30, 0x63,
> -  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
> -  0x00, 0x00, 0x00, 0x01, 0x69, 0x6e, 0x74, 0x65, 

Re: [PATCH 1/5] bsps/imxrt: Fix documentation error

2021-05-12 Thread Gedare Bloom
On Wed, May 12, 2021 at 3:49 AM Christian Mauderer
 wrote:
>
> Update #4180
> ---
>  bsps/arm/imxrt/include/fsl_qtmr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bsps/arm/imxrt/include/fsl_qtmr.h 
> b/bsps/arm/imxrt/include/fsl_qtmr.h
> index a675413f8d..eb1d612ac3 100644
> --- a/bsps/arm/imxrt/include/fsl_qtmr.h
> +++ b/bsps/arm/imxrt/include/fsl_qtmr.h
> @@ -207,7 +207,7 @@ rtems_vector_number QTMR_get_IRQ_from_fdt(const void 
> *fdt, int node);
>   *
>   * @param base Quad Timer peripheral base address.
>   *
> - * @return IRQ vector number. BSP_INTERRUPT_VECTOR_INVALID on error.
> + * @return Clock frequency value in hertz
nit: missing period.

>   */
>  uint32_t QTMR_get_src_clk(TMR_Type *base);
>  #endif /* __rtems__ */
> --
> 2.26.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/3] _TOD_Validate(): Fix incorrect return code

2021-05-12 Thread Gedare Bloom
> > These three files in bsps/ should not be calling score functions
> > directly, unless they implement part of the score CPU port. These
> > don't seem to be doing that. This issue exists before this patch, but
> > a ticket should be opened to fix this. A new API should be added for
> > application/BSP layers to validate an rtems_time_of_day value.
>
> I added a ticket:
>
> https://devel.rtems.org/ticket/4407
>
> For me it has a very low priority.
>
Understood, thanks.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v2] rtems: Constify rtems_task_wake_when()

2021-05-12 Thread Gedare Bloom
I understand the efficiency, but the interface is awkward. At least
maybe put UINT32_MAX behind a macro to make the intent more clear
#define RTEMS_TICKS_MASK 0xU
or UINT32_MAX is fine there too, equivalent.

Otherwise, go ahead.

On Tue, May 11, 2021 at 10:46 PM Sebastian Huber
 wrote:
>
> Add a parameter to _TOD_Validate() to disable the validation of the
> ticks member.
>
> There are two reasons for this change.  Firstly, in
> rtems_task_wake_when() was a double check for time_buffer == NULL (one
> in rtems_task_wake_when() and one in _TOD_Validate()).  Secondly, the
> ticks member is ignored by rtems_task_wake_when().  This was done with a
> write of zero to the ticks member and thus a modification of the
> user-provided structure.  Now the structure is no longer modified.
> Using a mask parameter is quite efficient. You just have to load an
> immediate value and there are no additional branches in _TOD_Validate().
>
> Close #4406.
> ---
>  bsps/arm/altera-cyclone-v/rtc/rtc.c|  3 +--
>  bsps/shared/dev/rtc/rtc-support.c  |  2 +-
>  cpukit/include/rtems/rtems/clockimpl.h | 13 -
>  cpukit/include/rtems/rtems/tasks.h |  2 +-
>  cpukit/rtems/src/clockset.c|  2 +-
>  cpukit/rtems/src/clocktodvalidate.c|  5 +++--
>  cpukit/rtems/src/taskwakewhen.c|  8 ++--
>  cpukit/rtems/src/timercreate.c |  2 +-
>  testsuites/sptests/sp2038/init.c   |  4 ++--
>  9 files changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/bsps/arm/altera-cyclone-v/rtc/rtc.c 
> b/bsps/arm/altera-cyclone-v/rtc/rtc.c
> index fb30da8d66..4edc7c87f6 100644
> --- a/bsps/arm/altera-cyclone-v/rtc/rtc.c
> +++ b/bsps/arm/altera-cyclone-v/rtc/rtc.c
> @@ -345,7 +345,6 @@ static int altera_cyclone_v_ds1339_get_time(int minor, 
> rtems_time_of_day* tod)
>
>if (sc == RTEMS_SUCCESSFUL)
>{
> -temp_tod.ticks  = 0;
>  temp_tod.second = ds1339_get_seconds();
>  temp_tod.minute = ds1339_get_minutes();
>  temp_tod.hour   = ds1339_get_hours();
> @@ -353,7 +352,7 @@ static int altera_cyclone_v_ds1339_get_time(int minor, 
> rtems_time_of_day* tod)
>  temp_tod.month  = ds1339_get_month();
>  temp_tod.year   = ds1339_get_year();
>
> -sc = _TOD_Validate(_tod)
> +sc = _TOD_Validate(_tod, 0)
>  if (sc == RTEMS_SUCCESSFUL)
>memcpy(tod, _tod, sizeof(temp_tod));
>}
> diff --git a/bsps/shared/dev/rtc/rtc-support.c 
> b/bsps/shared/dev/rtc/rtc-support.c
> index 04b8f0c847..1a0f2a3d9a 100644
> --- a/bsps/shared/dev/rtc/rtc-support.c
> +++ b/bsps/shared/dev/rtc/rtc-support.c
> @@ -255,7 +255,7 @@ int setRealTime(
>if (!RTC_Is_present())
>  return -1;
>
> -  if (_TOD_Validate(tod) != RTEMS_SUCCESSFUL)
> +  if (_TOD_Validate(tod, UINT32_MAX) != RTEMS_SUCCESSFUL)
>  return -1;
>
>RTC_Table[RTC_Minor].pDeviceFns->deviceSetTime(RTC_Minor, tod);
> diff --git a/cpukit/include/rtems/rtems/clockimpl.h 
> b/cpukit/include/rtems/rtems/clockimpl.h
> index 8ec4f0f6e3..670ea1e3d7 100644
> --- a/cpukit/include/rtems/rtems/clockimpl.h
> +++ b/cpukit/include/rtems/rtems/clockimpl.h
> @@ -35,19 +35,22 @@ extern "C" {
>   */
>
>  /**
> - * @brief TOD Validate
> + * @brief Validates the time of day.
>   *
> - * This support function tests whether @a the_tod references
> - * a valid time of day.
> + * @param the_tod is the reference to the time of day structure to validate 
> or
> + *   NULL.
>   *
> - * @param the_tod A reference to the time of day structure to validate.
> + * @param ticks_mask is the mask for the ticks member of the time of day.  
> Use
> + *   UINT32_MAX to validate the ticks member.  Use zero to skip the 
> validation of
> + *   the ticks member.
>   *
>   * @retval RTEMS_SUCCESSFUL @a the_tod references a valid time of day.
>   * @retval RTEMS_INVALID_CLOCK @a the_tod references an invalid time of day.
>   * @retval RTEMS_INVALID_ADDRESS @a the_tod reference is @c NULL.
>   */
>  rtems_status_code _TOD_Validate(
> -  const rtems_time_of_day *the_tod
> +  const rtems_time_of_day *the_tod,
> +  uint32_t ticks_mask
>  );
>
>  /**
> diff --git a/cpukit/include/rtems/rtems/tasks.h 
> b/cpukit/include/rtems/rtems/tasks.h
> index e6f7696923..841306eaef 100644
> --- a/cpukit/include/rtems/rtems/tasks.h
> +++ b/cpukit/include/rtems/rtems/tasks.h
> @@ -2071,7 +2071,7 @@ rtems_status_code rtems_task_wake_after( rtems_interval 
> ticks );
>   *   occur.
>   * @endparblock
>   */
> -rtems_status_code rtems_task_wake_when( rtems_time_of_day *time_buffer );
> +rtems_status_code rtems_task_wake_when( const rtems_time_of_day *time_buffer 
> );
>
>  /* Generated from spec:/rtems/task/if/get-scheduler */
>
> diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
> index df163531a7..d79d7648e8 100644
> --- a/cpukit/rtems/src/clockset.c
> +++ b/cpukit/rtems/src/clockset.c
> @@ -34,7 +34,7 @@ rtems_status_code rtems_clock_set(
>struct timespec   tod_as_timespec;
>ISR_lock_Context  lock_context;
>
> -  status 

Re: [PATCH] c-user: Add task priority glossary terms

2021-05-12 Thread Joel Sherrill
Looks good.

On Wed, May 12, 2021 at 8:07 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> ---
>  c-user/glossary.rst | 41 ++---
>  1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/c-user/glossary.rst b/c-user/glossary.rst
> index b3527a7..5a06c10 100644
> --- a/c-user/glossary.rst
> +++ b/c-user/glossary.rst
> @@ -194,6 +194,14 @@ Glossary
>  This term is an acronym for Cathode Ray Tube.  Normally used in
> reference to
>  the man-machine interface.
>
> +current priority
> +The current priority of a :term:`task` is the :term:`task
> priority` with
> +respect to the :term:`home scheduler` of the task.  It is an
> aggregation of
> +the :term:`real priority` and temporary priority adjustments due
> to locking
> +protocols, the rate-monotonic period objects on some schedulers
> such as EDF,
> +and the :term:`POSIX` sporadic server.  The current priority is an
> +:term:`eligible priority`.
> +
>  deadline
>  A fixed time limit by which a task must have completed a set of
> actions.
>  Beyond this point, the results are of reduced value and may even
> be
> @@ -246,6 +254,12 @@ Glossary
>  This term is an acronym for
>  `Executable and Linkable Format <
> https://en.wikipedia.org/wiki/Executable_and_Linkable_Format>`_.
>
> +eligible priority
> +An eligible priority of a :term:`task` is the :term:`task
> priority` with
> +respect to the corresponding :term:`eligible scheduler` of the
> task.  An
> +eligible priority is either the :term:`current priority` and a
> +:term:`helping priority` of a task.
> +
>  eligible scheduler
>  An eligible scheduler of a :term:`task` is a :term:`scheduler`
> which can be
>  used by the task to allocate a processor for the task.
> @@ -366,6 +380,11 @@ Glossary
>  dispatch is marked as necessary, then the next thread dispatch
> will make
>  the heir task the executing task.
>
> +helping priority
> +A helping priority of a :term:`task` is the :term:`task priority`
> with
> +respect to the corresponding :term:`helping scheduler` of the
> task.  A
> +helping priority is an :term:`eligible priority`.
> +
>  helping scheduler
>  A helping scheduler of a :term:`task` is a :term:`scheduler`
> which is a
>  :term:`eligible scheduler` and which is not the :term:`home
> scheduler` of
> @@ -632,9 +651,9 @@ Glossary
>  another task.
>
>  priority
> -A mechanism used to represent the relative importance of an
> element in a
> -set of items.  RTEMS uses priority to determine which task should
> -execute.
> +The priority is a mechanism used to represent the relative
> importance of an
> +element in a set of items.  RTEMS uses :term:`task priorities
> ` to determine
> +which :term:`task` should execute.
>
>  priority boosting
>  A simple approach to extend the priority inheritance protocol for
> @@ -686,6 +705,14 @@ Glossary
>  decided that other tasks are currently more important.  A task
> that is
>  ready to execute and has a processor assigned is called scheduled.
>
> +real priority
> +Each :term:`task` has exactly one real priority.  The real
> priority is
> +always with respect to the :term:`home scheduler` of a task.  It
> is defined
> +during task initialization.  It may be changed by directives such
> as
> +:c:func:`rtems_task_set_priority` and
> +:c:func:`rtems_task_set_scheduler`.  The real priority is the
> foundation
> +of the :term:`current priority`.
> +
>  real-time
>  A term used to describe systems which are characterized by
> requiring
>  deterministic response times to external stimuli.  The external
> stimuli
> @@ -959,6 +986,14 @@ Glossary
>  Task migration happens in case a task stops execution on one
> processor
>  and resumes execution on another processor.
>
> +task priority
> +A task priority of a :term:`task` determines its importance with
> respect to
> +other tasks.  The scheduler use task priorities to determine which
> +:term:`ready task` gets a processor allocated.  The
> +:term:`eligible priorities ` of a task define
> the position of the task in a
> +:term:`wait queue` which uses the priority discipline.  Each task
> has at
> +least the :term:`real priority`.
> +
>  task processor affinity
>  The set of processors on which a task is allowed to execute.
>
> --
> 2.26.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH v3 3/5] libcsupport: Implement utimes() in terms of utimensat()

2021-05-12 Thread Ryan Long
utimes() now calls utimensat() to update file access
and modification timestamps.

Updated license.

Closes #4398
---
 cpukit/libcsupport/src/utimes.c | 53 +++--
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/cpukit/libcsupport/src/utimes.c b/cpukit/libcsupport/src/utimes.c
index 3dc47c0..f16e6cf 100644
--- a/cpukit/libcsupport/src/utimes.c
+++ b/cpukit/libcsupport/src/utimes.c
@@ -1,38 +1,65 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  *  @file
  *
- *  @brief Change File Last Access and Modification Times 
  *  @ingroup libcsupport
+ *
+ *  @brief Set file access and modification times in milliseconds.
  */
 
 /*
- *  Written by: Vinu Rajashekhar 
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
  *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include 
-#include 
 #include 
 
+#include 
+
+/**
+ *  
https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/futimens.html
+ *
+ *  Set file access and modification times
+ */
 int utimes(
   const char   *path,
   const struct timeval  times[2]
-) 
+)
 {
-  struct utimbuf timeinsecs;
+  struct timespec timeinsecs[2];
 
   if ( times == NULL )
-return utime( path, NULL );
+return utimensat( AT_FDCWD, path, NULL , 0 );
 
-  timeinsecs.actime  = times[0].tv_sec;
-  timeinsecs.modtime = times[1].tv_sec;
+  timeinsecs[0].tv_sec = times[0].tv_sec;
+  timeinsecs[0].tv_nsec = times[0].tv_usec * 1000;
+  timeinsecs[1].tv_sec = times[1].tv_sec;
+  timeinsecs[1].tv_nsec = times[1].tv_usec * 1000;
 
-  return utime( path,  );
+  return utimensat( AT_FDCWD, path, timeinsecs, 0 );
 }
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v3 2/5] libcsupport: Implement utime() in terms of utimensat()

2021-05-12 Thread Ryan Long
utime() now calls utimensat() to update file access
and modification timestamps.

Updated license.

Closes #4397
---
 cpukit/libcsupport/src/utime.c | 77 +++---
 1 file changed, 43 insertions(+), 34 deletions(-)

diff --git a/cpukit/libcsupport/src/utime.c b/cpukit/libcsupport/src/utime.c
index e2d8883..884d227 100644
--- a/cpukit/libcsupport/src/utime.c
+++ b/cpukit/libcsupport/src/utime.c
@@ -1,58 +1,67 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  *  @file
  *
- *  @brief Set File Access and Modification Times
  *  @ingroup libcsupport
+ *
+ *  @brief Set file access and modification times in seconds.
  */
 
 /*
- *  COPYRIGHT (c) 1989-1999.
- *  On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
  *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-/* FIXME: This include is a workaround for a broken  in Newlib */
-#include 
+#include 
+#include 
 
+#include 
 #include 
 
-#include 
-
 /**
- *  POSIX 1003.1b 5.5.6 - Set File Access and Modification Times
+ *  https://pubs.opengroup.org/onlinepubs/009604599/functions/utime.html
+ *
+ *  Set file access and modification times
  */
-int utime( const char *path, const struct utimbuf *times )
+int utime(
+  const char *path,
+  const struct utimbuf *times
+)
 {
-  int rv = 0;
-  rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_FS_FOLLOW_LINK;
-  const rtems_filesystem_location_info_t *currentloc =
-rtems_filesystem_eval_path_start( , path, eval_flags );
-  struct utimbuf now_times;
-
-  if ( times == NULL ) {
-time_t now = time( NULL );
-
-now_times.actime = now;
-now_times.modtime = now;
-
-times = _times;
-  }
+  struct timespec new_times[2];
 
-  rv = (*currentloc->mt_entry->ops->utime_h)(
-currentloc,
-times->actime,
-times->modtime
-  );
+  if ( times == NULL )
+return utimensat(AT_FDCWD, path, NULL, 0);
 
-  rtems_filesystem_eval_path_cleanup(  );
+  new_times[0].tv_sec = times->actime;
+  new_times[0].tv_nsec = 0;
+  new_times[1].tv_sec = times->modtime;
+  new_times[1].tv_nsec = 0;
 
-  return rv;
+  return utimensat(AT_FDCWD, path, new_times, 0);
 }
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v3 5/5] Change filesystem utime_h handler to utimens_h

2021-05-12 Thread Ryan Long
Also updated licenses.

Closes #4400
---
 bsps/arm/csb337/umon/tfsDriver.c|  2 +-
 cpukit/Makefile.am  |  4 +-
 cpukit/include/rtems/confdefs/libio.h   |  4 +-
 cpukit/include/rtems/imfs.h |  7 ++--
 cpukit/include/rtems/libio.h| 21 +--
 cpukit/libcsupport/src/__usrenv.c   |  9 ++---
 cpukit/libfs/src/defaults/default_ops.c |  2 +-
 cpukit/libfs/src/defaults/default_utime.c   | 32 
 cpukit/libfs/src/defaults/default_utimens.c | 49 
 cpukit/libfs/src/dosfs/msdos_init.c | 11 +++---
 cpukit/libfs/src/ftpfs/ftpfs.c  |  2 +-
 cpukit/libfs/src/ftpfs/tftpDriver.c |  2 +-
 cpukit/libfs/src/imfs/imfs_init.c   |  4 +-
 cpukit/libfs/src/imfs/imfs_utime.c  | 41 
 cpukit/libfs/src/imfs/imfs_utimens.c| 58 +
 cpukit/libfs/src/jffs2/src/fs-rtems.c   | 11 +++---
 cpukit/libfs/src/rfs/rtems-rfs-rtems.c  | 16 
 spec/build/cpukit/librtemscpu.yml   |  4 +-
 18 files changed, 152 insertions(+), 127 deletions(-)
 delete mode 100644 cpukit/libfs/src/defaults/default_utime.c
 create mode 100644 cpukit/libfs/src/defaults/default_utimens.c
 delete mode 100644 cpukit/libfs/src/imfs/imfs_utime.c
 create mode 100644 cpukit/libfs/src/imfs/imfs_utimens.c

diff --git a/bsps/arm/csb337/umon/tfsDriver.c b/bsps/arm/csb337/umon/tfsDriver.c
index 0195346..caf3a4b 100644
--- a/bsps/arm/csb337/umon/tfsDriver.c
+++ b/bsps/arm/csb337/umon/tfsDriver.c
@@ -657,7 +657,7 @@ static const rtems_filesystem_operations_table  
rtems_tfs_ops = {
   .mount_h = rtems_filesystem_default_mount,
   .unmount_h = rtems_filesystem_default_unmount,
   .fsunmount_me_h = rtems_filesystem_default_fsunmount,
-  .utime_h = rtems_filesystem_default_utime,
+  .utimens_h = rtems_filesystem_default_utimens,
   .symlink_h = rtems_filesystem_default_symlink,
   .readlink_h = rtems_filesystem_default_readlink,
   .rename_h = rtems_filesystem_default_rename,
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 29b4207..c144773 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -377,7 +377,7 @@ librtemscpu_a_SOURCES += libfs/src/defaults/default_rmnod.c
 librtemscpu_a_SOURCES += libfs/src/defaults/default_statvfs.c
 librtemscpu_a_SOURCES += libfs/src/defaults/default_symlink.c
 librtemscpu_a_SOURCES += libfs/src/defaults/default_unmount.c
-librtemscpu_a_SOURCES += libfs/src/defaults/default_utime.c
+librtemscpu_a_SOURCES += libfs/src/defaults/default_utimens.c
 librtemscpu_a_SOURCES += libfs/src/defaults/default_write.c
 librtemscpu_a_SOURCES += libfs/src/defaults/default_writev.c
 librtemscpu_a_SOURCES += libfs/src/dosfs/fat.c
@@ -434,7 +434,7 @@ librtemscpu_a_SOURCES += libfs/src/imfs/imfs_stat.c
 librtemscpu_a_SOURCES += libfs/src/imfs/imfs_stat_file.c
 librtemscpu_a_SOURCES += libfs/src/imfs/imfs_symlink.c
 librtemscpu_a_SOURCES += libfs/src/imfs/imfs_unmount.c
-librtemscpu_a_SOURCES += libfs/src/imfs/imfs_utime.c
+librtemscpu_a_SOURCES += libfs/src/imfs/imfs_utimens.c
 librtemscpu_a_SOURCES += libfs/src/imfs/ioman.c
 librtemscpu_a_SOURCES += libfs/src/pipe/fifo.c
 librtemscpu_a_SOURCES += libfs/src/pipe/pipe.c
diff --git a/cpukit/include/rtems/confdefs/libio.h 
b/cpukit/include/rtems/confdefs/libio.h
index 16a4fb69..1b84f8c 100644
--- a/cpukit/include/rtems/confdefs/libio.h
+++ b/cpukit/include/rtems/confdefs/libio.h
@@ -231,9 +231,9 @@ static const rtems_filesystem_operations_table 
IMFS_root_ops = {
   #endif
   rtems_filesystem_default_fsunmount,
   #ifdef CONFIGURE_IMFS_DISABLE_UTIME
-rtems_filesystem_default_utime,
+rtems_filesystem_default_utimens,
   #else
-IMFS_utime,
+IMFS_utimens,
   #endif
   #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK
 rtems_filesystem_default_symlink,
diff --git a/cpukit/include/rtems/imfs.h b/cpukit/include/rtems/imfs.h
index b2a9868..6e0d5d5 100644
--- a/cpukit/include/rtems/imfs.h
+++ b/cpukit/include/rtems/imfs.h
@@ -5,7 +5,7 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2011.
+ *  COPYRIGHT (c) 1989-2011, 2021.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -954,10 +954,9 @@ extern int device_ftruncate(
  * This routine is the implementation of the utime() system
  * call for the IMFS.
  */
-extern int IMFS_utime(
+extern int IMFS_utimens(
   const rtems_filesystem_location_info_t *loc,
-  time_t actime,
-  time_t modtime
+  struct timespec times[2]
 );
 
 /**
diff --git a/cpukit/include/rtems/libio.h b/cpukit/include/rtems/libio.h
index 519e797..99543ba 100644
--- a/cpukit/include/rtems/libio.h
+++ b/cpukit/include/rtems/libio.h
@@ -11,7 +11,7 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2008.
+ *  COPYRIGHT (c) 1989-2008, 2021.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  Modifications to support reference counting in the file system are
@@ -375,18 +375,16 @@ typedef int 

[PATCH v3 4/5] psx13: Added tests for utimensat() and futimens()

2021-05-12 Thread Ryan Long
Improved tests for utime() and utimes() and update license.

Close #4399
---
 testsuites/psxtests/psx13/main.c |   5 +-
 testsuites/psxtests/psx13/test.c | 517 +--
 2 files changed, 498 insertions(+), 24 deletions(-)

diff --git a/testsuites/psxtests/psx13/main.c b/testsuites/psxtests/psx13/main.c
index f9e7907..7a560f9 100644
--- a/testsuites/psxtests/psx13/main.c
+++ b/testsuites/psxtests/psx13/main.c
@@ -1,5 +1,3 @@
-/*  SPDX-License-Identifier: BSD-2-Clause */
-
 /**
  *  @file
  *
@@ -8,8 +6,7 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2009, 2021.
- *  On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psx13/test.c b/testsuites/psxtests/psx13/test.c
index e98b03a..cc929ef 100644
--- a/testsuites/psxtests/psx13/test.c
+++ b/testsuites/psxtests/psx13/test.c
@@ -1,5 +1,3 @@
-/*  SPDX-License-Identifier: BSD-2-Clause */
-
 /**
  *  @file
  *
@@ -17,12 +15,13 @@
  * - umask()
  * - utime()
  * - utimes()
+ * - utimensat()
+ * - futimens()
  * - sync()
  */
 
 /*
- *  COPYRIGHT (c) 1989-2009, 2021.
- *  On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -210,8 +209,7 @@ static void Dup2Test( void )
 }
 
 /**
- * @brief Exercises fdatasync(). Does NOT test the functionality of the
- *underlying fdatasync entry in the IMFS op table.
+ * @brief Exercises fdatasync().
  */
 static void FDataSyncTest( void )
 {
@@ -259,60 +257,537 @@ static void UMaskTest( void )
 }
 
 /**
- * @brief Exercises utime(). Does not test the functionality of the
- *underlying utime entry in the IMFS op table.
+ * @brief Exercises utime().
  */
 static void UTimeTest( void )
 {
   int rv;
   struct utimbuf time;
+  struct timespec current_time;
   struct stat fstat;
 
-  /* First, an invalid filename. */
+  /* ENOENT test case */
+
+  /* Case: Pass an invalid filename. */
   rv = utime( "!This is an =invalid p@thname!!! :)", NULL );
   rtems_test_assert( rv == -1 );
   rtems_test_assert( errno == ENOENT );
 
-  /* Now, the success test. */
+  /* EACCES test case */
+
+  /* Case: Change user ID to someone besides root */
+  rv = seteuid( 1 );
+  rtems_test_assert( rv == 0 );
+
+  rv = utime( "testfile1.tst", NULL );
+  rtems_test_assert( rv == -1 );
+  rtems_test_assert( errno == EACCES );
+
+  rv = seteuid( 0 );
+  rtems_test_assert( rv == 0 );
+
+  /* EINVAL test cases */
+
+  /* Case: Invalid access time */
+  time.actime  = -1;
+  time.modtime = 54321;
+
+  rv = utime( "testfile1.tst",  );
+  rtems_test_assert( rv == -1 );
+  rtems_test_assert( errno == EINVAL );
+
+  /* Case: Invalid modified time */
+  time.actime  = 12345;
+  time.modtime = -1;
+
+  rv = utime( "testfile1.tst",  );
+  rtems_test_assert( rv == -1 );
+  rtems_test_assert( errno == EINVAL );
+
+  /* Successful test cases */
+
+  /* Case: Test without times argument */
+  clock_gettime( CLOCK_REALTIME, _time );
+
+  rv = utime( "testfile1.tst", NULL );
+  rtems_test_assert( rv == 0 );
+
+  rv = stat( "testfile1.tst",  );
+  rtems_test_assert( rv == 0 );
+  rtems_test_assert( current_time.tv_sec <= fstat.st_atim.tv_sec );
+  rtems_test_assert( current_time.tv_sec <= fstat.st_mtim.tv_sec );
+
+  /* Case: time is filled with valid values */
   time.actime  = 12345;
   time.modtime = 54321;
 
   rv = utime( "testfile1.tst",  );
   rtems_test_assert( rv == 0 );
 
-  /* But, did it set the time? */
+  /* Check that it actually changed the time */
   rv = stat( "testfile1.tst",  );
   rtems_test_assert( rv == 0 );
   rtems_test_assert( fstat.st_atime == 12345 );
   rtems_test_assert( fstat.st_mtime == 54321 );
-
-  rv = utime( "testfile1.tst", NULL );
-  rtems_test_assert( rv == 0 );
 }
 
 /**
- * @brief Exercises utimes(). Does NOT test the functionality of the
- *underlying utime entry in the IMFS op table.
+ * @brief Exercises utimes().
  */
 static void UTimesTest( void )
 {
   int rv;
   struct timeval time[2];
+  struct timespec current_time;
   struct stat fstat;
 
-  /* First, an invalid filename. */
+  /* ENOENT test case */
+
+  /* Case: First, an invalid filename. */
   rv = utimes( "!This is an =invalid p@thname!!! : )", NULL);
   rtems_test_assert( rv == -1 );
   rtems_test_assert( errno == ENOENT );
 
-  /* Now, the success test. */
+  /* EACCES test case */
+
+  /* Change the user ID of the process to someone besides root */
+  rv = seteuid( 1 );
+  rtems_test_assert( rv == 0 );
+
+  rv = utimes( "testfile1.tst", NULL );
+  rtems_test_assert( rv == -1 );
+  rtems_test_assert( errno == EACCES );
+
+  rv = 

[PATCH v3 1/5] libcsupport: Added futimens() and utimensat()

2021-05-12 Thread Ryan Long
Created futimens.c and utimensat.c to add support for the POSIX
methods futimens() and utimensat().

utime() and utimes() are considered obsolote by POSIX, but RTEMS
will continue to support them.

Closes #4396
---
 cpukit/Makefile.am   |   2 +
 cpukit/include/rtems/libio_.h|  64 -
 cpukit/include/rtems/score/timespec.h|  16 ++-
 cpukit/libcsupport/src/futimens.c|  87 
 cpukit/libcsupport/src/utimensat.c   | 224 +++
 cpukit/score/src/timespecisnonnegative.c |  35 +
 spec/build/cpukit/librtemscpu.yml|   3 +
 7 files changed, 426 insertions(+), 5 deletions(-)
 create mode 100644 cpukit/libcsupport/src/futimens.c
 create mode 100644 cpukit/libcsupport/src/utimensat.c
 create mode 100644 cpukit/score/src/timespecisnonnegative.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index b0df610..29b4207 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -262,6 +262,8 @@ librtemscpu_a_SOURCES += libcsupport/src/unmount.c
 librtemscpu_a_SOURCES += libcsupport/src/__usrenv.c
 librtemscpu_a_SOURCES += libcsupport/src/utime.c
 librtemscpu_a_SOURCES += libcsupport/src/utimes.c
+librtemscpu_a_SOURCES += libcsupport/src/futimens.c
+librtemscpu_a_SOURCES += libcsupport/src/utimensat.c
 librtemscpu_a_SOURCES += libcsupport/src/utsname.c
 librtemscpu_a_SOURCES += libcsupport/src/vprintk.c
 librtemscpu_a_SOURCES += libcsupport/src/write.c
diff --git a/cpukit/include/rtems/libio_.h b/cpukit/include/rtems/libio_.h
index e9eb462..b7455ef 100644
--- a/cpukit/include/rtems/libio_.h
+++ b/cpukit/include/rtems/libio_.h
@@ -2,13 +2,12 @@
  * @file
  *
  * @brief LibIO Internal Interface
- * 
+ *
  * This file is the libio internal interface.
  */
 
 /*
- *  COPYRIGHT (c) 1989-2011.
- *  On-Line Applications Research Corporation (OAR).
+ *  COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
  *
  *  Modifications to support reference counting in the file system are
  *  Copyright (c) 2012 embedded brains GmbH.
@@ -30,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -357,6 +357,64 @@ static inline void rtems_filesystem_instance_unlock(
   (*mt_entry->ops->unlock_h)( mt_entry );
 }
 
+/**
+ * @brief Checks the tv_nsec member of a timespec struct
+ *
+ * This function is used with utimensat() and futimens() only. This ensures
+ * that the value in the tv_nsec member is equal to either UTIME_NOW,
+ * UTIME_OMIT, or a value greater-than or equal to zero and less than a
+ * billion.
+ *
+ * @param[in] time The timespec struct to be validated
+ *
+ * @retval Returns true if tv_nsec member is a valid value, otherwise false.
+ */
+bool rtems_filesystem_utime_tv_nsec_valid( struct timespec time );
+
+/**
+ * @brief Determines if the process has write permissions to a file
+ *
+ * The timespec at index 0 is the access time, the timespec at index 1 is the
+ * modification time.
+ *
+ * This function is only used with utimensat() and futimens(). This checks
+ * whether the process has write access to a file, and checks for EACCES
+ * and EPERM errors depending on what values are in @times and if the process
+ * has write permissions to the file.
+ *
+ * @param[in] currentloc The current location to a file
+ * @param[in] times The timespec instance that will update the timestamps
+ *
+ * @retval Returns 0 if the process has write permissions, otherwise -1.
+ */
+int rtems_filesystem_utime_check_permissions(
+  const rtems_filesystem_location_info_t *currentloc,
+  const struct timespec times[2]
+);
+
+/**
+ * @brief Checks @times and fills @new_times with the time to be written
+ *
+ * For each of the arguments, the timespec at index 0 is the access time, and
+ * the timespec at index 1 is the modification time.
+ *
+ * This function is only used with utimensat() and futimens(). @times contains
+ * the constant values passed into utimensat/futimens. @new_times contains the
+ * values that will be written to the file. These values depend on @times. If
+ * @times is NULL, or either of its elements' tv_nsec members are UTIME_NOW,
+ * the current elapsed time in nanoseconds will be saved in the corresponding
+ * location in @new_times.
+ *
+ * @param[in] times The timespecs to be checked
+ * @param[in,out] new_times The timespecs containing the time to be written
+ *
+ * @retval Returns 0 if @times is valid, otherwise -1.
+ */
+int rtems_filesystem_utime_check_times(
+  const struct timespec times[2],
+  struct timespec new_times[2]
+);
+
 /*
  *  File Descriptor Routine Prototypes
  */
diff --git a/cpukit/include/rtems/score/timespec.h 
b/cpukit/include/rtems/score/timespec.h
index 314d804..3671067 100644
--- a/cpukit/include/rtems/score/timespec.h
+++ b/cpukit/include/rtems/score/timespec.h
@@ -8,8 +8,7 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2009.
- *  On-Line Applications Research Corporation (OAR).
+ *  COPYRIGHT (C) 1989, 2021 On-Line Applications Research 

[PATCH v3 0/5] Add nanosecond support patch

2021-05-12 Thread Ryan Long
Hi,

The notable changes in this iteration are:
- got rid of rtems_filesystem_utime_tv_sec_valid() created
  _Timespec_Is_non_negative() in rtems/score/timespec.h to take its
  place.
- Fixed some license issues

Thanks,
Ryan

Ryan Long (5):
  libcsupport: Added futimens() and utimensat()
  libcsupport: Implement utime() in terms of utimensat()
  libcsupport: Implement utimes() in terms of utimensat()
  psx13: Added tests for utimensat() and futimens()
  Change filesystem utime_h handler to utimens_h

 bsps/arm/csb337/umon/tfsDriver.c|   2 +-
 cpukit/Makefile.am  |   6 +-
 cpukit/include/rtems/confdefs/libio.h   |   4 +-
 cpukit/include/rtems/imfs.h |   7 +-
 cpukit/include/rtems/libio.h|  21 +-
 cpukit/include/rtems/libio_.h   |  64 +++-
 cpukit/include/rtems/score/timespec.h   |  16 +-
 cpukit/libcsupport/src/__usrenv.c   |   9 +-
 cpukit/libcsupport/src/futimens.c   |  87 +
 cpukit/libcsupport/src/utime.c  |  77 +++--
 cpukit/libcsupport/src/utimensat.c  | 224 
 cpukit/libcsupport/src/utimes.c |  53 ++-
 cpukit/libfs/src/defaults/default_ops.c |   2 +-
 cpukit/libfs/src/defaults/default_utime.c   |  32 --
 cpukit/libfs/src/defaults/default_utimens.c |  49 +++
 cpukit/libfs/src/dosfs/msdos_init.c |  11 +-
 cpukit/libfs/src/ftpfs/ftpfs.c  |   2 +-
 cpukit/libfs/src/ftpfs/tftpDriver.c |   2 +-
 cpukit/libfs/src/imfs/imfs_init.c   |   4 +-
 cpukit/libfs/src/imfs/imfs_utime.c  |  41 ---
 cpukit/libfs/src/imfs/imfs_utimens.c|  58 
 cpukit/libfs/src/jffs2/src/fs-rtems.c   |  11 +-
 cpukit/libfs/src/rfs/rtems-rfs-rtems.c  |  16 +-
 cpukit/score/src/timespecisnonnegative.c|  35 ++
 spec/build/cpukit/librtemscpu.yml   |   7 +-
 testsuites/psxtests/psx13/main.c|   5 +-
 testsuites/psxtests/psx13/test.c| 517 ++--
 27 files changed, 1159 insertions(+), 203 deletions(-)
 create mode 100644 cpukit/libcsupport/src/futimens.c
 create mode 100644 cpukit/libcsupport/src/utimensat.c
 delete mode 100644 cpukit/libfs/src/defaults/default_utime.c
 create mode 100644 cpukit/libfs/src/defaults/default_utimens.c
 delete mode 100644 cpukit/libfs/src/imfs/imfs_utime.c
 create mode 100644 cpukit/libfs/src/imfs/imfs_utimens.c
 create mode 100644 cpukit/score/src/timespecisnonnegative.c

-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] c-user: Add task priority glossary terms

2021-05-12 Thread Sebastian Huber
---
 c-user/glossary.rst | 41 ++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/c-user/glossary.rst b/c-user/glossary.rst
index b3527a7..5a06c10 100644
--- a/c-user/glossary.rst
+++ b/c-user/glossary.rst
@@ -194,6 +194,14 @@ Glossary
 This term is an acronym for Cathode Ray Tube.  Normally used in 
reference to
 the man-machine interface.
 
+current priority
+The current priority of a :term:`task` is the :term:`task priority` 
with
+respect to the :term:`home scheduler` of the task.  It is an 
aggregation of
+the :term:`real priority` and temporary priority adjustments due to 
locking
+protocols, the rate-monotonic period objects on some schedulers such 
as EDF,
+and the :term:`POSIX` sporadic server.  The current priority is an
+:term:`eligible priority`.
+
 deadline
 A fixed time limit by which a task must have completed a set of 
actions.
 Beyond this point, the results are of reduced value and may even be
@@ -246,6 +254,12 @@ Glossary
 This term is an acronym for
 `Executable and Linkable Format 
`_.
 
+eligible priority
+An eligible priority of a :term:`task` is the :term:`task priority` 
with
+respect to the corresponding :term:`eligible scheduler` of the task.  
An
+eligible priority is either the :term:`current priority` and a
+:term:`helping priority` of a task.
+
 eligible scheduler
 An eligible scheduler of a :term:`task` is a :term:`scheduler` which 
can be
 used by the task to allocate a processor for the task.
@@ -366,6 +380,11 @@ Glossary
 dispatch is marked as necessary, then the next thread dispatch will 
make
 the heir task the executing task.
 
+helping priority
+A helping priority of a :term:`task` is the :term:`task priority` with
+respect to the corresponding :term:`helping scheduler` of the task.  A
+helping priority is an :term:`eligible priority`.
+
 helping scheduler
 A helping scheduler of a :term:`task` is a :term:`scheduler` which is a
 :term:`eligible scheduler` and which is not the :term:`home scheduler` 
of
@@ -632,9 +651,9 @@ Glossary
 another task.
 
 priority
-A mechanism used to represent the relative importance of an element in 
a
-set of items.  RTEMS uses priority to determine which task should
-execute.
+The priority is a mechanism used to represent the relative importance 
of an
+element in a set of items.  RTEMS uses :term:`task priorities ` to determine
+which :term:`task` should execute.
 
 priority boosting
 A simple approach to extend the priority inheritance protocol for
@@ -686,6 +705,14 @@ Glossary
 decided that other tasks are currently more important.  A task that is
 ready to execute and has a processor assigned is called scheduled.
 
+real priority
+Each :term:`task` has exactly one real priority.  The real priority is
+always with respect to the :term:`home scheduler` of a task.  It is 
defined
+during task initialization.  It may be changed by directives such as
+:c:func:`rtems_task_set_priority` and
+:c:func:`rtems_task_set_scheduler`.  The real priority is the 
foundation
+of the :term:`current priority`.
+
 real-time
 A term used to describe systems which are characterized by requiring
 deterministic response times to external stimuli.  The external stimuli
@@ -959,6 +986,14 @@ Glossary
 Task migration happens in case a task stops execution on one processor
 and resumes execution on another processor.
 
+task priority
+A task priority of a :term:`task` determines its importance with 
respect to
+other tasks.  The scheduler use task priorities to determine which
+:term:`ready task` gets a processor allocated.  The
+:term:`eligible priorities ` of a task define the 
position of the task in a
+:term:`wait queue` which uses the priority discipline.  Each task has 
at
+least the :term:`real priority`.
+
 task processor affinity
 The set of processors on which a task is allowed to execute.
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] c-user: Document rtems_task_set_scheduler() errors

2021-05-12 Thread Sebastian Huber
---
 c-user/task/directives.rst | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst
index 2bfb8af..c0ef4e7 100644
--- a/c-user/task/directives.rst
+++ b/c-user/task/directives.rst
@@ -1702,12 +1702,32 @@ This directive sets the :term:`home scheduler` to the 
scheduler specified by
 ``scheduler_id``.
 
 :c:macro:`RTEMS_INVALID_PRIORITY`
-There task priority specified in ``priority`` was invalid with respect to
-the scheduler specified by ``scheduler_id``.
+The task priority specified by ``priority`` was invalid with respect to the
+scheduler specified by ``scheduler_id``.
 
 :c:macro:`RTEMS_INVALID_ID`
 There was no task associated with the identifier specified by ``task_id``.
 
+:c:macro:`RTEMS_RESOURCE_IN_USE`
+The task specified by ``task_id`` was enqueued on a :term:`wait queue`.
+
+:c:macro:`RTEMS_RESOURCE_IN_USE`
+The task specified by ``task_id`` had a :term:`current priority` which
+consisted of more than the :term:`real priority`.
+
+:c:macro:`RTEMS_RESOURCE_IN_USE`
+The task specified by ``task_id`` had a :term:`helping scheduler`.
+
+:c:macro:`RTEMS_RESOURCE_IN_USE`
+The task specified by ``task_id`` was pinned.
+
+:c:macro:`RTEMS_UNSATISFIED`
+The scheduler specified by ``scheduler_id`` owned no processor.
+
+:c:macro:`RTEMS_UNSATISFIED`
+The scheduler specified by ``scheduler_id`` did not support the affinity
+set of the task specified by ``task_id``.
+
 :c:macro:`RTEMS_ILLEGAL_ON_REMOTE_OBJECT`
 The task resided on a remote node.
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: Spidev different ioctl structure

2021-05-12 Thread Sebastian Huber

Hello Andre,

being compatible to Linux is the goal. If this doesn't work, then this 
is a bug. You can add a ticket for this and fix the issues.


On 12/05/2021 08:36, andre.nahrw...@dlr.de wrote:

I discovered that the Spidev include (linux/spi/spidev.h) contains different 
implementations of the ioctl structure when comparing rtems and linux.
I used the mode value of the structure and wanted to compile the application 
for rtems and linux, that is where I got some errors.
A few further value names differ also: cs, word_delay_usecs, pad.


I don't think the "pad" member should be used by an application.


Does anybody now why there is this difference?
Or is it not necessary to use the mode value for the ioctl commands?

On rtems it looks like this:

struct spi_ioc_transfer {
   void *rx_buf;
   const void *tx_buf;


Maybe use uintptr_t instead of void *.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

question about posix timer expiration

2021-05-12 Thread Gabriel.Moyano
Hello everyone,

Currently I am trying to get running ptpd on rtems (following the Chris' work, 
thx btw).

Ptpd uses posix timers and when a timer expires a handler with this signature 
void(int sig, siginfo_t *info, void *ucontext) is called. Unfortunately (*info) 
doesn't have the right values, eg. info->si_code should be SI_TIMER but it is 
SI_USER and also info->si_signo should be the same as sig but it's not.



Diving into the code I've found where the handler is called (also where *info 
is created). This is done in the function _POSIX_signals_Check_signal() in the 
file psignalunblockthread.c. It doesn't seems that info is updated with the 
values (I guess) should take from object ptimer, which was created by 
create_timer().



My question is: is this handler fully supported? Or maybe I'm missing something 
else.



Thanks in advance,

Gabriel

--
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institute for Software Technology | SC-OSS | Lilienthalplatz 7 | 38108 
Braunschweig  | Germany

Gabriel Moyano | Research Scientist in Onboard Software Systems group
gabriel.moy...@dlr.de
DLR.de

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 4/5] bsps/imxrt: Fix OCRAM, ITCM and DTCM sizes

2021-05-12 Thread Christian Mauderer
The sizes are configurable via fuses or per software via some registers.
At the moment the registers are not changed. Changing the registers
destroys data stored in the RAM areas (like application code or data).
So either the fuses or some bootloader should be used to set them before
the application starts.

This also adds an OCRAM only linker command file.

Update #4180
---
 bsps/arm/imxrt/include/imxrt/memory.h |  4 
 bsps/arm/imxrt/start/linkcmds.ocram   | 23 +++
 bsps/arm/imxrt/start/mpu-config.c |  6 +
 spec/build/bsps/arm/imxrt/bspimxrt.yml|  9 
 spec/build/bsps/arm/imxrt/linkcmdsmemory.yml  | 11 ++---
 spec/build/bsps/arm/imxrt/optlinkcmds.yml |  3 ++-
 spec/build/bsps/arm/imxrt/optmemdtcmsz.yml| 17 ++
 spec/build/bsps/arm/imxrt/optmemitcmsz.yml| 17 ++
 .../bsps/arm/imxrt/optmemocramnocachesz.yml   | 16 +
 spec/build/bsps/arm/imxrt/optmemocramsz.yml   | 17 ++
 10 files changed, 119 insertions(+), 4 deletions(-)
 create mode 100644 bsps/arm/imxrt/start/linkcmds.ocram
 create mode 100644 spec/build/bsps/arm/imxrt/optmemdtcmsz.yml
 create mode 100644 spec/build/bsps/arm/imxrt/optmemitcmsz.yml
 create mode 100644 spec/build/bsps/arm/imxrt/optmemocramnocachesz.yml
 create mode 100644 spec/build/bsps/arm/imxrt/optmemocramsz.yml

diff --git a/bsps/arm/imxrt/include/imxrt/memory.h 
b/bsps/arm/imxrt/include/imxrt/memory.h
index 5a6b457aa6..8185f713cc 100644
--- a/bsps/arm/imxrt/include/imxrt/memory.h
+++ b/bsps/arm/imxrt/include/imxrt/memory.h
@@ -48,6 +48,10 @@ extern char imxrt_memory_ocram_begin[];
 extern char imxrt_memory_ocram_end[];
 extern char imxrt_memory_ocram_size[];
 
+extern char imxrt_memory_ocram_nocache_begin[];
+extern char imxrt_memory_ocram_nocache_end[];
+extern char imxrt_memory_ocram_nocache_size[];
+
 extern char imxrt_memory_peripheral_begin[];
 extern char imxrt_memory_peripheral_end[];
 extern char imxrt_memory_peripheral_size[];
diff --git a/bsps/arm/imxrt/start/linkcmds.ocram 
b/bsps/arm/imxrt/start/linkcmds.ocram
new file mode 100644
index 00..6df3c917b1
--- /dev/null
+++ b/bsps/arm/imxrt/start/linkcmds.ocram
@@ -0,0 +1,23 @@
+INCLUDE linkcmds.memory
+
+REGION_ALIAS ("REGION_START", OCRAM);
+REGION_ALIAS ("REGION_VECTOR", OCRAM);
+REGION_ALIAS ("REGION_TEXT", OCRAM);
+REGION_ALIAS ("REGION_TEXT_LOAD", OCRAM);
+REGION_ALIAS ("REGION_RODATA", OCRAM);
+REGION_ALIAS ("REGION_RODATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_DATA", OCRAM);
+REGION_ALIAS ("REGION_DATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_FAST_TEXT", OCRAM);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", OCRAM);
+REGION_ALIAS ("REGION_FAST_DATA", OCRAM);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", OCRAM);
+REGION_ALIAS ("REGION_BSS", OCRAM);
+REGION_ALIAS ("REGION_WORK", OCRAM);
+REGION_ALIAS ("REGION_STACK", OCRAM);
+REGION_ALIAS ("REGION_NOCACHE", OCRAM_NOCACHE);
+REGION_ALIAS ("REGION_NOCACHE_LOAD", OCRAM);
+
+bsp_vector_table_in_start_section = 1;
+
+INCLUDE linkcmds.armv7m
diff --git a/bsps/arm/imxrt/start/mpu-config.c 
b/bsps/arm/imxrt/start/mpu-config.c
index 31c39bc16f..683b26d45b 100644
--- a/bsps/arm/imxrt/start/mpu-config.c
+++ b/bsps/arm/imxrt/start/mpu-config.c
@@ -55,6 +55,12 @@ BSP_START_DATA_SECTION const ARMV7M_MPU_Region_config
   .rasr = ARMV7M_MPU_RASR_AP(0x3)
 | ARMV7M_MPU_RASR_TEX(0x2)
 | ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = imxrt_memory_ocram_nocache_begin,
+  .end = imxrt_memory_ocram_nocache_end,
+  .rasr = ARMV7M_MPU_RASR_AP(0x3)
+| ARMV7M_MPU_RASR_TEX(0x2)
+| ARMV7M_MPU_RASR_ENABLE,
 }, {
   .begin = imxrt_memory_peripheral_begin,
   .end = imxrt_memory_peripheral_end,
diff --git a/spec/build/bsps/arm/imxrt/bspimxrt.yml 
b/spec/build/bsps/arm/imxrt/bspimxrt.yml
index 07f6bcef39..f543a14394 100644
--- a/spec/build/bsps/arm/imxrt/bspimxrt.yml
+++ b/spec/build/bsps/arm/imxrt/bspimxrt.yml
@@ -109,6 +109,7 @@ install:
 - destination: ${BSP_LIBDIR}
   source:
   - bsps/arm/imxrt/start/linkcmds.flexspi
+  - bsps/arm/imxrt/start/linkcmds.ocram
   - bsps/arm/imxrt/start/linkcmds.sdram
 links:
 - role: build-dependency
@@ -123,14 +124,22 @@ links:
   uid: optfsledmaemlm
 - role: build-dependency
   uid: optlinkcmds
+- role: build-dependency
+  uid: optmemdtcmsz
 - role: build-dependency
   uid: optmemflashcfgsz
 - role: build-dependency
   uid: optmemflashivtsz
 - role: build-dependency
   uid: optmemflexspisz
+- role: build-dependency
+  uid: optmemitcmsz
 - role: build-dependency
   uid: optmemnullsz
+- role: build-dependency
+  uid: optmemocramsz
+- role: build-dependency
+  uid: optmemocramnocachesz
 - role: build-dependency
   uid: optmemsdrambase
 - role: build-dependency
diff --git a/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml 
b/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml
index 86dc37c3bd..3f7885c589 100644
--- a/spec/build/bsps/arm/imxrt/linkcmdsmemory.yml
+++ 

[PATCH 2/5] bsps/imxrt: Reduce devicetree size

2021-05-12 Thread Christian Mauderer
Remove symbols that would be necessary for overlays and decrease padding
that would be necessary for adding stuff during run-time.

Update #4180
---
 bsps/arm/imxrt/dts/imxrt1050-evkb.c   | 1235 ++---
 bsps/arm/imxrt/dts/imxrt1050-evkb.dts |2 +-
 2 files changed, 472 insertions(+), 765 deletions(-)

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c 
b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
index 4842f1b85d..b93dcd775b 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
@@ -7,10 +7,10 @@
 #include 
 
 const unsigned char imxrt_dtb[] = {
-  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x2b, 0x36, 0x00, 0x00, 0x00, 0x38, 
-  0x00, 0x00, 0x24, 0xd4, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
-  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x62, 
-  0x00, 0x00, 0x24, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x1d, 0x73, 0x00, 0x00, 0x00, 0x38, 
+  0x00, 0x00, 0x1b, 0xcc, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
+  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x67, 
+  0x00, 0x00, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 
@@ -20,252 +20,236 @@ const unsigned char imxrt_dtb[] = {
   0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 
   0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x75, 
   0x61, 0x72, 0x74, 0x40, 0x34, 0x30, 0x31, 0x38, 0x34, 0x30, 0x30, 0x30, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 
-  0x00, 0x00, 0x00, 0x01, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2f, 
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 
+  0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00, 0x00, 0x00, 0x00, 0x03, 
+  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x2f, 0x73, 0x6f, 0x63, 
+  0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 
+  0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 
+  0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2d, 
   0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 
   0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 
-  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x38, 0x30, 0x30, 0x30, 
+  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 0x63, 0x30, 0x30, 0x30, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 
-  0x00, 0x00, 0x00, 0x35, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 
+  0x00, 0x00, 0x00, 0x33, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 
   0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 
-  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x62, 
-  0x63, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
-  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3b, 0x2f, 0x73, 0x6f, 0x63, 
+  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x63, 
+  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
+  0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x39, 0x2f, 0x73, 0x6f, 0x63, 
   0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 
   0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 
-  0x34, 0x30, 0x31, 0x63, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x41, 
+  0x34, 0x30, 0x31, 0x63, 0x34, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3f, 
   0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 
-  0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x67, 
-  0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x31, 0x63, 0x34, 0x30, 0x30, 0x30, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 
-  0x00, 0x00, 0x00, 0x47, 0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 
-  0x73, 0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 
-  0x30, 0x30, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x30, 0x63, 
-  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
-  0x00, 0x00, 0x00, 0x01, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, 0x70, 
-  0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 
-  0x40, 0x65, 0x30, 0x30, 0x30, 0x65, 0x31, 0x30, 0x30, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x4d, 
-  

[PATCH 5/5] bsps/imxrt: Enable DMA clock

2021-05-12 Thread Christian Mauderer
The EDMA is intialized so make sure the the clock is initialized too.

Update #4180
---
 bsps/arm/imxrt/start/bspstarthooks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bsps/arm/imxrt/start/bspstarthooks.c 
b/bsps/arm/imxrt/start/bspstarthooks.c
index 2b6b59f66b..b8149691e7 100644
--- a/bsps/arm/imxrt/start/bspstarthooks.c
+++ b/bsps/arm/imxrt/start/bspstarthooks.c
@@ -48,4 +48,7 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
 
   /* Reduce frequency for I2C */
   CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 5);
+
+  /* Enable EDMA clock. We initialize the EDMA so we need the clock. */
+  CLOCK_EnableClock(kCLOCK_Dma);
 }
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/5] bsps/imxrt: Fix documentation error

2021-05-12 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imxrt/include/fsl_qtmr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/arm/imxrt/include/fsl_qtmr.h 
b/bsps/arm/imxrt/include/fsl_qtmr.h
index a675413f8d..eb1d612ac3 100644
--- a/bsps/arm/imxrt/include/fsl_qtmr.h
+++ b/bsps/arm/imxrt/include/fsl_qtmr.h
@@ -207,7 +207,7 @@ rtems_vector_number QTMR_get_IRQ_from_fdt(const void *fdt, 
int node);
  *
  * @param base Quad Timer peripheral base address.
  *
- * @return IRQ vector number. BSP_INTERRUPT_VECTOR_INVALID on error.
+ * @return Clock frequency value in hertz
  */
 uint32_t QTMR_get_src_clk(TMR_Type *base);
 #endif /* __rtems__ */
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/5] bsps/imxrt: Various improvements

2021-05-12 Thread Christian Mauderer
Hello,

this patch set contains a number of improvements for the i.MXRT1050 BSP.

Best regards

Christian


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Spidev different ioctl structure

2021-05-12 Thread Andre.Nahrwold
Hello,

I discovered that the Spidev include (linux/spi/spidev.h) contains different 
implementations of the ioctl structure when comparing rtems and linux.
I used the mode value of the structure and wanted to compile the application 
for rtems and linux, that is where I got some errors.
A few further value names differ also: cs, word_delay_usecs, pad.

Does anybody now why there is this difference?
Or is it not necessary to use the mode value for the ioctl commands?

On rtems it looks like this:

struct spi_ioc_transfer {
  void *rx_buf;
  const void *tx_buf;

  size_t len;
  uint32_t speed_hz;

  uint16_t delay_usecs;
  uint8_t bits_per_word;
  uint8_t cs_change;
  uint8_t rx_nbits;
  uint8_t tx_nbits;

  uint32_t mode;
  uint8_t cs;
};

On linux it looks like this:

struct spi_ioc_transfer {
__u64   tx_buf;
__u64   rx_buf;

__u32   len;
__u32   speed_hz;

__u16   delay_usecs;
__u8bits_per_word;
__u8cs_change;
__u8tx_nbits;
__u8rx_nbits;

__u8word_delay_usecs;
__u8pad;
};

Best regards
Andre Nahrwold
--
Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR) German Aerospace Center 
Institute for Software Technolog | SRV-OSS BS | Lilienthalpl. 7 | 38108 
Braunschweig | Geb. 112C Raum 001 M.Sc. Andre Nahrwold | Telephone +49 531 
295-3834 | andre.nahrw...@dlr.de DLR.de

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel