<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div><br></div><div><br>On 25. Jul 2017, at 08:26, Neil Patrao <<a href="mailto:illusion.webs@ymail.com">illusion.webs@ymail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385">></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385">> <span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11141" style="">This depends on whether you are running in kernel mode or in user mode.</span><span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11142" style=""> </span></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385"><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif"><br clear="none"></font></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385"><font id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11202" face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif">My program is running in the kernel mode.</font></div></div></blockquote><div><br></div><div>Just to clarify, do you mean that you are creating a kernel thread via a custom loadable kernel module? I don't know how else you would get a custom program to run in kernel mode in Linux. </div><div><br></div><blockquote type="cite"><div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14430"><span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14431">This is the hardware: </span><a rel="noreferrer" shape="rect" class="yiv2279148208" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14432" target="_blank" href="https://www.aim-online.com/products/hardware/mil-std-1553/ape1553-x.aspx">https://www.aim-online.com/products/hardware/mil-std-1553/ape1553-x.aspx</a></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">It has a board support package which includes the driver and a library to access the hardware.</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">All calls are made using the library. To access the device (under /dev/) via the library, the application</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr">either needs to run as root or the permissions to the device has to be changed.</div></div></blockquote><div><br></div><div>This actually sounds like your code is *not* running in kernel mode, because otherwise there would be no need to use device files. </div><br><blockquote type="cite"><div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr"><br></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr">Below is an excerpt from the BSP manual:</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr"><img src="cid:32ff5e08-3d7d-59f8-3b66-deb4e0a52914@yahoo.com" data-id="inline-image-guid-e77171cf-8fa8-dc87-beac-8dad790d40f0" alt="Inline image" style="width:100%;max-width:615px;max-height:221px;" id="yui_3_16_0_ym19_1_1500962438618_27876"><br><br></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">Also, the programming manual suggests to use 2 separate functions to read/write from hardware.</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">1. In case of accessing from interrupt handler function<br clear="none"></div></div></blockquote><div><br></div><div>Which interrupt handler?</div><br><blockquote type="cite"><div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14498">2. In case of accessing normally from the program</div></div></blockquote><div><br></div><div>You mean from regular process context in user mode?</div><br><blockquote type="cite"><div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14498">This is what got me thinking if the interrupt runs in the process context or not.</div></div></blockquote><div><br></div>Which method are you using?<br><div><br></div><div>- Björn </div></body></html>