static char *progname;
extern int errno;
+u32_t system_hz;
/*===========================================================================*
* main *
re_t *rep;
long v;
+ system_hz = sys_hz();
+
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
env_setargs(argc, argv);
tmra_inittimer(&rl_watchdog);
/* Use a synchronous alarm instead of a watchdog timer. */
- sys_setalarm(HZ, 0);
+ sys_setalarm(system_hz, 0);
}
port = mp->DL_PORT;
#define BUF_ALIGNMENT (64*1024)
- if(!(mallocbuf = malloc(BUF_ALIGNMENT + tot_bufsize))) {
+ if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) {
panic("RTL8139","Couldn't allocate kernel buffer",i);
}
- if(OK != (i = sys_umap(SELF, D, (vir_bytes) mallocbuf, tot_bufsize, &buf))) {
- panic("RTL8139","Couldn't re-map malloced buffer",i);
- }
-
/* click-align mallocced buffer. this is what we used to get
* from kmalloc() too.
*/
do {
if (!(rl_inb(port, RL_BMCR) & MII_CTRL_RST))
break;
- } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+ } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
panic("rtl8139","reset PHY failed to complete", NO_NUM);
#endif
do {
if (!(rl_inb(port, RL_CR) & RL_CR_RST))
break;
- } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+ } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
printf("rl_reset_hw: (after reset) port = 0x%x, RL_CR = 0x%x\n",
port, rl_inb(port, RL_CR));
if (rl_inb(port, RL_CR) & RL_CR_RST)
do {
if (!(rl_inb(port, RL_CR) & RL_CR_RE))
break;
- } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+ } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_CR) & RL_CR_RE)
panic("rtl8139","cannot disable receiver", NO_NUM);
do {
if (!(rl_inb(port, RL_CR) & RL_CR_TE))
break;
- } while (getuptime(&t1)==OK && (t1-t0) < HZ);
+ } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_CR) & RL_CR_TE)
{
panic("rtl8139","cannot disable transmitter",
int i;
re_t *rep;
/* Use a synchronous alarm instead of a watchdog timer. */
- sys_setalarm(HZ, 0);
+ sys_setalarm(system_hz, 0);
for (i= 0, rep = &re_table[0]; i<RE_PORT_NR; i++, rep++)
{