mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "dave" <davekern@ihug.co.nz>
To: <linux-kernel@vger.kernel.org>
Subject: error using unsigned long long not working in 2.4.x
Date: Mon, 17 Mar 2003 21:44:16 -0800	[thread overview]
Message-ID: <002d01c2ed11$6ba7a110$0b721cac@stacy> (raw)

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

hi i am writing a kernel 2.4.x driver and need to do maths on 64 bit ints
(unsigned long long)
bcause you can not use the FPU
but when i insmod i get the error unresolved symbol __udivdi3 i need!! 64
bit ints

i have included the code

thank you


[-- Attachment #2: lnvrm_nv05Pramdac.c --]
[-- Type: application/octet-stream, Size: 2231 bytes --]

#include <lnvrm.h>
#include <lnvrm_exports.h>

unsigned long nv05_pramdacPllCalc(struct _lnvrm_objNv01Device  *hw , unsigned long long clock)
{
  unsigned long long refClock  = hw->refClock ;
  unsigned long long vcoMax = 350000000 ;
  unsigned long long vcoMin =         0 ;
  unsigned long long nMax   =       255 ;
  unsigned long long nMin   =         1 ;
  unsigned long long mMax   =        14 ;
  unsigned long long mMin   =         1 ;
  unsigned long long pMax   =         4 ;
  unsigned long long pMin   =         1 ;
  unsigned long long f        ;
  unsigned long long fDif     ;
  unsigned long long fDifBest = ~0x00 ;
  unsigned long long fBest    = 0 ;
  unsigned long long nBest    = nMin ;
  unsigned long long mBest    = mMax ;
  unsigned long long pBest    = pMax ;
  unsigned long long vco   ;
  unsigned long long n     ;
  unsigned long long m     ;
  unsigned long long p     ;
  
  if(clock > vcoMax) clock = vco ;
  
  for(p = pMin ; p <= pMax ; p++) 
    {
      vco = clock * (1 << p) ;
      for(m = mMin ; m <= mMax ; m++)
	{
	  n = vco / (refClock / m) ;
	  if((n >= nMin) & (n <= nMax))
	    {
	      f = refClock / m * n ;
	      if(vco > f)
		fDif = vco - f ;
	      else
		fDif = f   - vco ;
	      if(fDif < fDifBest) { fDifBest = fDif ; fBest = f ; nBest = n ; mBest = m ; pBest = p ; } 
	    }
	}
    }
  printk("nv05_pramdacPllCalc: M:N:P %2.2LX:%2.2LX:%2.2LX f = %Ld Hz out = %Ld Hz\n",
	 mBest,
	 nBest,
	 pBest,
	 clock,
	 fBest / (1 << pBest));

  return((pBest << 16) | (nBest << 8) | mBest) ;
}

void nv05_pramdacSetPllNv(struct _lnvrm_objNv01Device  *hw , unsigned long long clock)
{
  unsigned long value ;
  value = nv05_pramdacPllCalc(hw,clock) ;
  nvr_regw(NV04_PRAMDAC_NVPLL_COEFF , value) ;
}

void nv05_pramdacSetPllMem(struct _lnvrm_objNv01Device  *hw , unsigned long long clock)
{
  unsigned long value ;
  value = nv05_pramdacPllCalc(hw,clock) ;
  nvr_regw(NV04_PRAMDAC_MPLL_COEFF , value) ;
}

void nv05_pramdacSetPllPixel(struct _lnvrm_objNv01Device  *hw , unsigned long long clock)
{
  unsigned long value ;
  value = nv05_pramdacPllCalc(hw,clock) ;
  nvr_regw(NV04_PRAMDAC_VPLL_COEFF , value) ;
}

             reply	other threads:[~2003-03-17  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18  5:44 dave [this message]
2003-03-17  8:54 ` Matti Aarnio
2003-03-17 19:06 ` Randy.Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002d01c2ed11$6ba7a110$0b721cac@stacy' \
    --to=davekern@ihug.co.nz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®