<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="ezFormProc_div" style="FONT-SIZE: 10pt; FONT-FAMILY: 굴림">
<div id="msgbody">
<div>Hi, Andre,<br>
I reallize the ioctl function does it all.<br>
I,m home now so I'll check tomorrow. <br>
Thanks!<br>
Chan<br>
<br>
-----원본 메시지-----<br>
<b>보낸사람:</b> "André Marques" <andre.lousa.marques@gmail.com><br>
<b>보낸날짜:</b> 2015-08-19 23:23:03<br>
<b>받는사람:</b> "김찬" <ckim@etri.re.kr><br>
<b>참조:</b> "users@rtems.org" <users@rtems.org><br>
Hello Chan,<br>
<br>
<br>
<br>
On 19-08-2015 13:46, Chan Kim wrote:<br>
<br>
> Hello, rtems folks,<br>
<br>
> 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<br>
<br>
> tryng to test file read and write. File read is done anyway and I can print the file contents.<br>
<br>
> 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.<br>
<br>
><br>
<br>
> somewhere in the driver, there are lines below.<br>
<br>
><br>
<br>
> static const rtems_driver_address_table sd_card_disk_ops = {<br>
<br>
> .initialization_entry = sd_card_disk_init,<br>
<br>
> .open_entry = rtems_blkdev_generic_open,<br>
<br>
> .close_entry = rtems_blkdev_generic_close,<br>
<br>
> .read_entry = rtems_blkdev_generic_read,<br>
<br>
> .write_entry = rtems_blkdev_generic_write,<br>
<br>
> .control_entry = rtems_blkdev_generic_ioctl<br>
<br>
> };<br>
<br>
><br>
<br>
> sc = rtems_io_register_driver( 0, &sd_card_disk_ops, &major);<br>
<br>
><br>
<br>
> 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.<br>
<br>
> Is this normal? Can someone direct me to a good document on how this works or explain it to me?<br>
<br>
> Thanks!<br>
<br>
> Chan<br>
<br>
<br>
<br>
sd_card_disk_init should be creating the disk in the system through <br>
<br>
rtems_disk_create_phys, which takes an IO control handler for the block <br>
<br>
operations. This controller is the one that should be doing your reads <br>
<br>
and writes.<br>
<br>
<br>
<br>
From [1] :<br>
<br>
<br>
<br>
These primitives (except initialize) can be implemented in a generic <br>
<br>
fashion based upon the supplied block device driver IO control handler. <br>
<br>
*Every block device driver should provide an initialize entry point, <br>
<br>
which registers the appropriate IO control handler.*<br>
<br>
<br>
<br>
[1] - <br>
<br>
https://docs.rtems.org/doxygen/cpukit/html/group__rtems__blkdev__generic.html#gab2d9149dc532657053697e5010fffa82<br>
<br>
<br>
<br>
--André Marques<br>
<br>
<br>
<br>
> _______________________________________________<br>
<br>
> users mailing list<br>
<br>
> users@rtems.org<br>
<br>
> http://lists.rtems.org/mailman/listinfo/users<br>
<br>
<br>
<br>
</div>
</div>
</div>
</body>
</html>