本文整理汇总了C++中EXIT_CRITICAL_SECTION函数的典型用法代码示例。如果您正苦于以下问题:C++ EXIT_CRITICAL_SECTION函数的具体用法?C++ EXIT_CRITICAL_SECTION怎么用?C++ EXIT_CRITICAL_SECTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXIT_CRITICAL_SECTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialPortEnable
void serialPortEnable(bool xRxEnable, bool xTxEnable)
{
ENTER_CRITICAL_SECTION();
if( xRxEnable )
{
P1OUT &= ~BIT1; // set to receive mode
IE1 |= URXIE0;
}
else
{
IFG1 &= ~URXIFG0; // Clear rx interrupt flag
IE1 &= ~URXIE0;
}
if(xTxEnable)
{
P1OUT |= BIT1; // set to transmit mode
IE1 |= UTXIE0;
IFG1 |= UTXIFG0; // trigger 1st interrupt manually
}
else
{
IFG1 &= ~UTXIFG0; // Clear tx interrupt flag
IE1 &= ~UTXIE0;
}
EXIT_CRITICAL_SECTION();
return ;
}
示例2: WritePATable
// *************************************************************************************************
// @fn WritePATable
// @brief Write data to power table
// @param unsigned char value Value to write
// @return none
// *************************************************************************************************
void WritePATable(unsigned char value)
{
unsigned char readbackPATableValue = 0;
u16 int_state;
ENTER_CRITICAL_SECTION(int_state);
while (readbackPATableValue != value)
{
while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
RF1AINSTRW = 0x7E00 + value; // PA Table write (burst)
while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
RF1AINSTRB = RF_SNOP; // reset pointer
while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
RF1AINSTRB = 0xFE; // PA Table read (burst)
while (!(RF1AIFCTL1 & RFDINIFG)) ;
RF1ADINB = 0x00; //dummy write
while (!(RF1AIFCTL1 & RFDOUTIFG)) ;
readbackPATableValue = RF1ADOUT0B;
while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
RF1AINSTRB = RF_SNOP;
}
EXIT_CRITICAL_SECTION(int_state);
}
示例3: eMBRTUStop
/**
-----------------------------------------------------------------------------------------------------------------------
eMBRTUStop
-----------------------------------------------------------------------------------------------------------------------
* Event Handler for GPI module
*
* @date DEC/02/2013
* @author FW_DEV_2
* @pre None
* @return None
************************************************************************************************************************
*/
void eMBRTUStop( void )
{
ENTER_CRITICAL_SECTION( );
vMBPortSerialEnable( FALSE, FALSE );
vMBPortTimersDisable( );
EXIT_CRITICAL_SECTION( );
}
示例4: FddpPushJobItem
static BOOL FddpPushJobItem(FDD_JOB_ITEM *pJobItem)
{
BOOL bResult = TRUE;
ENTER_CRITICAL_SECTION();
{
/* check up the remain space of Q */
if(m_JobItemQ.cnt >= FDD_JOB_ITEM_Q_SIZE) {
bResult = FALSE;
goto $exit;
}
/* process */
m_JobItemQ.cnt++;
m_JobItemQ.queue[m_JobItemQ.tail].type = pJobItem->type;
m_JobItemQ.queue[m_JobItemQ.tail].sector = pJobItem->sector;
m_JobItemQ.queue[m_JobItemQ.tail].numbers_of_sectors = pJobItem->numbers_of_sectors;
m_JobItemQ.queue[m_JobItemQ.tail].pt_data = pJobItem->pt_data;
m_JobItemQ.queue[m_JobItemQ.tail].thread = pJobItem->thread;
m_JobItemQ.tail++;
if(m_JobItemQ.tail >= FDD_JOB_ITEM_Q_SIZE)
m_JobItemQ.tail = 0;
}
$exit:
EXIT_CRITICAL_SECTION();
return bResult;
}
示例5: uxos_update_sysclock
static void uxos_update_sysclock()
{
uint16_t temp_overflow_count;
ENTER_CRITICAL_SECTION();
temp_overflow_count=uxos_get_overflow();
EXIT_CRITICAL_SECTION();
if (temp_overflow_count>0)
{
ENTER_CRITICAL_SECTION();
uxos_clear_overflow();
EXIT_CRITICAL_SECTION();
uxos_timer_update(temp_overflow_count);
}
}
示例6: FddpPopJobItem
static BOOL FddpPopJobItem(FDD_JOB_ITEM *pJobItem)
{
BOOL bResult = TRUE;
ENTER_CRITICAL_SECTION();
{
/* check up count */
if(m_JobItemQ.cnt == 0) {
bResult = FALSE;
goto $exit;
}
/* process */
m_JobItemQ.cnt--;
pJobItem->type = m_JobItemQ.queue[m_JobItemQ.head].type;
pJobItem->sector = m_JobItemQ.queue[m_JobItemQ.head].sector;
pJobItem->numbers_of_sectors = m_JobItemQ.queue[m_JobItemQ.head].numbers_of_sectors;
pJobItem->pt_data = m_JobItemQ.queue[m_JobItemQ.head].pt_data;
pJobItem->thread = m_JobItemQ.queue[m_JobItemQ.head].thread;
m_JobItemQ.head++;
if(m_JobItemQ.head >= FDD_JOB_ITEM_Q_SIZE)
m_JobItemQ.head = 0;
}
$exit:
EXIT_CRITICAL_SECTION();
return bResult;
}
示例7: eMBRTUInit
/**
* Initialize ModBus master.
*
* @param ucSlaveAddress - Not used in master mode
* @param ucPort - Serial port number
* @param ulBaudRate - Serial port baud rate
* @param eParity - MB_PAR_NONE, MB_PAR_ODD, MB_PAR_EVEN
* @return MB_ENOERR on success
*/
eMBErrorCode eMBRTUInit(UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate,
eMBParity eParity)
{
eMBErrorCode eStatus = MB_ENOERR;
ULONG ulTimerT35_50us;
( void )ucSlaveAddress;
ENTER_CRITICAL_SECTION( );
/* Modbus RTU uses 8 Databits. */
if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE )
{
eStatus = MB_EPORTERR;
}
if( ulBaudRate > 19200 )
{
/* The timer reload value for a character is given by:
*
* ChTimeValue = Ticks_per_1s / ( Baudrate / 11 )
* = 11 * Ticks_per_1s / Baudrate
* = 220000 / Baudrate
* The reload for t3.5 is 1.5 times this value and similarly
* for t3.5.
*/
ulTimerT35_50us = ( 7UL * 220000UL ) / ( 2UL * ulBaudRate );
}
DEBUG_PUTSTRING1("T35 = ", ulTimerT35_50us);
if( xMBPortTimersInit( ( USHORT ) ulTimerT35_50us ) != TRUE )
{
eStatus = MB_EPORTERR;
}
EXIT_CRITICAL_SECTION( );
return eStatus;
}
示例8: eMBRTUReceive
eMBErrorCode
eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
{
BOOL xFrameReceived = FALSE;
eMBErrorCode eStatus = MB_ENOERR;
ENTER_CRITICAL_SECTION();
assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX );
/* Length and CRC check */
if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN )
&& ( usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) == 0 ) )
{
/* Save the address field. All frames are passed to the upper layed
* and the decision if a frame is used is done there.
*/
*pucRcvAddress = ucRTUBuf[MB_SER_PDU_ADDR_OFF];
/* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus
* size of address field and CRC checksum.
*/
*pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC );
/* Return the start of the Modbus PDU to the caller. */
*pucFrame = ( UCHAR * ) & ucRTUBuf[MB_SER_PDU_PDU_OFF];
xFrameReceived = TRUE;
}
else
{
eStatus = MB_EIO;
}
EXIT_CRITICAL_SECTION();
return eStatus;
}
示例9: vMBPortSerialEnable
/* ----------------------- Start implementation -----------------------------*/
void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable )
{
/* If xRXEnable enable serial receive interrupts. If xTxENable enable
* transmitter empty interrupts.
*/
ENTER_CRITICAL_SECTION( );
if(xRxEnable){
//SciaRegs.SCICTL1.bit.RXENA = 1;
SciaRegs.SCICTL2.bit.RXBKINTENA =1;
}
else {
//SciaRegs.SCICTL1.bit.RXENA = 0;
SciaRegs.SCICTL2.bit.RXBKINTENA =0;
}
if(xTxEnable){
//SciaRegs.SCICTL1.bit.TXENA = 1;
SciaRegs.SCICTL2.bit.TXINTENA =1;
SciaRegs.SCICTL2.bit.TXEMPTY = 0;
SciaRegs.SCICTL1.bit.SWRESET = 0;
SciaRegs.SCICTL1.bit.SWRESET = 1;
//IFR = 0x0000;
}
else{
//SciaRegs.SCICTL1.bit.TXENA = 0;
SciaRegs.SCICTL2.bit.TXINTENA =0;
}
EXIT_CRITICAL_SECTION( );
}
示例10: protocolSendPacket
void protocolSendPacket(uint8 *buf, uint8 len)
{
uint16 checksum;
if ( (len!=PDU_SIZE) || (g_serialPortRecvState!=STATE_RX_IDLE) )
{
return ;
}
ENTER_CRITICAL_SECTION();
g_serialPortBufSendCnt = len;
g_serialPortSendPtr = g_serialPortBuf;
checksum = computeChecksum(buf, len-2);
buf[CSM_OFF] = (uint8)(checksum & 0xFF);
buf[CSM_OFF+1] = (uint8)(checksum >> 8);
g_serialPortSendState = STATE_TX_XMIT;
serialPortEnable(FALSE, TRUE);
EXIT_CRITICAL_SECTION();
return ;
}
示例11: eMBMasterRTUReceive
/*************************************************************************
* eMBMasterRTUReceive
* Функция приёма данных и проверка их целосности.
*************************************************************************/
eMBErrorCode
eMBMasterRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
{
eMBErrorCode eStatus = MB_ENOERR;
ENTER_CRITICAL_SECTION( );
assert_param( usMasterRcvBufferPos < MB_SER_PDU_SIZE_MAX );
// Проверка длинны пакета и его CRC
if( ( usMasterRcvBufferPos >= MB_SER_PDU_SIZE_MIN )
&& ( usMBCRC16( ( UCHAR * ) ucMasterRTURcvBuf, usMasterRcvBufferPos ) == 0 ) )
{
// Save the address field. All frames are passed to the upper layed and the decision if a frame is used is done there.
*pucRcvAddress = ucMasterRTURcvBuf[MB_SER_PDU_ADDR_OFF];
// Общая длина данных(Modbus-PDU) без поля адреса и CRC.
*pusLength = ( USHORT )( usMasterRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC );
// Адрес начала данных(Modbus-PDU)
*pucFrame = ( UCHAR * ) & ucMasterRTURcvBuf[MB_SER_PDU_PDU_OFF];
}
else
{
eStatus = MB_EIO;
}
EXIT_CRITICAL_SECTION( );
return eStatus;
}
示例12: eMBMasterRTUStop
void
eMBMasterRTUStop( void )
{
OS_CPU_SR cpu_sr;
ENTER_CRITICAL_SECTION( );
vMBMasterPortSerialEnable( FALSE, FALSE );
vMBMasterPortTimersDisable( );
EXIT_CRITICAL_SECTION( );
}
示例13: eMBASCIIStop
void
eMBASCIIStop( void )
{
ENTER_CRITICAL_DECLARE( );
ENTER_CRITICAL_SECTION( );
vMBPortSerialEnable( FALSE, FALSE );
vMBPortTimersDisable( );
EXIT_CRITICAL_SECTION( );
}
示例14: PsGetCurrentThread
KERNELAPI HANDLE PsGetCurrentThread(VOID)
{
HANDLE thread;
ENTER_CRITICAL_SECTION();
thread = (HANDLE)(m_ProcMgrBlk.pt_current_thread);
EXIT_CRITICAL_SECTION();
return thread;
}
示例15: PspGetNextProcessID
static DWORD PspGetNextProcessID(void)
{
DWORD process_id;
ENTER_CRITICAL_SECTION();
process_id = m_ProcMgrBlk.next_process_id++;
EXIT_CRITICAL_SECTION();
return process_id;
}