mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
1) GET_TIME function completely broken
it returns time in microseconds instead of HZ (feel difference!) 2) change GET_TIME type to unsigned long in all places to prevent overflow
This commit is contained in:
parent
4540f59ffb
commit
f73cefd412
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1301
@ -225,7 +225,7 @@ extern int hz;
|
||||
* ticks. This can overflow, so the timeout might be real big...
|
||||
*
|
||||
*/
|
||||
extern long get_time(void);
|
||||
extern unsigned long get_time(void);
|
||||
#define GET_TIME() get_time()
|
||||
/*#define GET_TIME() (lbolt) */ /* Returns current time (1/HZ secs since boot) */
|
||||
|
||||
|
@ -102,14 +102,15 @@ static int
|
||||
wait_data_avail (int t)
|
||||
{
|
||||
int loopc = 5000000;
|
||||
unsigned long tt;
|
||||
|
||||
t += GET_TIME ();
|
||||
tt = t + GET_TIME ();
|
||||
do
|
||||
{
|
||||
if (INB (DSP_DATA_AVAIL) & 0x80)
|
||||
return 1;
|
||||
}
|
||||
while (--loopc && GET_TIME () < t);
|
||||
while (--loopc && GET_TIME () < tt);
|
||||
printk ("!data_avail l=%d\n", loopc);
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,9 +81,10 @@ int sb_dsp_command (unsigned char val);
|
||||
int
|
||||
sb_dsp_command (unsigned char val)
|
||||
{
|
||||
int i, limit;
|
||||
int i;
|
||||
unsigned long limit;
|
||||
|
||||
limit = GET_TIME () + 10; /* The timeout is 0.1 secods */
|
||||
limit = GET_TIME () + HZ/10; /* The timeout is 0.1 secods */
|
||||
|
||||
/*
|
||||
* Note! the i<500000 is an emergency exit. The sb_dsp_command() is sometimes
|
||||
|
@ -46,7 +46,7 @@ static int midi_opened[MAX_MIDI_DEV] =
|
||||
static int midi_written[MAX_MIDI_DEV] =
|
||||
{0};
|
||||
|
||||
long seq_time = 0; /* Reference point for the timer */
|
||||
unsigned long seq_time = 0; /* Reference point for the timer */
|
||||
|
||||
#include "tuning.h"
|
||||
|
||||
|
@ -67,12 +67,18 @@ int sndwrite (int dev, struct uio *uio);
|
||||
int sndselect (int dev, int rw);
|
||||
static void sound_mem_init(void);
|
||||
|
||||
unsigned
|
||||
long
|
||||
get_time()
|
||||
{
|
||||
extern struct timeval time;
|
||||
struct timeval timecopy;
|
||||
int x = splclock();
|
||||
|
||||
return(time.tv_usec + (time.tv_sec*1000000));
|
||||
timecopy = time;
|
||||
splx(x);
|
||||
return ((unsigned long)timecopy.tv_usec*HZ)/1000000 +
|
||||
(unsigned long)timecopy.tv_sec*HZ;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user