회신: Re: a question about SD card rtems_blkdev_generic functions
김찬
ckim at etri.re.kr
Wed Aug 19 15:19:53 UTC 2015
Hi, Andre,
I reallize the ioctl function does it all.
I,m home now so I'll check tomorrow.
Thanks!
Chan
-----원본 메시지-----
보낸사람: "André Marques"
보낸날짜: 2015-08-19 23:23:03
받는사람: "김찬"
참조: "users at rtems.org"
Hello Chan,
On 19-08-2015 13:46, Chan Kim wrote:
> Hello, rtems folks,
> I managed to write an SD card driver on our platform (it was a month ago but I was doing other things lately) and am
> tryng to test file read and write. File read is done anyway and I can print the file contents.
> Couple of days ago I saw block write starting initiated by file write operation, but somehow I don't know how to make block write start.
>
> somewhere in the driver, there are lines below.
>
> static const rtems_driver_address_table sd_card_disk_ops = {
> .initialization_entry = sd_card_disk_init,
> .open_entry = rtems_blkdev_generic_open,
> .close_entry = rtems_blkdev_generic_close,
> .read_entry = rtems_blkdev_generic_read,
> .write_entry = rtems_blkdev_generic_write,
> .control_entry = rtems_blkdev_generic_ioctl
> };
>
> sc = rtems_io_register_driver( 0, &sd_card_disk_ops, &major);
>
> but strangely, even when I read a file successfully(using fopen, fgets) and print it, only rtems_blkdev_generic_open and rtems_blkdev_generic_close function are called and rtems_blkdev_generic_read/write.functions are not called.
> Is this normal? Can someone direct me to a good document on how this works or explain it to me?
> Thanks!
> Chan
sd_card_disk_init should be creating the disk in the system through
rtems_disk_create_phys, which takes an IO control handler for the block
operations. This controller is the one that should be doing your reads
and writes.
From [1] :
These primitives (except initialize) can be implemented in a generic
fashion based upon the supplied block device driver IO control handler.
*Every block device driver should provide an initialize entry point,
which registers the appropriate IO control handler.*
[1] -
https://docs.rtems.org/doxygen/cpukit/html/group__rtems__blkdev__generic.html#gab2d9149dc532657053697e5010fffa82
--André Marques
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20150819/d3f04b29/attachment.html>
More information about the users
mailing list