Hi, This evening I played with leds...
This may be splitted and incorporated into h4000.c but at the moment is
better to use module... since we could minimize reboot.
well.. h4000 seems to have 4 leds.
Leds is connected to the asic3.
The charger led and a green led in the same socket of the red one of
this use the same address of leds in h1900. We can combinate this led to
get 2 or more colors. (we can play on duty and cycle to make led blinks
or at higher rate we can get different kinds of amber color. - sorry for
my english).
The other 2 leds may be connected to asic3 too but I don't know the
physical location. Perhaps may be useful haret and the shawn tips.
the phisical location of led to use in haret should be
red led location 0x0C0007XX (where XX are frequency parameter)
green led location 0x0C0008XX (where XX are frequency parameter)
insmod h4000_led.ko ; sleep 1; rmmod h4000_led.ko
h4000_led_init: Initializing leds...
h4000_led_init: iPAQ ASIC3 Virtual Address: f3800000
h4000_led_exit: Exiting leds...
Please don't commit yet is really very premature...
ciao
Eddi
make_module.sh: (adjusted from a michaelo mail in h2200 list)
-------------------------------------------------------------------
_KERNELPATH=/ipaq-4100/linux/kernel26/include
#_BASENAME_PATH=arch/arm/mach-pxa/
_BASENAME_PATH=./
_BASENAME=h4000_led
arm-linux-gcc -Wp,-MD,.${_BASENAME}.o.d -nostdinc -iwithprefix include
-D__KERNEL__ \
-Iinclude -I${_KERNELPATH} -I. -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototypes \
-Wno-trigraphs -fno-strict-aliasing -fno-common \
-fno-omit-frame-pointer -mapcs -mno-sched-prolog \
-mapcs-32 -D__LINUX_ARM_ARCH__=5 -march=armv5te \
-mtune=xscale -Wa,-mcpu=xscale -mshort-load-bytes \
-msoft-float -Wa,-mno-fpu -Uarm -Os -DMODULE \
-DKBUILD_BASENAME=${_BASENAME} -DKBUILD_MODNAME=${_BASENAME} \
-c -o ${_BASENAME}.o ${_BASENAME_PATH}${_BASENAME}.c
arm-linux-ld -r -o ${_BASENAME}.ko ${_BASENAME}.o
-------------------------------------------------------------------
h4000_lcd.c
------------------------------------------------------------------- #include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <asm/delay.h>
#include <asm/arch/ipaq.h>
#include <asm/arch/h4000-gpio.h>
//#include <linux/h3600_keyboard.h>
#include <asm/hardware/ipaq-asic3.h>
#define IPAQ_ASIC3_VIRT H3900_ASIC3_VIRT
// Already defined in <asm/hardware/ipaq-asic3.h>
//#define _IPAQ_ASIC3_LED_0_Base 0x700 (Charger LED)
//#define _IPAQ_ASIC3_LED_1_Base 0x800 (Green LED used to make Amber on
charge end)
//#define _IPAQ_ASIC3_LED_2_Base 0x??? Since this is very similar to
h39xx I suppose another address
//#define _IPAQ_ASIC3_LED_3_Base 0x??? is given to turn on blue and
green wifi led but I can't find it yet.
static int h4000_led_init(void)
{
int duty_time = 50;
int cycle_time = 100;
printk("%s: Initializing leds...\n", __FUNCTION__);
// printk("%s: iPAQ ASIC3 Phisical Address...\n", __FUNCTION__,
IPAQ_ASIC3_PHYS);
printk("%s: iPAQ ASIC3 Virtual Address: %08x\n\n", __FUNCTION__,
IPAQ_ASIC3_VIRT);
// LED CRASH?
// IPAQ_ASIC3_LED_TimeBase(IPAQ_ASIC3_VIRT,2) = 0x6 | LEDTBS_BLINK;
// IPAQ_ASIC3_LED_PeriodTime(IPAQ_ASIC3_VIRT,2) = cycle_time;
// IPAQ_ASIC3_LED_DutyTime(IPAQ_ASIC3_VIRT,2) = 0;
// udelay(1);
// IPAQ_ASIC3_LED_DutyTime(IPAQ_ASIC3_VIRT,2) = duty_time;
//
// IPAQ_ASIC3_LED_1_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
// IPAQ_ASIC3_LED_1_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
// IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = 0;
// LED RED
IPAQ_ASIC3_LED_0_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_0_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = 0;
udelay(1);
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = duty_time;
IPAQ_ASIC3_LED_1_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_1_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = 0;
// GREEN LED
/* IPAQ_ASIC3_LED_1_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_1_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = 0;
udelay(1);
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = duty_time;
IPAQ_ASIC3_LED_0_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_0_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = 0;
*/
// YELLOW LED
/* IPAQ_ASIC3_LED_1_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_1_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = 0;
IPAQ_ASIC3_LED_0_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_0_PeriodTime(IPAQ_ASIC3_VIRT) = cycle_time;
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = 0;
udelay(1);
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = duty_time;
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = duty_time;
*/
return 0;
}
static void h4000_led_exit(void)
{
printk("%s: Exiting leds...\n", __FUNCTION__);
// LED OFF
IPAQ_ASIC3_LED_0_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_0_PeriodTime(IPAQ_ASIC3_VIRT) = 1;
IPAQ_ASIC3_LED_0_DutyTime(IPAQ_ASIC3_VIRT) = 0;
IPAQ_ASIC3_LED_1_TimeBase(IPAQ_ASIC3_VIRT) = 0x6 | LEDTBS_BLINK;
IPAQ_ASIC3_LED_1_PeriodTime(IPAQ_ASIC3_VIRT) = 1;
IPAQ_ASIC3_LED_1_DutyTime(IPAQ_ASIC3_VIRT) = 0;
}
module_init(h4000_led_init);
module_exit(h4000_led_exit);
MODULE_AUTHOR(" ");
MODULE_DESCRIPTION(" ");
MODULE_LICENSE("Dual BSD/GPL");
-------------------------------------------------------------------
Received on Fri Apr 02 23:48:18 2004
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:41:51 EDT