Skip to content

Commit a2408f0

Browse files
committed
piolib: Support larger DMA buffers
Similar to the increase in supported transfer lengths, for performance reasons it may be helpful to allow larger DMA buffers. This requires an updated rp1-pio driver that supports the new ioctl messages, otherwise calls to pio_sm_config_xfer with buffer sizes of 65536 or larger will fail. Signed-off-by: Phil Elwell <[email protected]>
1 parent 0c30b0d commit a2408f0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

piolib/include/rp1_pio_if.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ struct rp1_pio_sm_config_xfer_args {
160160
uint16_t buf_count;
161161
};
162162

163+
struct rp1_pio_sm_config_xfer32_args {
164+
uint16_t sm;
165+
uint16_t dir;
166+
uint32_t buf_size;
167+
uint32_t buf_count;
168+
};
169+
163170
struct rp1_pio_sm_xfer_data_args {
164171
uint16_t sm;
165172
uint16_t dir;
@@ -186,6 +193,7 @@ struct rp1_access_hw_args {
186193
#define PIO_IOC_SM_CONFIG_XFER _IOW(PIO_IOC_MAGIC, 0, struct rp1_pio_sm_config_xfer_args)
187194
#define PIO_IOC_SM_XFER_DATA _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args)
188195
#define PIO_IOC_SM_XFER_DATA32 _IOW(PIO_IOC_MAGIC, 2, struct rp1_pio_sm_xfer_data32_args)
196+
#define PIO_IOC_SM_CONFIG_XFER32 _IOW(PIO_IOC_MAGIC, 3, struct rp1_pio_sm_config_xfer32_args)
189197

190198
#define PIO_IOC_READ_HW _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args)
191199
#define PIO_IOC_WRITE_HW _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args)

piolib/pio_rp1.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,14 @@ static int rp1_ioctl(PIO pio, int request, void *args)
256256
static int rp1_pio_sm_config_xfer(PIO pio, uint sm, uint dir, uint buf_size, uint buf_count)
257257
{
258258
struct rp1_pio_sm_config_xfer_args args = { .sm = sm, .dir = dir, .buf_size = buf_size, .buf_count = buf_count };
259+
struct rp1_pio_sm_config_xfer32_args args32 = { .sm = sm, .dir = dir, .buf_size = buf_size, .buf_count = buf_count };
260+
int err;
259261
check_sm_param(sm);
260-
return rp1_ioctl(pio, PIO_IOC_SM_CONFIG_XFER, &args);
262+
if (buf_size > 0xffff || buf_count > 0xffff)
263+
err = rp1_ioctl(pio, PIO_IOC_SM_CONFIG_XFER32, &args32);
264+
else
265+
err = rp1_ioctl(pio, PIO_IOC_SM_CONFIG_XFER, &args);
266+
return err;
261267
}
262268

263269
static int rp1_pio_sm_xfer_data(PIO pio, uint sm, uint dir, uint data_bytes, void *data)

0 commit comments

Comments
 (0)