1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_SetProtectionRegion*</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_SetProtectionRegion* <img src="../../image/NTR.gif" align="middle"><img src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15<P><CODE>#include &lt;nitro/os.h&gt;</CODE><BR> <BR> (<CODE>Specifies address and size</CODE>)<BR> <CODE>OS_SetProtectionRegion( regionNo, address, sizeStr );</CODE><BR> <CODE>void OS_SetProtectionRegionEx( int regionNo, u32 address, u32 sizeDef );</CODE><BR> <BR> (<CODE>Specifies parameters</CODE>)<BR> <CODE>void OS_SetProtectionRegionParam( int regionNo, u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion0( u32 param )</CODE>;<BR> <CODE>void OS_SetProtectionRegion1( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion2( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion3( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion4( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion5( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion6( u32 param );</CODE><BR> <CODE>void OS_SetProtectionRegion7( u32 param );</CODE><BR>
16</DL>
17<H2>Arguments</H2>
18<TABLE border="1">
19  <TBODY>
20    <TR>
21<TD><B><I>regionNo</I></B></TD>
22<TD>Protection Region number. Specify a value between 0 and 7.</TD>
23    </TR>
24    <TR>
25<TD><B><I>address</I></B></TD>
26<TD>Base address (starting address). Specify as type u32.</TD>
27    </TR>
28    <TR>
29<TD><B><I>sizeStr</I></B></TD>
30<TD>String indicating area size. Only certain strings such as 4KB, 8KB, etc. can be specified.</TD>
31    </TR>
32    <TR>
33<TD><B><I>sizeDef</I></B></TD>
34<TD>Value indicating the area size. It is of the form &quot;<CODE>OS_PR_SIZE_xxx</CODE>,&quot; where &quot;<CODE>xxx</CODE>&quot; is 4KB, 8KB, ... 4GB.</TD>
35    </TR>
36    <TR>
37<TD><B><I>param</I></B></TD>
38<TD>Logical sum of specified base address and area size values. This logical sum value is set in CP15.</TD>
39    </TR>
40  </TBODY>
41</TABLE>
42<H2>Return Values</H2>
43<P>None.</P>
44<H2>Description</H2>
45<P>Sets the Protection Region's base address (starting address) and size. Also, with the <CODE>OS_SetProtectionRegion</CODE> function, the protection unit is enabled at the same time.</P>
46<P><font color="red">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.</font></P>
47<H3><CODE>�&nbsp;OS_SetProtectionRegion </CODE></H3>
48<P>The <CODE>OS_SetProtectionRegion</CODE> function is a macro. The <CODE>regionNo</CODE> argument is the region number of the Protection Region being set. The 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.</P>
49<P>The <CODE>address</CODE> argument 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.</P>
50<P>The <CODE>sizeStr</CODE> argument is a string that indicates the area size of the Protection Region.</P>
51<BLOCKQUOTE>
52<P>4KB 8KB 16KB 32KB 64KB 128KB 256KB 512KB<BR> 1MB 2MB 4MB 8MB 16MB 32MB 64MB 128MB 256MB 512MB<BR> 1GB 2GB 4GB</P>
53</BLOCKQUOTE>
54<BLOCKQUOTE>Example:<BR> <CODE>OS_SetProtectionRegion( 2, 0x02080000, 32KB );</CODE><BR>
55</BLOCKQUOTE>
56<P>Regardless of the status before calling the <CODE>OS_SetProtectionRegion</CODE> function, the region becomes enabled.</P>
57<H3><CODE>�&nbsp;OS_SetProtectionRegionEx</CODE></H3>
58<P>The <CODE>OS_SetProtectionRegionEx</CODE> function was created to make it possible to pass variables for region numbers for which this was not possible because the <CODE>OS_SetProtectionRegion</CODE> function was a macro.</P>
59<P>The <CODE>regionNo</CODE> argument is the region number of the Protection Region being set. It takes the values 0 through 7.</P>
60<P>The <CODE>address</CODE> argument is the base address (starting address) of the Protection Region being set. Everything else is the same as with the <CODE>OS_SetProtectionRegion</CODE> function.</P>
61<P>The <CODE>sizeDef</CODE> argument is a value of the form <CODE>OS_PR_SIZE_xxx</CODE>. Any of the following can be specified in <CODE>xxx</CODE>.</P>
62<BLOCKQUOTE>4KB 8KB 16KB 32KB 64KB 128KB 256KB 512KB<BR> 1MB 2MB 4MB 8MB 16MB 32MB 64MB 128MB 256MB 512MB<BR> 1GB 2GB 4GB</BLOCKQUOTE>
63<P> </P>
64<BLOCKQUOTE>Example:<BR> <CODE>OS_SetProtectionRegionEx( 2, 0x02080000, OS_PR_SIZE_32KB );</CODE></BLOCKQUOTE>
65<H3><CODE>�&nbsp;OS_SetProtectionRegionParam</CODE></H3>
66<P>The <CODE>OS_SetProtectionRegionParam</CODE> function is used to set the base address and region size, using the Protection Region's internal parameter format. The <CODE>regionNo</CODE> argument is the same as in the <CODE>OS_SetProtectionRegionEx</CODE> function. The <CODE>param</CODE> parameter is the logical sum of the base address and <CODE>HW_C6_PR_SIZE_<I>xxx</I></CODE>, which is the value set to express the area size. <CODE><I>xxx</I></CODE> takes the string named for <CODE>sizeStr</CODE> (that is, 4KB or 8KB or ... 4GB). In addition, add <CODE>HW_C6_PR_ENABLE</CODE> in the logical sum to enable the region.</P>
67<BLOCKQUOTE>Example: <BR> <CODE>OS_SetProtectionRegionParam( 2, 0x02080000 | HW_C6_PR_32KB | HW_C6_PR_ENABLE );</CODE><BR>
68</BLOCKQUOTE>
69<H3><CODE>�&nbsp;OS_SetProtectionRegion0 - OS_SetProtectionRegion7</CODE></H3>
70<P>The functions <CODE>OS_SetProtectionRegion0</CODE> through <CODE>OS_SetProtectionRegion7</CODE> are used for specifying the region numbers of <CODE>OS_SetProtectionRegionParam</CODE> using the function names. The <CODE>param</CODE> argument is the same as in the <CODE>OS_SetProtectionRegionParam</CODE> function.</P>
71<H2>Internal Operation</H2>
72<P>Modifies register 6 of the system control co-processor CP15.</P>
73
74<H2>See Also</H2>
75<P><A href="OS_EnableProtectionUnit.html"><CODE>OS_EnableProtectionUnit</CODE></A><BR> <A href="OS_DisableProtectionUnit.html"><CODE>OS_DisableProtectionUnit</CODE></A><BR> <A href="OS_GetProtectionRegion.html"><CODE>OS_GetProtectionRegion*</CODE></A></P>
76<H2>Revision History</H2>
77<P>2007/10/25 Added the <CODE>OS_SetProtectionRegionEx</CODE> function. Also added other descriptions.<BR>2004/07/08 Described <CODE>HW_C6_PR_ENABLE</CODE>.<BR> 2004/05/28 Initial version.</P>
78<hr><p>CONFIDENTIAL</p></body>
79</HTML>