From owner-freebsd-drivers@FreeBSD.ORG Mon Mar 19 15:25:47 2012 Return-Path: Delivered-To: drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01B39106566B; Mon, 19 Mar 2012 15:25:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C9E178FC1F; Mon, 19 Mar 2012 15:25:46 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7C82946B17; Mon, 19 Mar 2012 11:25:46 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DEDA9B960; Mon, 19 Mar 2012 11:25:45 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Mon, 19 Mar 2012 09:24:06 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <88AB8EB2D3F1D249AE07FAFFF17A396F0384C3956A@HZU1EXCH02.hq.exar.com> In-Reply-To: <88AB8EB2D3F1D249AE07FAFFF17A396F0384C3956A@HZU1EXCH02.hq.exar.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203190924.06912.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 19 Mar 2012 11:25:46 -0400 (EDT) Cc: Yong Fan , "drivers@FreeBSD.org" Subject: Re: How can I decide whether my code is running in interrupt context or not? X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 15:25:47 -0000 On Thursday, March 15, 2012 10:06:13 pm Yong Fan wrote: > Hi all, > > In Linux, I can use in_interrupt() function. > FreeBSD has such a similar kernel function for drivers? Hmm, we do not, though the only part of your driver that can run in primary interrupt context is an interrupt filter. If you mean interrupt-thread context (i.e. when sleeping is not permitted), then that would apply to your normal interrupt handler and any callout routines that you have. -- John Baldwin