From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <52602ECC.7060800@xenomai.org> Date: Thu, 17 Oct 2013 20:39:08 +0200 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <525EC963.2000005@xenomai.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] Hardware I/O from Userspace List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Drasko DRASKOVIC Cc: "xenomai@xenomai.org" On 10/17/2013 04:57 PM, Drasko DRASKOVIC wrote: > Hi Gilles, > > On Wed, Oct 16, 2013 at 7:14 PM, Gilles Chanteperdrix > wrote: >> On 10/16/2013 06:06 PM, Drasko DRASKOVIC wrote: >>> Hi all, >>> I would like to access to various peripheral and CPU regs of my FPGA >>> from userspace. >>> >>> Is mmap of /dev/mem best way to it, or I should do it from kernelspace >>> via kernel module? >> >> Hi, >> >> The RTDM kernel module is the recommended way, among other things, it may >> be used to prevent several applications to access the registers at the >> same time. > > I will most probably have only one application who access these regs. > > Is not putting this application into the user-space safer - if it > breaks it will not block system? > Did i misunderstand something, or RTDM kernel module is like standard > kernel module - if it has a bug it can break the whole kernel. Yes, but having to separate application from driver is a future proof pattern: the same driver can be used with different applications, and changing hardware does not break the application, you only have to write a driver for the new hardware. -- Gilles.