OS_SetProtectionRegion*

C Specification

#include <nitro/os.h>
OS_SetProtectionRegion( regionNo, address, sizeStr );
OS_SetProtectionRegionParam( regionNo, param );
(These functions are macros)

Arguments

None.

regionNo The Protection Region number. Specify a value between 0 and 7.
address The base address (starting address). Specify as type u32.
sizeStr Character string indicating area size. Only certain strings such as 4KB, 8KB, etc. can be specified.
param Logical sum of specified base address and area size values. This logical sum value is set in CP15.

Return Values

None.

Description

Sets the Protection Region's base address (starting address) and size. Also, with OS_SetProtectionRegion(), the protection unit is enabled.

The Protection Region's settings are closely related to system behavior. When making these settings, be sure you understand the design of the Protection Region and how each area is used.

OS_SetProtectionRegion() is a macro. regionNo is the region number of the Protection Region being set. The character string itself is used as the argument by the macro, so you cannot use the value to specify a variable. You should specify a number between 0 and 7.

address is the base address (starting address) of the Protection Region being set. Specify as type u32. The alignment restrictions of the specified address will vary, depending on the size of the Protection Region. The Protection Region's starting address must be a multiple of the area size. Thus, if the Protection Region is 4KB, then the lower 12 bits of the address expressed as a u32 value must be 0.

sizeStr is a character string that indicates the area size of the Protection Region.

4KB 8KB 16KB 32KB 64KB 128KB 256KB 512KB
1MB 2MB 4MB 8MB 16MB 32MB 64MB 128MB 256MB 512MB
1GB 2GB 4GB

Example:
OS_SetProtectionRegion( 2, 0x02080000, 32KB );

Regardless of the status before calling OS_SetProtectionRegion(), the region becomes enabled.

OS_SetProtectionRegionParam() is also a macro. regionNo is handled the same as with OS_SetProtectionRegion(). The param parameter is the logical sum of the base address and HW_C6_PR_SIZE_xxx, which is the value set to express the area size. xxx takes the string named for sizeStr (i.e., 4KB or 8KB or ...4GB). In addition, add HW_C6_PR_ENABLE in the logical sum to enable the region.

Example:
OS_SetProtectionRegionParam( 2, 0x02080000 | HW_C6_PR_32KB | HW_C6_PR_ENABLE );

Internal Operation

The function itself is a macro, but it ultimately operates register 6 of the CP15 system control co-processor.

See Also

OS_EnableProtectionUnit, OS_DisableProtectionUnit
OS_GetProtectionRegion*

Revision History

07/08/2004 Described HW_C6_PR_ENABLE
05/28/2004 Initial version