本文整理汇总了C++中putDebugChar函数的典型用法代码示例。如果您正苦于以下问题:C++ putDebugChar函数的具体用法?C++ putDebugChar怎么用?C++ putDebugChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了putDebugChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putpacket
/*
* send the packet in buffer.
*/
static void putpacket(char *buffer)
{
unsigned char checksum;
int count;
unsigned char ch;
/*
* $<packet info>#<checksum>.
*/
do {
putDebugChar('$');
checksum = 0;
count = 0;
while ((ch = buffer[count]) != 0) {
if (!(putDebugChar(ch)))
return;
checksum += ch;
count += 1;
}
putDebugChar('#');
putDebugChar(hexchars[checksum >> 4]);
putDebugChar(hexchars[checksum & 0xf]);
}
while ((getDebugChar() & 0x7f) != '+');
}
示例2: while
static unsigned char *stub_puts(unsigned char *buffer)
{
unsigned char c, sum;
int i;
while (1) {
putDebugChar('$');
i = 0;
sum = 0;
while ((c = buffer[i++]) != '\0') {
putDebugChar(c);
sum += c;
}
putDebugChar('#');
putDebugChar(h2a((sum >> 4) & 0xf));
putDebugChar(h2a(sum & 0xf));
if (getDebugChar() == '+')
break;
}
return buffer;
}
示例3: putpacket
/* send the packet in buffer. */
int putpacket(char *buffer)
{
unsigned char checksum;
int count;
unsigned char ch;
/* $<packet info>#<checksum>. */
do
{
if(putDebugChar('$'))
return 1;
checksum = 0;
count = 0;
while((ch = (buffer[count])))
{
if(putDebugChar(ch))
return 1;
checksum += ch;
count += 1;
}
if(putDebugChar('#') || putDebugChar(hexchars[checksum >> 4])
|| putDebugChar(hexchars[checksum & 0xf]))
return 1;
if(getDebugChar(&ch))
return 1;
}
while(ch != '+');
return 0;
}
示例4: putpacket
void putpacket (char *buffer) {
unsigned char checksum;
int count;
char ch;
/* $<packet info>#<checksum>. */
do
{
putDebugChar ('$');
checksum = 0;
count = 0;
while (ch = buffer[count])
{
putDebugChar (ch);
checksum += ch;
count += 1;
}
putDebugChar ('#');
putDebugChar (hexchars[checksum >> 4]);
putDebugChar (hexchars[checksum % 16]);
}
while (getDebugChar () != '+');
}
示例5: getpacket
/* scan for the sequence $<data>#<checksum> */
static void
getpacket(char *buffer)
{
unsigned char checksum;
unsigned char xmitcsum;
int i;
int count;
unsigned char ch;
do {
/* wait around for the start character, ignore all other
* characters */
while ((ch = (getDebugChar() & 0x7f)) != '$') {
#ifdef KGDB_DEBUG
if (kdebug)
putc(ch);
#endif
;
}
checksum = 0;
xmitcsum = -1;
count = 0;
/* now, read until a # or end of buffer is found */
while (count < BUFMAX) {
ch = getDebugChar() & 0x7f;
if (ch == '#')
break;
checksum = checksum + ch;
buffer[count] = ch;
count = count + 1;
}
if (count >= BUFMAX)
continue;
buffer[count] = 0;
if (ch == '#') {
xmitcsum = hex(getDebugChar() & 0x7f) << 4;
xmitcsum |= hex(getDebugChar() & 0x7f);
if (checksum != xmitcsum)
putDebugChar('-'); /* failed checksum */
else {
putDebugChar('+'); /* successful transfer */
/* if a sequence char is present, reply the ID */
if (buffer[2] == ':') {
putDebugChar(buffer[0]);
putDebugChar(buffer[1]);
/* remove sequence chars from buffer */
count = strlen(buffer);
for (i=3; i <= count; i++)
buffer[i-3] = buffer[i];
}
}
}
} while (checksum != xmitcsum);
}
示例6: putpacket
/* send the packet in buffer. */
static void
putpacket(unsigned char *buffer)
{
unsigned char checksum;
int count;
unsigned char ch, recv;
/* $<packet info>#<checksum>. */
do {
putDebugChar('$');
checksum = 0;
count = 0;
while ((ch = buffer[count])) {
putDebugChar(ch);
checksum += ch;
count += 1;
}
putDebugChar('#');
putDebugChar(hexchars[checksum >> 4]);
putDebugChar(hexchars[checksum & 0xf]);
recv = getDebugChar();
} while ((recv & 0x7f) != '+');
}
示例7: serialtest
static int serialtest()
{
int i,j;
printf("serial test\n");
initserial(0);
initserial(1);
for(i=0;i<16;i++)
{
if(testDebugChar(0))getDebugChar(0);
else break;
}
for(i=0;i<16;j++)
{
if(testDebugChar(1))getDebugChar(1);
else break;
}
printf("serial 0 send data to serial 1...");
for(i=0;i<10;i++)
{
putDebugChar(0,'a'+i);
for(j=0;j<TIMEOUT;j++)
{
if(testDebugChar(1))break;
}
if(j==TIMEOUT){printf("timeout");break;}
printf("%c",getDebugChar(1));
}
printf("\n");
for(i=0;i<16;i++)
{
if(testDebugChar(0))getDebugChar(0);
else break;
}
for(i=0;i<16;j++)
{
if(testDebugChar(1))getDebugChar(1);
else break;
}
printf("serial 1 send data to serial 0...");
for(i=0;i<10;i++)
{
putDebugChar(1,'a'+i);
for(j=0;j<TIMEOUT;j++)
{
if(testDebugChar(0))break;
}
if(j==TIMEOUT){printf("timeout");break;}
printf("%c",getDebugChar(0));
}
printf("\n");
return 0;
}
示例8: imx6_uart_putchar
void
imx6_uart_putchar(char c)
{
putDebugChar(c);
if (c == '\n') {
putDebugChar('\r');
}
}
示例9: am335x_uart_putchar
void
am335x_uart_putchar(char c)
{
putDebugChar(c);
if (c == '\n') {
putDebugChar('\r');
}
}
示例10: putDebugString
void putDebugString(char* str)
{
while (*str != '\0') {
putDebugChar(*str);
str++;
}
putDebugChar('\r');
return;
}
示例11: putDebugStr
void
putDebugStr(const char *str)
{
while (*str != '\0') {
if (*str == '\n')
putDebugChar('\r');
putDebugChar(*str++);
}
}
示例12: getpacket
/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
returned. */
static void
getpacket (char *buffer)
{
unsigned char checksum;
unsigned char xmitcsum;
int i;
int count;
char ch;
do {
while ((ch = getDebugChar ()) != '$')
/* Wait for the start character $ and ignore all other characters */;
checksum = 0;
xmitcsum = -1;
count = 0;
/* Read until a # or the end of the buffer is reached */
while (count < BUFMAX) {
ch = getDebugChar ();
if (ch == '#')
break;
checksum = checksum + ch;
buffer[count] = ch;
count = count + 1;
}
buffer[count] = '\0';
if (ch == '#') {
xmitcsum = hex (getDebugChar ()) << 4;
xmitcsum += hex (getDebugChar ());
if (checksum != xmitcsum) {
/* Wrong checksum */
putDebugChar ('-');
}
else {
/* Correct checksum */
putDebugChar ('+');
/* If sequence characters are received, reply with them */
if (buffer[2] == ':') {
putDebugChar (buffer[0]);
putDebugChar (buffer[1]);
/* Remove the sequence characters from the buffer */
count = gdb_cris_strlen (buffer);
for (i = 3; i <= count; i++)
buffer[i - 3] = buffer[i];
}
}
}
} while (checksum != xmitcsum);
}
示例13: putDebugChar
void
putDebugChar(const char c)
{
volatile scc_uart_t *up;
volatile cbd_t *tbdf;
volatile immap_t *im;
if (c == '\n')
putDebugChar ('\r');
im = (immap_t *)CONFIG_SYS_IMMR;
up = (scc_uart_t *)&im->im_dprambase[KGDB_PROFF_SCC];
tbdf = (cbd_t *)&im->im_dprambase[up->scc_genscc.scc_tbase];
/* Wait for last character to go.
*/
while (tbdf->cbd_sc & BD_SC_READY)
;
/* Load the character into the transmit buffer.
*/
*(volatile char *)tbdf->cbd_bufaddr = c;
tbdf->cbd_datlen = 1;
tbdf->cbd_sc |= BD_SC_READY;
}
示例14: set_debug_traps
/* this function is used to set up exception handlers for tracing and
breakpoints */
void
set_debug_traps (void)
{
stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1];
exceptionHandler (0, _catchException0);
exceptionHandler (1, _catchException1);
exceptionHandler (3, _catchException3);
exceptionHandler (4, _catchException4);
exceptionHandler (5, _catchException5);
exceptionHandler (6, _catchException6);
exceptionHandler (7, _catchException7);
exceptionHandler (8, _catchException8);
exceptionHandler (9, _catchException9);
exceptionHandler (10, _catchException10);
exceptionHandler (11, _catchException11);
exceptionHandler (12, _catchException12);
exceptionHandler (13, _catchException13);
exceptionHandler (14, _catchException14);
exceptionHandler (16, _catchException16);
/* In case GDB is started before us, ack any packets (presumably
"$?#xx") sitting there. */
putDebugChar ('+');
initialized = true;
}
示例15: putDebugStr
void
putDebugStr (const char *s)
{
while (*s) {
putDebugChar (*s++);
}
}