#define USB_DEBUG_BOOT 1
#if USB_DEBUG_BOOT
/***************************************************/
char * my_strcpy_x(char * dst, const char * src) {
char * cp = dst;
while (*cp++ = *src++)
;
return (dst);
}
char * my_strcat_x(char * dst, const char * src) {
char * p = dst;
while (*p)
p++;
while (*p++ = *src++)
;
return (dst);
}
int my_strlen_x(const char * str) {
const char *p = str;
while (*p++)
;
return ((int) (p - str - 1));
}
char *my_itou_x(unsigned long num, char *str) {
char *table_x="0123456789ABCDEF";
char *ptr=str;
char *start=str;
unsigned long tmp_val = 0;
if (num == 0) {
*ptr++ = '0';
*ptr = '\0';
return str;
}
while (num) {
*ptr++ = table_x[num & 0xF];
num >>= 4;
}
*ptr = '\0';
ptr--;
while (start < ptr) {
char temp = *start;
*start = *ptr;
*ptr = temp;
start++;
ptr--;
}
return str;
}
void usbboot_print(int power_key,char *s)
{
//char buf[256] = { '\0' };
//int power_key = 0x12345678
char ir_buf[256];
my_strcpy_x(ir_buf, s);
my_strcpy_x(ir_buf, "value = 0x");
my_itou_x(power_key, ir_buf + my_strlen_x(ir_buf));
my_strcat_x(ir_buf, "\n");
serial_puts(ir_buf);
}
#endif
阅读(880) | 评论(0) | 转发(0) |