本文整理汇总了C++中TRACE_PE函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE_PE函数的具体用法?C++ TRACE_PE怎么用?C++ TRACE_PE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACE_PE函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: receive_error
static void receive_error(struct r3964_info *pInfo, const char flag)
{
switch (flag) {
case TTY_NORMAL:
break;
case TTY_BREAK:
TRACE_PE("received break");
pInfo->flags |= R3964_BREAK;
break;
case TTY_PARITY:
TRACE_PE("parity error");
pInfo->flags |= R3964_PARITY;
break;
case TTY_FRAME:
TRACE_PE("frame error");
pInfo->flags |= R3964_FRAME;
break;
case TTY_OVERRUN:
TRACE_PE("frame overrun");
pInfo->flags |= R3964_OVERRUN;
break;
default:
TRACE_PE("receive_error - unknown flag %d", flag);
pInfo->flags |= R3964_UNKNOWN;
break;
}
}
示例2: retry_transmit
static void retry_transmit(struct r3964_info *pInfo)
{
if(pInfo->nRetry<R3964_MAX_RETRIES)
{
TRACE_PE("transmission failed. Retry #%d",
pInfo->nRetry);
pInfo->bcc = 0;
put_char(pInfo, STX);
flush(pInfo);
pInfo->state = R3964_TX_REQUEST;
pInfo->count_down = R3964_TO_QVZ;
pInfo->nRetry++;
}
else
{
TRACE_PE("transmission failed after %d retries",
R3964_MAX_RETRIES);
remove_from_tx_queue(pInfo, R3964_TX_FAIL);
put_char(pInfo, NAK);
flush(pInfo);
pInfo->state = R3964_IDLE;
trigger_transmit(pInfo);
}
}
示例3: add_msg
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
int error_code, struct r3964_block_header *pBlock)
{
struct r3964_message *pMsg;
unsigned long flags;
if (pClient->msg_count < R3964_MAX_MSG_COUNT - 1) {
queue_the_message:
pMsg = kmalloc(sizeof(struct r3964_message),
error_code ? GFP_ATOMIC : GFP_KERNEL);
TRACE_M("add_msg - kmalloc %p", pMsg);
if (pMsg == NULL) {
return;
}
spin_lock_irqsave(&pClient->lock, flags);
pMsg->msg_id = msg_id;
pMsg->arg = arg;
pMsg->error_code = error_code;
pMsg->block = pBlock;
pMsg->next = NULL;
if (pClient->last_msg == NULL) {
pClient->first_msg = pClient->last_msg = pMsg;
} else {
pClient->last_msg->next = pMsg;
pClient->last_msg = pMsg;
}
pClient->msg_count++;
if (pBlock != NULL) {
pBlock->locks++;
}
spin_unlock_irqrestore(&pClient->lock, flags);
} else {
if ((pClient->last_msg->msg_id == R3964_MSG_ACK)
&& (pClient->last_msg->error_code == R3964_OVERFLOW)) {
pClient->last_msg->arg++;
TRACE_PE("add_msg - inc prev OVERFLOW-msg");
} else {
msg_id = R3964_MSG_ACK;
arg = 0;
error_code = R3964_OVERFLOW;
pBlock = NULL;
TRACE_PE("add_msg - queue OVERFLOW-msg");
goto queue_the_message;
}
}
/* Send SIGIO signal to client process: */
if (pClient->sig_flags & R3964_USE_SIGIO) {
kill_pid(pClient->pid, SIGIO, 1);
}
}
示例4: on_timeout
static void on_timeout(unsigned long priv)
{
struct r3964_info *pInfo = (void *)priv;
switch(pInfo->state)
{
case R3964_TX_REQUEST:
TRACE_PE("TX_REQUEST - timeout");
retry_transmit(pInfo);
break;
case R3964_WAIT_ZVZ_BEFORE_TX_RETRY:
put_char(pInfo, NAK);
flush(pInfo);
retry_transmit(pInfo);
break;
case R3964_WAIT_FOR_TX_ACK:
TRACE_PE("WAIT_FOR_TX_ACK - timeout");
retry_transmit(pInfo);
break;
case R3964_WAIT_FOR_RX_BUF:
TRACE_PE("WAIT_FOR_RX_BUF - timeout");
put_char(pInfo, NAK);
flush(pInfo);
pInfo->state=R3964_IDLE;
break;
case R3964_RECEIVING:
TRACE_PE("RECEIVING - timeout after %d chars",
pInfo->rx_position);
put_char(pInfo, NAK);
flush(pInfo);
pInfo->state=R3964_IDLE;
break;
case R3964_WAIT_FOR_RX_REPEAT:
TRACE_PE("WAIT_FOR_RX_REPEAT - timeout");
pInfo->state=R3964_IDLE;
break;
case R3964_WAIT_FOR_BCC:
TRACE_PE("WAIT_FOR_BCC - timeout");
put_char(pInfo, NAK);
flush(pInfo);
pInfo->state=R3964_IDLE;
break;
}
}
示例5: receive_char
static void receive_char(struct r3964_info *pInfo, const unsigned char c)
{
switch (pInfo->state) {
case R3964_TX_REQUEST:
if (c == DLE) {
TRACE_PS("TX_REQUEST - got DLE");
pInfo->state = R3964_TRANSMITTING;
pInfo->tx_position = 0;
transmit_block(pInfo);
} else if (c == STX) {
if (pInfo->nRetry == 0) {
TRACE_PE("TX_REQUEST - init conflict");
if (pInfo->priority == R3964_SLAVE) {
goto start_receiving;
}
} else {
TRACE_PE("TX_REQUEST - secondary init "
"conflict!? Switching to SLAVE mode "
"for next rx.");
goto start_receiving;
}
} else {
TRACE_PE("TX_REQUEST - char != DLE: %x", c);
retry_transmit(pInfo);
}
break;
case R3964_TRANSMITTING:
if (c == NAK) {
TRACE_PE("TRANSMITTING - got NAK");
retry_transmit(pInfo);
} else {
TRACE_PE("TRANSMITTING - got invalid char");
pInfo->state = R3964_WAIT_ZVZ_BEFORE_TX_RETRY;
mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
}
break;
case R3964_WAIT_FOR_TX_ACK:
if (c == DLE) {
TRACE_PS("WAIT_FOR_TX_ACK - got DLE");
remove_from_tx_queue(pInfo, R3964_OK);
pInfo->state = R3964_IDLE;
trigger_transmit(pInfo);
} else {
retry_transmit(pInfo);
}
break;
case R3964_WAIT_FOR_RX_REPEAT:
/* FALLTROUGH */
case R3964_IDLE:
if (c == STX) {
/* Prevent rx_queue from overflow: */
if (pInfo->blocks_in_rx_queue >=
R3964_MAX_BLOCKS_IN_RX_QUEUE) {
TRACE_PE("IDLE - got STX but no space in "
"rx_queue!");
pInfo->state = R3964_WAIT_FOR_RX_BUF;
mod_timer(&pInfo->tmr,
jiffies + R3964_TO_NO_BUF);
break;
}
start_receiving:
/* Ok, start receiving: */
TRACE_PS("IDLE - got STX");
pInfo->rx_position = 0;
pInfo->last_rx = 0;
pInfo->flags &= ~R3964_ERROR;
pInfo->state = R3964_RECEIVING;
mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
pInfo->nRetry = 0;
put_char(pInfo, DLE);
flush(pInfo);
pInfo->bcc = 0;
}
break;
case R3964_RECEIVING:
if (pInfo->rx_position < RX_BUF_SIZE) {
pInfo->bcc ^= c;
if (c == DLE) {
if (pInfo->last_rx == DLE) {
pInfo->last_rx = 0;
goto char_to_buf;
}
pInfo->last_rx = DLE;
break;
} else if ((c == ETX) && (pInfo->last_rx == DLE)) {
if (pInfo->flags & R3964_BCC) {
pInfo->state = R3964_WAIT_FOR_BCC;
mod_timer(&pInfo->tmr,
jiffies + R3964_TO_ZVZ);
} else {
on_receive_block(pInfo);
}
} else {
pInfo->last_rx = c;
char_to_buf:
//.........这里部分代码省略.........
示例6: on_receive_block
static void on_receive_block(struct r3964_info *pInfo)
{
unsigned int length;
struct r3964_client_info *pClient;
struct r3964_block_header *pBlock;
length = pInfo->rx_position;
/* compare byte checksum characters: */
if (pInfo->flags & R3964_BCC) {
if (pInfo->bcc != pInfo->last_rx) {
TRACE_PE("checksum error - got %x but expected %x",
pInfo->last_rx, pInfo->bcc);
pInfo->flags |= R3964_CHECKSUM;
}
}
/* check for errors (parity, overrun,...): */
if (pInfo->flags & R3964_ERROR) {
TRACE_PE("on_receive_block - transmission failed error %x",
pInfo->flags & R3964_ERROR);
put_char(pInfo, NAK);
flush(pInfo);
if (pInfo->nRetry < R3964_MAX_RETRIES) {
pInfo->state = R3964_WAIT_FOR_RX_REPEAT;
pInfo->nRetry++;
mod_timer(&pInfo->tmr, jiffies + R3964_TO_RX_PANIC);
} else {
TRACE_PE("on_receive_block - failed after max retries");
pInfo->state = R3964_IDLE;
}
return;
}
/* received block; submit DLE: */
put_char(pInfo, DLE);
flush(pInfo);
del_timer_sync(&pInfo->tmr);
TRACE_PS(" rx success: got %d chars", length);
/* prepare struct r3964_block_header: */
pBlock = kmalloc(length + sizeof(struct r3964_block_header),
GFP_KERNEL);
TRACE_M("on_receive_block - kmalloc %p", pBlock);
if (pBlock == NULL)
return;
pBlock->length = length;
pBlock->data = ((unsigned char *)pBlock) +
sizeof(struct r3964_block_header);
pBlock->locks = 0;
pBlock->next = NULL;
pBlock->owner = NULL;
memcpy(pBlock->data, pInfo->rx_buf, length);
/* queue block into rx_queue: */
add_rx_queue(pInfo, pBlock);
/* notify attached client processes: */
for (pClient = pInfo->firstClient; pClient; pClient = pClient->next) {
if (pClient->sig_flags & R3964_SIG_DATA) {
add_msg(pClient, R3964_MSG_DATA, length, R3964_OK,
pBlock);
}
}
wake_up_interruptible(&pInfo->read_wait);
pInfo->state = R3964_IDLE;
trigger_transmit(pInfo);
}