本文整理汇总了C++中INTERRUPT_DECLARATION函数的典型用法代码示例。如果您正苦于以下问题:C++ INTERRUPT_DECLARATION函数的具体用法?C++ INTERRUPT_DECLARATION怎么用?C++ INTERRUPT_DECLARATION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INTERRUPT_DECLARATION函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RITQueue_PutPending
bool RITQueue_PutPending(uint8_t elementpos)
{
bool ret = false;
uint8_t i;
//EnterCriticalSection
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
if (RITQueue_IsEmpty() == false)
{
if (elementpos < maxElements)
{
pvObjList[elementpos].pending = 1;
pvObjList[elementpos].countretry++;
ret = true;
}
}
else
{
//printf("LISTA VAZIA!!!!! \n");
}
//LeaveCriticalSection
ENABLE_INTERRUPTS();
return ret;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:29,代码来源:openqueue.c
示例2: new
/**
\brief Request a new (free) packet buffer.
Component throughout the protocol stack can call this function is they want to
get a new packet buffer to start creating a new packet.
\note Once a packet has been allocated, it is up to the creator of the packet
to free it using the openqueue_freePacketBuffer() function.
\returns A pointer to the queue entry when it could be allocated, or NULL when
it could not be allocated (buffer full or not synchronized).
*/
OpenQueueEntry_t* openqueue_getFreePacketBuffer(uint8_t creator) {
uint8_t i;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
// refuse to allocate if we're not in sync
if (ieee154e_isSynch()==FALSE && creator > COMPONENT_IEEE802154E){
ENABLE_INTERRUPTS();
return NULL;
}
// if you get here, I will try to allocate a buffer for you
// walk through queue and find free entry
for (i=0;i<QUEUELENGTH;i++) {
if (openqueue_vars.queue[i].owner==COMPONENT_NULL) {
openqueue_vars.queue[i].creator=creator;
openqueue_vars.queue[i].owner=COMPONENT_OPENQUEUE;
ENABLE_INTERRUPTS();
return &openqueue_vars.queue[i];
}
}
ENABLE_INTERRUPTS();
return NULL;
}
开发者ID:pedrohenriquegomes,项目名称:openwsn-fw-ez,代码行数:37,代码来源:openqueue.c
示例3: RITQueue_ExistFramePending
/*
* Verifica se existe algum frame pendente
*/
bool RITQueue_ExistFramePending(void)
{
bool ret = false;
uint8_t i;
//EnterCriticalSection
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
for (i = 0; i < maxElements; i++)
{
if (pvObjList[i].pending)
{
if (pvObjList[i].countretry < 3)
{
ret = true;
break;
}
else //REMOVO O ELEMENTO QUE JA ESTA A TEMPOS AQUI
{
RITQueue_Free(i);
}
}
}
if (coappending)
ret = true;
//LeaveCriticalSection
ENABLE_INTERRUPTS();
return ret;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:37,代码来源:openqueue.c
示例4: schedule_indicateTx
/**
\brief Indicate the transmission of a packet.
*/
void schedule_indicateTx(asn_t* asnTimestamp,
bool succesfullTx) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
// increment usage statistics
if (schedule_vars.currentScheduleEntry->numTx==0xFF) {
schedule_vars.currentScheduleEntry->numTx/=2;
schedule_vars.currentScheduleEntry->numTxACK/=2;
}
schedule_vars.currentScheduleEntry->numTx++;
if (succesfullTx==TRUE) {
schedule_vars.currentScheduleEntry->numTxACK++;
}
// update last used timestamp
memcpy(&schedule_vars.currentScheduleEntry->lastUsedAsn, asnTimestamp, sizeof(asn_t));
// update this slot's backoff parameters
if (succesfullTx==TRUE) {
// reset backoffExponent
schedule_vars.currentScheduleEntry->backoffExponent = MINBE-1;
// reset backoff
schedule_vars.currentScheduleEntry->backoff = 0;
} else {
// increase the backoffExponent
if (schedule_vars.currentScheduleEntry->backoffExponent<MAXBE) {
schedule_vars.currentScheduleEntry->backoffExponent++;
}
// set the backoff to a random value in [0..2^BE]
schedule_vars.currentScheduleEntry->backoff =
openrandom_get16b()%(1<<schedule_vars.currentScheduleEntry->backoffExponent);
}
ENABLE_INTERRUPTS();
}
开发者ID:Bug-bear,项目名称:g_nf_vs_pdr,代码行数:38,代码来源:schedule.c
示例5: openqueue_removeAllOwnedBy
/**
\brief Free all the packet buffers owned by a specific module.
\param owner The identifier of the component, taken in COMPONENT_*.
*/
void openqueue_removeAllOwnedBy(uint8_t owner) {
uint8_t i;
uint8_t count=0;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
for (i=0;i<QUEUELENGTH;i++){
if (openqueue_vars.queue[i].owner==owner) {
count++;
openqueue_reset_entry(&(openqueue_vars.queue[i]));
}
}
ENABLE_INTERRUPTS();
#if ((ENABLE_DEBUG_RFF ==1) && (DBG_OPENQUEUE == 1))
{
uint8_t pos=0;
rffbuf[pos++]= RFF_OPENQUEUE_FREE;
rffbuf[pos++]= 0x03;
rffbuf[pos++]= owner;
rffbuf[pos++]= count;
openserial_printStatus(STATUS_RFF,(uint8_t*)&rffbuf,pos);
}
#endif
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:31,代码来源:openqueue.c
示例6: openqueue_macGetDataPacket
OpenQueueEntry_t* openqueue_macGetDataPacket(open_addr_t* toNeighbor) {
uint8_t i;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
if (toNeighbor->type==ADDR_64B) {
// a neighbor is specified, look for a packet unicast to that neigbhbor
for (i=0;i<QUEUELENGTH;i++) {
if (openqueue_vars.queue[i].owner==COMPONENT_RES_TO_IEEE802154E &&
packetfunctions_sameAddress(toNeighbor,&openqueue_vars.queue[i].l2_nextORpreviousHop)) {
ENABLE_INTERRUPTS();
return &openqueue_vars.queue[i];
}
}
} else if (toNeighbor->type==ADDR_ANYCAST) {
// anycast case: look for a packet which is either not created by RES
// or an KA (created by RES, but not broadcast)
for (i=0;i<QUEUELENGTH;i++) {
if (openqueue_vars.queue[i].owner==COMPONENT_RES_TO_IEEE802154E &&
( openqueue_vars.queue[i].creator!=COMPONENT_RES ||
(
openqueue_vars.queue[i].creator==COMPONENT_RES &&
packetfunctions_isBroadcastMulticast(&(openqueue_vars.queue[i].l2_nextORpreviousHop))==FALSE
)
)
) {
ENABLE_INTERRUPTS();
return &openqueue_vars.queue[i];
}
}
}
ENABLE_INTERRUPTS();
return NULL;
}
开发者ID:Bug-bear,项目名称:g_nf_vs_pdr,代码行数:33,代码来源:openqueue.c
示例7: openserial_printData
owerror_t openserial_printData(uint8_t* buffer, uint8_t length) {
uint8_t i;
uint8_t asn[5];
INTERRUPT_DECLARATION();
// retrieve ASN
ieee154e_getAsn(asn);// byte01,byte23,byte4
DISABLE_INTERRUPTS();
openserial_vars.outputBufFilled = TRUE;
outputHdlcOpen();
outputHdlcWrite(SERFRAME_MOTE2PC_DATA);
outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]);
outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]);
outputHdlcWrite(asn[0]);
outputHdlcWrite(asn[1]);
outputHdlcWrite(asn[2]);
outputHdlcWrite(asn[3]);
outputHdlcWrite(asn[4]);
for (i=0;i<length;i++){
outputHdlcWrite(buffer[i]);
}
outputHdlcClose();
ENABLE_INTERRUPTS();
return E_SUCCESS;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:27,代码来源:openserial.c
示例8: openserial_printInfoErrorCritical
owerror_t openserial_printInfoErrorCritical(
char severity,
uint8_t calling_component,
uint8_t error_code,
errorparameter_t arg1,
errorparameter_t arg2
) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
openserial_vars.outputBufFilled = TRUE;
outputHdlcOpen();
outputHdlcWrite(severity);
outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]);
outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]);
outputHdlcWrite(calling_component);
outputHdlcWrite(error_code);
outputHdlcWrite((uint8_t)((arg1 & 0xff00)>>8));
outputHdlcWrite((uint8_t) (arg1 & 0x00ff));
outputHdlcWrite((uint8_t)((arg2 & 0xff00)>>8));
outputHdlcWrite((uint8_t) (arg2 & 0x00ff));
outputHdlcClose();
ENABLE_INTERRUPTS();
return E_SUCCESS;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:26,代码来源:openserial.c
示例9: idmanager_setMyID
owerror_t idmanager_setMyID(open_addr_t* newID) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
switch (newID->type) {
case ADDR_16B:
memcpy(&idmanager_vars.my16bID,newID,sizeof(open_addr_t));
break;
case ADDR_64B:
memcpy(&idmanager_vars.my64bID,newID,sizeof(open_addr_t));
break;
case ADDR_PANID:
memcpy(&idmanager_vars.myPANID,newID,sizeof(open_addr_t));
break;
case ADDR_PREFIX:
memcpy(&idmanager_vars.myPrefix,newID,sizeof(open_addr_t));
break;
case ADDR_128B:
//don't set 128b, but rather prefix and 64b
default:
openserial_printCritical(COMPONENT_IDMANAGER,ERR_WRONG_ADDR_TYPE,
(errorparameter_t)newID->type,
(errorparameter_t)1);
ENABLE_INTERRUPTS();
return E_FAIL;
}
ENABLE_INTERRUPTS();
return E_SUCCESS;
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:28,代码来源:idmanager.c
示例10: idmanager_getMyID
open_addr_t* idmanager_getMyID(uint8_t type) {
open_addr_t* res;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
switch (type) {
case ADDR_16B:
res= &idmanager_vars.my16bID;
break;
case ADDR_64B:
res= &idmanager_vars.my64bID;
break;
case ADDR_PANID:
res= &idmanager_vars.myPANID;
break;
case ADDR_PREFIX:
res= &idmanager_vars.myPrefix;
break;
case ADDR_128B:
// you don't ask for my full address, rather for prefix, then 64b
default:
openserial_printCritical(COMPONENT_IDMANAGER,ERR_WRONG_ADDR_TYPE,
(errorparameter_t)type,
(errorparameter_t)0);
res= NULL;
break;
}
ENABLE_INTERRUPTS();
return res;
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:29,代码来源:idmanager.c
示例11: openserial_startInput
void openserial_startInput() {
INTERRUPT_DECLARATION();
if (openserial_vars.inputBufFill>0) {
openserial_printError(COMPONENT_OPENSERIAL,ERR_INPUTBUFFER_LENGTH,
(errorparameter_t)openserial_vars.inputBufFill,
(errorparameter_t)0);
DISABLE_INTERRUPTS();
openserial_vars.inputBufFill=0;
ENABLE_INTERRUPTS();
}
uart_clearTxInterrupts();
uart_clearRxInterrupts(); // clear possible pending interrupts
uart_enableInterrupts(); // Enable USCI_A1 TX & RX interrupt
DISABLE_INTERRUPTS();
openserial_vars.busyReceiving = FALSE;
openserial_vars.mode = MODE_INPUT;
openserial_vars.reqFrameIdx = 0;
#ifdef FASTSIM
uart_writeBufferByLen_FASTSIM(
openserial_vars.reqFrame,
sizeof(openserial_vars.reqFrame)
);
openserial_vars.reqFrameIdx = sizeof(openserial_vars.reqFrame);
#else
uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]);
#endif
ENABLE_INTERRUPTS();
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:31,代码来源:openserial.c
示例12: RITQueue_Get_Element
sRITqueue RITQueue_Get_Element(uint8_t pos)
{
sRITqueue elem;
//EnterCriticalSection
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
if (RITQueue_IsEmpty() == false)
{
if ( pos < maxElements)
{
elem = pvObjList[pos];
}
else
{
elem.frameType = 0;
RITQueue_ClearAddress(&elem.destaddr);
}
}
else
{
elem.frameType = 0;
RITQueue_ClearAddress(&elem.destaddr);
}
//LeaveCriticalSection
ENABLE_INTERRUPTS();
return elem;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:31,代码来源:openqueue.c
示例13: RITQueue_Free
bool RITQueue_Free(uint8_t elementpos)
{
bool ret = false;
uint8_t i;
//EnterCriticalSection
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
if (elementpos < maxElements)
{
RITQueue_ClearAddress(&pvObjList[elementpos].destaddr);
pvObjList[elementpos].timestamp = 0;
pvObjList[elementpos].msglength = 0;
pvObjList[elementpos].frameType = 0;
pvObjList[elementpos].pending = 0;
pvObjList[elementpos].numTargetParents = 0;
pvObjList[elementpos].countretry = 0;
pvObjList[elementpos].lasttxduration = 0;
pvObjList[elementpos].isBroadcastMulticast = 0;
if (numAvailableElements > 0)
numAvailableElements--;
ret = true;
}
//LeaveCriticalSection
ENABLE_INTERRUPTS();
return ret;
}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:33,代码来源:openqueue.c
示例14: output_buffer_index_write_increment
uint16_t output_buffer_index_write_increment() {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
openserial_vars.output_buffer_index_write=(openserial_vars.output_buffer_index_write+1)%SERIAL_OUTPUT_BUFFER_SIZE;
ENABLE_INTERRUPTS();
return openserial_vars.output_buffer_index_write;
}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:7,代码来源:openserial.c
示例15: schedule_advanceSlot
void schedule_advanceSlot() {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
// advance to next active slot
schedule_vars.currentScheduleEntry = schedule_vars.currentScheduleEntry->next;
ENABLE_INTERRUPTS();
}
开发者ID:giu7ppe,项目名称:openwsn,代码行数:7,代码来源:schedule.c
示例16: openserial_printError
error_t openserial_printError(uint8_t calling_component, uint8_t error_code,
errorparameter_t arg1,
errorparameter_t arg2) {
leds_error_toggle();
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
openserial_vars.somethingInOutputBuffer=TRUE;
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'E'; //this is an error
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]);
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]);
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)calling_component; //component generating error
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)error_code; //error_code
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg1 & 0xff00)>>8); //arg1
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg1 & 0x00ff);
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg2 & 0xff00)>>8); //arg2
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg2 & 0x00ff);
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$';
ENABLE_INTERRUPTS();
return E_SUCCESS;
}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:27,代码来源:openserial.c
示例17: openserial_printData
error_t openserial_printData(uint8_t* buffer, uint8_t length) {
uint8_t counter;
uint8_t asn[5];
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
openserial_vars.somethingInOutputBuffer=TRUE;
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'D'; //this is data
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]);
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]);
//asn to serial ..
asnWriteToSerial(asn);// byte01,byte23,byte4
openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[0];
openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[1];
openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[2];
openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[3];
openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[4];
for (counter=0; counter<length; counter++) {
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)buffer[counter];
}
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$';
openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$';
ENABLE_INTERRUPTS();
return E_SUCCESS;
}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:31,代码来源:openserial.c
示例18: idmanager_setIsDAGroot
void idmanager_setIsDAGroot(bool newRole) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
idmanager_vars.isDAGroot = newRole;
neighbors_updateMyDAGrankAndNeighborPreference();
ENABLE_INTERRUPTS();
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:7,代码来源:idmanager.c
示例19: schedule_getOkToSend
/**
\brief Check whether I can send on this slot.
This function is called at the beginning of every TX slot.
If the slot is *not* a shared slot, it always return TRUE.
If the slot is a shared slot, it decrements the backoff counter and returns
TRUE only if it hits 0.
Note that the backoff counter is global, not per slot.
\returns TRUE if it is OK to send on this slot, FALSE otherwise.
*/
bool schedule_getOkToSend() {
bool returnVal;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
if (schedule_vars.currentScheduleEntry->shared==FALSE) {
// non-shared slot: backoff does not apply
returnVal = TRUE;
} else {
// non-shared slot: check backoff before answering
// decrement backoff
if (schedule_vars.backoff>0) {
schedule_vars.backoff--;
}
// only return TRUE if backoff hit 0
if (schedule_vars.backoff==0) {
returnVal = TRUE;
} else {
returnVal = FALSE;
}
}
ENABLE_INTERRUPTS();
return returnVal;
}
开发者ID:giu7ppe,项目名称:openwsn,代码行数:41,代码来源:schedule.c
示例20: openserial_getInputBuffer
uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes) {
uint8_t numBytesWritten;
uint8_t inputBufFillLevel;
INTERRUPT_DECLARATION();
//<<<<<<<<<<<<<<<<<<<<<<<
DISABLE_INTERRUPTS();
inputBufFillLevel = openserial_vars.inputBufFillLevel;
ENABLE_INTERRUPTS();
//>>>>>>>>>>>>>>>>>>>>>>>
if (maxNumBytes<inputBufFillLevel-1) {
openserial_printError(
COMPONENT_OPENSERIAL,
ERR_GETDATA_ASKS_TOO_FEW_BYTES,
(errorparameter_t)maxNumBytes,
(errorparameter_t)inputBufFillLevel-1
);
numBytesWritten = 0;
} else {
numBytesWritten = inputBufFillLevel-1;
//<<<<<<<<<<<<<<<<<<<<<<<
DISABLE_INTERRUPTS();
memcpy(bufferToWrite,&(openserial_vars.inputBuf[1]),numBytesWritten);
ENABLE_INTERRUPTS();
//>>>>>>>>>>>>>>>>>>>>>>>
}
return numBytesWritten;
}
开发者ID:renfernand,项目名称:cc2538em,代码行数:30,代码来源:openserial.c
注:本文中的INTERRUPT_DECLARATION函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论