Files
OpenCellular/util/comm-host.h
Randall Spangler 7f5f7be3e5 Add memory-mapped data support for I2C and SPI protocols
And fix returning memory-mapped string length on LPC as well.

BUG=chrome-os-partner:11090
TEST=manual

from EC, 'hostevent set 0x40000'
from host, 'ectool eventget' --> should print 0x40000

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I9edbd0a1468b5d4160ce67c471332226e51fa868
Reviewed-on: https://gerrit.chromium.org/gerrit/26719
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-07-07 17:14:18 -07:00

40 lines
1.2 KiB
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.
*/
#ifndef COMM_HOST_H
#define COMM_HOST_H
#include "common.h"
#include "ec_commands.h"
/* Perform initializations needed for subsequent requests
*
* returns 0 in case of success or error code. */
int comm_init(void);
/*
* Send a command to the EC. Returns the length of output data returned (0 if
* none), or a negative number if error; errors are -EC_RES_* constants from
* ec_commands.h.
*/
int ec_command(int command, const void *indata, int insize,
void *outdata, int outsize);
/*
* Return the content of the EC information area mapped as "memory".
* The offsets are defined by the EC_MEMMAP_ constants.
*/
uint8_t read_mapped_mem8(uint8_t offset);
uint16_t read_mapped_mem16(uint8_t offset);
uint32_t read_mapped_mem32(uint8_t offset);
/*
* Read a memory-mapped string at the specified offset and store into buf,
* which must be at least size EC_MEMMAP_TEXT_MAX. Returns the length of
* the copied string, not counting the terminating '\0', or <0 if error.
*/
int read_mapped_string(uint8_t offset, char *buf);
#endif /* COMM_HOST_H */