Skip to content

Conversation

@Donny9
Copy link
Contributor

@Donny9 Donny9 commented Dec 30, 2025

Note: Please adhere to Contributing Guidelines.

Summary

add i3c tools

usage: i3c options...
options:
-b --bus bus to use.
-m --manufid manufacturer ID (upper 16 bits of PID).
-p --partid part ID (lower 32 bits of PID).
-r --read read data.
-w --write Write data block.
-g --get get a dev info.
-h --help Output usage message and exit.

Impact

debug toos for i3c

Testing

local compile test and run i3c tools

nsh> i3c
usage: i3c options...
  options:
  -b --bus     <bus>          bus to use.
  -m --manufid <manufid>      manufacturer ID (upper 16 bits of PID).
  -p --partid  <partid>       part ID (lower 32 bits of PID).
  -r --read    <data length>  read data.
  -w --write   <data block>   Write data block.
  -g --get     <data block>   get a dev info.
  -h --help    Output usage message and exit.

usage: i3c options...
  options:
  -b --bus     <bus>          bus to use.
  -m --manufid <manufid>      manufacturer ID (upper 16 bits of PID).
  -p --partid  <partid>       part ID (lower 32 bits of PID).
  -r --read    <data length>  read data.
  -w --write   <data block>   Write data block.
  -g --get     <data block>   get a dev info.
  -h --help    Output usage message and exit.))

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
FAR uint8_t *tmp;
uint32_t i;

tmp = calloc(xfer->len, sizeof(uint8_t));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the allocation

uint8_t rnw; /* encodes the transfer direction. true for a read, false for a write */
uint16_t len; /* Length of data buffer buffers, in bytes */
FAR uint8_t *data; /* Holds pointer to userspace buffer with transmit data */
uint8_t pad[5];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

****************************************************************************/

static int rx_args_to_xfer(int length, int rnw, FAR uint8_t **data,
FAR char *arg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add const

}

rnw = 1;
length = len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nop

tmp[len] = (uint8_t)strtol(data_ptrs[len], NULL, 0);
}

length = len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nop

case 'b':
break;
case 'r':
if (rx_args_to_xfer(xfers->len, xfers->rnw, &xfers->data,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need increase xfers


break;
case 'w':
if (w_args_to_xfer(xfers->len, &xfers->data, optarg))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

* Private Type
****************************************************************************/

struct i3c_ioc_priv_xfer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use i3c_priv_xfer directly

}

transfers.nxfers = nxfers;
transfers.xfers = (FAR struct i3c_priv_xfer *)xfers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the casst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants