# rm.c File Reference

This is the Resource Manager Low Level Driver file. More...

`#include <stdint.h>`
`#include <stdlib.h>`
`#include <ti/drv/rm/rm.h>`
`#include <ti/drv/rm/rm_public_lld.h>`
`#include <ti/drv/rm/resource_table_defs.h>`
`#include <ti/drv/rm/include/rm_pvt.h>`
`#include <rm_osal.h>`
`#include <string.h>`
`#include <ti/csl/csl_qm_queue.h>`

## Functions

void | Rm_permissionTableInit (void)
void | Rm_setTablePermissions (const Rm_Resource *resourceEntry, Rm_Perms *rmPermsArray, uint32_t len)
Rm_Result | Rm_populatePermissionTable (const Rm_Resource *rmResourceTable)
void | Rm_updatePermissionTables (void)
Rm_Result | Rm_getInitPermissions (Rm_Perms *resourcePermissions)
Rm_Result | Rm_getUsePermissions (Rm_Perms *resourcePermissions)
Rm_Result | Rm_getLinkRamPermissions (Bool isInitCheck, Rm_qmssLinkingRamPerms *linkRamPermArray, Rm_ResourceInfo *linkRamResData)
Rm_Result | Rm_initPermissionChecker (Rm_ResourceInfo *resourceData)
Rm_Result | Rm_usePermissionChecker (Rm_ResourceInfo *resourceData)
Rm_Result | Rm_init (const Rm_Resource *rmResourceTable)
Rm_Result | Rm_start (void)
Rm_Handle | Rm_getHandle (void)
uint32_t | Rm_getVersion (void)
const char * | Rm_getVersionStr (void)

## Variables

Rm_LldPermCallouts | rmPermissionCheckers
| Global Variable (should be local per DSP) containing LLD RM permission checkers.
const char | rmLldVersionStr [] = RM_LLD_VERSION_STR ":" __DATE__ ":" __TIME__
| Global Variable which describes the RM LLD Version Information.

## Detailed Description

This is the Resource Manager Low Level Driver file.

  ============================================================================
  (C) Copyright 2012, Texas Instruments, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

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.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

## Function Documentation

Rm_Result Rm_getInitPermissions | ( | Rm_Perms * | resourcePermissions | ) |

Description
This function extracts the initialization permission for a DSP from a resource permission element.

Parameters:

  `[in]` | resourcePermissions | A permissions structure element to extract the per DSP initialization permission

Return values:

  | Success | - RM_INIT_PERMISSION_APPROVED
  | Failure | - RM_INIT_PERMISSION_DENIED

Rm_Result Rm_getLinkRamPermissions | ( | Bool | isInitCheck,
|  | Rm_qmssLinkingRamPerms * | linkRamPermArray,
|  | Rm_ResourceInfo * | linkRamResData |
| ) |  |  |

Description
This function searches the list of linking RAM address ranges to find one that has the requested linking RAM address within it. If found the function returns the permissions for this range. Otherwise it returns denied.

Parameters:

  `[in]` | isInitCheck | True - Permissions check is for initialization False - Permissions check is for usage
  `[in]` | linkRamPermArray | Internal array of linking RAM ranges and their permissions
  `[in]` | linkRamResData | Linking RAM addresses to check for initialization or usage permissions

Return values:

  | Success | - RM_INIT_PERMISSION_APPROVED
  | Failure | - RM_INIT_PERMISSION_DENIED

Rm_Result Rm_getUsePermissions | ( | Rm_Perms * | resourcePermissions | ) |

Description
This function extracts the usage permission for a DSP from a resource permission element.

Parameters:

  `[in]` | resourcePermissions | A permissions structure element to extract the per DSP usage permission

Return values:

  | Success | - RM_INIT_PERMISSION_APPROVED
  | Failure | - RM_INIT_PERMISSION_DENIED

Rm_Result Rm_initPermissionChecker | ( | Rm_ResourceInfo * | resourceData | ) |

Description
This function is used by LLDs to check initialization permissions for a resource

Parameters:

  `[in]` | resourceData | Structure containing resource information such as resource type and the resource value to be checked

Return values:

  | Success | - RM_INIT_PERMISSION_APPROVED
  | Failure | - RM_INIT_PERMISSION_DENIED

void Rm_permissionTableInit | ( | void |  | ) |

Description
Initialize the permission tables. All resources are intialized to deny all initialization and usage permissions.

Rm_Result Rm_populatePermissionTable | ( | const Rm_Resource * | rmResourceTable | ) |

Description
Takes an application specified resource table as input and transfers all resource permissions specified within into the internal resource permission tables. Upon completion of permission transfer a global synchronization object is written to sync with slave cores.

Parameters:

  `[in]` | rmResourceTable | Application defined resource table containing all resources that should have permissions set for the DSPs

Return values:

  | Success | - RM_OK
  | Failure | - RM_ERROR_PERMISSION_TABLE_POPULATION_FAILED

void Rm_setTablePermissions | ( | const Rm_Resource * | resourceEntry,
|  | Rm_Perms * | rmPermsArray,
|  | uint32_t | len |
| ) |  |  |

Description
Sets a list of entries in a permissions array to the specified permissions

Parameters:

  `[in]` | resourceEntry | The resource entry from the application defined resource table containing a range of resources and the permissions to assign to them.
  `[in]` | rmPermsArray | The permissions array for the resource specified in the resourceEntry.
  `[in]` | len | Full length of permissions array for writeback after the permissions have been transferred.

void Rm_updatePermissionTables | ( | void |  | ) |

Description
This function is called on slave DSPs after the master DSP has populated the internal permission tables. This function invalidates all internal global permission tables so that no further invalidates are required when LLDs perform resource permission checks

Rm_Result Rm_usePermissionChecker | ( | Rm_ResourceInfo * | resourceData | ) |

Description
This function is used by LLDs to check usage permissions for a resource

Parameters:

  `[in]` | resourceData | Structure containing resource information such as resource type and the resource value to be checked

Return values:

  | Success | - RM_INIT_PERMISSION_APPROVED
  | Failure | - RM_INIT_PERMISSION_DENIED

Copyright 2012, Texas Instruments Incorporated