ac74d8b652
Replace the existing Apache 2.0 boilerplate header with an SPDX tag throughout the zephyr code tree. This patch was generated via a script run over the master branch. Also updated doc/porting/application.rst that had a dependency on line numbers in a literal include. Manually updated subsys/logging/sys_log.c that had a malformed header in the original file. Also cleanup several cases that already had a SPDX tag and we either got a duplicate or missed updating. Jira: ZEP-1457 Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c Signed-off-by: David B. Kinder <david.b.kinder@intel.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
/* ipm_console_send.c - Console messages to another processor */
|
|
|
|
/*
|
|
* Copyright (c) 2015 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <errno.h>
|
|
|
|
#include <kernel.h>
|
|
#include <misc/printk.h>
|
|
#include <ipm.h>
|
|
#include <console/ipm_console.h>
|
|
|
|
static struct device *ipm_console_device;
|
|
|
|
static int consoleOut(int character)
|
|
{
|
|
if (character == '\r') {
|
|
return character;
|
|
}
|
|
|
|
/*
|
|
* We just stash the character into the id field and don't supply
|
|
* any extra data
|
|
*/
|
|
ipm_send(ipm_console_device, 1, character, NULL, 0);
|
|
|
|
return character;
|
|
}
|
|
|
|
extern void __printk_hook_install(int (*fn)(int));
|
|
extern void __stdout_hook_install(int (*fn)(int));
|
|
|
|
int ipm_console_sender_init(struct device *d)
|
|
{
|
|
const struct ipm_console_sender_config_info *config_info;
|
|
|
|
config_info = d->config->config_info;
|
|
ipm_console_device = device_get_binding(config_info->bind_to);
|
|
|
|
if (!ipm_console_device) {
|
|
printk("unable to bind IPM console sender to '%s'\n",
|
|
config_info->bind_to);
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (config_info->flags & IPM_CONSOLE_STDOUT) {
|
|
__stdout_hook_install(consoleOut);
|
|
}
|
|
if (config_info->flags & IPM_CONSOLE_PRINTK) {
|
|
__printk_hook_install(consoleOut);
|
|
}
|
|
|
|
return 0;
|
|
}
|