From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757484AbYEDNtd (ORCPT ); Sun, 4 May 2008 09:49:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755679AbYEDNtY (ORCPT ); Sun, 4 May 2008 09:49:24 -0400 Received: from 178-47-31-89.wifiinternet.cz ([89.31.47.178]:58894 "EHLO seznam.cz" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755244AbYEDNtX (ORCPT ); Sun, 4 May 2008 09:49:23 -0400 From: monstr@seznam.cz To: linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linux-arch@vger.kernel.org, stephen.neuendorffer@xilinx.com, John.Linn@xilinx.com, john.williams@petalogix.com, matthew@wil.cx, will.newton@gmail.com, drepper@redhat.com, microblaze-uclinux@itee.uq.edu.au, grant.likely@secretlab.ca, Michal Simek Subject: [PATCH 20/56] microblaze_v2: heartbeat file Date: Sun, 4 May 2008 13:41:09 +0200 Message-Id: <4df4022e06b9056202cc2fdf0b99deb01563a0fa.1209897266.git.monstr@monstr.eu> X-Mailer: git-send-email 1.5.4.GIT In-Reply-To: References: <1209901305-6404-1-git-send-email-monstr@seznam.cz> <684c36e5ad3f598e5079e88ec195545c4a7150c2.1209897266.git.monstr@monstr.eu> <0674b1f7abb9a3d564b68c95bc28adc2c2fe9551.1209897266.git.monstr@monstr.eu> <9a7c6646e5dd9724c1cf34767adec181481fa3ef.1209897266.git.monstr@monstr.eu> <932956128c9c655a218a940eaf02017a5dd0bdf9.1209897266.git.monstr@monstr.eu> <2f801c33caee22e112af51ae927c264ce99ead01.1209897266.git.monstr@monstr.eu> <2391e49379fb6639f57d9d6e5811f3d49a4c6fda.1209897266.git.monstr@monstr.eu> <0873f3a1f3b72591735c6461b51964693cac52e5.1209897266.git.monstr@monstr.eu> <0ba1f259d3c17eba54e334622493577493f5065f.1209897266.git.monstr@monstr.eu> <694451053534fea7b78fb9d618b53a2b5ebeb602.1209897266.git.monstr@monstr.eu> <625ef466cf121d655539eedc919dd39166087e0c.1209897266.git.monstr@monstr.eu> <378157891bac535dbc55e658d5f03fdd332e85cf.1209897266.git.monstr@monstr.eu> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Simek Signed-off-by: Michal Simek --- arch/microblaze/kernel/heartbeat.c | 37 ++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/heartbeat.c diff --git a/arch/microblaze/kernel/heartbeat.c b/arch/microblaze/kernel/heartbeat.c new file mode 100644 index 0000000..508b463 --- /dev/null +++ b/arch/microblaze/kernel/heartbeat.c @@ -0,0 +1,37 @@ +/* + * arch/microblaze/kernel/heartbeat.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#include +#include +#include +#include + +void heartbeat(void) +{ + static unsigned int cnt, period, dist; + + if (cnt == 0 || cnt == dist) + iowrite32(1, CONFIG_HEART_BEAT_ADDRESS); + else if (cnt == 7 || cnt == dist + 7) + iowrite32(0, CONFIG_HEART_BEAT_ADDRESS); + + if (++cnt > period) { + cnt = 0; + + /* + * The hyperbolic function below modifies the heartbeat period + * length in dependency of the current (5min) load. It goes + * through the points f(0)=126, f(1)=86, f(5)=51, f(inf)->30. + */ + period = ((672 << FSHIFT) / (5 * avenrun[0] + + (7 << FSHIFT))) + 30; + dist = period / 4; + } +} -- 1.5.4.GIT