aboutsummaryrefslogtreecommitdiffstats
path: root/docs/i2c_driver.md
Commit message (Expand)AuthorAgeFilesLines
* Update i2c_driver.md (#10131)Ikta2020-08-221-2/+2
* [Docs] Random Fixes (#8340)James Young2020-03-151-12/+12
* [Docs] Update to I2C docs: Clarify address expectation and return values (#8413)brickbots2020-03-151-11/+24
* [Docs] Update i2c_driver.md (#6665)Elliot Powell2019-09-031-1/+1
* Removed prescaler define from avr i2c, as it was impossible to use (#6617)Mikkel Jeppesen2019-08-301-1/+0
* Add ARM I2Cv1 support to i2c_master (#6262)Joel Challis2019-07-161-2/+18
* Parameterise STM32 I2C pin modes and timing parameters. (#5671)Nick Brassel2019-06-011-5/+24
* Next set of split_common changes (#4974)James Churchill2019-03-121-1/+1
* Add documentation for led matrixskullY2019-02-101-7/+11
* Remove duplicate row from Available functions table in i2c_driver doc (#4416)Junya Ogura2018-11-131-1/+0
* I2C driver docs (#4298)yiancar2018-11-101-0/+83
0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * printf.c:  Internal prom library printf facility.
 *
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
 *
 * We used to warn all over the code: DO NOT USE prom_printf(),
 * and yet people do. Anton's banking code was outputting banks
 * with prom_printf for most of the 2.4 lifetime. Since an effective
 * stick is not available, we deployed a carrot: an early printk
 * through PROM by means of -p boot option. This ought to fix it.
 * USE printk; if you need, deploy -p.
 */

#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/spinlock.h>

#include <asm/openprom.h>
#include <asm/oplib.h>

#define CONSOLE_WRITE_BUF_SIZE	1024

static char ppbuf[1024];
static char console_write_buf[CONSOLE_WRITE_BUF_SIZE];
static DEFINE_RAW_SPINLOCK(console_write_lock);

void notrace prom_write(const char *buf, unsigned int n)
{
	unsigned int dest_len;
	unsigned long flags;
	char *dest;

	dest = console_write_buf;
	raw_spin_lock_irqsave(&console_write_lock, flags);

	dest_len = 0;
	while (n-- != 0) {
		char ch = *buf++;
		if (ch == '\n') {
			*dest++ = '\r';
			dest_len++;
		}
		*dest++ = ch;
		dest_len++;
		if (dest_len >= CONSOLE_WRITE_BUF_SIZE - 1) {
			prom_console_write_buf(console_write_buf, dest_len);
			dest = console_write_buf;
			dest_len = 0;
		}
	}
	if (dest_len)
		prom_console_write_buf(console_write_buf, dest_len);

	raw_spin_unlock_irqrestore(&console_write_lock, flags);
}

void notrace prom_printf(const char *fmt, ...)
{
	va_list args;
	int i;

	va_start(args, fmt);
	i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
	va_end(args);

	prom_write(ppbuf, i);
}