Files
OpenCellular/include/host_command.h
Randall Spangler 4c89ccd89e Register host commands the same clever way we do console commands
BUG=none
TEST=run assorted ectool commands

Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
2012-02-28 13:58:34 -08:00

34 lines
937 B
C

/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Host command module for Chrome EC */
#ifndef __CROS_EC_HOST_COMMAND_H
#define __CROS_EC_HOST_COMMAND_H
#include "common.h"
#include "lpc_commands.h"
/* Host command */
struct host_command {
/* Command code. */
int command;
/* Handler for the command; data points to parameters/response. */
enum lpc_status (*handler)(uint8_t *data);
};
/* Called by LPC module when a command is written to one of the
command slots (0=kernel, 1=user). */
void host_command_received(int slot, int command);
/* Register a host command handler */
#define DECLARE_HOST_COMMAND(command, routine) \
const struct host_command __host_cmd_##command \
__attribute__((section(".rodata.hcmds"))) \
= {command, routine}
#endif /* __CROS_EC_HOST_COMMAND_H */