#endif
/*###################CompilerspecificIntrinsics###########################*/
#ifdefined(__CC_ARM)/*------------------RealViewCompiler-----------------*/
/*ARMarmccspecificfunctions*/
/**
*@briefReturntheProcessStackPointer
*
*@returnProcessStackPointer
*
*Returntheactualprocessstackpointer
*/
__ASMuint32_t__get_PSP(void)
{
mrsr0,psp
bxlr
}
/**
*@briefSettheProcessStackPointer
*
*@paramtopOfProcStackProcessStackPointer
*
*AssignthevalueProcessStackPointertotheMSP
*(processstackpointer)Cortexprocessorregister
*/
__ASMvoid__set_PSP(uint32_ttopOfProcStack)
{
msrpsp,r0
bxlr
}
/**
*@briefReturntheMainStackPointer
*
*@returnMainStackPointer
*
*ReturnthecurrentvalueoftheMSP(mainstackpointer)
*Cortexprocessorregister
*/
__ASMuint32_t__get_MSP(void)
{
mrsr0,msp
bxlr
}
/**
*@briefSettheMainStackPointer
*
*@paramtopOfMainStackMainStackPointer
*
*AssignthevaluemainStackPointertotheMSP
*(mainstackpointer)Cortexprocessorregister
*/
__ASMvoid__set_MSP(uint32_tmainStackPointer)
{
msrmsp,r0
bxlr
}
/**
*@briefReversebyteorderinunsignedshortvalue
*
*@paramvaluevaluetoreverse
*@returnreversedvalue
*
*Reversebyteorderinunsignedshortvalue
*/
__ASMuint32_t__REV16(uint16_tvalue)
{
rev16r0,r0
bxlr
}
/**
*@briefReversebyteorderinsignedshortvaluewithsignextensiontointeger
*
*@paramvaluevaluetoreverse
*@returnreversedvalue
*
*Reversebyteorderinsignedshortvaluewithsignextensiontointeger
*/
__ASMint32_t__REVSH(int16_tvalue)
{
revshr0,r0
bxlr
}
#if(__ARMCC_VERSION<400000)
/**
*@briefRemovetheexclusivelockcreatedbyldrex
*
*Removestheexclusivelockwhichiscreatedbyldrex.
*/
__ASMvoid__CLREX(void)
{
clrex
}
/**
*@briefReturntheBasePriorityvalue
*
*@returnBasePriority
*
*Returnthecontentofthebasepriorityregister
*/
__ASMuint32_t__get_BASEPRI(void)
{
mrsr0,basepri
bxlr
}
/**
*@briefSettheBasePriorityvalue
*
*@parambasePriBasePriority
*
*Setthebasepriorityregister
*/
__ASMvoid__set_BASEPRI(uint32_tbasePri)
{
msrbasepri,r0
bxlr
}
/**
*@briefReturnthePriorityMaskvalue
*
*@returnPriMask
*
*Returnstateoftheprioritymaskbitfromtheprioritymaskregister
*/
__ASMuint32_t__get_PRIMASK(void)
{
mrsr0,primask
bxlr
}
/**
*@briefSetthePriorityMaskvalue
*
*@parampriMaskPriMask
*
*Settheprioritymaskbitintheprioritymaskregister
*/
__ASMvoid__set_PRIMASK(uint32_tpriMask)
{
msrprimask,r0
bxlr
}
/**
*@briefReturntheFaultMaskvalue
*
*@returnFaultMask
*
*Returnthecontentofthefaultmaskregister
*/
__ASMuint32_t__get_FAULTMASK(void)
{
mrsr0,faultmask
bxlr
}
/**
*@briefSettheFaultMaskvalue
*
*@paramfaultMaskfaultMaskvalue
*
*Setthefaultmaskregister
*/
__ASMvoid__set_FAULTMASK(uint32_tfaultMask)
{
msrfaultmask,r0
bxlr
}
/**
*@briefReturntheControlRegistervalue
*
*@returnControlvalue
*
*Returnthecontentofthecontrolregister
*/
__ASMuint32_t__get_CONTROL(void)
{
mrsr0,control
bxlr
}
/**
*@briefSettheControlRegistervalue
*
*@paramcontrolControlvalue
*
*Setthecontrolregister
*/
__ASMvoid__set_CONTROL(uint32_tcontrol)
{
msrcontrol,r0
bxlr
}
#endif/*__ARMCC_VERSION*/
#elif(defined(__ICCARM__))/*------------------ICCCompiler-------------------*/
/*IARiccarmspecificfunctions*/
#pragmadiag_suppress=Pe940
/**
*@briefReturntheProcessStackPointer
*
*@returnProcessStackPointer
*
*Returntheactualprocessstackpointer
*/
uint32_t__get_PSP(void)
{
__ASM("mrsr0,psp");
__ASM("bxlr");
}
/**
*@briefSettheProcessStackPointer
*
*@paramtopOfProcStackProcessStackPointer
*
*AssignthevalueProcessStackPointertotheMSP
*(processstackpointer)Cortexprocessorregister
*/
void__set_PSP(uint32_ttopOfProcStack)
{
__ASM("msrpsp,r0");
__ASM("bxlr");
}
/**
*@briefReturntheMainStackPointer
*
*@returnMainStackPointer
*
*ReturnthecurrentvalueoftheMSP(mainstackpointer)
*Cortexprocessorregister
*/
uint32_t__get_MSP(void)
{
__ASM("mrsr0,msp");
__ASM("bxlr");
}
/**
*@briefSettheMainStackPointer
*
*@paramtopOfMainStackMainStackPointer
*
*AssignthevaluemainStackPointertotheMSP
*(mainstackpointer)Cortexprocessorregister
*/
void__set_MSP(uint32_ttopOfMainStack)
{
__ASM("msrmsp,r0");
__ASM("bxlr");
}
/**
*@briefReversebyteorderinunsignedshortvalue
*
*@paramvaluevaluetoreverse
*@returnreversedvalue
*
*Reversebyteorderinunsignedshortvalue
*/
uint32_t__REV16(uint16_tvalue)
{
__ASM("rev16r0,r0");
__ASM("bxlr");
}
/**
*@briefReversebitorderofvalue
*
*@paramvaluevaluetoreverse
*@returnreversedvalue
*
*Reversebitorderofvalue
*/
uint32_t__RBIT(uint32_tvalue)
{
__ASM("rbitr0,r0");
__ASM("bxlr");
}
/**
*@briefLDRExclusive(8bit)
*
*@param*addraddresspointer
*@returnvalueof(*address)
*
*ExclusiveLDRcommandfor8bitvalues)
*/
uint8_t__LDREXB(uint8_t*addr)
{
__ASM("ldrexbr0,[r0]");
__ASM("bxlr");
}
/**
*@briefLDRExclusive(16bit)
*
*@param*addraddresspointer
*@returnvalueof(*address)
*
*ExclusiveLDRcommandfor16bitvalues
*/
uint16_t__LDREXH(uint16_t*addr)
{
__ASM("ldrexhr0,[r0]");
__ASM("bxlr");
}
/**
*@briefLDRExclusive(32bit)
*
*@param*addraddresspointer
*@returnvalueof(*address)
*
*ExclusiveLDRcommandfor32bitvalues
*/
uint32_t__LDREXW(uint32_t*addr)
{
__ASM("ldrexr0,[r0]");
__ASM("bxlr");
}
/**
*@briefSTRExclusive(8bit)
*
*@paramvaluevaluetostore
*@param*addraddresspointer
*@returnsuccessful/failed
*
*ExclusiveSTRcommandfor8bitvalues
*/
uint32_t__STREXB(uint8_tvalue,uint8_t*addr)
{
__ASM("strexbr0,r0,[r1]");
__ASM("bxlr");
}
/**
*@briefSTRExclusive(16bit)
*
*@paramvaluevaluetostore
*@param*addraddresspointer
*@returnsuccessful/failed
*
*ExclusiveSTRcommandfor16bitvalues
*/
uint32_t__STREXH(uint16_tvalue,uint16_t*addr)
{
__ASM("strexhr0,r0,[r1]");
__ASM("bxlr");
}
/**
*@briefSTRExclusive(32bit)
*
*@paramvaluevaluetostore
*@param*addraddresspointer
*@returnsuccessful/failed
*
*ExclusiveSTRcommandfor32bitvalues
*/
uint32_t__STREXW(uint32_tvalue,uint32_t*addr)
{
__ASM("strexr0,r0,[r1]");
__ASM("bxlr");
}
#pragmadiag_default=Pe940
#elif(defined(__GNUC__))/*------------------GNUCompiler---------------------*/
/*GNUgccspecificfunctions*/
/**
*@briefReturntheProcessStackPointer
*
*@returnProcessStackPointer
*
*Returntheactualprocessstackpointer
*/
uint32_t__get_PSP(void)__attribute__((naked));
uint32_t__get_PSP(void)
{
uint32_tresult=0;
__ASMvolatile("MRS%0,psp\n\t"
"MOVr0,%0\n\t"
"BXlr\n\t":
"=r"(result));
return(result);
}
/**
*@briefSettheProcessStackPointer
*
*@paramtopOfProcStackProcessStackPointer
*
*AssignthevalueProcessStackPointertotheMSP
*(processstackpointer)Cortexprocessorregister
*/
void__set_PSP(uint32_ttopOfProcStack)__attribute__((naked));
void__set_PSP(uint32_ttopOfProcStack)
{
__ASMvolatile("MSRpsp,%0\n\t"
"BXlr\n\t":
:
"r"(topOfProcStack));
}
/**
*@briefReturntheMainStackPointer
*
*@returnMainStackPointer
*
*ReturnthecurrentvalueoftheMSP(mainstackpointer)
*Cortexprocessorregister
*/
uint32_t__get_MSP(void)__attribute__((naked));
uint32_t__get_MSP(void)
{
uint32_tresult=0;
__ASMvolatile("MRS%0,msp\n\t"
"MOVr0,%0\n\t"
"BXlr\n\t"