summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c
blob: 640c39f696fb44a112734a9da8ca73cc1dba8367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/** @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 = 0;

  CurrentToken++;

  return (CM_OBJECT_TOKEN)CM_ABSTRACT_TOKEN_MAKE (ETokenNameSpaceGenerated, 0, CurrentToken);
}