19 Commits

Author SHA1 Message Date
Evan Green
73ca38f017 build: Honor CFLAGS
If CFLAGS is set in the environment, it should be used. The Makefile
was previously clobbering it. Now it adds -Wall -g -O2 only if CFLAGS
was not specified.

Signed-off-by: Evan Green <evangreen86@gmail.com>
2019-01-19 12:29:42 -08:00
Bjorn Andersson
17b41035f8 make: Enable QRTR and UDEV by default
Default to support both QRTR based and RPMSG based communication, rather
than none. This default configuration allow us to run the binary on both
SDM845 and DB820c; but still make it possible to disable the RPMSG based
peripheral support when the host doesn't have the cross compile
environment for libudev.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-08-01 23:56:11 -07:00
Bjorn Andersson
de16f5e2a7 diag: Restructure repository
Move router code into "router" and move send_data into "tools", in order
to make things cleaner as the implementation gains further components.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-12 21:56:44 -07:00
Bjorn Andersson
c96d6445c7 qrtr: Introduce initial qrtr support
In recent platforms the previous SMD based transport is replaced by QRTR
sockets, introduce the initial support for this.

This has been tested by booting the modem and sending loopback messages
and retrieving the associated responses. More work is needed to handle
dying remotes etc.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-12 21:56:11 -07:00
Bjorn Andersson
789a9a8fc4 send_data: Introduce crude "send_data" util
Provide a crude tool called "send_data", which can be used to send
single DIAG commands, over the newly added local UNIX socket, and wait
for the responses.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-12 21:56:07 -07:00
Bjorn Andersson
fa22fef49e unix: Implement UNIX socket based local server
In order to interact with the DIAG router locally this introduces a
crude UNIX socket based DM.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-12 21:52:06 -07:00
Bjorn Andersson
0c8d5f50b5 peripheral: Extract rpmsg specifics to separate file
Move the rpmsg based peripheral discovery and communication
implementation, in order to be able to make it depend on the presence of
libudev.h. This is useful as the dependency of this is optional in the
new AF_QIPCRTR based communication model.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-12 21:47:31 -07:00
Bjorn Andersson
365aa41212 dm: Introduce Diagnostic Monitor abstraction
Move common helpers related to "diag clients" into a "Diagnostics
Monitor" implementation. This becomes necessary in order to support
non-HDLC encoding between the DM and device transparently to the
rest of the implementation.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-24 22:10:17 -08:00
Bjorn Andersson
ce085f6055 circ_buf: Introduce circular buffer structure
This introduces a circular buffer and a read operation to store stream
data, from e.g. a TCP stream.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-24 21:38:46 -08:00
Eyal Ilsar
2955443bcc diag: router: Add handling of Logging Configuration command (cmd_id=115)
Implemented and registered a handler for the Logging Configuration command
request.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Move handler to common_cmds.c,
	abstract broadcasting the logmask to all peripherals,
	replace posix_memalign with malloc]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
d90a511b65 diag: masks: Add support for masks
Added support for managing masks.
Note that some masks are built from hardcoded lists but are also modified
at runtime and are kept in memory.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Omit debug prints, use malloc instead of posix_memalign]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
465f028820 diag: router: Add infrastructure for apps command registration
1) Added command key generation macros.
2) Added a utility command registration call that creates a command
instance for a given key and adds it to the given commands list.

Change-Id: Ibc4f451cd60d7bb6a6e751137f50545a31645d5b
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
8e6ec12a65 diag: router: Separate the router layer
Move request command routing logic to separate file.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Omit debug mask pieces]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
eff5c09208 diag: transport: Add support for USB connection to host PC
Add the option to connect to a host PC connected via a USB cable.
Configure the USB via the following command line option:
-g <gadget device name[#serial number]>
The device name is typically /dev/ffs_diag.
Note that this is based on a user space erected driver using configfs and
requires a gadget and diag function file system nodes to be setup a priori.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved to usb.c, replaced transport wrapper]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:08 -08:00
Eyal Ilsar
258e749d6f diag: transport: Add support for UART connection to host PC
Add the option to connect to a host PC connected via a UART cable.
Configure the UART via the following command line option:
-u <uart device name[@baudrate]>
The device name is typically /dev/ttyMSM1 and the baud rate 115200.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved code to uart.c, modified initialization from main,
	made uart register iself as client]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:44 -08:00
Eyal Ilsar
adcfe45ded diag: transport: Separate the socket connect call
First move in separating the transport layer from the main code so to
enable support for other connections besides socket based.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Retained original implementation,
	dropped now unnecessary includes from diag.c,
	moved implementation to socket.c]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00
Bjorn Andersson
58cf9ddb2e hdlc: Replace borrowed CRC implementation
The CRC implementation previously included was borrowed from the Linux
kernel, it's removed and instead a new implementation, based on [1], is
introduced.

[1] http://www.ross.net/crc/download/crc_v3.txt

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-02-13 01:07:31 -08:00
Bjorn Andersson
ed3c97ac76 diag: Add dynamic peripheral support
Add support for detecting peripherals as they come and go.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-30 22:50:15 -08:00
Bjorn Andersson
9cbdac263d diag: Initial prototype of diag router
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-27 23:29:26 -08:00