static void log_msg(struct logmsg_struct *msg)
{
	unsigned char msgtxt[5];
	int mpos = 0;
	switch (msg->ctrl & LOG_TYPE_MASK) {
	case LOG_TYPE_CHAR: {
		uint32_t ch;
		ch = msg->log_data;
		while (ch != 0) {
			msgtxt[mpos++] = ch&0xFF;
			ch >>= 8;
		}
		msgtxt[mpos] = 0;
		log_str(msgtxt);
		break;
	}
	case LOG_TYPE_INTEGER: {
		dbg_raw_nro(msg->ctrl, msg->log_data);
		break;
	}
	default:
		break;
	}
	if (msg->ctrl & LOG_EOL)
		log_eol();
}
/*
 * Collect chars in log_line buffer and output the buffer when it is full.
 * No locking needed because only "mobicore_log" thread updates this buffer.
 */
static void log_char(char ch, uint16_t source)
{
	if (ch == '\n' || ch == '\r') {
		log_eol(source);
		return;
	}

	if (log_line_len >= LOG_LINE_SIZE - 1 || source != prev_source)
		log_eol(source);


	log_line[log_line_len] = ch;
	log_line[log_line_len + 1] = 0;
	log_line_len++;
	prev_eol = false;
	prev_source = source;
}
/**
 * Put a char to the log line if there is enough space if not then also
 * output the line. Assume nobody else is updating the line! */
static void log_char(char ch)
{
	if (ch == '\n' || ch == '\r') {
		log_eol();
		return;
	}

	if (log_line_len >= LOG_LINE_SIZE - 1) {
		printk(KERN_INFO "%s\n", log_line);
		log_line_len = 0;
		log_line[0] = 0;
	}

	log_line[log_line_len] = ch;
	log_line[log_line_len + 1] = 0;
	log_line_len++;
}
示例#4
0
/*
 * Collect chars in log_line buffer and output the buffer when it is full.
 * No locking needed because only "mobicore_log" thread updates this buffer.
 */
static void log_char(char ch)
{
	if (ch == '\n' || ch == '\r') {
		log_eol();
		return;
	}

	if (log_line_len >= LOG_LINE_SIZE - 1) {
		dev_info(mcd, "%s\n", log_line);
		log_line_len = 0;
		log_line[0] = 0;
	}

	log_line[log_line_len] = ch;
	log_line[log_line_len + 1] = 0;
	log_line_len++;
}
static void log_msg(struct logmsg_struct *msg)
{
	switch (msg->ctrl & LOG_TYPE_MASK) {
	case LOG_TYPE_CHAR: {
		uint32_t ch;
		ch = msg->log_data;
		while (ch != 0) {
			log_char(ch & 0xFF, msg->source);
			ch >>= 8;
		}
		break;
	}
	case LOG_TYPE_INTEGER: {
		dbg_raw_nro(msg->ctrl, msg->log_data, msg->source);
		break;
	}
	default:
		break;
	}
	if (msg->ctrl & LOG_EOL)
		log_eol(msg->source);
}