mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 10:45:22 +00:00
This lets us force the EC to return various error codes, so that we can be sure we're seeing them. BUG=chromium:242706 BRANCH=none TEST=none Trigger various errors like so: ectool test 0 14 ectool test 1 14 ectool test 5 14 ectool test 8 14 ectool test 0 33 Change-Id: Ia951cd7afacdcce6c8ec7d35d3bfb5b113dea694 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59327 Reviewed-by: Randall Spangler <rspangler@chromium.org>
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
/* Copyright (c) 2013 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.
|
|
*/
|
|
|
|
#ifndef _CROS_EC_DEV_H_
|
|
#define _CROS_EC_DEV_H_
|
|
|
|
#include <linux/ioctl.h>
|
|
#include <linux/types.h>
|
|
|
|
#define CROS_EC_DEV_NAME "cros_ec"
|
|
#define CROS_EC_DEV_VERSION "1.0.0"
|
|
|
|
|
|
/*
|
|
* @version: Command version number (often 0)
|
|
* @command: Command to send (EC_CMD_...)
|
|
* @outdata: Outgoing data to EC
|
|
* @outsize: Outgoing length in bytes
|
|
* @indata: Where to put the incoming data from EC
|
|
* @insize: On call, how much we can accept. On return, how much we got.
|
|
* @result: EC's response to the command (separate from communication failure)
|
|
* ioctl returns zero on success, negative on error
|
|
*/
|
|
struct cros_ec_command {
|
|
uint32_t version;
|
|
uint32_t command;
|
|
uint8_t *outdata;
|
|
uint32_t outsize;
|
|
uint8_t *indata;
|
|
uint32_t insize;
|
|
uint32_t result;
|
|
};
|
|
|
|
/*
|
|
* @offset: within EC_LPC_ADDR_MEMMAP region
|
|
* @bytes: number of bytes to read. zero means "read a string" (including '\0')
|
|
* (at most only EC_MEMMAP_SIZE bytes can be read)
|
|
* @buffer: where to store the result
|
|
* ioctl returns the number of bytes read, negative on error
|
|
*/
|
|
struct cros_ec_readmem {
|
|
uint32_t offset;
|
|
uint32_t bytes;
|
|
char *buffer;
|
|
};
|
|
|
|
#define CROS_EC_DEV_IOC ':'
|
|
#define CROS_EC_DEV_IOCXCMD _IOWR(':', 0, struct cros_ec_command)
|
|
#define CROS_EC_DEV_IOCRDMEM _IOWR(':', 1, struct cros_ec_readmem)
|
|
|
|
#endif /* _CROS_EC_DEV_H_ */
|