示例#1
0
static void outchar(const char c)
{
    if (g_log_disable) {
        if (log_ptr < log_end)
            *log_ptr++ = (char)c;        
        else 
            g_log_miss_chrs++;
    } else {
        PutUARTByte(c);
    }
}
示例#2
0
static int uart_send(u8 *buf, u32 len)
{
    if (CFG_UART_META != CFG_UART_LOG)
        mtk_serial_set_current_uart(CFG_UART_META);

    while (len--) {
        PutUARTByte(*buf++);
    }

    if (CFG_UART_META != CFG_UART_LOG)
        mtk_serial_set_current_uart(CFG_UART_LOG);

    return 0;
}
/**********************************************************
Description : debug print used internally
Input       : Buffer pointer, value to convert.
Output      : None
***********************************************************/
void bl_print_internal(LOG_LEVEL level, kal_char *fmt, va_list ap)
{
   kal_int64   dval;
   kal_int32    ival;
   kal_char    *p, *sval;
   kal_char    *bp, cval;
   kal_int32    fract;
#ifdef __ADV_DBG_PRINT__
   kal_uint32 uival, uival1, uival2;
   kal_char *bp_old;
   kal_int32 i, j;
#endif /* __ADV_DBG_PRINT__ */

   bp= buf;
   *bp= 0;
   
   if((level) < debug_level)
   {
      return;
   }

   for (p= fmt; *p; p++)
   {
      if (*p != '%')
      {
         *bp++= *p;
         continue;
      }
      switch (*++p) 
      {
         case 'd':
            ival= va_arg(ap, kal_int32);
            if (ival < 0)
            {
               *bp++= '-';
               ival= -ival;
            }
            itoa (&bp, ival, 10);
            break;
         
         case 'o':
            ival= va_arg(ap, kal_int32);
            if (ival < 0)
            {
               *bp++= '-';
              ival= -ival;
            }
            *bp++= '0';
            itoa (&bp, ival, 8);
            break;
         
         case 'x':
            ival= va_arg(ap, kal_int32);
            if (ival < 0)
            {
              *bp++= '-';
              ival= -ival;
            }
            *bp++= '0';
            *bp++= 'x';
            itoa (&bp, ival, 16);
            break;

#ifdef __ADV_DBG_PRINT__
         case 'u':
            uival= va_arg(ap, unsigned int);
            *bp++= '0';
            *bp++= 'x';
            bp_old = bp;
            uival1 = uival >> 16;
            uival2 = uival & 0x0000ffff;
            itoa(&bp, uival1, 16);
            i = (unsigned int)bp - (unsigned int)bp_old;
            if (i < 4) {           
                for (j = 3; j > (3 - i); j--) {
                    bp_old[j] = bp_old[j - (3 - i) - 1];
                }          
                for (j = 0; j <= (3 - i); j++)
                    bp_old[j] = '0';
            }
            bp = bp_old + 4;
            bp_old = bp;
            itoa(&bp, uival2, 16);
            i = (unsigned int)bp - (unsigned int)bp_old;
            if (i < 4) {            
                for (j = 3; j > (3 - i); j--) {
                    bp_old[j] = bp_old[j - (3 - i) - 1];
                }            
                for (j = 0; j <= (3 - i); j++)
                    bp_old[j] = '0';
            }
            bp = bp_old + 4;
            break;
#endif /* __ADV_DBG_PRINT__ */
         
         case 'p':
            ival= va_arg(ap, kal_int32);
            *bp++= '0';
            *bp++= 'x';
            itoa (&bp, ival, 16);
            break;
         
         case 'c':
            cval= va_arg(ap, kal_int32);
            *bp++= cval;
            break;
         
         case 'f':
            dval= va_arg(ap, kal_int64);
            if (dval < 0)
            {
               *bp++= '-';
               dval= -dval;
            }
            if (dval >= 1.0)
               itoa (&bp, (kal_int32)dval, 10);
             else
               *bp++= '0';
            *bp++= '.';
            fract= (kal_int32)((dval- (kal_int64)(kal_int32)dval)*(kal_int64)(MAXFRACT));
            itof(&bp, fract);
            break;
         
         case 's':
            for (sval = va_arg(ap, kal_char *) ; *sval ; sval++ )
               *bp++= *sval;
            break;
      }
   }
   
   *bp= 0;
   
   for (bp= buf; *bp; bp++) 
   {
      PutUARTByte(*bp);
   } 
}
示例#4
0
文件: w32_uart.c 项目: 12019/mtktest
void PutUARTBytes(UART_PORT port, kal_uint8 *data,kal_uint16 len)
{
   kal_uint16 index;
   for(index=0;index<len;index++)
      PutUARTByte(port,*(data+index));
}
示例#5
0
文件: bl_Init.c 项目: 12019/mtktest
/**********************************************************
Description : HW ID check with software load version
Input       : None
Output      : None
***********************************************************/
void INT_Version_Check(void)
{
   volatile register kal_uint16 HwCode;
   register kal_uint8 HExtra = ' ';
   register kal_uint16 BuildCode;
   register kal_int32 i;
   
   HwCode = *HW_CODE;
   BuildCode = *HW_VER;
   
   // MT6217AT/AN
   if ((HwCode == 0x6218) && (BuildCode == 0x8B03))
   {
      HwCode = 0x6217;
   }
   // MT6223P
   else if ((HwCode == 0x6223) && (*((volatile kal_uint16 *)(CONFIG_base+0xf010)) & 0x8000))
   {
      HExtra = 'P';
   }
   // MT6226M
   else if ((HwCode == 0x6219) && ((BuildCode & 0xFF00) == 0x8B00))
   {
      HwCode = 0x6226;
      HExtra = 'M';
   }
   // MT6226D
   else if ((HwCode == 0x6226) && ((BuildCode & 0xFF00) == 0x8D00))
   {
      HExtra = 'D';
   }
   // MT6227D
   else if ((HwCode == 0x6227) && ((BuildCode & 0xFF00) == 0x8D00))
   {
      HExtra = 'D';
   }

#if defined(MT6205B)
   BuildCode = 0x6205;
#elif defined(MT6217)
   BuildCode = 0x6217;
#elif defined(MT6219)
   BuildCode = 0x6219;
#elif defined(MT6223)
   BuildCode = 0x6223;
#elif defined (MT6223P)
   BuildCode = 0x6223;
   #define	ExtraVer 'P'
#elif defined(MT6225)
   BuildCode = 0x6225;
#elif defined(MT6226)
   BuildCode = 0x6226;
#elif defined(MT6226D)
   BuildCode = 0x6226;
   #define	ExtraVer 'D'
#elif defined(MT6226M)
   BuildCode = 0x6226;
   #define	ExtraVer 'M'
#elif defined(MT6227)
   BuildCode = 0x6227;
#elif defined(MT6227D)
   BuildCode = 0x6227;
   #define	ExtraVer 'D'
#elif defined(MT6228)
   BuildCode = 0x6228;
#elif defined(MT6229)
   BuildCode = 0x6229;
#elif defined(MT6230)
   BuildCode = 0x6230;
#else
   BuildCode = 0;
#endif

#ifndef ExtraVer
   #define	ExtraVer ' '
#endif

   if ((HwCode != BuildCode) || (HExtra != ExtraVer))
   {
      PutUARTByte('@');
      while(1)
      {
         PutUARTByte(' ');
         PutUARTByte('H');
         PutUARTByte('W');
         PutUARTByte('=');
         PutUARTByte('M');
         PutUARTByte('T');
         for(i = 12; i >= 0; i -= 4)
         {
            PutUARTByte('0' + ((HwCode >> i) & 0x0F));
         }
         PutUARTByte(HExtra);
         PutUARTByte(',');
         PutUARTByte(' ');
         PutUARTByte('S');
         PutUARTByte('W');
         PutUARTByte('=');
         PutUARTByte('M');
         PutUARTByte('T');
         for(i = 12; i >= 0; i -= 4)
         {
            PutUARTByte('0' + ((BuildCode >> i) & 0x0F));
         }
         PutUARTByte(ExtraVer);
         PutUARTByte(' ');
         PutUARTByte('\r');
         PutUARTByte('\n');
         
         for(i = 0xFFFFF; i > 0; i--) ;
         PutUARTByte('#');
      }
   }