您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ExitCritical函数代码示例

51自学网 2021-06-01 20:39:50
  C++
这篇教程C++ ExitCritical函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ExitCritical函数的典型用法代码示例。如果您正苦于以下问题:C++ ExitCritical函数的具体用法?C++ ExitCritical怎么用?C++ ExitCritical使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ExitCritical函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CI2C1_SendBlock

/*** ===================================================================**     Method      :  CI2C1_SendBlock (component InternalI2C)**     Description :**         When working as a MASTER, this method writes one (7-bit**         addressing) or two (10-bit addressing) slave address bytes**         inclusive of R/W bit = 0 to the I2C bus and then writes the**         block of characters to the bus. The slave address must be**         specified before, by the "SelectSlave" or "SlaveSelect10"**         method or in component initialization section, "Target slave**         address init" property. If interrupt service is enabled and**         the method returns ERR_OK, it doesn't mean that transmission**         was successful. The state of transmission is detectable by**         means of events (OnTransmitData, OnError or OnArbitLost).**         Data to be send is not copied to an internal buffer and**         remains in the original location. Therefore the content of**         the buffer should not be changed until the transmission is**         complete. Event OnTransmitData can be used to detect the end**         of the transmission.**         When working as a SLAVE, this method writes a block of**         characters to the internal output slave buffer and then,**         after the master starts the communication, to the I2C bus.**         If no character is ready for a transmission (internal output**         slave buffer is empty), the "Empty character" will be sent**         (see "Empty character" property). In SLAVE mode the data are**         copied to an internal buffer, if specified by "Output buffer**         size" property.**     Parameters  :**         NAME            - DESCRIPTION**       * Ptr             - Pointer to the block of data to send.**         Siz             - Size of the block.**       * Snt             - Amount of data sent (moved to a buffer).**                           In master mode, if interrupt support is**                           enabled, the parameter always returns the**                           same value as the parameter 'Siz' of this**                           method.**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_DISABLED -  Device is disabled**                           ERR_BUSY - The slave device is busy, it**                           does not respond by the acknowledge (only**                           in master mode and when interrupt service**                           is disabled)**                           ERR_BUSOFF - Clock timeout elapsed or**                           device cannot transmit data**                           ERR_TXFULL - Transmitter is full. Some data**                           has not been sent. (slave mode only)**                           ERR_ARBITR - Arbitration lost (only when**                           interrupt service is disabled and in master**                           mode)** ===================================================================*/byte CI2C1_SendBlock(void *Ptr,word Siz,word *Snt){  LDD_TError Error;  if (Siz == 0U) {                     /* Test variable Size on zero */    *Snt = 0U;    return ERR_OK;                     /* If zero then OK */  }  EnterCritical();                     /* Enter the critical section */  Error = IntI2cLdd1_MasterSendBlock(IntI2cLdd1_DeviceDataPtr, (LDD_TData *)Ptr, (LDD_I2C_TSize)Siz, LDD_I2C_SEND_STOP); /* Send one data byte */  if (Error == ERR_BUSY) {    ExitCritical();                    /* Exit the critical section */    return ERR_BUSOFF;  }  OutLenM = Siz;                       /* Set length of output bufer's content */  ExitCritical();                      /* Exit the critical section */  *Snt = Siz;                          /* Dummy number of really sent chars */  return ERR_OK;                       /* OK */}
开发者ID:yuhua-cheng,项目名称:usi0106,代码行数:74,


示例2: Serial_2_ClearRxBuf

/*** ===================================================================**     Method      :  Serial_2_ClearRxBuf (component AsynchroSerial)**     Description :**         Clears the receive buffer.**         This method is available only if non-zero length of the**         input buffer is defined and the receiver property is enabled.**     Parameters  : None**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode** ===================================================================*/byte Serial_2_ClearRxBuf(void){  EnterCritical();                     /* Save the PS register */  Serial_2_InpLen = 0x00U;             /* Set number of chars in the receive buffer to 0 */  InpIndxR = 0x00U;                    /* Reset read index to the receive buffer */  InpIndxW = 0x00U;                    /* Reset write index to the receive buffer */  SerFlag &= (byte)(~(byte)(CHAR_IN_RX | FULL_RX)); /* Clear the flags indicating a char in buffer */  ExitCritical();                      /* Restore the PS register */  return ERR_OK;                       /* OK */}
开发者ID:ddtdanilo,项目名称:Proyectos-III-War-of-Tanks,代码行数:25,


示例3: route_show

voidroute_show(void) {  int i;  print_route(NULL);  EnterCritical();  for (i = 0 ; i < GETNUMROUTEENTRIES ; i++) {    print_route(GETROUTEP(i));  }  ExitCritical();}
开发者ID:aunali1,项目名称:exopc,代码行数:10,


示例4: SM1_GetError

/*** ===================================================================**     Method      :  SM1_GetError (component SynchroMaster)**     Description :**         Returns a set of errors on the channel (errors that cannot**         be returned in given methods). The component accumulates**         errors in a set; after calling [GetError] this set is**         returned and cleared. This method is available only if the**         "Interrupt service/event" property is enabled.**     Parameters  :**         NAME            - DESCRIPTION**       * Err             - A pointer to the returned set of errors**     Returns     :**         ---             - Error code (if GetError did not succeed),**                           possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode** ===================================================================*/byte SM1_GetError(SM1_TError *Err){  EnterCritical();                     /* Disable global interrupts */  Err->err = 0U;  Err->errName.OverRun = (((ErrFlag & OVERRUN_ERR) != 0U)? 1U : 0U); /* Overrun error */  Err->errName.RxBufOvf = (((ErrFlag & FULL_RX) != 0U)? 1U : 0U); /* Buffer overflow */  ErrFlag = 0x00U;                     /* Reset error flags */  ExitCritical();                      /* Enable global interrupts */  return ERR_OK;                       /* OK */}
开发者ID:nikolarobottesla,项目名称:BatteryTestSystem,代码行数:30,


示例5: SM1_ClearRxBuf

/*** ===================================================================**     Method      :  SM1_ClearRxBuf (component SynchroMaster)**     Description :**         Clears the receive buffer. This method is available only if**         a non-zero length of input buffer is defined.**     Parameters  : None**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode** ===================================================================*/byte SM1_ClearRxBuf(void){  EnterCritical();                     /* Disable global interrupts */  SM1_InpLen = 0U;                     /* Set number of chars in the transmit buffer to 0 */  InpIndexW = 0x00U;                   /* Set index on the first item in the transmit buffer */  InpIndexR = 0x00U;  SerFlag &= (byte)~(OVERRUN_ERR | FULL_RX); /* Clear flags */  ExitCritical();                      /* Enable global interrupts */  return ERR_OK;                       /* OK */}
开发者ID:nikolarobottesla,项目名称:BatteryTestSystem,代码行数:24,


示例6: TMOUT1_LeaveCounter

/*** ===================================================================**     Method      :  TMOUT1_LeaveCounter (component Timeout)****     Description :**         To be called to return the counter. Note that a counter**         always should be returned so it can be reused.**     Parameters  :**         NAME            - DESCRIPTION**         handle          - Counter handle**     Returns     : Nothing** ===================================================================*/void TMOUT1_LeaveCounter(TMOUT1_CounterHandle handle){  if (handle==TMOUT1_OUT_OF_HANDLE) {    return;  }  EnterCritical();  TMOUT1_Counters[handle] = 0;  TMOUT1_FreeCounters[handle]=TRUE;  ExitCritical();}
开发者ID:michaeljohneduave,项目名称:superninjamodethesis,代码行数:23,


示例7: hwExpIn_GetRxIdle

/*** ===================================================================**     Method      :  hwExpIn_GetRxIdle (bean AsynchroSerial)****     Description :**         Returns the state of the receiver idle flag. This method**         is available only if event <OnIdle> is disabled.**     Parameters  : None**     Returns     :**         ---             - The state of the receiver idle flag.** ===================================================================*/bool hwExpIn_GetRxIdle(void){  bool Result;  EnterCritical();                     /* Save the PS register */  Result = (bool)((SerFlag & IDLE_ERR)?1:0); /* If idle signal has been received? */  SerFlag &= ~IDLE_ERR;                /* Reset idle signal flag */  ExitCritical();                      /* Restore the PS register */  return Result;                       /* OK */}
开发者ID:WaterOptimizer,项目名称:WOIS-PE,代码行数:22,


示例8: watchdog_periodic

/*---------------------------------------------------------------------------*/voidwatchdog_periodic(void){#if PLATFORM_CONF_ENABLE_WATCHDOG  EnterCritical();  SIM_SRVCOP = SIM_SRVCOP_SRVCOP(COP_KEY_1);  SIM_SRVCOP = SIM_SRVCOP_SRVCOP(COP_KEY_2);  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();#endif /* PLATFORM_CONF_ENABLE_WATCHDOG */}
开发者ID:AlexanderWiniger,项目名称:kinetis-mote,代码行数:12,


示例9: TACHO_CalcSpeed

void TACHO_CalcSpeed(void) {#if 1  /* we calculate the speed as follow:                              1000           steps/sec =  delta * -----------------                        samplePeriod (ms)   As this function may be called very frequently, it is important to make it as efficient as possible!   */  int16_t deltaLeft, deltaRight, newLeft, newRight, oldLeft, oldRight;  int32_t speedLeft, speedRight;  bool negLeft, negRight;  EnterCritical();  oldLeft = (int16_t)TACHO_LeftPosHistory[TACHO_PosHistory_Index]; /* oldest left entry */  oldRight = (int16_t)TACHO_RightPosHistory[TACHO_PosHistory_Index]; /* oldest right entry */  if (TACHO_PosHistory_Index==0) { /* get newest entry */    newLeft = (int16_t)TACHO_LeftPosHistory[NOF_HISTORY-1];    newRight = (int16_t)TACHO_RightPosHistory[NOF_HISTORY-1];  } else {    newLeft = (int16_t)TACHO_LeftPosHistory[TACHO_PosHistory_Index-1];    newRight = (int16_t)TACHO_RightPosHistory[TACHO_PosHistory_Index-1];  }  ExitCritical();  deltaLeft = oldLeft-newLeft; /* delta of oldest position and most recent one */  /* use unsigned arithmetic */  if (deltaLeft < 0) {    deltaLeft = -deltaLeft;    negLeft = TRUE;  } else {    negLeft = FALSE;  }  deltaRight = oldRight-newRight; /* delta of oldest position and most recent one */  /* use unsigned arithmetic */  if (deltaRight < 0) {    deltaRight = -deltaRight;    negRight = TRUE;  } else {    negRight = FALSE;  }  /* calculate speed. this is based on the delta and the time (number of samples or entries in the history table) */  speedLeft = (int32_t)(deltaLeft * 1000/(TACHO_SAMPLE_PERIOD_MS*(NOF_HISTORY-1)));  if (negLeft) {    speedLeft = -speedLeft;  }  speedRight = (int32_t)(deltaRight * 1000/(TACHO_SAMPLE_PERIOD_MS*(NOF_HISTORY-1)));  if (negRight) {    speedRight = -speedRight;  }  TACHO_currLeftSpeed = -speedLeft; /* store current speed in global variable */  TACHO_currRightSpeed = -speedRight; /* store current speed in global variable */#else  /*! /todo Implement function */ #endif}
开发者ID:infotronik,项目名称:sumo,代码行数:54,


示例10: get_ifnum_cardno

intget_ifnum_cardno(int ifnum) {  if_entry_p ife;  int cardno;  ASSERTIFNUM(ifnum);  EnterCritical();  ife = GETIFP(ifnum);  cardno = ife->cardno;  ExitCritical();  return cardno;}
开发者ID:aunali1,项目名称:exopc,代码行数:11,


示例11: RC_SendChar

/*** ===================================================================**     Method      :  RC_SendChar (component AsynchroSerial)**     Description :**         Sends one character to the channel. If the component is**         temporarily disabled (Disable method) SendChar method only**         stores data into an output buffer. In case of a zero output**         buffer size, only one character can be stored. Enabling the**         component (Enable method) starts the transmission of the**         stored data. This method is available only if the**         transmitter property is enabled.**     Parameters  :**         NAME            - DESCRIPTION**         Chr             - Character to send**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_TXFULL - Transmitter is full** ===================================================================*/byte RC_SendChar(RC_TComData Chr){  if ((SerFlag & FULL_TX) != 0U) {     /* Is any char is in TX buffer */    return ERR_TXFULL;                 /* If yes then error */  }  EnterCritical();                     /* Disable global interrupts */  OutBuffer = Chr;                     /* Store char to temporary variable */  (void)ASerialLdd1_SendBlock(ASerialLdd1_DeviceDataPtr, (LDD_TData *)&OutBuffer, 1U); /* Send one data byte */  SerFlag |= (FULL_TX);                /* Set the flag "full TX buffer" */  ExitCritical();                      /* Enable global interrupts */  return ERR_OK;                       /* OK */}
开发者ID:kwrobit,项目名称:robit_k64f_drone,代码行数:34,


示例12: TMOUT1_AddTick

/*** ===================================================================**     Method      :  TMOUT1_AddTick (component Timeout)****     Description :**         Method to be called from a priodic timer or interrupt. It**         will decrement all current counters by one down to zero.**     Parameters  : None**     Returns     : Nothing** ===================================================================*/void TMOUT1_AddTick(void){  byte i;  EnterCritical();  for(i=0;i<TMOUT1_NOF_COUNTERS;i++) {    if (TMOUT1_Counters[i]>0) {      TMOUT1_Counters[i]--;    }  }  ExitCritical();}
开发者ID:michaeljohneduave,项目名称:superninjamodethesis,代码行数:23,


示例13: TMOUT1_CounterExpired

/*** ===================================================================**     Method      :  TMOUT1_CounterExpired (component Timeout)****     Description :**         Returns true if the timeout counter has been expired**     Parameters  :**         NAME            - DESCRIPTION**         handle          - The timeout handle retrieved using**                           GetCounter()**     Returns     :**         ---             - Returns TRUE if the counter has been**                           expired, FALSE otherwise** ===================================================================*/bool TMOUT1_CounterExpired(TMOUT1_CounterHandle handle){  bool res;  if (handle==TMOUT1_OUT_OF_HANDLE) {    return TRUE;  }  EnterCritical();  res = (bool)(TMOUT1_Counters[handle]==0);  ExitCritical();  return res;}
开发者ID:michaeljohneduave,项目名称:superninjamodethesis,代码行数:27,


示例14: SPI_SD_GetBlockReceivedStatus

/* ===================================================================*/bool SPI_SD_GetBlockReceivedStatus(LDD_TDeviceData *DeviceDataPtr){  uint8_t Status;                      /* Temporary variable for flag saving */  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  Status = ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->SerFlag; /* Save flag for return */  ((SPI_SD_TDeviceDataPtr)DeviceDataPtr)->SerFlag &= (uint8_t)(~(uint8_t)BLOCK_RECEIVED); /* Clear data block sent flag */  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return (bool)(((Status & BLOCK_RECEIVED) != 0U)? TRUE : FALSE); /* Return saved status */}
开发者ID:SeismicPi,项目名称:SeismicPi,代码行数:13,


示例15: wakeup

void wakeup (void *chan) {  int i;  d0printf("%d wakeup chan: %p/n", getpid(),chan);  global_ftable->counter1++;  EnterCritical();  for (i = 0; i < NENV; i++)     if (synch_table->wchan[i] == chan)       synch_table->wchan[i] = (void *)0;  ExitCritical();}
开发者ID:aunali1,项目名称:exopc,代码行数:12,


示例16: ASerialLdd3_GetError

/* ===================================================================*/LDD_TError ASerialLdd3_GetError(LDD_TDeviceData *DeviceDataPtr, LDD_SERIAL_TError *ErrorPtr){  ASerialLdd3_TDeviceDataPtr DeviceDataPrv = (ASerialLdd3_TDeviceDataPtr)DeviceDataPtr;  /* {Bareboard RTOS Adapter} Critical section begin (RTOS function call is defined by Bareboard RTOS Adapter property) */  EnterCritical();  *ErrorPtr = DeviceDataPrv->ErrFlag;  DeviceDataPrv->ErrFlag = 0x00U;      /* Reset error flags */  /* {Bareboard RTOS Adapter} Critical section ends (RTOS function call is defined by Bareboard RTOS Adapter property) */  ExitCritical();  return ERR_OK;                       /* OK */}
开发者ID:rpc-fw,项目名称:usbmidi2,代码行数:13,


示例17: ASerialLdd1_GetError

/* ===================================================================*/LDD_TError ASerialLdd1_GetError(LDD_TDeviceData *DeviceDataPtr, LDD_SERIAL_TError *ErrorPtr){  ASerialLdd1_TDeviceDataPtr DeviceDataPrv = (ASerialLdd1_TDeviceDataPtr)DeviceDataPtr;  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  *ErrorPtr = DeviceDataPrv->ErrFlag;  DeviceDataPrv->ErrFlag = 0x00U;      /* Reset error flags */  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return ERR_OK;                       /* OK */}
开发者ID:swichu91,项目名称:ecuCAN,代码行数:13,


示例18: Serial_2_SendChar

/*** ===================================================================**     Method      :  Serial_2_SendChar (component AsynchroSerial)**     Description :**         Sends one character to the channel. If the component is**         temporarily disabled (Disable method) SendChar method only**         stores data into an output buffer. In case of a zero output**         buffer size, only one character can be stored. Enabling the**         component (Enable method) starts the transmission of the**         stored data. This method is available only if the**         transmitter property is enabled.**     Parameters  :**         NAME            - DESCRIPTION**         Chr             - Character to send**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_TXFULL - Transmitter is full** ===================================================================*/byte Serial_2_SendChar(Serial_2_TComData Chr){  if (SerFlag & FULL_TX) {             /* Is any char in TX buffer? */    return ERR_TXFULL;                 /* If yes then error */  }  EnterCritical();                     /* Save the PS register */  (void)SCI2S1;                        /* Reset interrupt request flag */  SCI2D = (byte)Chr;                   /* Store char to the transmitter register */  SCI2C2_TIE = 0x01U;                  /* Enable transmit interrupt */  SerFlag |= FULL_TX;                  /* Set the flag "full TX buffer" */  ExitCritical();                      /* Restore the PS register */  return ERR_OK;                       /* OK */}
开发者ID:ddtdanilo,项目名称:Proyectos-III-War-of-Tanks,代码行数:35,


示例19: iter_ifnum

intiter_ifnum(unsigned int flags) {  if_entry_p ife;  EnterCritical();  for(;;) {    if (ifnum_iter >= GETNUMIFENTRIES || ifnum_iter < 0) {      ExitCritical();      return -1;    }    if (flags) {      ife = GETIFP(ifnum_iter);      if ((ife->flags & flags) == flags) {	ExitCritical();	return ifnum_iter++;      }    } else {      ExitCritical();      return ifnum_iter++;    }    ifnum_iter++;  }}
开发者ID:aunali1,项目名称:exopc,代码行数:22,


示例20: WriteWord

/*** ===================================================================**     Method      :  WriteWord (bean IntFLASH)****     Description :**         This method is internal. It is used by Processor Expert**         only.** ===================================================================*/static byte WriteWord(dword Addr,word Data16){  EnterCritical();                     /* Enter critical section */  ClearFlags();                        /* Clear all flags */  if (FSTAT_CBEIF == 0) {              /* Is command buffer full ? */    ExitCritical();                    /* Exit critical section */    return ERR_BUSY;                   /* If yes then error */  }  *(word *far) Addr = Data16;          /* Array address and program data */  FCMD = 32;                           /* Word program command */  FSTAT = 128;                         /* Clear flag command buffer empty */  if ((FSTAT_PVIOL == 1)||(FSTAT_ACCERR == 1)) { /* Is protection violation or acces error detected ? */    ExitCritical();                    /* Exit critical section */    return ERR_NOTAVAIL;               /* If yes then error */  }  while (FSTAT_CBEIF == 0);            /* Wait to buffer empty */  while (FSTAT_CCIF == 0);             /* Wait to command complete */  ExitCritical();                      /* Exit critical section */  if (*(word *far) Addr != Data16)     /* Was attempt to write data to the given address errorneous? */    return ERR_VALUE;                  /* If yes then error */ return ERR_OK;                        /* OK */}
开发者ID:EPLab,项目名称:Eco_AccBabyMonitor,代码行数:31,


示例21: RealTimeLdd1_Reset

/* ===================================================================*/LDD_TError RealTimeLdd1_Reset(LDD_TDeviceData *DeviceDataPtr){  RealTimeLdd1_TDeviceData *DeviceDataPrv = (RealTimeLdd1_TDeviceData *)DeviceDataPtr;  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  (void)TU2_ResetCounter(DeviceDataPrv->LinkedDeviceDataPtr); /* Reset counter of TimerUnit */  DeviceDataPrv->TimerTicks =  0U;     /* Reset counter of timer ticks */  DeviceDataPrv->Overflow = FALSE;     /* Reset counter overflow flag */  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return ERR_OK;}
开发者ID:arulle,项目名称:CC3501,代码行数:14,


示例22: AS1_SendChar

/*** ===================================================================**     Method      :  AS1_SendChar (bean AsynchroSerial)****     Description :**         Sends one character to the channel. If the bean is**         temporarily disabled (Disable method) SendChar method**         only stores data into an output buffer. In case of a zero**         output buffer size, only one character can be stored.**         Enabling the bean (Enable method) starts the transmission**         of the stored data. This method is available only if the**         transmitter property is enabled.**     Parameters  :**         NAME            - DESCRIPTION**         Chr             - Character to send**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_TXFULL - Transmitter is full** ===================================================================*/byte AS1_SendChar(AS1_TComData Chr){  if(SerFlag & FULL_TX) {              /* Is any char in the TX buffer */    return ERR_TXFULL;                 /* If yes then error */  }  EnterCritical();                     /* Save the PS register */  (void) SCISR1;                       /* Reset interrupt request flag */  SCIDRL = (byte)Chr;                  /* Store char to transmitter register */  SCICR2_SCTIE = 1;                    /* Enable transmit interrupt */  SerFlag |= FULL_TX;                  /* Set the flag "full TX buffer" */  ExitCritical();                      /* Restore the PS register */  return ERR_OK;                       /* OK */}
开发者ID:jonyMarino,项目名称:microsdhacel,代码行数:36,


示例23: IntI2cLdd1_MasterReceiveBlock

/* ===================================================================*/LDD_TError IntI2cLdd1_MasterReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, LDD_I2C_TSize Size, LDD_I2C_TSendStop SendStop){  IntI2cLdd1_TDeviceData *DeviceDataPrv = (IntI2cLdd1_TDeviceData *)DeviceDataPtr;  if (Size == 0x00U) {                 /* Test variable Size on zero */    return ERR_OK;                     /* If zero then OK */  }  if (SendStop == LDD_I2C_NO_SEND_STOP) { /* Test variable SendStop on supported value */    return ERR_PARAM_MODE;             /* If not supported value then error */  }  if ((DeviceDataPrv->SerFlag & GENERAL_CALL) != 0x00U) { /* Is the general call flag set (SelectSlaveDevice - address type is general call) ? */    return ERR_NOTAVAIL;               /* It is not possible to receive data - Call SelectSlaveDevice method */  }  if (DeviceDataPrv->SendStop == LDD_I2C_SEND_STOP) {    if ((I2C_PDD_GetBusStatus(I2C0_BASE_PTR) == I2C_PDD_BUS_BUSY) || /* Is the bus busy? */  /      ((DeviceDataPrv->SerFlag & MASTER_IN_PROGRES) != 0x00U) || /      (DeviceDataPrv->InpLenM != 0x00U)) {      return ERR_BUSY;                 /* If yes then error */    }  } else {    if(((DeviceDataPrv->SerFlag & MASTER_IN_PROGRES) != 0x00U) || /* Is the bus busy? */  /      (DeviceDataPrv->InpLenM != 0x00U)) {      return ERR_BUSY;               /* If yes then error */    }  }  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  DeviceDataPrv->SerFlag |= MASTER_IN_PROGRES; /* Set flag "busy" */  DeviceDataPrv->InpPtrM = (uint8_t *)BufferPtr; /* Save pointer to data for reception */  DeviceDataPrv->InpByteMNum = 0x00U;  /* Clear data number */  DeviceDataPrv->InpLenM = Size;       /* Set the counter of input bufer's content */  DeviceDataPrv->SendStop = SendStop;  /* Set generating stop condition */  I2C_PDD_SetTransmitMode(I2C0_BASE_PTR, I2C_PDD_TX_DIRECTION); /* Set TX mode */  if (I2C_PDD_GetMasterMode(I2C0_BASE_PTR) == I2C_PDD_MASTER_MODE) { /* Is device in master mode? */    I2C_PDD_RepeatStart(I2C0_BASE_PTR); /* If yes then repeat start cycle generated */  } else {    I2C_PDD_SetMasterMode(I2C0_BASE_PTR, I2C_PDD_MASTER_MODE); /* If no then start signal generated */  }  if ((DeviceDataPrv->SerFlag & ADDR_7) != 0x00U) { /* Is 7-bit addressing set ? */    DeviceDataPrv->SerFlag |= (ADDR_COMPLETE|REP_ADDR_COMPLETE); /* Only one byte of address will be sent 7-bit address mode*/    I2C_PDD_WriteDataReg(I2C0_BASE_PTR, (uint8_t)(DeviceDataPrv->SlaveAddr | 0x01U)); /* Send slave address */  } else {    if ((DeviceDataPrv->SerFlag & ADDR_10) != 0x00U) { /* Is 10-bit addressing set ? */      DeviceDataPrv->SerFlag &= (uint8_t)~(ADDR_COMPLETE | REP_ADDR_COMPLETE); /* Second byte of address will be sent later */      I2C_PDD_WriteDataReg(I2C0_BASE_PTR, DeviceDataPrv->SlaveAddrHigh); /* Send slave address - high byte */    }  }  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return ERR_OK;                       /* OK */}
开发者ID:jeloyah,项目名称:MagnAcc_FRDM-K64,代码行数:52,


示例24: AS1_RecvChar

/*** ===================================================================**     Method      :  AS1_RecvChar (bean AsynchroSerial)****     Description :**         If any data is received, this method returns one**         character, otherwise it returns an error code (it does**         not wait for data). This method is enabled only if the**         receiver property is enabled.**         [Note:] Because the preferred method to handle error and**         break exception in the interrupt mode is to use events**         <OnError> and <OnBreak> the return value ERR_RXEMPTY has**         higher priority than other error codes. As a consequence**         the information about an exception in interrupt mode is**         returned only if there is a valid character ready to be**         read.**     Parameters  :**         NAME            - DESCRIPTION**       * Chr             - Pointer to a received character**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_RXEMPTY - No data in receiver**                           ERR_BREAK - Break character is detected**                           (only when the <Interrupt service>**                           property is disabled and the <Break**                           signal> property is enabled)**                           ERR_COMMON - common error occurred (the**                           <GetError> method can be used for error**                           specification)** ===================================================================*/byte AS1_RecvChar(AS1_TComData *Chr){  byte Result = ERR_OK;                /* Return error code */  if(!(SerFlag & CHAR_IN_RX)) {        /* Is any char in the RX buffer? */    return ERR_RXEMPTY;                /* If no then error */  }  EnterCritical();                     /* Save the PS register */  *Chr = BufferRead;                   /* Received char */  Result = (byte)((SerFlag & (OVERRUN_ERR|COMMON_ERR))?ERR_COMMON:ERR_OK);  SerFlag &= ~(OVERRUN_ERR|COMMON_ERR|CHAR_IN_RX); /* Clear all errors in the status variable */  ExitCritical();                      /* Restore the PS register */  return Result;                       /* Return error code */}
开发者ID:jonyMarino,项目名称:microsdhacel,代码行数:48,


示例25: SMasterLdd1_ReceiveBlock

/* ===================================================================*/LDD_TError SMasterLdd1_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size){  if (((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq != 0x00U) { /* Is the previous receive operation pending? */    return ERR_BUSY;                   /* If yes then error */  }  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataPtr = (uint8_t*)BufferPtr; /* Store a pointer to the input data. */  ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpDataNumReq = Size; /* Store a number of characters to be received. */  ((SMasterLdd1_TDeviceDataPtr)DeviceDataPtr)->InpRecvDataNum = 0x00U; /* Set number of received characters to zero. */  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return ERR_OK;                       /* OK */}
开发者ID:c-kel,项目名称:Assorted,代码行数:15,


示例26: ASerial_RecvChar

/*** ===================================================================**     Method      :  ASerial_RecvChar (component AsynchroSerial)**     Description :**         If any data is received, this method returns one character,**         otherwise it returns an error code (it does not wait for**         data). This method is enabled only if the receiver property**         is enabled.**         [Note:] Because the preferred method to handle error and**         break exception in the interrupt mode is to use events**         <OnError> and <OnBreak> the return value ERR_RXEMPTY has**         higher priority than other error codes. As a consequence the**         information about an exception in interrupt mode is returned**         only if there is a valid character ready to be read.**     Parameters  :**         NAME            - DESCRIPTION**       * Chr             - Pointer to a received character**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_RXEMPTY - No data in receiver**                           ERR_BREAK - Break character is detected**                           (only when the <Interrupt service> property**                           is disabled and the <Break signal> property**                           is enabled)**                           ERR_COMMON - common error occurred (the**                           <GetError> method can be used for error**                           specification)** ===================================================================*/byte ASerial_RecvChar(ASerial_TComData *Chr){  byte Result = ERR_OK;                /* Return error code */  if ((SerFlag & CHAR_IN_RX) == 0U) {  /* Is any char in RX buffer? */    return ERR_RXEMPTY;                /* If no then error */  }  EnterCritical();                     /* Disable global interrupts */  *Chr = BufferRead;                   /* Received char */  Result = (byte)((SerFlag & (OVERRUN_ERR|COMMON_ERR))? ERR_COMMON : ERR_OK);  SerFlag &= (word)~(word)(OVERRUN_ERR|COMMON_ERR|CHAR_IN_RX); /* Clear all errors in the status variable */  ExitCritical();                      /* Enable global interrupts */  return Result;                       /* Return error code */}
开发者ID:jeloyah,项目名称:MagnAcc_FRDM-K64,代码行数:46,


示例27: SM1_SetIdleClockPolarity

/*** ===================================================================**     Method      :  SM1_SetIdleClockPolarity (component SynchroMaster)**     Description :**         Sets the idle clock polarity at runtime. If the**         communication does not run, the clock signal will have**         required level. The method will disable communication (if**         enabled), change the idle clock polarity end re-enable the**         communication (if it was enabled before).**     Parameters  :**         NAME            - DESCRIPTION**         Level           - Idle clock polarity:**                           0-low**                           1-high**     Returns     :**         ---             - Error code, possible codes:**                           ERR_OK - OK**                           ERR_SPEED - This device does not work in**                           the active speed mode**                           ERR_RANGE - Parameter out of range**                           **                           [ Version specific information neither for**                           Freescale HC08 derivatives ] **                           [ERR_DISABLED] - Obsolete, this error code**                           is not used.**                           ** ===================================================================*/byte SM1_SetIdleClockPolarity(byte Level){  if (Level > 1U) {    return ERR_RANGE;  }  SpiClockfeatures = ((SpiClockfeatures & 0xFEU) | Level);  EnterCritical();                     /* Disable global interrupts */  (void)SMasterLdd1_Disable(SMasterLdd1_DeviceDataPtr); /* Disable device */  (void)SMasterLdd1_Enable(SMasterLdd1_DeviceDataPtr); /* Enable device and cancel receive data request */  (void)SMasterLdd1_SelectConfiguration(SMasterLdd1_DeviceDataPtr, 0x00U, SpiClockfeatures);  HWEnDi();                            /* Enable/Disable device */  ExitCritical();                      /* Enable global interrupts */  return ERR_OK;}
开发者ID:nikolarobottesla,项目名称:BatteryTestSystem,代码行数:42,


示例28: IntI2cLdd1_MasterSendBlock

/* ===================================================================*/LDD_TError IntI2cLdd1_MasterSendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, LDD_I2C_TSize Size, LDD_I2C_TSendStop SendStop){  IntI2cLdd1_TDeviceData *DeviceDataPrv = (IntI2cLdd1_TDeviceData *)DeviceDataPtr;  if (Size == 0x00U) {                 /* Test variable Size on zero */    return ERR_OK;                     /* If zero then OK */  }  if (DeviceDataPrv->SendStop == LDD_I2C_SEND_STOP) {    if ((I2C_PDD_GetBusStatus(I2C0_BASE_PTR) == I2C_PDD_BUS_BUSY) || /* Is the bus busy? */  /       ((DeviceDataPrv->SerFlag & MASTER_IN_PROGRES) != 0x00U) || /       (DeviceDataPrv->OutLenM != 0x00U))  {      return ERR_BUSY;                 /* If yes then error */    }  } else {    if (((DeviceDataPrv->SerFlag & MASTER_IN_PROGRES) != 0x00U) || /* Is the bus busy? */  /      (DeviceDataPrv->OutLenM != 0x00U))  {      return ERR_BUSY;                 /* If yes then error */    }  }  /* {Default RTOS Adapter} Critical section begin, general PE function is used */  EnterCritical();  DeviceDataPrv->SerFlag |= MASTER_IN_PROGRES; /* Set flag "busy" */  DeviceDataPrv->OutPtrM = (uint8_t *)BufferPtr; /* Save pointer to data for transmitting */  DeviceDataPrv->OutByteMNum = 0x00U;  /* Set data counter */  DeviceDataPrv->OutLenM = Size;       /* Set the counter of output bufer's content */  DeviceDataPrv->SendStop = SendStop;  /* Set generating stop condition */  I2C_PDD_SetTransmitMode(I2C0_BASE_PTR, I2C_PDD_TX_DIRECTION); /* Set TX mode */  if (I2C_PDD_GetMasterMode(I2C0_BASE_PTR) == I2C_PDD_MASTER_MODE) { /* Is device in master mode? */    I2C_PDD_RepeatStart(I2C0_BASE_PTR); /* If yes then repeat start cycle generated */  } else {    I2C_PDD_SetMasterMode(I2C0_BASE_PTR, I2C_PDD_MASTER_MODE); /* If no then start signal generated */  }  if ((DeviceDataPrv->SerFlag & ADDR_7) != 0x00U) { /* Is 7-bit addressing set ? */    DeviceDataPrv->SerFlag |= (ADDR_COMPLETE | REP_ADDR_COMPLETE); /* Only one byte of address will be sent 7-bit address mode*/    I2C_PDD_WriteDataReg(I2C0_BASE_PTR, DeviceDataPrv->SlaveAddr); /* Send slave address */  } else {    if ((DeviceDataPrv->SerFlag & ADDR_10) != 0x00U) { /* Is 10-bit addressing set ? */      DeviceDataPrv->SerFlag &= (uint8_t)~(ADDR_COMPLETE | REP_ADDR_COMPLETE); /* Second byte of address will be sent later */      I2C_PDD_WriteDataReg(I2C0_BASE_PTR, DeviceDataPrv->SlaveAddrHigh); /* Send slave address - high byte */    } else {      if ((DeviceDataPrv->SerFlag & GENERAL_CALL) != 0x00U) { /* Is general call command required ? */        DeviceDataPrv->SerFlag |= ADDR_COMPLETE; /* Only one byte of address will be sent in general call address mode*/        I2C_PDD_WriteDataReg(I2C0_BASE_PTR, 0x00U); /* Send general call address */      }    }  }  /* {Default RTOS Adapter} Critical section end, general PE function is used */  ExitCritical();  return ERR_OK;                       /* OK */}
开发者ID:jeloyah,项目名称:MagnAcc_FRDM-K64,代码行数:51,


示例29: route_add

introute_add(int flags, ipaddr_t net, ipaddr_t netmask, ipaddr_t dst) {  route_entry_p routep;  int bitcount;  int i,location,ret;  mk_ip_table_rw();  EnterCritical();  routep = get_route(net,netmask);  if (routep) {    /* route exists */    fprintf(stderr,"Route exists/n");    ret = -1;  } else if (GETNUMROUTEENTRIES == ROUTETABLESZ) {    /* no space left */    fprintf(stderr,"No space for new route/n");    ret = -1;  } else {    bitcount = get_ipaddr_bitcount(netmask);    /* search for place of insertion: first entry that is smaller, and take previous */    for (i = 0 ; i < GETNUMROUTEENTRIES ; i++) {      routep = GETROUTEP(i);      if (bitcount >= routep->bitcount) 	break;    }    if (i == GETNUMROUTEENTRIES) {      /* there were no entries, append at bottom */      location = GETNUMROUTEENTRIES;    } else {      location = i;      /* shift down all entries, to make space */      for (i = GETNUMROUTEENTRIES; i >= location ; i--) {	routep = GETROUTEP(i);	*routep = *(GETROUTEP(i-1));      }    }        routep = GETROUTEP(location);    INCNUMROUTEENTRIES;    routep->flags = flags;    routep->bitcount = bitcount;    bcopy(net, routep->net,4);    bcopy(netmask, routep->netmask,4);    bcopy(dst, routep->dst,4);    ret = 0;  }  ExitCritical();  mk_ip_table_ro();  return ret;}
开发者ID:aunali1,项目名称:exopc,代码行数:50,



注:本文中的ExitCritical函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ExitFunction函数代码示例
C++ ExecuteEvent函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。