From owner-freebsd-drivers@FreeBSD.ORG Tue Mar 20 01:43:29 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 EF4111065670; Tue, 20 Mar 2012 01:43:29 +0000 (UTC) (envelope-from yong.fan@exar.com) Received: from smtp1.exar.com (webmail.exar.com [204.154.183.83]) by mx1.freebsd.org (Postfix) with ESMTP id CEDA08FC14; Tue, 20 Mar 2012 01:43:29 +0000 (UTC) Received: from HZU1EXCH02.hq.exar.com (172.18.10.52) by FRE1-CAS.hq.exar.com (10.127.1.162) with Microsoft SMTP Server (TLS) id 8.1.436.0; Mon, 19 Mar 2012 18:43:29 -0700 Received: from HZU1EXCH02.hq.exar.com ([fe80::5528:f080:2385:1c90]) by HZU1EXCH02.hq.exar.com ([fe80::5528:f080:2385:1c90%13]) with mapi; Tue, 20 Mar 2012 09:43:25 +0800 From: Yong Fan To: John Baldwin , "freebsd-drivers@freebsd.org" Date: Tue, 20 Mar 2012 09:43:23 +0800 Thread-Topic: How can I decide whether my code is running in interrupt context or not? Thread-Index: Ac0F5JE1lnduUOCoRHuQCf6FFaeaPQAVi87w Message-ID: <88AB8EB2D3F1D249AE07FAFFF17A396F0384C398AC@HZU1EXCH02.hq.exar.com> References: <88AB8EB2D3F1D249AE07FAFFF17A396F0384C3956A@HZU1EXCH02.hq.exar.com> <201203190924.06912.jhb@freebsd.org> In-Reply-To: <201203190924.06912.jhb@freebsd.org> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, zh-CN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "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: Tue, 20 Mar 2012 01:43:30 -0000 Thanks your warm reply. I see. Thanks Yongfan -----Original Message----- From: John Baldwin [mailto:jhb@freebsd.org] Sent: Monday, March 19, 2012 7:24 AM To: freebsd-drivers@freebsd.org Cc: Yong Fan; drivers@FreeBSD.org Subject: Re: How can I decide whether my code is running in interrupt conte= xt or not? 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 you= r normal interrupt handler and any callout routines that you have. -- John Baldwin The information and any attached documents contained in this message may be confidential and/or legally privileged. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, dissemination, or reproduction is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender immediately by return e-mail and destroy all copies of the original message.