summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c')
-rw-r--r--DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c
new file mode 100644
index 0000000000..7033b5f1b5
--- /dev/null
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c
@@ -0,0 +1,29 @@
+/** @file
+ Token Generator
+
+ Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+/** Generate a token.
+
+ @return A token.
+**/
+CM_OBJECT_TOKEN
+EFIAPI
+GenerateToken (
+ VOID
+ )
+{
+ // Start Tokens at 1 to avoid collisions with CM_NULL_TOKEN.
+ STATIC UINTN CurrentToken = 1;
+
+ return (CM_OBJECT_TOKEN)(CurrentToken++);
+}