iq31244_7seg.c (140308) | iq31244_7seg.c (140350) |
---|---|
1/* $NetBSD: iq31244_7seg.c,v 1.2 2003/07/15 00:25:01 lukem Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 26 unchanged lines hidden (view full) --- 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38/* 39 * Support for the 7-segment display on the Intel IQ31244. 40 */ 41 42#include <sys/cdefs.h> | 1/* $NetBSD: iq31244_7seg.c,v 1.2 2003/07/15 00:25:01 lukem Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 26 unchanged lines hidden (view full) --- 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38/* 39 * Support for the 7-segment display on the Intel IQ31244. 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/arm/xscale/i80321/iq31244_7seg.c 140308 2005-01-15 18:55:22Z cognet $"); | 43__FBSDID("$FreeBSD: head/sys/arm/xscale/i80321/iq31244_7seg.c 140350 2005-01-16 13:18:52Z cognet $"); |
44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/module.h> 49#include <sys/bus.h> | 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/module.h> 49#include <sys/bus.h> |
50#include <sys/sysctl.h> |
|
50 51#include <machine/bus.h> 52 53#include <arm/xscale/i80321/iq80321reg.h> 54#include <arm/xscale/i80321/iq80321var.h> 55 56#define WRITE(x, v) *((__volatile uint8_t *) (x)) = (v) 57 --- 270 unchanged lines hidden (view full) --- 328 * | | | | 329 * | | | | 330 * | | | | 331 * +-----+ +-----+ 332 */ 333 { ~SEG_B, ~SEG_F }, 334}; 335 | 51 52#include <machine/bus.h> 53 54#include <arm/xscale/i80321/iq80321reg.h> 55#include <arm/xscale/i80321/iq80321var.h> 56 57#define WRITE(x, v) *((__volatile uint8_t *) (x)) = (v) 58 --- 270 unchanged lines hidden (view full) --- 329 * | | | | 330 * | | | | 331 * | | | | 332 * +-----+ +-----+ 333 */ 334 { ~SEG_B, ~SEG_F }, 335}; 336 |
337SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); 338static int freq = 100; 339SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, 340 "7 Seg update frequency"); |
|
336static void 337iq31244_7seg_snake(void) 338{ 339 static int snakefreq; 340 int cur = snakestate; 341 342 snakefreq++; | 341static void 342iq31244_7seg_snake(void) 343{ 344 static int snakefreq; 345 int cur = snakestate; 346 347 snakefreq++; |
343 if ((snakefreq & (0xff))) | 348 if ((snakefreq % freq)) |
344 return; 345 WRITE(IQ80321_7SEG_MSB, snakemap[cur][0]); 346 WRITE(IQ80321_7SEG_LSB, snakemap[cur][1]); 347 348 snakestate = (cur + 1) & 7; 349} 350 351struct iq31244_7seg_softc { --- 34 unchanged lines hidden --- | 349 return; 350 WRITE(IQ80321_7SEG_MSB, snakemap[cur][0]); 351 WRITE(IQ80321_7SEG_LSB, snakemap[cur][1]); 352 353 snakestate = (cur + 1) & 7; 354} 355 356struct iq31244_7seg_softc { --- 34 unchanged lines hidden --- |