summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/block01/block01.doc2
-rw-r--r--testsuites/libtests/block01/init.c2
-rw-r--r--testsuites/libtests/block02/block02.doc2
-rw-r--r--testsuites/libtests/block02/init.c2
-rw-r--r--testsuites/libtests/block03/block03.doc2
-rw-r--r--testsuites/libtests/block03/init.c2
-rw-r--r--testsuites/libtests/block04/block04.doc2
-rw-r--r--testsuites/libtests/block04/init.c2
-rw-r--r--testsuites/libtests/block05/block05.doc2
-rw-r--r--testsuites/libtests/block05/init.c2
-rw-r--r--testsuites/libtests/block07/block07.doc2
-rw-r--r--testsuites/libtests/block07/init.c2
-rw-r--r--testsuites/libtests/block09/block09.doc2
-rw-r--r--testsuites/libtests/block09/init.c2
-rw-r--r--testsuites/libtests/block10/block10.doc2
-rw-r--r--testsuites/libtests/block10/init.c2
-rw-r--r--testsuites/libtests/block11/init.c2
-rw-r--r--testsuites/libtests/block12/init.c2
-rw-r--r--testsuites/libtests/block13/init.c2
-rw-r--r--testsuites/libtests/block14/init.c2
-rw-r--r--testsuites/libtests/block15/init.c2
-rw-r--r--testsuites/libtests/block16/init.c2
-rw-r--r--testsuites/libtests/block17/init.c2
-rw-r--r--testsuites/libtests/can01/can-loopback.c110
-rw-r--r--testsuites/libtests/can01/init.c249
-rw-r--r--testsuites/libtests/crypt01/init.c2
-rw-r--r--testsuites/libtests/defaultconfig01/init.c2
-rw-r--r--testsuites/libtests/devfs01/init.c2
-rw-r--r--testsuites/libtests/dl01/dl01-o1.c2
-rw-r--r--testsuites/libtests/dl02/dl02-o1.c2
-rw-r--r--testsuites/libtests/dl02/dl02-o2.c2
-rw-r--r--testsuites/libtests/dl05/dl05-o5.cc2
-rw-r--r--testsuites/libtests/dl06/dl06-o1.c2
-rw-r--r--testsuites/libtests/dl06/dl06-o2.c2
-rw-r--r--testsuites/libtests/dl07/dl-load.c1
-rw-r--r--testsuites/libtests/dl07/dl07-o1.c2
-rw-r--r--testsuites/libtests/dl07/dl07-o2.c2
-rw-r--r--testsuites/libtests/dl07/dl07-o3.c2
-rw-r--r--testsuites/libtests/dl07/dl07-o4.c2
-rw-r--r--testsuites/libtests/dl07/dl07-o5.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o1.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o2.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o3.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o4.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o5.c2
-rw-r--r--testsuites/libtests/dl08/dl08-o6-123456789-123456789.c2
-rw-r--r--testsuites/libtests/dl09/dl-load.c16
-rw-r--r--testsuites/libtests/dl09/dl09-o1.c2
-rw-r--r--testsuites/libtests/dl09/dl09-o2.c2
-rw-r--r--testsuites/libtests/dl09/dl09-o3.c2
-rw-r--r--testsuites/libtests/dl09/dl09-o4.c2
-rw-r--r--testsuites/libtests/dl09/dl09-o5.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o1.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o2.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o3.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o4.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o5.c2
-rw-r--r--testsuites/libtests/dl10/dl10-o6.c1
-rw-r--r--testsuites/libtests/dl11/dl-load.c95
-rw-r--r--testsuites/libtests/dl11/dl11-o1.c1
-rw-r--r--testsuites/libtests/dl11/init.c2
-rw-r--r--testsuites/libtests/exit01/init.c2
-rw-r--r--testsuites/libtests/exit02/init.c2
-rw-r--r--testsuites/libtests/exit03/init.c2
-rw-r--r--testsuites/libtests/exit03/stdio.cc2
-rw-r--r--testsuites/libtests/flashdev01/flashdev01.doc11
-rw-r--r--testsuites/libtests/flashdev01/flashdev01.scn2
-rw-r--r--testsuites/libtests/flashdev01/init.c190
-rw-r--r--testsuites/libtests/flashdev01/test_flashdev.c275
-rw-r--r--testsuites/libtests/flashdev01/test_flashdev.h35
-rw-r--r--testsuites/libtests/flashdisk01/init.c2
-rw-r--r--testsuites/libtests/flashdisk01/test-file-system.c2
-rw-r--r--testsuites/libtests/flashdisk01/test-file-system.h2
-rw-r--r--testsuites/libtests/getentropy01/init.c2
-rw-r--r--testsuites/libtests/heapwalk/init.c2
-rw-r--r--testsuites/libtests/i2c01/init.c2
-rw-r--r--testsuites/libtests/irqs01/init.c2
-rw-r--r--testsuites/libtests/libfdt01/init.c2
-rw-r--r--testsuites/libtests/libfdt01/some.dts2
-rw-r--r--testsuites/libtests/malloctest/init.c2
-rw-r--r--testsuites/libtests/md501/init.c2
-rw-r--r--testsuites/libtests/newlib01/init.c2
-rw-r--r--testsuites/libtests/ofw01/some.dts2
-rw-r--r--testsuites/libtests/pwdgrp01/init.c2
-rw-r--r--testsuites/libtests/pwdgrp02/init.c2
-rw-r--r--testsuites/libtests/rbheap01/init.c2
-rw-r--r--testsuites/libtests/record01/init.c2
-rw-r--r--testsuites/libtests/record02/init.c2
-rw-r--r--testsuites/libtests/regulator01/regulator01.c1310
-rw-r--r--testsuites/libtests/regulator01/regulator01.doc67
-rw-r--r--testsuites/libtests/regulator01/rtems_config.c59
-rw-r--r--testsuites/libtests/sha/init.c2
-rw-r--r--testsuites/libtests/shell01/init.c2
-rw-r--r--testsuites/libtests/sparsedisk01/init.c2
-rw-r--r--testsuites/libtests/spi01/init.c2
-rw-r--r--testsuites/libtests/termios01/termios_testdriver.c2
-rw-r--r--testsuites/libtests/termios03/termios_testdriver_polled.c2
-rw-r--r--testsuites/libtests/termios04/termios_testdriver_impl.h2
-rw-r--r--testsuites/libtests/termios09/init.c2
-rw-r--r--testsuites/libtests/ttest01/init.c2
-rw-r--r--testsuites/libtests/ttest01/t-self-test.h2
-rw-r--r--testsuites/libtests/ttest01/test-assert.c2
-rw-r--r--testsuites/libtests/ttest01/test-checks.c2
-rw-r--r--testsuites/libtests/ttest01/test-destructor.c2
-rw-r--r--testsuites/libtests/ttest01/test-eno.c2
-rw-r--r--testsuites/libtests/ttest01/test-example.c2
-rw-r--r--testsuites/libtests/ttest01/test-fixture.c2
-rw-r--r--testsuites/libtests/ttest01/test-leak.c2
-rw-r--r--testsuites/libtests/ttest01/test-log.c2
-rw-r--r--testsuites/libtests/ttest01/test-malloc.c2
-rw-r--r--testsuites/libtests/ttest01/test-plan.c2
-rw-r--r--testsuites/libtests/ttest01/test-psx.c2
-rw-r--r--testsuites/libtests/ttest01/test-rtems.c2
-rw-r--r--testsuites/libtests/ttest01/test-simple.c2
-rw-r--r--testsuites/libtests/ttest01/test-step.c2
-rw-r--r--testsuites/libtests/ttest01/test-task-context.c2
-rw-r--r--testsuites/libtests/ttest01/test-time.c2
-rw-r--r--testsuites/libtests/ttest01/test-verbosity.c2
-rw-r--r--testsuites/libtests/ttest02/init.c2
-rw-r--r--testsuites/libtests/utf8proc01/init.c2
120 files changed, 2150 insertions, 482 deletions
diff --git a/testsuites/libtests/block01/block01.doc b/testsuites/libtests/block01/block01.doc
index 66fca83ea4..ff4d309f0a 100644
--- a/testsuites/libtests/block01/block01.doc
+++ b/testsuites/libtests/block01/block01.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2009 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block01/init.c b/testsuites/libtests/block01/init.c
index 6af83f7655..7717b0b7e6 100644
--- a/testsuites/libtests/block01/init.c
+++ b/testsuites/libtests/block01/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block02/block02.doc b/testsuites/libtests/block02/block02.doc
index 97f9de2e28..e5b99ec8fe 100644
--- a/testsuites/libtests/block02/block02.doc
+++ b/testsuites/libtests/block02/block02.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2009 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block02/init.c b/testsuites/libtests/block02/init.c
index 3eb399dff4..1e8d179d9d 100644
--- a/testsuites/libtests/block02/init.c
+++ b/testsuites/libtests/block02/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block03/block03.doc b/testsuites/libtests/block03/block03.doc
index 7c31c06765..221c7dd816 100644
--- a/testsuites/libtests/block03/block03.doc
+++ b/testsuites/libtests/block03/block03.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2009 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block03/init.c b/testsuites/libtests/block03/init.c
index d4014e784d..da2fa27589 100644
--- a/testsuites/libtests/block03/init.c
+++ b/testsuites/libtests/block03/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block04/block04.doc b/testsuites/libtests/block04/block04.doc
index 744c4be5be..2c05114636 100644
--- a/testsuites/libtests/block04/block04.doc
+++ b/testsuites/libtests/block04/block04.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2009 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block04/init.c b/testsuites/libtests/block04/init.c
index 92b7d3af7a..cdbab6e3fc 100644
--- a/testsuites/libtests/block04/init.c
+++ b/testsuites/libtests/block04/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block05/block05.doc b/testsuites/libtests/block05/block05.doc
index 4c739d41ee..30a246bdf1 100644
--- a/testsuites/libtests/block05/block05.doc
+++ b/testsuites/libtests/block05/block05.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved.
+# Copyright (C) 2009, 2010 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block05/init.c b/testsuites/libtests/block05/init.c
index 9845ec6895..e54fa9bd32 100644
--- a/testsuites/libtests/block05/init.c
+++ b/testsuites/libtests/block05/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block07/block07.doc b/testsuites/libtests/block07/block07.doc
index 7643cb8630..18b2f9f656 100644
--- a/testsuites/libtests/block07/block07.doc
+++ b/testsuites/libtests/block07/block07.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2009 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2009 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block07/init.c b/testsuites/libtests/block07/init.c
index 93685ad3b2..a755cde987 100644
--- a/testsuites/libtests/block07/init.c
+++ b/testsuites/libtests/block07/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block09/block09.doc b/testsuites/libtests/block09/block09.doc
index 9522de911a..ffe672eb1d 100644
--- a/testsuites/libtests/block09/block09.doc
+++ b/testsuites/libtests/block09/block09.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2010 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block09/init.c b/testsuites/libtests/block09/init.c
index 6c5dfb6ffd..2456952164 100644
--- a/testsuites/libtests/block09/init.c
+++ b/testsuites/libtests/block09/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2009, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block10/block10.doc b/testsuites/libtests/block10/block10.doc
index 46ad5c808c..7020cc56c0 100644
--- a/testsuites/libtests/block10/block10.doc
+++ b/testsuites/libtests/block10/block10.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+# Copyright (c) 2010 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block10/init.c b/testsuites/libtests/block10/init.c
index 3ea1022020..693a8a8908 100644
--- a/testsuites/libtests/block10/init.c
+++ b/testsuites/libtests/block10/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2010, 2018 embedded brains GmbH.
+ * Copyright (C) 2010, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block11/init.c b/testsuites/libtests/block11/init.c
index 22ae8e1e5a..5d442e768f 100644
--- a/testsuites/libtests/block11/init.c
+++ b/testsuites/libtests/block11/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block12/init.c b/testsuites/libtests/block12/init.c
index 7d488a9fe9..ad51974fec 100644
--- a/testsuites/libtests/block12/init.c
+++ b/testsuites/libtests/block12/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2012, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block13/init.c b/testsuites/libtests/block13/init.c
index 9b6f3ed09d..c91ce8818d 100644
--- a/testsuites/libtests/block13/init.c
+++ b/testsuites/libtests/block13/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2012, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block14/init.c b/testsuites/libtests/block14/init.c
index e3fe71e5da..ba0291d314 100644
--- a/testsuites/libtests/block14/init.c
+++ b/testsuites/libtests/block14/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2012, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block15/init.c b/testsuites/libtests/block15/init.c
index 4d8b48fc66..9409061631 100644
--- a/testsuites/libtests/block15/init.c
+++ b/testsuites/libtests/block15/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block16/init.c b/testsuites/libtests/block16/init.c
index 883e1b05ea..d800895fee 100644
--- a/testsuites/libtests/block16/init.c
+++ b/testsuites/libtests/block16/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/block17/init.c b/testsuites/libtests/block17/init.c
index cedadfced8..bf670f679d 100644
--- a/testsuites/libtests/block17/init.c
+++ b/testsuites/libtests/block17/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2013, 2018 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2013, 2018 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/can01/can-loopback.c b/testsuites/libtests/can01/can-loopback.c
deleted file mode 100644
index 0aaf2f6a6d..0000000000
--- a/testsuites/libtests/can01/can-loopback.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * @file
- *
- * @ingroup CANBus
- *
- * @brief Controller Area Network (CAN) loopback device Implementation
- *
- */
-
-/*
- * Copyright (C) 2022 Prashanth S (fishesprashanth@gmail.com)
- *
- * 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.
- */
-
-#include <dev/can/can.h>
-
-struct can_loopback_priv {
- struct can_bus *bus;
-};
-
-static bool can_loopback_tx_ready(void *data);
-static void can_loopback_int(void *data, bool flag);
-static int can_loopback_tx(void *data, struct can_msg *msg);
-int can_loopback_init(const char *can_dev_file);
-
-static struct can_dev_ops dev_ops = {
- .dev_tx = can_loopback_tx,
- .dev_tx_ready = can_loopback_tx_ready,
- .dev_int = can_loopback_int,
-};
-
-static bool can_loopback_tx_ready(void *data)
-{
- return true;
-}
-
-static void can_loopback_int(void *data, bool flag)
-{
- return;
-}
-
-static int can_loopback_tx(void *data, struct can_msg *msg)
-{
- struct can_loopback_priv *priv = data;
-
- can_receive(priv->bus, msg);
-
- return RTEMS_SUCCESSFUL;
-}
-
-int can_loopback_init(const char *can_dev_file)
-{
- int ret;
- struct can_loopback_priv *priv = NULL;
-
- struct can_bus *bus = can_bus_alloc_and_init(sizeof(struct can_bus));
- if (bus == NULL) {
- CAN_ERR("can_loopback_init: can_bus_alloc_and_init failed\n");
- return RTEMS_NO_MEMORY;
- }
-
- priv = (struct can_loopback_priv *)calloc(1, sizeof(struct can_loopback_priv));
- if (priv == NULL) {
- CAN_ERR("can_loopback_init: calloc failed\n");
- ret = RTEMS_NO_MEMORY;
- goto free_bus_return;
- }
-
- priv->bus = bus;
- bus->priv = priv;
-
- priv->bus->can_dev_ops = &dev_ops;
-
- if ((ret = can_bus_register(bus, can_dev_file)) != RTEMS_SUCCESSFUL) {
- CAN_ERR("can_loopback_init: bus register failed\n");
- goto free_priv_return;
- }
-
- CAN_DEBUG("can_loopback_init: can_loopback driver registered\n");
-
- return ret;
-
-free_priv_return:
- free(priv);
-
-free_bus_return:
- free(bus);
-
- return ret;
-}
diff --git a/testsuites/libtests/can01/init.c b/testsuites/libtests/can01/init.c
deleted file mode 100644
index 0675fe606f..0000000000
--- a/testsuites/libtests/can01/init.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-
-/*
- * Copyright (c) 2022 Prashanth S (fishesprashanth@gmail.com) All rights reserved.
- *
- * 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 <rtems.h>
-#include <rtems/error.h>
-#include <sched.h>
-#include <tmacros.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <dev/can/can.h>
-
-#define TASKS (12)
-
-#define CAN_DEV_FILE "/dev/can-loopback"
-#define NUM_TEST_MSGS (0xf)
-
-#define NEXT_TASK_NAME(c1, c2, c3, c4) \
- if (c4 == '9') { \
- if (c3 == '9') { \
- if (c2 == 'z') { \
- if (c1 == 'z') { \
- printf("not enough task letters for names !!!\n"); \
- exit( 1 ); \
- } else \
- c1++; \
- c2 = 'a'; \
- } else \
- c2++; \
- c3 = '0'; \
- } else \
- c3++; \
- c4 = '0'; \
- } \
- else \
- c4++ \
-
-static void test_task(rtems_task_argument);
-int can_loopback_init(const char *);
-int create_task(int);
-
-static rtems_id task_id[TASKS];
-static rtems_id task_test_status[TASKS] = {[0 ... (TASKS - 1)] = false};
-
-const char rtems_test_name[] = "CAN test TX, RX with CAN loopback driver";
-
-/*FIXME: Should Implement one more test application for the
- * RTR support
- *
- * For testing, the number of successful read and write
- * count is verified.
- */
-static void test_task(rtems_task_argument data)
-{
- //sleep so that other tasks will be created.
- sleep(1);
-
- int fd, task_num = (uint32_t)data;
- uint32_t count = 0, msg_size;
-
- struct can_msg msg;
-
- printf("CAN tx and rx for %s\n", CAN_DEV_FILE);
-
- fd = open(CAN_DEV_FILE, O_RDWR);
- if (fd < 0) {
- printf("open error: task = %u %s: %s\n", task_num, CAN_DEV_FILE, strerror(errno));
- }
-
- rtems_test_assert(fd >= 0);
-
- for (int i = 0; i < NUM_TEST_MSGS; i++) {
- printf("test_task %u\n", task_num);
-
- msg.id = task_num;
- //FIXME: Implement Test cases for other flags also.
- msg.flags = 0;
- msg.len = (i + 1) % 9;
-
- for (int j = 0; j < msg.len; j++) {
- msg.data[j] = 'a' + j;
- }
-
- msg_size = ((char *)&msg.data[msg.len] - (char *)&msg);
-
- printf("calling write task = %u\n", task_num);
-
- count = write(fd, &msg, sizeof(msg));
- rtems_test_assert(count == msg_size);
- printf("task = %u write count = %u\n", task_num, count);
-
- printf("calling read task = %u\n", task_num);
- count = read(fd, &msg, sizeof(msg));
- rtems_test_assert(count > 0);
- printf("task = %u read count = %u\n", task_num, count);
-
- printf("received message\n");
- can_print_msg(&msg);
-
- sleep(1);
- }
- close(fd);
-
- task_test_status[task_num] = true;
-
- printf("task exited = %u\n", task_num);
- rtems_task_exit();
-}
-
-int create_task(int i)
-{
- printf("Creating task %d\n", i);
-
- rtems_status_code result;
- rtems_name name;
-
- char c1 = 'a';
- char c2 = 'a';
- char c3 = '1';
- char c4 = '1';
-
- name = rtems_build_name(c1, c2, c3, c4);
-
- result = rtems_task_create(name,
- 1,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_PREEMPT | RTEMS_TIMESLICE,
- RTEMS_FIFO | RTEMS_FLOATING_POINT,
- &task_id[i]);
- if (result != RTEMS_SUCCESSFUL) {
- printf("rtems_task_create error: %s\n", rtems_status_text(result));
- rtems_test_assert(result == RTEMS_SUCCESSFUL);
- }
-
- printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", i, task_id[i]);
-
- fflush(stdout);
-
- printf("starting task\n");
- result = rtems_task_start(task_id[i],
- test_task,
- (rtems_task_argument)i);
-
- if (result != RTEMS_SUCCESSFUL) {
- printf("rtems_task_start failed %s\n", rtems_status_text(result));
- rtems_test_assert(result == RTEMS_SUCCESSFUL);
- }
-
- NEXT_TASK_NAME(c1, c2, c3, c4);
-
- return result;
-}
-
-static rtems_task Init(
- rtems_task_argument ignored
-)
-{
- printf("Init\n");
-
- int ret;
-
- rtems_print_printer_fprintf_putc(&rtems_test_printer);
-
- TEST_BEGIN();
-
- rtems_task_priority old_priority;
- rtems_mode old_mode;
-
- rtems_task_set_priority(RTEMS_SELF, RTEMS_MAXIMUM_PRIORITY - 1, &old_priority);
- rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode);
-
- ret = can_loopback_init(CAN_DEV_FILE);
- if (ret != RTEMS_SUCCESSFUL) {
- printf("%s failed\n", rtems_test_name);
- rtems_test_assert(ret == RTEMS_SUCCESSFUL);
- }
-
- for (int i = 0; i < TASKS; i++) {
- create_task(i);
- }
-
- /* Do not exit untill all the tasks are exited */
- while (1) {
- int flag = 0;
- for (int i = 0; i < TASKS; i++) {
- if (task_test_status[i] == false) {
- printf("task not exited = %d\n", i);
- sleep(1);
- flag = 1;
- break;
- }
- }
- if (flag == 0) {
- break;
- }
- }
-
- TEST_END();
-
- rtems_test_exit( 0 );
-}
-
-
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
-
-#define CONFIGURE_MAXIMUM_TASKS (TASKS + TASKS)
-
-#define CONFIGURE_MAXIMUM_SEMAPHORES 10
-
-#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (TASKS * 2)
-
-#define CONFIGURE_TICKS_PER_TIMESLICE 100
-
-#define CONFIGURE_INIT
-
-#include <rtems/confdefs.h>
diff --git a/testsuites/libtests/crypt01/init.c b/testsuites/libtests/crypt01/init.c
index 26ba70e250..37966a0200 100644
--- a/testsuites/libtests/crypt01/init.c
+++ b/testsuites/libtests/crypt01/init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2011 The FreeBSD Project. All rights reserved.
*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/defaultconfig01/init.c b/testsuites/libtests/defaultconfig01/init.c
index 1a5451fb09..b8d702c96f 100644
--- a/testsuites/libtests/defaultconfig01/init.c
+++ b/testsuites/libtests/defaultconfig01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/devfs01/init.c b/testsuites/libtests/devfs01/init.c
index 193c7641db..b467bbd998 100644
--- a/testsuites/libtests/devfs01/init.c
+++ b/testsuites/libtests/devfs01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/dl01/dl01-o1.c b/testsuites/libtests/dl01/dl01-o1.c
index ade4d5744d..9350235d85 100644
--- a/testsuites/libtests/dl01/dl01-o1.c
+++ b/testsuites/libtests/dl01/dl01-o1.c
@@ -29,7 +29,7 @@
* Hello World as a loadable module.
*/
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl02/dl02-o1.c b/testsuites/libtests/dl02/dl02-o1.c
index b442f82ae7..3b3e51825d 100644
--- a/testsuites/libtests/dl02/dl02-o1.c
+++ b/testsuites/libtests/dl02/dl02-o1.c
@@ -29,7 +29,7 @@
#include <dlfcn.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl02/dl02-o2.c b/testsuites/libtests/dl02/dl02-o2.c
index 02a537a84f..6694c5e985 100644
--- a/testsuites/libtests/dl02/dl02-o2.c
+++ b/testsuites/libtests/dl02/dl02-o2.c
@@ -27,7 +27,7 @@
#include "dl-o2.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__)
diff --git a/testsuites/libtests/dl05/dl05-o5.cc b/testsuites/libtests/dl05/dl05-o5.cc
index c861916ff0..f928cf9004 100644
--- a/testsuites/libtests/dl05/dl05-o5.cc
+++ b/testsuites/libtests/dl05/dl05-o5.cc
@@ -2,7 +2,7 @@
#include <stdexcept>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl06/dl06-o1.c b/testsuites/libtests/dl06/dl06-o1.c
index 719d01e91f..1b8482bc3e 100644
--- a/testsuites/libtests/dl06/dl06-o1.c
+++ b/testsuites/libtests/dl06/dl06-o1.c
@@ -30,7 +30,7 @@
#include <dlfcn.h>
#include <math.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl06/dl06-o2.c b/testsuites/libtests/dl06/dl06-o2.c
index 837c2e8e4f..0a46c027a8 100644
--- a/testsuites/libtests/dl06/dl06-o2.c
+++ b/testsuites/libtests/dl06/dl06-o2.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <math.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl07/dl-load.c b/testsuites/libtests/dl07/dl-load.c
index 58e3e06f78..2946120ca6 100644
--- a/testsuites/libtests/dl07/dl-load.c
+++ b/testsuites/libtests/dl07/dl-load.c
@@ -32,6 +32,7 @@
RTEMS_RTL_TRACE_WARNING | \
RTEMS_RTL_TRACE_LOAD | \
RTEMS_RTL_TRACE_UNLOAD | \
+ RTEMS_RTL_TRACE_LOAD_SECT | \
RTEMS_RTL_TRACE_SYMBOL | \
RTEMS_RTL_TRACE_RELOC | \
RTEMS_RTL_TRACE_ALLOCATOR | \
diff --git a/testsuites/libtests/dl07/dl07-o1.c b/testsuites/libtests/dl07/dl07-o1.c
index 24a8086c49..0bca0ab838 100644
--- a/testsuites/libtests/dl07/dl07-o1.c
+++ b/testsuites/libtests/dl07/dl07-o1.c
@@ -28,7 +28,7 @@
#include "dl-o1.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#include "dl-load.h"
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl07/dl07-o2.c b/testsuites/libtests/dl07/dl07-o2.c
index 12cc917ae0..46aef0d6fe 100644
--- a/testsuites/libtests/dl07/dl07-o2.c
+++ b/testsuites/libtests/dl07/dl07-o2.c
@@ -29,7 +29,7 @@
#include "dl-o1.h"
#include "dl-o2.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl07/dl07-o3.c b/testsuites/libtests/dl07/dl07-o3.c
index 12a5fe6829..ab60f50e97 100644
--- a/testsuites/libtests/dl07/dl07-o3.c
+++ b/testsuites/libtests/dl07/dl07-o3.c
@@ -32,7 +32,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl07/dl07-o4.c b/testsuites/libtests/dl07/dl07-o4.c
index aeeb404561..e5f831ec24 100644
--- a/testsuites/libtests/dl07/dl07-o4.c
+++ b/testsuites/libtests/dl07/dl07-o4.c
@@ -29,7 +29,7 @@
#include "dl-o1.h"
#include "dl-o4.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl07/dl07-o5.c b/testsuites/libtests/dl07/dl07-o5.c
index e487d072ae..83e98f6d9d 100644
--- a/testsuites/libtests/dl07/dl07-o5.c
+++ b/testsuites/libtests/dl07/dl07-o5.c
@@ -30,7 +30,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl08/dl08-o1.c b/testsuites/libtests/dl08/dl08-o1.c
index ccd8bc3587..015e847ea2 100644
--- a/testsuites/libtests/dl08/dl08-o1.c
+++ b/testsuites/libtests/dl08/dl08-o1.c
@@ -28,7 +28,7 @@
#include "dl-o1.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#include "dl-load.h"
#include "dl-o1.h"
#include "dl-o2.h"
diff --git a/testsuites/libtests/dl08/dl08-o2.c b/testsuites/libtests/dl08/dl08-o2.c
index 8d72cb8703..3833cb5768 100644
--- a/testsuites/libtests/dl08/dl08-o2.c
+++ b/testsuites/libtests/dl08/dl08-o2.c
@@ -29,7 +29,7 @@
#include "dl-o2.h"
#include "dl-o3.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl08/dl08-o3.c b/testsuites/libtests/dl08/dl08-o3.c
index 267895476c..dc839bf270 100644
--- a/testsuites/libtests/dl08/dl08-o3.c
+++ b/testsuites/libtests/dl08/dl08-o3.c
@@ -31,7 +31,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl08/dl08-o4.c b/testsuites/libtests/dl08/dl08-o4.c
index b77bf60465..d09fd2ec93 100644
--- a/testsuites/libtests/dl08/dl08-o4.c
+++ b/testsuites/libtests/dl08/dl08-o4.c
@@ -29,7 +29,7 @@
#include "dl-o4.h"
#include "dl-o5.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl08/dl08-o5.c b/testsuites/libtests/dl08/dl08-o5.c
index 614bff6a24..de86437757 100644
--- a/testsuites/libtests/dl08/dl08-o5.c
+++ b/testsuites/libtests/dl08/dl08-o5.c
@@ -30,7 +30,7 @@
#include "dl-o6.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl08/dl08-o6-123456789-123456789.c b/testsuites/libtests/dl08/dl08-o6-123456789-123456789.c
index 3a03ec6e84..47d3f66f76 100644
--- a/testsuites/libtests/dl08/dl08-o6-123456789-123456789.c
+++ b/testsuites/libtests/dl08/dl08-o6-123456789-123456789.c
@@ -29,7 +29,7 @@
#include "dl-o6.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl09/dl-load.c b/testsuites/libtests/dl09/dl-load.c
index ce9708c3a3..216fb5a201 100644
--- a/testsuites/libtests/dl09/dl-load.c
+++ b/testsuites/libtests/dl09/dl-load.c
@@ -116,8 +116,12 @@ static void dl_check_resolved(void* handle, bool has_unresolved)
rtems_test_assert (unresolved == 0);
}
}
- printf ("handel: %p: %sunresolved externals\n",
- handle, unresolved != 0 ? "" : "no ");
+ if (handle == RTLD_SELF)
+ printf ("handle: RTL_SELF: %sunresolved externals\n",
+ unresolved != 0 ? "" : "no ");
+ else
+ printf ("handle: %p: %sunresolved externals\n",
+ handle, unresolved != 0 ? "" : "no ");
}
static void* dl_load_obj (const char* name, bool has_unresolved)
@@ -152,12 +156,20 @@ static void dl_close (void* handle)
static int dl_call (void* handle, const char* func)
{
+ static call_sig last_call;
call_sig call = dlsym (handle, func);
if (call == NULL)
{
printf("dlsym failed: symbol not found: %s\n", func);
return 1;
}
+ if (last_call != NULL && last_call != call)
+ {
+ printf("Call location different: moved by: %i (call:%p last:%p)\n",
+ (int) (call - last_call),
+ call, last_call);
+ }
+ last_call = call;
call ();
return 0;
}
diff --git a/testsuites/libtests/dl09/dl09-o1.c b/testsuites/libtests/dl09/dl09-o1.c
index 4659fda17c..291d33fcd0 100644
--- a/testsuites/libtests/dl09/dl09-o1.c
+++ b/testsuites/libtests/dl09/dl09-o1.c
@@ -28,7 +28,7 @@
#include "dl-o1.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#include "dl-load.h"
#include "dl-o1.h"
#include "dl-o2.h"
diff --git a/testsuites/libtests/dl09/dl09-o2.c b/testsuites/libtests/dl09/dl09-o2.c
index a6906b4ad9..e8976f3b49 100644
--- a/testsuites/libtests/dl09/dl09-o2.c
+++ b/testsuites/libtests/dl09/dl09-o2.c
@@ -29,7 +29,7 @@
#include "dl-o2.h"
#include "dl-o3.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl09/dl09-o3.c b/testsuites/libtests/dl09/dl09-o3.c
index fab70c02c7..d9a056d45d 100644
--- a/testsuites/libtests/dl09/dl09-o3.c
+++ b/testsuites/libtests/dl09/dl09-o3.c
@@ -31,7 +31,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl09/dl09-o4.c b/testsuites/libtests/dl09/dl09-o4.c
index 5cf4eb0f4b..8998059c93 100644
--- a/testsuites/libtests/dl09/dl09-o4.c
+++ b/testsuites/libtests/dl09/dl09-o4.c
@@ -29,7 +29,7 @@
#include "dl-o4.h"
#include "dl-o5.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl09/dl09-o5.c b/testsuites/libtests/dl09/dl09-o5.c
index 6b4aedbf68..e5374f3eb8 100644
--- a/testsuites/libtests/dl09/dl09-o5.c
+++ b/testsuites/libtests/dl09/dl09-o5.c
@@ -30,7 +30,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl10/dl10-o1.c b/testsuites/libtests/dl10/dl10-o1.c
index ccd8bc3587..015e847ea2 100644
--- a/testsuites/libtests/dl10/dl10-o1.c
+++ b/testsuites/libtests/dl10/dl10-o1.c
@@ -28,7 +28,7 @@
#include "dl-o1.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#include "dl-load.h"
#include "dl-o1.h"
#include "dl-o2.h"
diff --git a/testsuites/libtests/dl10/dl10-o2.c b/testsuites/libtests/dl10/dl10-o2.c
index 8d72cb8703..3833cb5768 100644
--- a/testsuites/libtests/dl10/dl10-o2.c
+++ b/testsuites/libtests/dl10/dl10-o2.c
@@ -29,7 +29,7 @@
#include "dl-o2.h"
#include "dl-o3.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl10/dl10-o3.c b/testsuites/libtests/dl10/dl10-o3.c
index 267895476c..dc839bf270 100644
--- a/testsuites/libtests/dl10/dl10-o3.c
+++ b/testsuites/libtests/dl10/dl10-o3.c
@@ -31,7 +31,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl10/dl10-o4.c b/testsuites/libtests/dl10/dl10-o4.c
index b77bf60465..d09fd2ec93 100644
--- a/testsuites/libtests/dl10/dl10-o4.c
+++ b/testsuites/libtests/dl10/dl10-o4.c
@@ -29,7 +29,7 @@
#include "dl-o4.h"
#include "dl-o5.h"
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl10/dl10-o5.c b/testsuites/libtests/dl10/dl10-o5.c
index 35cfbda2cd..185c259d8c 100644
--- a/testsuites/libtests/dl10/dl10-o5.c
+++ b/testsuites/libtests/dl10/dl10-o5.c
@@ -29,7 +29,7 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
+#include <rtems/test-printer.h>
#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
diff --git a/testsuites/libtests/dl10/dl10-o6.c b/testsuites/libtests/dl10/dl10-o6.c
index fad9516f7b..2484ff6f2f 100644
--- a/testsuites/libtests/dl10/dl10-o6.c
+++ b/testsuites/libtests/dl10/dl10-o6.c
@@ -29,7 +29,6 @@
#include "dl-o5.h"
#include <inttypes.h>
-#include <rtems/test-info.h>
int rtems_main_o5 (void)
{
diff --git a/testsuites/libtests/dl11/dl-load.c b/testsuites/libtests/dl11/dl-load.c
index aee1517269..b09128acdf 100644
--- a/testsuites/libtests/dl11/dl-load.c
+++ b/testsuites/libtests/dl11/dl-load.c
@@ -27,6 +27,8 @@
#include <errno.h>
#include <stdio.h>
+#include "tmacros.h"
+#include <pthread.h>
#include <dlfcn.h>
@@ -37,10 +39,17 @@
#define TEST_TRACE 0
#if TEST_TRACE
+ #define SHOW_GLOBAL_SYMS 1
+ #if SHOW_GLOBAL_SYMS
+ #define TRACE_GLOBAL_SYMBOL RTEMS_RTL_TRACE_GLOBAL_SYM
+ #else
+ #define TRACE_GLOBAL_SYMBOL 0
+ #endif
#define DEBUG_TRACE (RTEMS_RTL_TRACE_DETAIL | \
RTEMS_RTL_TRACE_WARNING | \
RTEMS_RTL_TRACE_LOAD | \
RTEMS_RTL_TRACE_UNLOAD | \
+ TRACE_GLOBAL_SYMBOL | \
RTEMS_RTL_TRACE_SYMBOL | \
RTEMS_RTL_TRACE_RELOC | \
RTEMS_RTL_TRACE_ALLOCATOR | \
@@ -69,13 +78,63 @@ static void dl_load_dump (void)
typedef int (*int_call_t)(void);
typedef int* (*ptr_call_t)(void);
-int dl_load_test(void)
+void* get_errno_ptr(void);
+int get_errno(void);
+
+int_call_t int_call;
+ptr_call_t ptr_call;
+static int perform_test(void)
{
- void* handle;
- int_call_t int_call;
- ptr_call_t ptr_call;
int int_call_ret;
int* ptr_call_ret;
+ ptr_call_ret = ptr_call ();
+ if (ptr_call_ret != get_errno_ptr())
+ {
+ printf("dlsym ptr_call failed: ret value bad\n");
+ return 1;
+ }
+
+ errno = 12345;
+ int_call_ret = int_call ();
+ if (int_call_ret != get_errno())
+ {
+ printf("dlsym int_call failed: ret value bad\n");
+ return 1;
+ }
+ errno = 0;
+
+ return 0;
+}
+
+static void *secondary_thread(void *arg)
+{
+ printf("Running test on secondary thread\n");
+ if (perform_test()) {
+ printf("Test failed on secondary task\n");
+ return (void *) 1;
+ }
+
+ return NULL;
+}
+
+static void start_secondary(void)
+{
+ /* Run the test on a secondary thread */
+ pthread_t threadId;
+ int status;
+ void *ret;
+ status = pthread_create( &threadId, NULL, secondary_thread, NULL );
+ rtems_test_assert( !status );
+
+ /* Wait on thread to exit */
+ status = pthread_join(threadId, &ret);
+ rtems_test_assert( !status );
+ rtems_test_assert( ret == NULL );
+}
+
+int dl_load_test(void)
+{
+ void* handle;
int unresolved;
char* message = "loaded";
@@ -115,20 +174,13 @@ int dl_load_test(void)
return 1;
}
- ptr_call_ret = ptr_call ();
- if (ptr_call_ret != &errno)
- {
- printf("dlsym ptr_call failed: ret value bad\n");
+ /* Run the test on the init thread */
+ printf("Running test on init task\n");
+ if (perform_test()) {
return 1;
}
- errno = 12345;
- int_call_ret = int_call ();
- if (int_call_ret != 12345)
- {
- printf("dlsym int_call failed: ret value bad\n");
- return 1;
- }
+ start_secondary();
if (dlclose (handle) < 0)
{
@@ -140,3 +192,16 @@ int dl_load_test(void)
return 0;
}
+
+/*
+ * Disasseble these to see how the platform accesses TLS
+ */
+void* get_errno_ptr(void)
+{
+ return &errno;
+}
+
+int get_errno(void)
+{
+ return errno;
+}
diff --git a/testsuites/libtests/dl11/dl11-o1.c b/testsuites/libtests/dl11/dl11-o1.c
index 21aa9bfc43..93ee2a60c7 100644
--- a/testsuites/libtests/dl11/dl11-o1.c
+++ b/testsuites/libtests/dl11/dl11-o1.c
@@ -25,7 +25,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <rtems/test-info.h>
#include <errno.h>
int get_errno_val (void);
diff --git a/testsuites/libtests/dl11/init.c b/testsuites/libtests/dl11/init.c
index 91f529b055..0ff4557421 100644
--- a/testsuites/libtests/dl11/init.c
+++ b/testsuites/libtests/dl11/init.c
@@ -86,6 +86,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
diff --git a/testsuites/libtests/exit01/init.c b/testsuites/libtests/exit01/init.c
index df4beb15c3..0938cff025 100644
--- a/testsuites/libtests/exit01/init.c
+++ b/testsuites/libtests/exit01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/exit02/init.c b/testsuites/libtests/exit02/init.c
index 652464ab9b..8d8e43c173 100644
--- a/testsuites/libtests/exit02/init.c
+++ b/testsuites/libtests/exit02/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/exit03/init.c b/testsuites/libtests/exit03/init.c
index b761c0af4a..44acb35c6e 100644
--- a/testsuites/libtests/exit03/init.c
+++ b/testsuites/libtests/exit03/init.c
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2022 Chris Johns (Contemporary Software). All rights reserved.
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/exit03/stdio.cc b/testsuites/libtests/exit03/stdio.cc
index 2a14089d01..09f2f1951c 100644
--- a/testsuites/libtests/exit03/stdio.cc
+++ b/testsuites/libtests/exit03/stdio.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2022 Chris Johns (Contemporary Software). All rights reserved.
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/flashdev01/flashdev01.doc b/testsuites/libtests/flashdev01/flashdev01.doc
new file mode 100644
index 0000000000..0638a5a842
--- /dev/null
+++ b/testsuites/libtests/flashdev01/flashdev01.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts testd by this test set.
+
+test set name: flashdev01
+
+directives:
+
+ TBD
+
+concepts:
+
+ - Ensure that the flashdev driver API works.
diff --git a/testsuites/libtests/flashdev01/flashdev01.scn b/testsuites/libtests/flashdev01/flashdev01.scn
new file mode 100644
index 0000000000..809ff3cd80
--- /dev/null
+++ b/testsuites/libtests/flashdev01/flashdev01.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST FLASHDEV 1 ***
+*** END OF TEST FLASHDEV 1 ***
diff --git a/testsuites/libtests/flashdev01/init.c b/testsuites/libtests/flashdev01/init.c
new file mode 100644
index 0000000000..6ce9709496
--- /dev/null
+++ b/testsuites/libtests/flashdev01/init.c
@@ -0,0 +1,190 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2023 Aaron Nyholm
+ *
+ * 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.
+ */
+
+#include "tmacros.h"
+
+#include "test_flashdev.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#define TEST_NAME_LENGTH 10
+
+#define TEST_DATA_SIZE (PAGE_SIZE * PAGE_COUNT)
+#define PAGE_COUNT 16
+#define PAGE_SIZE 128
+#define WB_SIZE 1
+
+const char rtems_test_name[] = "FLASHDEV 1";
+
+static void run_test(void);
+
+static void run_test(void) {
+
+ char buff[TEST_DATA_SIZE] = {0};
+ FILE *file;
+ int fd;
+ rtems_flashdev* flash;
+ int status;
+ char* read_data;
+ rtems_flashdev_region e_args;
+ rtems_flashdev_ioctl_page_info pg_info;
+ rtems_flashdev_region region;
+ uint32_t jedec;
+ int page_count;
+ int type;
+ size_t wb_size;
+
+ /* Initalize the flash device driver and flashdev */
+ flash = test_flashdev_init();
+ rtems_test_assert(flash != NULL);
+
+ /* Register the flashdev as a device */
+ status = rtems_flashdev_register(flash, "dev/flashdev0");
+ rtems_test_assert(!status);
+
+ /* Open the flashdev */
+ file = fopen("dev/flashdev0", "r+");
+ rtems_test_assert(file != NULL);
+ fd = fileno(file);
+
+ /* Read data from flash */
+ read_data = fgets(buff, TEST_DATA_SIZE, file);
+ rtems_test_assert(read_data != NULL);
+
+ /* Fseek to start of flash */
+ status = fseek(file, 0x0, SEEK_SET);
+ rtems_test_assert(!status);
+
+ /* Write the test name to the flash */
+ status = fwrite(rtems_test_name, TEST_NAME_LENGTH, 1, file);
+ rtems_test_assert(status == 1);
+
+ /* Fseek to start of flash and read again */
+ status = fseek(file, 0x0, SEEK_SET);
+ rtems_test_assert(!status);
+ fgets(buff, TEST_DATA_SIZE, file);
+ rtems_test_assert(!strncmp(buff, rtems_test_name, TEST_NAME_LENGTH));
+
+ /* Test Erasing */
+ e_args.offset = 0x0;
+ e_args.size = PAGE_SIZE;
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_ERASE, &e_args);
+ rtems_test_assert(!status);
+
+ fseek(file, 0x0, SEEK_SET);
+ fgets(buff, TEST_DATA_SIZE, file);
+ rtems_test_assert(buff[0] == 0);
+
+ /* Test getting JEDEC ID */
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_JEDEC_ID, &jedec);
+ rtems_test_assert(!status);
+ rtems_test_assert(jedec == 0x00ABCDEF);
+
+ /* Test getting flash type */
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_TYPE, &type);
+ rtems_test_assert(!status);
+ rtems_test_assert(type == RTEMS_FLASHDEV_NOR);
+
+ /* Test getting page info from offset */
+ pg_info.location = PAGE_SIZE + PAGE_SIZE/2;
+
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET, &pg_info);
+ rtems_test_assert(!status);
+ rtems_test_assert(pg_info.page_info.offset == PAGE_SIZE);
+ rtems_test_assert(pg_info.page_info.size == PAGE_SIZE);
+
+ /* Test getting page info from index */
+ pg_info.location = 2;
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX, &pg_info);
+ rtems_test_assert(!status);
+ rtems_test_assert(pg_info.page_info.offset == 2*PAGE_SIZE);
+ rtems_test_assert(pg_info.page_info.size == PAGE_SIZE);
+
+ /* Test getting page count */
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGE_COUNT, &page_count);
+ rtems_test_assert(!status);
+ rtems_test_assert(page_count == PAGE_COUNT);
+
+ /* Test getting write block size */
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE, &wb_size);
+ rtems_test_assert(!status);
+ rtems_test_assert(wb_size == WB_SIZE);
+
+ /* Test Regions */
+ region.offset = 0x400;
+ region.size = 0x200;
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_REGION_SET, &region);
+ rtems_test_assert(!status);
+
+ /* Test read to larger then region */
+ fseek(file, 0x0, SEEK_SET);
+ read_data = fgets(buff, 2048, file);
+ rtems_test_assert(read_data == NULL);
+
+ /* Test fseek outside of region */
+ status = fseek(file, 0x201, SEEK_SET);
+ rtems_test_assert(status);
+
+ /* Write to base unset region and check the writes location */
+ fseek(file, 0x0, SEEK_SET);
+ fwrite("HELLO WORLD", 11, 1, file);
+ ioctl(fd, RTEMS_FLASHDEV_IOCTL_REGION_UNSET, NULL);
+ fseek(file, 0x400, SEEK_SET);
+ fgets(buff, 11, file);
+ rtems_test_assert(strncmp(buff, "HELLO WORLD", 11));
+}
+
+static void Init(rtems_task_argument arg)
+{
+ TEST_BEGIN();
+
+ run_test();
+
+ TEST_END();
+ rtems_test_exit(0);
+}
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 2000
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 7
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/libtests/flashdev01/test_flashdev.c b/testsuites/libtests/flashdev01/test_flashdev.c
new file mode 100644
index 0000000000..708d708977
--- /dev/null
+++ b/testsuites/libtests/flashdev01/test_flashdev.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2023 Aaron Nyholm
+ *
+ * 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.
+ */
+
+#include "test_flashdev.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <rtems/seterr.h>
+
+#define TEST_DATA_SIZE (PAGE_SIZE * PAGE_COUNT)
+#define PAGE_COUNT 16
+#define PAGE_SIZE 128
+#define WB_SIZE 1
+#define MAX_NUM_REGIONS 48
+#define BITALLOC_SIZE 32
+#define NUM_BITALLOC ((MAX_NUM_REGIONS + BITALLOC_SIZE - 1) / BITALLOC_SIZE)
+
+/**
+ * This flash device driver is for testing flashdev
+ * API calls.
+ */
+typedef struct test_flashdev {
+ char* data;
+ uint32_t jedec_id;
+ uint32_t bit_allocator[NUM_BITALLOC];
+ rtems_flashdev_region regions[MAX_NUM_REGIONS];
+} test_flashdev;
+
+int test_flashdev_page_by_off(
+ rtems_flashdev *flash,
+ off_t search_offset,
+ off_t *page_offset,
+ size_t *page_size
+);
+
+int test_flashdev_page_by_index(
+ rtems_flashdev *flash,
+ off_t search_index,
+ off_t *page_offset,
+ size_t *page_size
+);
+
+int test_flashdev_page_count(
+ rtems_flashdev *flash,
+ int *page_count
+);
+
+int test_flashdev_wb_size(
+ rtems_flashdev *flash,
+ size_t *write_block_size
+);
+
+uint32_t test_flashdev_jedec_id(
+ rtems_flashdev* flash
+);
+
+int test_flashdev_type(
+ rtems_flashdev* flash,
+ rtems_flashdev_flash_type* type
+);
+
+int test_flashdev_read(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count,
+ void* buffer
+);
+
+int test_flashdev_write(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count,
+ const void* buffer
+);
+
+int test_flashdev_erase(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count
+);
+
+/* Find page info by offset handler */
+int test_flashdev_page_by_off(
+ rtems_flashdev *flash,
+ off_t search_offset,
+ off_t *page_offset,
+ size_t *page_size
+)
+{
+ *page_offset = search_offset - (search_offset%PAGE_SIZE);
+ *page_size = PAGE_SIZE;
+ return 0;
+}
+
+/* Find page by index handler */
+int test_flashdev_page_by_index(
+ rtems_flashdev *flash,
+ off_t search_index,
+ off_t *page_offset,
+ size_t *page_size
+)
+{
+ *page_offset = search_index * PAGE_SIZE;
+ *page_size = PAGE_SIZE;
+ return 0;
+}
+
+/* Page count handler */
+int test_flashdev_page_count(
+ rtems_flashdev *flash,
+ int *page_count
+)
+{
+ *page_count = PAGE_COUNT;
+ return 0;
+}
+
+/* Write block size handler */
+int test_flashdev_wb_size(
+ rtems_flashdev *flash,
+ size_t *write_block_size
+)
+{
+ *write_block_size = WB_SIZE;
+ return 0;
+}
+
+/* JEDEC ID handler, this would normally require a READID
+ * call to the physical flash device.
+ */
+uint32_t test_flashdev_jedec_id(
+ rtems_flashdev* flash
+)
+{
+ test_flashdev* driver = flash->driver;
+ return driver->jedec_id;
+}
+
+/* Function to identify what kind of flash is attached. */
+int test_flashdev_type(
+ rtems_flashdev *flash,
+ rtems_flashdev_flash_type *type
+)
+{
+ *type = RTEMS_FLASHDEV_NOR;
+ return 0;
+}
+
+/* Read flash call. Any offset or count protections are
+ * required to be done in the driver function. */
+int test_flashdev_read(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count,
+ void* buffer
+)
+{
+ test_flashdev* driver = flash->driver;
+
+ if (offset + count > TEST_DATA_SIZE) {
+ rtems_set_errno_and_return_minus_one( EINVAL );
+ }
+
+ memcpy(buffer, &driver->data[offset], count);
+ return 0;
+}
+
+/* Write Flash call. Any offset or count protections are
+ * required to be done in the driver function. */
+int test_flashdev_write(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count,
+ const void* buffer
+)
+{
+ test_flashdev* driver = flash->driver;
+
+ if (offset + count > TEST_DATA_SIZE) {
+ rtems_set_errno_and_return_minus_one( EINVAL );
+ }
+
+ memcpy(&driver->data[offset], buffer, count);
+ return 0;
+}
+
+/* Erase Flash call. Any offset or count protections are
+ * required to be done in the driver function. */
+int test_flashdev_erase(
+ rtems_flashdev* flash,
+ uintptr_t offset,
+ size_t count
+)
+{
+ test_flashdev* driver = flash->driver;
+
+ if (offset + count > TEST_DATA_SIZE) {
+ rtems_set_errno_and_return_minus_one( EINVAL );
+ }
+
+ if (offset%PAGE_SIZE || count%PAGE_SIZE) {
+ rtems_set_errno_and_return_minus_one( EINVAL );
+ }
+
+ memset(&driver->data[offset], 0, count);
+ return 0;
+}
+
+/* Initialize Flashdev and underlying driver. */
+rtems_flashdev* test_flashdev_init(void)
+{
+ rtems_flashdev *flash = rtems_flashdev_alloc_and_init(sizeof(rtems_flashdev));
+
+ if (flash == NULL) {
+ return NULL;
+ }
+
+ test_flashdev* flash_driver = calloc(1, sizeof(test_flashdev));
+
+ if (flash_driver == NULL) {
+ rtems_flashdev_destroy_and_free(flash);
+ return NULL;
+ }
+
+ flash_driver->data = calloc(1, TEST_DATA_SIZE);
+ if (flash_driver->data == NULL) {
+ free(flash_driver);
+ rtems_flashdev_destroy_and_free(flash);
+ return NULL;
+ }
+
+ flash_driver->jedec_id = 0x00ABCDEF;
+
+ rtems_flashdev_region_table *ftable = calloc(1, sizeof(rtems_flashdev_region_table));
+ ftable->max_regions = MAX_NUM_REGIONS;
+ ftable->regions = flash_driver->regions;
+ ftable->bit_allocator = flash_driver->bit_allocator;
+
+ flash->driver = flash_driver;
+ flash->read = &test_flashdev_read;
+ flash->write = &test_flashdev_write;
+ flash->erase = &test_flashdev_erase;
+ flash->jedec_id = &test_flashdev_jedec_id;
+ flash->flash_type = &test_flashdev_type;
+ flash->page_info_by_offset = &test_flashdev_page_by_off;
+ flash->page_info_by_index = &test_flashdev_page_by_index;
+ flash->page_count = &test_flashdev_page_count;
+ flash->write_block_size = &test_flashdev_wb_size;
+ flash->region_table = ftable;
+
+ return flash;
+}
diff --git a/testsuites/libtests/flashdev01/test_flashdev.h b/testsuites/libtests/flashdev01/test_flashdev.h
new file mode 100644
index 0000000000..8b03959c42
--- /dev/null
+++ b/testsuites/libtests/flashdev01/test_flashdev.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Aaron Nyholm
+ *
+ * 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.
+ */
+
+#ifndef __TEST_FLASHDEV_H
+#define __TEST_FLASHDEV_H
+
+#include <dev/flash/flashdev.h>
+
+rtems_flashdev* test_flashdev_init(void);
+
+#endif /* __TEST_FLASHDEV_H */
diff --git a/testsuites/libtests/flashdisk01/init.c b/testsuites/libtests/flashdisk01/init.c
index 0caeb4e181..da9fc2a5b5 100644
--- a/testsuites/libtests/flashdisk01/init.c
+++ b/testsuites/libtests/flashdisk01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/flashdisk01/test-file-system.c b/testsuites/libtests/flashdisk01/test-file-system.c
index 66b18de273..f8c87fb8ad 100644
--- a/testsuites/libtests/flashdisk01/test-file-system.c
+++ b/testsuites/libtests/flashdisk01/test-file-system.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2010-2012 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2010, 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/flashdisk01/test-file-system.h b/testsuites/libtests/flashdisk01/test-file-system.h
index 5bb5064246..b592ac7dca 100644
--- a/testsuites/libtests/flashdisk01/test-file-system.h
+++ b/testsuites/libtests/flashdisk01/test-file-system.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2010-2012 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2010, 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/getentropy01/init.c b/testsuites/libtests/getentropy01/init.c
index 12f9741665..afdd0c88c1 100644
--- a/testsuites/libtests/getentropy01/init.c
+++ b/testsuites/libtests/getentropy01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c
index d7f0302b0f..2864feac28 100644
--- a/testsuites/libtests/heapwalk/init.c
+++ b/testsuites/libtests/heapwalk/init.c
@@ -6,7 +6,7 @@
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (c) 2009 embedded brains GmbH.
+ * Copyright (c) 2009 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/i2c01/init.c b/testsuites/libtests/i2c01/init.c
index b6480fb99e..452bea4ac1 100644
--- a/testsuites/libtests/i2c01/init.c
+++ b/testsuites/libtests/i2c01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/irqs01/init.c b/testsuites/libtests/irqs01/init.c
index ab7ca926ca..604aaf1f22 100644
--- a/testsuites/libtests/irqs01/init.c
+++ b/testsuites/libtests/irqs01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/libfdt01/init.c b/testsuites/libtests/libfdt01/init.c
index 80a8361339..6f369daf82 100644
--- a/testsuites/libtests/libfdt01/init.c
+++ b/testsuites/libtests/libfdt01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/libfdt01/some.dts b/testsuites/libtests/libfdt01/some.dts
index c6e2fc84ad..c4c7d926c6 100644
--- a/testsuites/libtests/libfdt01/some.dts
+++ b/testsuites/libtests/libfdt01/some.dts
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index ae3719c2cd..d72f49112e 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -4,7 +4,7 @@
* COPYRIGHT (c) 1989-2011, 2014.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (c) 2009, 2016 embedded brains GmbH.
+ * Copyright (C) 2009, 2016 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/md501/init.c b/testsuites/libtests/md501/init.c
index 00941acd85..e388f082b2 100644
--- a/testsuites/libtests/md501/init.c
+++ b/testsuites/libtests/md501/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/newlib01/init.c b/testsuites/libtests/newlib01/init.c
index 6edae3adbd..d3ccbddba1 100644
--- a/testsuites/libtests/newlib01/init.c
+++ b/testsuites/libtests/newlib01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014, 2022 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2014, 2022 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ofw01/some.dts b/testsuites/libtests/ofw01/some.dts
index e828622d02..6a5023414f 100644
--- a/testsuites/libtests/ofw01/some.dts
+++ b/testsuites/libtests/ofw01/some.dts
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2020 Niteesh G S <niteesh.gs@gmail.com>. All rights reserved.
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/pwdgrp01/init.c b/testsuites/libtests/pwdgrp01/init.c
index 3420c8eafa..e241237272 100644
--- a/testsuites/libtests/pwdgrp01/init.c
+++ b/testsuites/libtests/pwdgrp01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/pwdgrp02/init.c b/testsuites/libtests/pwdgrp02/init.c
index 8a67ec1f53..3fb74b226c 100644
--- a/testsuites/libtests/pwdgrp02/init.c
+++ b/testsuites/libtests/pwdgrp02/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/rbheap01/init.c b/testsuites/libtests/rbheap01/init.c
index 34e7aacbb5..ab6d36ec34 100644
--- a/testsuites/libtests/rbheap01/init.c
+++ b/testsuites/libtests/rbheap01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012-2015 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2012, 2015 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/record01/init.c b/testsuites/libtests/record01/init.c
index fea509089a..eb257b8a2e 100644
--- a/testsuites/libtests/record01/init.c
+++ b/testsuites/libtests/record01/init.c
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/record02/init.c b/testsuites/libtests/record02/init.c
index 7568f06e18..3c4dac25a0 100644
--- a/testsuites/libtests/record02/init.c
+++ b/testsuites/libtests/record02/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2018, 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2018, 2020 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/regulator01/regulator01.c b/testsuites/libtests/regulator01/regulator01.c
new file mode 100644
index 0000000000..cc5af01223
--- /dev/null
+++ b/testsuites/libtests/regulator01/regulator01.c
@@ -0,0 +1,1310 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @defgroup RegulatorTests Regulator Test Cases
+ *
+ * @brief Unit test cases for the Regulator
+ *
+ * This is a set of unit test cases for the regulator.
+ */
+
+/**
+ * @ingroup RegulatorTests
+ *
+ * @file
+ *
+ * @brief Test 01 for Regulator Library
+ */
+
+/*
+ * Copyright (C) 2022 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.
+ *
+ * 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <rtems.h>
+#include <rtems/test-info.h>
+#include <tmacros.h>
+
+#include <rtems/regulator.h>
+
+/**
+ * @brief Regulator Test Name
+ */
+const char rtems_test_name[] = "Regulator 1";
+
+/*
+ * Prototypes for wrapped functions
+ */
+void *__wrap_malloc(size_t size);
+void *__real_malloc(size_t size);
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Calloc Wrapper Trigger Count
+ */
+static int malloc_trigger_count;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Calloc Wrapper Call Count
+ */
+static int malloc_call_count;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Calloc Wrapper Trigger enable
+ */
+static bool malloc_trigger_enabled;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Enable Calloc Wrapper Trigger
+ */
+static void malloc_trigger_enable(
+ int trigger_count
+)
+{
+ malloc_trigger_enabled = true;
+ malloc_trigger_count = trigger_count;
+ malloc_call_count = 0;
+}
+/**
+ * @ingroup RegulatorTests
+ * @brief Reset Calloc Wrapper Trigger and Count
+ */
+static void malloc_trigger_reset(void)
+{
+ malloc_trigger_enabled = 0;
+ malloc_trigger_count = 0;
+ malloc_call_count = 0;
+}
+/**
+ * @ingroup RegulatorTests
+ * @brief Calloc Wrapper to Trigger Allocation Errors
+ */
+void *__wrap_malloc(size_t size)
+{
+ if (malloc_trigger_enabled) {
+ malloc_call_count++;
+ if (malloc_call_count == malloc_trigger_count) {
+ return NULL;
+ }
+ }
+
+ return __real_malloc(size);
+}
+
+/**
+ * @brief Constant to simpify code
+ */
+#define FIVE_SECONDS (5 * rtems_clock_get_ticks_per_second())
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Empty Deliver Method for Testing
+ */
+static bool test_regulator_deliverer(
+ void *context,
+ void *message,
+ size_t length
+)
+{
+ (void) context;
+ (void) message;
+ (void) length;
+
+ return true;
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Maximum length of a test message that is delivered
+ */
+#define MAXIMUM_MESSAGE_LENGTH 32
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Maximum number of test messages to buffer
+ */
+#define MAXIMUM_MESSAGES_TO_BUFFER 10
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Structure for capturing messages as delivered
+ */
+typedef struct {
+ rtems_interval processed;
+ char message[MAXIMUM_MESSAGE_LENGTH];
+} message_log_t;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Set of Delivered messages
+ */
+message_log_t delivered_messages[MAXIMUM_MESSAGES_TO_BUFFER];
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Count of Delivered messages
+ */
+int delivered_message_count;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Reset Delivered Message Set
+ *
+ * This is used at the beginning of a test case which is going to
+ * check that message contents and delivery times were as expected.
+ */
+static void delivered_messages_reset(void)
+{
+ delivered_message_count = 0;
+ memset(delivered_messages, 0xc5, sizeof(delivered_messages));
+}
+
+/**
+ * @brief Context for Logger Delivery Function
+ */
+typedef struct {
+ /** Regulator instance being operated on */
+ rtems_regulator_instance *regulator;
+} deliverer_logger_context_t;
+
+/**
+ * @brief Context Instance for Logger Delivery Function
+ */
+static deliverer_logger_context_t deliverer_logger_context;
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Empty Deliver Method for Testing
+ *
+ * This deliverer method implementation logs the messages along with
+ * their time of arrival. This is used by the test cases to verify
+ * proper delivery.
+ */
+static bool test_regulator_deliverer_logger(
+ void *context,
+ void *message,
+ size_t length
+)
+{
+ deliverer_logger_context_t *the_context;
+
+ the_context = (deliverer_logger_context_t *)context;
+
+ static bool caller_releases_buffer = true;
+
+ size_t len;
+ rtems_interval ticks;
+ rtems_status_code sc;
+
+ len = strnlen(message, MAXIMUM_MESSAGE_LENGTH) + 1;
+ rtems_test_assert(len = length);
+
+ ticks = rtems_clock_get_ticks_since_boot();
+
+ delivered_messages[delivered_message_count].processed = ticks;
+
+ strcpy(delivered_messages[delivered_message_count].message, message);
+
+ delivered_message_count++;
+
+ /*
+ * Alternate releasing the buffer here and allowing the calling Delivery
+ * Thread to do it. This increases coverage of that logic.
+ */
+ if (caller_releases_buffer == true) {
+ caller_releases_buffer = false;
+ return true;
+ }
+
+ sc = rtems_regulator_release_buffer(the_context->regulator, message);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ return false;
+}
+
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Helper to create a Regulator instance
+ *
+ * This helper creates a regulator instance with some arbitrary attributes.
+ * This is used in multiple test cases to have a valie regulator instance to
+ * trigger error cases.
+ */
+static rtems_regulator_instance *test_regulator_create_regulator_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes = {
+ .deliverer = test_regulator_deliverer,
+ .deliverer_context = NULL,
+ .maximum_message_size = 16,
+ .maximum_messages = 10,
+ .delivery_thread_priority = 16,
+ .delivery_thread_stack_size = 0,
+ .delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000),
+ .maximum_to_dequeue_per_period = 3
+ };
+ rtems_regulator_instance *regulator;
+
+ regulator = NULL;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(regulator != NULL);
+
+ return regulator;
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create() maximum_to_dequeue_per_period
+ * attributes error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the maximum_to_dequeue_per_period attribute is zero.
+ */
+static void test_regulator_create_max_dequeue_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes = {
+ .deliverer = test_regulator_deliverer,
+ .deliverer_context = NULL,
+ .maximum_message_size = 16,
+ .maximum_messages = 10,
+ .delivery_thread_priority = 16,
+ .delivery_thread_stack_size = 0,
+ .delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000),
+ .maximum_to_dequeue_per_period = 0
+ };
+ rtems_regulator_instance *regulator;
+
+ regulator = NULL;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create() NULL attributes error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the attributes argument is NULL.
+ */
+static void test_regulator_create_null_attributes(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+
+ sc = rtems_regulator_create(NULL, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create NULL regulator error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the regulator argument is NULL.
+ */
+static void test_regulator_create_null_regulator(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+
+ sc = rtems_regulator_create(&attributes, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create deliverer is NULL
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the the attributes deliverer field is NULL.
+ */
+static void test_regulator_create_deliverer_is_null(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = NULL;
+ attributes.maximum_messages = 0;
+ attributes.maximum_message_size = 16;
+ attributes.maximum_to_dequeue_per_period = 1;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create maximum_messages is 0 error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the the attributes maximum_messages field is 0.
+ */
+static void test_regulator_create_maximum_messages_is_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 0;
+ attributes.maximum_message_size = 16;
+ attributes.maximum_to_dequeue_per_period = 1;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create maximum_message_size is 0 error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the the attributes maximum_message_size field is 0.
+ */
+static void test_regulator_create_maximum_message_size_is_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 0;
+ attributes.maximum_to_dequeue_per_period = 1;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_SIZE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create maximum_to_dequeue_per_period is 0 error
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * the the attributes maximum_to_dequeue_per_period field is 0.
+ */
+static void test_regulator_create_maximum_to_dequeue_per_period_is_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 0;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_SIZE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create returns error on failure to allocate regulator
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * it is unable to allocate the mmemory for the regulator instance.
+ */
+static void test_regulator_create_malloc_regulator_fails(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 32;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ malloc_trigger_enable(1);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_NO_MEMORY);
+
+ malloc_trigger_reset();
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create returns error on failure to allocate buffers
+ *
+ * This unit test verifies that rtems_regulator_create() returns an error when
+ * it is unable to allocate the mmemory for the regulator buffers.
+ */
+static void test_regulator_create_malloc_buffers_fails(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 32;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ malloc_trigger_enable(2);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_NO_MEMORY);
+
+ malloc_trigger_reset();
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create and delete work
+ *
+ * This unit test verifies that rtems_regulator_create() can successfully create
+ * the the attributes delivery_thread_priority field is 0.
+ */
+static void test_regulator_create_delivery_thread_priority_is_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 0;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_INVALID_PRIORITY);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create rtems_partition_create error
+ *
+ * This unit test verifies that rtems_regulator_create() correctly returns an
+ * error when the call to rtems_partition_create() fails.
+ */
+static void test_regulator_create_partition_create_fails(void)
+{
+ rtems_status_code sc;
+ rtems_id partition_id;
+ unsigned long partition_area[16];
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ sc = rtems_partition_create(
+ rtems_build_name('T', 'P', 'T', 'P'),
+ partition_area,
+ 16 * sizeof(unsigned long),
+ 2 * sizeof(unsigned long),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &partition_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 8;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_TOO_MANY);
+
+ sc = rtems_partition_delete(partition_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create rtems_message_queue_create error
+ *
+ * This unit test verifies that rtems_regulator_create() correctly returns an
+ * error when the call to rtems_message_queue_create() fails.
+ */
+static void test_regulator_create_message_queue_create_fails(void)
+{
+ rtems_status_code sc;
+ rtems_id queue_id;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ sc = rtems_message_queue_create(
+ rtems_build_name('T', 'Q', 'T', 'Q'),
+ 4,
+ sizeof(unsigned long),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &queue_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 8;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_TOO_MANY);
+
+ sc = rtems_message_queue_delete(queue_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_create rtems_task_create error
+ *
+ * This unit test verifies that rtems_regulator_create() correctly returns an
+ * error when the call to rtems_task_create() fails.
+ */
+static void test_regulator_create_task_create_fails(void)
+{
+ rtems_status_code sc;
+ rtems_id task_id;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ sc = rtems_task_create(
+ rtems_build_name('T', 'T', 'T', 'T'),
+ 80,
+ 0,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &task_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 8;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_TOO_MANY);
+
+ sc = rtems_task_delete(task_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify Regulator Output Thread Handles Error on Period Create
+ *
+ * This unit test verifies that regulator output thread correctly exits
+ * when the call to rtems_rate_monotonic_create() fails.
+ *
+ * This error condition/path cannot be directly detected via a return code,
+ * It is verified via a debugger or code coverage reports.
+ */
+static void test_regulator_create_rate_monotonic_create_fails(void)
+{
+ rtems_status_code sc;
+ rtems_id period_id;
+ rtems_regulator_attributes attributes;
+ rtems_regulator_instance *regulator;
+
+ sc = rtems_rate_monotonic_create(
+ rtems_build_name('T', 'S', 'T', 'P'),
+ &period_id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ (void) memset(&attributes, 0, sizeof(rtems_regulator_attributes));
+
+ attributes.deliverer = test_regulator_deliverer;
+ attributes.maximum_messages = 10;
+ attributes.maximum_message_size = 16;
+ attributes.delivery_thread_priority = 8;
+ attributes.maximum_to_dequeue_per_period = 1;
+ attributes.delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000);
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ /*
+ * Let the output thread execute and encounter the create error.
+ */
+
+ sleep(1);
+
+ /*
+ * Now deallocate the resources allocated earlier
+ */
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_rate_monotonic_delete(period_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_delete NULL regulator error
+ *
+ * This unit test verifies that rtems_regulator_delete() returns an error when
+ * the regulator argument is NULL.
+ */
+static void test_regulator_delete_null_regulator(void)
+{
+ rtems_status_code sc;
+
+ sc = rtems_regulator_delete(NULL, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_delete uninitialized regulator error
+ *
+ * This unit test verifies that rtems_regulator_delete() returns an error when
+ * the regulator argument is uninitialized.
+ */
+static void test_regulator_delete_uninitialized_regulator(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance regulator;
+
+ (void) memset(&regulator, 0, sizeof(regulator));
+
+ sc = rtems_regulator_delete(&regulator, 0);
+ rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_delete successful case
+ *
+ * This unit test verifies that rtems_regulator_delete() can be successfully
+ * deleted.
+ */
+static void test_regulator_delete_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+
+ regulator = test_regulator_create_regulator_OK();
+ rtems_test_assert(regulator != NULL);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_obtain_buffer NULL regulator error
+ *
+ * This unit test verifies that rtems_regulator_obtain_buffer() returns an error when
+ * the regulator argument is NULL.
+ */
+static void test_regulator_obtain_buffer_null_regulator(void)
+{
+ rtems_status_code sc;
+ void *buffer;
+
+ sc = rtems_regulator_obtain_buffer(NULL, &buffer);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_obtain_buffer uninitialized regulator error
+ *
+ * This unit test verifies that rtems_regulator_obtain_buffer() returns an error when
+ * the regulator argument is uninitialized.
+ */
+static void test_regulator_obtain_buffer_uninitialized_regulator(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance regulator;
+ void *buffer;
+
+ (void) memset(&regulator, 0, sizeof(regulator));
+
+ sc = rtems_regulator_obtain_buffer(&regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_obtain_buffer successful case
+ *
+ * This unit test verifies that rtems_regulator_obtain_buffer() can be successfully
+ * obtained from an initialized regulator.
+ */
+static void test_regulator_obtain_buffer_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+ void *buffer;
+
+ regulator = test_regulator_create_regulator_OK();
+ rtems_test_assert(regulator != NULL);
+
+ sc = rtems_regulator_obtain_buffer(regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ /*
+ * Not really testing this here but cannot delete underlying partition
+ * if there are buffers outstanding.
+ */
+ sc = rtems_regulator_release_buffer(regulator, buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_release_buffer NULL regulator error
+ *
+ * This unit test verifies that rtems_regulator_release_buffer() returns an error when
+ * the regulator argument is NULL.
+ */
+static void test_regulator_release_buffer_null_regulator(void)
+{
+ rtems_status_code sc;
+ void *buffer;
+
+ sc = rtems_regulator_release_buffer(NULL, &buffer);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_release_buffer uninitialized regulator error
+ *
+ * This unit test verifies that rtems_regulator_release_buffer() returns an
+ * error when the regulator argument is uninitialized.
+ */
+static void test_regulator_release_buffer_uninitialized_regulator(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance regulator;
+ void *buffer;
+
+ (void) memset(&regulator, 0, sizeof(regulator));
+
+ sc = rtems_regulator_release_buffer(&regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_release_buffer successful case
+ *
+ * This unit test verifies that rtems_regulator_release_buffer() can be successfully
+ * invoked with a buffer previously allocated by rtems_regulator_obtain_buffer().
+ */
+static void test_regulator_release_buffer_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+ void *buffer;
+
+ regulator = test_regulator_create_regulator_OK();
+ rtems_test_assert(regulator != NULL);
+
+ sc = rtems_regulator_obtain_buffer(regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ sc = rtems_regulator_release_buffer(regulator, buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send NULL regulator error
+ *
+ * This unit test verifies that rtems_regulator_send() returns an error when
+ * the regulator argument is NULL.
+ */
+static void test_regulator_send_null_regulator(void)
+{
+ rtems_status_code sc;
+ void *buffer;
+ size_t length;
+
+ buffer = &length;
+ length = sizeof(size_t);
+
+ sc = rtems_regulator_send(NULL, buffer, length);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send NULL message error
+ *
+ * This unit test verifies that rtems_regulator_send() returns an error when
+ * the message argument is NULL.
+ */
+static void test_regulator_send_null_message(void)
+{
+ rtems_status_code sc;
+ size_t length;
+ rtems_regulator_instance regulator;
+
+ length = sizeof(size_t);
+
+ sc = rtems_regulator_send(&regulator, NULL, length);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send zero length message error
+ *
+ * This unit test verifies that rtems_regulator_send() returns an
+ * error when the message length is 0.
+ */
+static void test_regulator_send_length_is_zero(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance regulator;
+ void *buffer;
+ size_t length;
+
+ buffer = &length;
+ length = 0;
+
+ sc = rtems_regulator_send(&regulator, buffer, length);
+ rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send uninitialized regulator error
+ *
+ * This unit test verifies that rtems_regulator_send() returns an
+ * error when the regulator argument is uninitialized.
+ */
+static void test_regulator_send_uninitialized_regulator(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance regulator;
+ void *buffer;
+ size_t length;
+
+ buffer = &length;
+ length = sizeof(size_t);
+
+ (void) memset(&regulator, 0, sizeof(regulator));
+
+ sc = rtems_regulator_send(&regulator, buffer, length);
+ rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify Cannot Delete with Message Outstanding
+ *
+ * This unit test verifies that when the regulator is successfully
+ * initialized, that it cannot be deleted with an undelivered message.
+ * It also verifies some basic statistics are working.
+ */
+static void test_regulator_cannot_delete_with_outstanding(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+ char message[MAXIMUM_MESSAGE_LENGTH];
+ void *buffer;
+ size_t length;
+ int match;
+ rtems_regulator_attributes attributes = {
+ .deliverer = test_regulator_deliverer_logger,
+ .deliverer_context = &deliverer_logger_context,
+ .maximum_message_size = 16,
+ .maximum_messages = 10,
+ .delivery_thread_priority = 16,
+ .delivery_thread_stack_size = 0,
+ .delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(250),
+ .maximum_to_dequeue_per_period = 3
+ };
+ rtems_regulator_statistics stats;
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(regulator != NULL);
+
+ deliverer_logger_context.regulator = regulator;
+
+ delivered_messages_reset();
+
+ // Ensure statistics show no buffers obtained or processed
+ sc = rtems_regulator_get_statistics(regulator, &stats);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(stats.obtained == 0);
+ rtems_test_assert(stats.released == 0);
+ rtems_test_assert(stats.delivered == 0);
+ rtems_test_assert(stats.period_statistics.count == 0);
+ rtems_test_assert(stats.period_statistics.missed_count == 0);
+
+ // Obtain a buffer which should change the statistics
+ sc = rtems_regulator_obtain_buffer(regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ // Ensure statistics show one buffer obtained
+ sc = rtems_regulator_get_statistics(regulator, &stats);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(stats.obtained == 1);
+ rtems_test_assert(stats.released == 0);
+ rtems_test_assert(stats.delivered == 0);
+ rtems_test_assert(stats.period_statistics.count == 0);
+ rtems_test_assert(stats.period_statistics.missed_count == 0);
+
+
+ // Format and send the message -- statistics do not change
+ length = snprintf(message, MAXIMUM_MESSAGE_LENGTH, "message %d", 1024) + 1;
+ strcpy(buffer, message);
+
+ sc = rtems_regulator_send(regulator, buffer, length);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ // Ensure statistics show one buffer obtained
+ sc = rtems_regulator_get_statistics(regulator, &stats);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(stats.obtained == 1);
+ rtems_test_assert(stats.released == 0);
+ rtems_test_assert(stats.delivered == 0);
+ rtems_test_assert(stats.period_statistics.count == 0);
+ rtems_test_assert(stats.period_statistics.missed_count == 0);
+
+ // This is the actual failing case -- cannot delete w/outstanding
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE);
+
+ // Now let the deliveries happen
+ sleep(1);
+
+ // Ensure statistics show all buffers released
+ sc = rtems_regulator_get_statistics(regulator, &stats);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(stats.obtained == 1);
+ rtems_test_assert(stats.released == 1);
+ rtems_test_assert(stats.delivered == 1);
+ rtems_test_assert(stats.period_statistics.count != 0);
+ rtems_test_assert(stats.period_statistics.missed_count == 0);
+
+ rtems_test_assert(delivered_message_count == 1);
+ match = strncmp(
+ delivered_messages[0].message,
+ message,
+ MAXIMUM_MESSAGE_LENGTH
+ );
+ rtems_test_assert(match == 0);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ deliverer_logger_context.regulator = NULL;
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send and output thread delivers message
+ *
+ * This unit test verifies that when the regulator is
+ * successfully initialized and used as expected, a message sent via
+ * rtems_regulator_send() is delivered as expected.
+ */
+static void test_regulator_send_one_message_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+ char message[MAXIMUM_MESSAGE_LENGTH];
+ void *buffer;
+ size_t length;
+ int match;
+ rtems_regulator_attributes attributes = {
+ .deliverer = test_regulator_deliverer_logger,
+ .deliverer_context = &deliverer_logger_context,
+ .maximum_message_size = 16,
+ .maximum_messages = 10,
+ .delivery_thread_priority = 16,
+ .delivery_thread_stack_size = 0,
+ .delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(250),
+ .maximum_to_dequeue_per_period = 3
+ };
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(regulator != NULL);
+
+ deliverer_logger_context.regulator = regulator;
+
+ delivered_messages_reset();
+
+ sc = rtems_regulator_obtain_buffer(regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ length = snprintf(message, MAXIMUM_MESSAGE_LENGTH, "message %d", 1024) + 1;
+ strcpy(buffer, message);
+
+ sc = rtems_regulator_send(regulator, buffer, length);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sleep(1);
+
+ rtems_test_assert(delivered_message_count == 1);
+ match = strncmp(
+ delivered_messages[0].message,
+ message,
+ MAXIMUM_MESSAGE_LENGTH
+ );
+ rtems_test_assert(match == 0);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ deliverer_logger_context.regulator = NULL;
+}
+
+/**
+ * @ingroup RegulatorTests
+ * @brief Verify rtems_regulator_send and output thread delivers messages
+ *
+ * This unit test verifies that when the regulator is successfully initialized
+ * and used as expected, and multiple messages are sent via rtems_regulator_send()
+ * that they are delivered as expected.
+ */
+#include <stdio.h>
+static void test_regulator_send_multiple_messages_OK(void)
+{
+ rtems_status_code sc;
+ rtems_regulator_instance *regulator;
+ char message[MAXIMUM_MESSAGE_LENGTH];
+ void *buffer;
+ size_t length;
+ int match;
+ int i;
+ time_t base_time;
+ time_t tmp_time;
+ rtems_interval base_ticks;
+ rtems_interval ticks;
+ rtems_interval ticks_per_second;
+
+ rtems_regulator_attributes attributes = {
+ .deliverer = test_regulator_deliverer_logger,
+ .deliverer_context = &deliverer_logger_context,
+ .maximum_message_size = MAXIMUM_MESSAGE_LENGTH,
+ .maximum_messages = 10,
+ .delivery_thread_priority = 16,
+ .delivery_thread_stack_size = 0,
+ .delivery_thread_period = RTEMS_MILLISECONDS_TO_TICKS(1000),
+ .maximum_to_dequeue_per_period = 2
+ };
+
+ delivered_messages_reset();
+
+ sc = rtems_regulator_create(&attributes, &regulator);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(regulator != NULL);
+
+ deliverer_logger_context.regulator = regulator;
+
+ /*
+ * Ensure the messages are sent on a second boundary to ensure the
+ * output thread will process them as expected.
+ */
+ tmp_time = time(NULL);
+ do {
+ base_time = time(NULL);
+ } while (tmp_time == base_time);
+
+ /**
+ * Send five messages as a burst which will need to be smoothly sent at
+ * the configured rate.
+ */
+ for (i=1 ; i <= 5 ; i++) {
+ sc = rtems_regulator_obtain_buffer(regulator, &buffer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(buffer != NULL);
+
+ length = snprintf(message, MAXIMUM_MESSAGE_LENGTH, "message %d", i);
+ strcpy(buffer, message);
+
+ sc = rtems_regulator_send(regulator, buffer, length);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ }
+
+ /*
+ * Let the output thread executed and deliver the messages.
+ */
+ sleep(5);
+
+ /**
+ * Ensure the five messages were delivered as follows:
+ *
+ * - deliver all 5
+ * - contents are "message N" where N is 1 to 5
+ * - message 1 and 2 delivered during the first second
+ * - message 3 and 4 delivered during the second second
+ * - message 5 delivered during the third second
+ * - no further messages delivered
+ */
+
+ rtems_test_assert(delivered_message_count == 5);
+
+ for (i=0 ; i < 5 ; i++) {
+ (void) snprintf(message, MAXIMUM_MESSAGE_LENGTH, "message %d", i+1);
+// printf("%d %s\n", i, delivered_messages[i].message);
+ match = strncmp(
+ delivered_messages[i].message,
+ message,
+ MAXIMUM_MESSAGE_LENGTH
+ );
+ rtems_test_assert(match == 0);
+ }
+
+ /**
+ * Verify that messages were delivered in the proper groups. Check that
+ * the delivery time matches expectations.
+ */
+ rtems_test_assert(delivered_messages[0].processed == delivered_messages[1].processed);
+ rtems_test_assert(delivered_messages[1].processed != delivered_messages[2].processed);
+ rtems_test_assert(delivered_messages[2].processed == delivered_messages[3].processed);
+ rtems_test_assert(delivered_messages[3].processed != delivered_messages[4].processed);
+
+ /**
+ * Verify that the message groups were properly spaced temporally. They
+ * should be one second apart.
+ */
+ ticks_per_second = rtems_clock_get_ticks_per_second();
+
+ base_ticks = delivered_messages[1].processed;
+ ticks = delivered_messages[2].processed;
+ rtems_test_assert(ticks_per_second == ticks - base_ticks);
+
+ base_ticks = delivered_messages[3].processed;
+ ticks = delivered_messages[4].processed;
+ rtems_test_assert(ticks_per_second == ticks - base_ticks);
+
+ sc = rtems_regulator_delete(regulator, FIVE_SECONDS);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ deliverer_logger_context.regulator = NULL;
+}
+
+/* Necessary prototype */
+rtems_task test_regulator(rtems_task_argument);
+
+/**
+ * @ingroup RegulatorTestshttps://devel.rtems.org/milestone/6.1
+ * @brief Test entry task which invokes test cases
+ */
+rtems_task test_regulator(rtems_task_argument arg)
+{
+ (void) arg;
+
+ TEST_BEGIN();
+
+ malloc_trigger_reset();
+
+ test_regulator_create_max_dequeue_zero();
+ test_regulator_create_null_attributes();
+ test_regulator_create_null_regulator();
+ test_regulator_create_deliverer_is_null();
+ test_regulator_create_maximum_messages_is_zero();
+ test_regulator_create_maximum_message_size_is_zero();
+ test_regulator_create_maximum_to_dequeue_per_period_is_zero();
+ test_regulator_create_malloc_regulator_fails();
+ test_regulator_create_malloc_buffers_fails();
+ test_regulator_create_delivery_thread_priority_is_zero();
+ test_regulator_create_partition_create_fails();
+ test_regulator_create_message_queue_create_fails();
+ test_regulator_create_task_create_fails();
+ test_regulator_create_rate_monotonic_create_fails();
+
+ test_regulator_delete_null_regulator();
+ test_regulator_delete_uninitialized_regulator();
+ test_regulator_delete_OK();
+
+ test_regulator_obtain_buffer_null_regulator();
+ test_regulator_obtain_buffer_uninitialized_regulator();
+ test_regulator_obtain_buffer_OK();
+
+ test_regulator_release_buffer_null_regulator();
+ test_regulator_release_buffer_uninitialized_regulator();
+ test_regulator_release_buffer_OK();
+
+ test_regulator_send_null_regulator();
+ test_regulator_send_null_message();
+ test_regulator_send_length_is_zero();
+ test_regulator_send_uninitialized_regulator();
+
+ test_regulator_send_one_message_OK();
+ test_regulator_cannot_delete_with_outstanding();
+
+ test_regulator_send_multiple_messages_OK();
+
+ TEST_END();
+
+ rtems_test_exit(0);
+}
diff --git a/testsuites/libtests/regulator01/regulator01.doc b/testsuites/libtests/regulator01/regulator01.doc
new file mode 100644
index 0000000000..ff4e8005ec
--- /dev/null
+++ b/testsuites/libtests/regulator01/regulator01.doc
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+# Copyright (c) 2023 OAR Corporation
+#
+# 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.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: regulator01
+
+directives:
+ + rtems_regulator_create
+ + rtems_regulator_delete
+ + rtems_regulator_obtain_buffer
+ + rtems_regulator_release_buffer
+ + rtems_regulator_send
+
+concepts
+ + Verify rtems_regulator_create() maximum_to_dequeue_per_period
+ + Verify rtems_regulator_create() NULL attributes error
+ + Verify rtems_regulator_create NULL regulator error
+ + Verify rtems_regulator_create deliverer is NULL
+ + Verify rtems_regulator_create maximum_messages is 0 error
+ + Verify rtems_regulator_create maximum_message_size is 0 error
+ + Verify rtems_regulator_create maximum_to_dequeue_per_period is 0 error
+ + Verify rtems_regulator_create returns error on failure to allocate regulator
+ + Verify rtems_regulator_create returns error on failure to allocate buffers
+ + Verify rtems_regulator_create and delete work
+ + Verify rtems_regulator_create rtems_partition_create error
+ + Verify rtems_regulator_create rtems_message_queue_create error
+ + Verify rtems_regulator_create rtems_task_create error
+ + Verify Regulator Output Thread Handles Error on Period Create
+ + Verify rtems_regulator_delete NULL regulator error
+ + Verify rtems_regulator_delete uninitialized regulator error
+ + Verify rtems_regulator_delete successful case
+ + Verify rtems_regulator_obtain_buffer NULL regulator error
+ + Verify rtems_regulator_obtain_buffer uninitialized regulator error
+ + Verify rtems_regulator_obtain_buffer successful case
+ + Verify rtems_regulator_release_buffer NULL regulator error
+ + Verify rtems_regulator_release_buffer uninitialized regulator error
+ + Verify rtems_regulator_release_buffer successful case
+ + Verify rtems_regulator_send NULL regulator error
+ + Verify rtems_regulator_send NULL message error
+ + Verify rtems_regulator_send zero length message error
+ + Verify rtems_regulator_send uninitialized regulator error
+ + Verify rtems_regulator_send and output thread delivers message
+ + Verify rtems_regulator_send and cannot delete with outstanding messages
diff --git a/testsuites/libtests/regulator01/rtems_config.c b/testsuites/libtests/regulator01/rtems_config.c
new file mode 100644
index 0000000000..ca96e1b1dd
--- /dev/null
+++ b/testsuites/libtests/regulator01/rtems_config.c
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief RTEMS Configuration for regulator tests
+ */
+
+/*
+ * COPYRIGHT (c) 2022. * 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.
+ *
+ * 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.
+ */
+
+
+#include <rtems.h>
+
+rtems_task test_regulator(rtems_task_argument);
+
+#include <bsp.h> /* for device driver prototypes */
+
+/* NOTICE: the clock driver is explicitly disabled */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_ENTRY_POINT test_regulator
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+/* Use hard limits to make it easier to trip object creation errors */
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+#define CONFIGURE_MAXIMUM_PERIODS 1
+
+#define CONFIGURE_UNIFIED_WORK_AREAS
+#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (8 * 1024)
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/libtests/sha/init.c b/testsuites/libtests/sha/init.c
index ccb20750ec..7d8c4ada3e 100644
--- a/testsuites/libtests/sha/init.c
+++ b/testsuites/libtests/sha/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/shell01/init.c b/testsuites/libtests/shell01/init.c
index 0fc29b8936..83564d9937 100644
--- a/testsuites/libtests/shell01/init.c
+++ b/testsuites/libtests/shell01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014, 2019 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2014, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/sparsedisk01/init.c b/testsuites/libtests/sparsedisk01/init.c
index c756daa188..5398bf98ce 100644
--- a/testsuites/libtests/sparsedisk01/init.c
+++ b/testsuites/libtests/sparsedisk01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/spi01/init.c b/testsuites/libtests/spi01/init.c
index aeabdc04d0..7b68d0f76a 100644
--- a/testsuites/libtests/spi01/init.c
+++ b/testsuites/libtests/spi01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2016 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/termios01/termios_testdriver.c b/testsuites/libtests/termios01/termios_testdriver.c
index d0a9534b52..49810a37e0 100644
--- a/testsuites/libtests/termios01/termios_testdriver.c
+++ b/testsuites/libtests/termios01/termios_testdriver.c
@@ -192,7 +192,7 @@ rtems_device_driver termios_test_driver_open(
termios_test_driver_set_attributes, /* setAttributes */
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
- 0 /* outputUsesInterrupts */
+ TERMIOS_POLLED /* outputUsesInterrupts */
};
if ( minor > 2 ) {
diff --git a/testsuites/libtests/termios03/termios_testdriver_polled.c b/testsuites/libtests/termios03/termios_testdriver_polled.c
index a852fe1f20..8daf8d6685 100644
--- a/testsuites/libtests/termios03/termios_testdriver_polled.c
+++ b/testsuites/libtests/termios03/termios_testdriver_polled.c
@@ -159,7 +159,7 @@ rtems_device_driver termios_test_driver_open(
termios_test_driver_set_attributes, /* setAttributes */
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
- 0 /* outputUsesInterrupts */
+ TERMIOS_POLLED /* outputUsesInterrupts */
};
if ( minor > 2 ) {
diff --git a/testsuites/libtests/termios04/termios_testdriver_impl.h b/testsuites/libtests/termios04/termios_testdriver_impl.h
index cfe9ebedf4..740f9e0778 100644
--- a/testsuites/libtests/termios04/termios_testdriver_impl.h
+++ b/testsuites/libtests/termios04/termios_testdriver_impl.h
@@ -271,7 +271,7 @@ rtems_device_driver termios_test_driver_open(
#if defined(TASK_DRIVEN)
TERMIOS_TASK_DRIVEN /* outputUsesInterrupts */
#else
- 0 /* outputUsesInterrupts */
+ TERMIOS_POLLED /* outputUsesInterrupts */
#endif
};
diff --git a/testsuites/libtests/termios09/init.c b/testsuites/libtests/termios09/init.c
index 3cb71fb267..a7c2518ecc 100644
--- a/testsuites/libtests/termios09/init.c
+++ b/testsuites/libtests/termios09/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/init.c b/testsuites/libtests/ttest01/init.c
index 658f8f6289..433bc0581b 100644
--- a/testsuites/libtests/ttest01/init.c
+++ b/testsuites/libtests/ttest01/init.c
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/t-self-test.h b/testsuites/libtests/ttest01/t-self-test.h
index 1035872c9d..d2767d5e70 100644
--- a/testsuites/libtests/ttest01/t-self-test.h
+++ b/testsuites/libtests/ttest01/t-self-test.h
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-assert.c b/testsuites/libtests/ttest01/test-assert.c
index 398539fe8e..2a401ca577 100644
--- a/testsuites/libtests/ttest01/test-assert.c
+++ b/testsuites/libtests/ttest01/test-assert.c
@@ -86,7 +86,7 @@ T_TEST_OUTPUT(assert2,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-checks.c b/testsuites/libtests/ttest01/test-checks.c
index fa5591121e..14f3cda44c 100644
--- a/testsuites/libtests/ttest01/test-checks.c
+++ b/testsuites/libtests/ttest01/test-checks.c
@@ -5415,7 +5415,7 @@ T_TEST_OUTPUT(check_false_no_fmt,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-destructor.c b/testsuites/libtests/ttest01/test-destructor.c
index 0a2f650ed2..5e30e6c203 100644
--- a/testsuites/libtests/ttest01/test-destructor.c
+++ b/testsuites/libtests/ttest01/test-destructor.c
@@ -31,7 +31,7 @@ T_TEST_OUTPUT(destructor,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-eno.c b/testsuites/libtests/ttest01/test-eno.c
index c334b5e1f7..744feb6434 100644
--- a/testsuites/libtests/ttest01/test-eno.c
+++ b/testsuites/libtests/ttest01/test-eno.c
@@ -50,7 +50,7 @@ T_TEST_OUTPUT(test_eno_success,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-example.c b/testsuites/libtests/ttest01/test-example.c
index 6fa062f6c8..94bd9487db 100644
--- a/testsuites/libtests/ttest01/test-example.c
+++ b/testsuites/libtests/ttest01/test-example.c
@@ -32,7 +32,7 @@ T_TEST_OUTPUT(example,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-fixture.c b/testsuites/libtests/ttest01/test-fixture.c
index e1f59876ca..3cc0f64d63 100644
--- a/testsuites/libtests/ttest01/test-fixture.c
+++ b/testsuites/libtests/ttest01/test-fixture.c
@@ -185,7 +185,7 @@ T_TEST_OUTPUT(fixture,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2020 embedded brains GmbH
+ * Copyright (C) 2018, 2020 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-leak.c b/testsuites/libtests/ttest01/test-leak.c
index 923ad1989c..c63ef0cd48 100644
--- a/testsuites/libtests/ttest01/test-leak.c
+++ b/testsuites/libtests/ttest01/test-leak.c
@@ -215,7 +215,7 @@ T_TEST_OUTPUT(missing_key_delete,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-log.c b/testsuites/libtests/ttest01/test-log.c
index bf1b822c0e..38573f2f6b 100644
--- a/testsuites/libtests/ttest01/test-log.c
+++ b/testsuites/libtests/ttest01/test-log.c
@@ -23,7 +23,7 @@ T_TEST_OUTPUT(log,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-malloc.c b/testsuites/libtests/ttest01/test-malloc.c
index 14066ddf7b..ffaa4c6682 100644
--- a/testsuites/libtests/ttest01/test-malloc.c
+++ b/testsuites/libtests/ttest01/test-malloc.c
@@ -93,7 +93,7 @@ T_TEST_OUTPUT(calloc_auto,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-plan.c b/testsuites/libtests/ttest01/test-plan.c
index d7632b8590..0b8ccd4477 100644
--- a/testsuites/libtests/ttest01/test-plan.c
+++ b/testsuites/libtests/ttest01/test-plan.c
@@ -95,7 +95,7 @@ T_TEST_OUTPUT(nested_plan,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-psx.c b/testsuites/libtests/ttest01/test-psx.c
index b43fd96846..9b82543c26 100644
--- a/testsuites/libtests/ttest01/test-psx.c
+++ b/testsuites/libtests/ttest01/test-psx.c
@@ -72,7 +72,7 @@ T_TEST_OUTPUT(test_psx_success,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-rtems.c b/testsuites/libtests/ttest01/test-rtems.c
index 1f94b7318c..a44323886e 100644
--- a/testsuites/libtests/ttest01/test-rtems.c
+++ b/testsuites/libtests/ttest01/test-rtems.c
@@ -111,7 +111,7 @@ T_TEST_OUTPUT(rsc_success,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-simple.c b/testsuites/libtests/ttest01/test-simple.c
index f98e3a1dfa..7732d2f937 100644
--- a/testsuites/libtests/ttest01/test-simple.c
+++ b/testsuites/libtests/ttest01/test-simple.c
@@ -31,7 +31,7 @@ T_TEST_OUTPUT(a_test_case,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-step.c b/testsuites/libtests/ttest01/test-step.c
index 6d5ee9f7ab..38d0cb6518 100644
--- a/testsuites/libtests/ttest01/test-step.c
+++ b/testsuites/libtests/ttest01/test-step.c
@@ -23,7 +23,7 @@ T_TEST_OUTPUT(step,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-task-context.c b/testsuites/libtests/ttest01/test-task-context.c
index 56139f9474..884e3e3d34 100644
--- a/testsuites/libtests/ttest01/test-task-context.c
+++ b/testsuites/libtests/ttest01/test-task-context.c
@@ -23,7 +23,7 @@ T_TEST_OUTPUT(check_task_context,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-time.c b/testsuites/libtests/ttest01/test-time.c
index a324290e56..2b5039015b 100644
--- a/testsuites/libtests/ttest01/test-time.c
+++ b/testsuites/libtests/ttest01/test-time.c
@@ -280,7 +280,7 @@ T_TEST_OUTPUT(begin_time,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest01/test-verbosity.c b/testsuites/libtests/ttest01/test-verbosity.c
index 486969c85c..fc54724ce1 100644
--- a/testsuites/libtests/ttest01/test-verbosity.c
+++ b/testsuites/libtests/ttest01/test-verbosity.c
@@ -34,7 +34,7 @@ T_TEST_OUTPUT(verbosity_changes,
/*
* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
*
- * Copyright (C) 2018, 2019 embedded brains GmbH
+ * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/ttest02/init.c b/testsuites/libtests/ttest02/init.c
index 4d540c9a86..881bbedc92 100644
--- a/testsuites/libtests/ttest02/init.c
+++ b/testsuites/libtests/ttest02/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/libtests/utf8proc01/init.c b/testsuites/libtests/utf8proc01/init.c
index 660459ae24..71a8936257 100644
--- a/testsuites/libtests/utf8proc01/init.c
+++ b/testsuites/libtests/utf8proc01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions