1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<title>MI_Swap*</title> 9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 10</head> 11 12<body> 13 14<h1 align="left">MI_Swap* <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1> 15<h2>Syntax</h2> 16 17<dl> 18 <dd> 19<CODE>#include <nitro/mi.h></CODE><BR> 20 <BR> 21 <CODE>u32 MI_SwapWord( u32 setData, volatile u32* destp );</CODE><br> 22 <CODE>u8 MI_SwapByte( u32 setData, volatile u8* destp );</CODE></dd> 23</dl> 24<h2>Arguments</h2> 25<TABLE border="1" width="100%"> 26 <TBODY> 27 <TR> 28 <TD width="13%"><EM><STRONG>setData</STRONG></EM></TD> 29 <TD width="87%">The data that is set</TD> 30 </TR> 31 <TR> 32 <TD width="13%"><EM><STRONG>destp</STRONG></EM></TD> 33 <TD width="87%">Pointer to the swap destination</TD> 34 </TR> 35 </TBODY> 36</TABLE> 37 38<h2>Return Values</h2> 39<p>Value stored in the swap destination immediately prior to the swap.</p> 40 41<H2>Description</H2> 42<P>This function swaps <CODE><EM><STRONG>setData</STRONG></EM></CODE> and the data stored at *<EM><CODE><STRONG>destp</STRONG></CODE></EM>. This function implements spinlock to exclusively control resources that are shared between processors or modules. <CODE>MI_SwapByte()</CODE> swaps byte data. <CODE>MI_SwapWord()</CODE> swaps word data.</P> 43<P>Note that byte access to the main memory is possible only via cache in the TEG environment. Therefore, <CODE>MI_SwapWord()</CODE> should be used for main memory.</P> 44 45 46<h2>Internal Operation</h2> 47<P>This swaps using the ARM instructions <CODE>swp</CODE> or <CODE>swpb</CODE>.</P> 48 49<h2>See Also</h2> 50<P>None.</P> 51 52<H2>Revision History</H2> 53<P> 542004/10/18 Corrected the description of byte access.<br> 2004/02/10 Initial version. 55</P> 56<hr><p>CONFIDENTIAL</p></body> 57</html> 58