MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / char_dev_write

Function char_dev_write

components/fal/src/fal_rtt.c:370–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370static rt_ssize_t char_dev_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
371{
372 int ret = 0;
373 struct fal_char_device *part;
374
375 part = (struct fal_char_device *) dev;
376 RT_ASSERT(part != RT_NULL);
377
378 if (pos == 0)
379 {
380 fal_partition_erase_all(part->fal_part);
381 }
382 else if (pos + size > part->fal_part->len)
383 {
384 size = part->fal_part->len - pos;
385 }
386
387 ret = fal_partition_write(part->fal_part, pos, buffer, size);
388
389 if (ret != (int) size)
390 ret = 0;
391
392 return ret;
393}
394
395#ifdef RT_USING_DEVICE_OPS
396const static struct rt_device_ops char_dev_ops =

Callers

nothing calls this directly

Calls 2

fal_partition_erase_allFunction · 0.85
fal_partition_writeFunction · 0.85

Tested by

no test coverage detected