diff options
Diffstat (limited to 'firmware')
43 files changed, 936 insertions, 271 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 4b25cf755d..cd628fb683 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -338,6 +338,7 @@ target/sh/archos/player/hwcompat-player.c | |||
338 | target/sh/archos/player/lcd-as-player.S | 338 | target/sh/archos/player/lcd-as-player.S |
339 | target/sh/archos/player/lcd-player.c | 339 | target/sh/archos/player/lcd-player.c |
340 | target/sh/archos/player/power-player.c | 340 | target/sh/archos/player/power-player.c |
341 | target/sh/archos/player/powermgmt-player.c | ||
341 | target/sh/archos/player/usb-player.c | 342 | target/sh/archos/player/usb-player.c |
342 | #endif /* SIMULATOR */ | 343 | #endif /* SIMULATOR */ |
343 | #endif /* ARCHOS_PLAYER */ | 344 | #endif /* ARCHOS_PLAYER */ |
@@ -350,6 +351,7 @@ target/sh/archos/lcd-archos-bitmap.c | |||
350 | target/sh/archos/lcd-as-archos-bitmap.S | 351 | target/sh/archos/lcd-as-archos-bitmap.S |
351 | target/sh/archos/recorder/button-recorder.c | 352 | target/sh/archos/recorder/button-recorder.c |
352 | target/sh/archos/recorder/power-recorder.c | 353 | target/sh/archos/recorder/power-recorder.c |
354 | target/sh/archos/recorder/powermgmt-recorder.c | ||
353 | target/sh/archos/recorder/usb-recorder.c | 355 | target/sh/archos/recorder/usb-recorder.c |
354 | #endif /* SIMULATOR */ | 356 | #endif /* SIMULATOR */ |
355 | #endif /* ARCHOS_RECORDER */ | 357 | #endif /* ARCHOS_RECORDER */ |
@@ -362,6 +364,7 @@ target/sh/archos/lcd-archos-bitmap.c | |||
362 | target/sh/archos/lcd-as-archos-bitmap.S | 364 | target/sh/archos/lcd-as-archos-bitmap.S |
363 | target/sh/archos/fm_v2/button-fm_v2.c | 365 | target/sh/archos/fm_v2/button-fm_v2.c |
364 | target/sh/archos/fm_v2/power-fm_v2.c | 366 | target/sh/archos/fm_v2/power-fm_v2.c |
367 | target/sh/archos/fm_v2/powermgmt-fm_v2.c | ||
365 | target/sh/archos/fm_v2/usb-fm_v2.c | 368 | target/sh/archos/fm_v2/usb-fm_v2.c |
366 | #endif /* SIMULATOR */ | 369 | #endif /* SIMULATOR */ |
367 | #endif /* ARCHOS_FMRECORDER || ARCHOS_RECORDERV2 */ | 370 | #endif /* ARCHOS_FMRECORDER || ARCHOS_RECORDERV2 */ |
@@ -372,6 +375,7 @@ target/sh/archos/lcd-archos-bitmap.c | |||
372 | target/sh/archos/lcd-as-archos-bitmap.S | 375 | target/sh/archos/lcd-as-archos-bitmap.S |
373 | target/sh/archos/ondio/button-ondio.c | 376 | target/sh/archos/ondio/button-ondio.c |
374 | target/sh/archos/ondio/power-ondio.c | 377 | target/sh/archos/ondio/power-ondio.c |
378 | target/sh/archos/ondio/powermgmt-ondio.c | ||
375 | target/sh/archos/ondio/usb-ondio.c | 379 | target/sh/archos/ondio/usb-ondio.c |
376 | #endif /* SIMULATOR */ | 380 | #endif /* SIMULATOR */ |
377 | #endif /* ARCHOS_ONDIOFM || ARCHOS_ONDIOFM */ | 381 | #endif /* ARCHOS_ONDIOFM || ARCHOS_ONDIOFM */ |
@@ -386,6 +390,7 @@ target/arm/sandisk/sansa-e200/backlight-e200.c | |||
386 | target/arm/usb-fw-pp502x.c | 390 | target/arm/usb-fw-pp502x.c |
387 | target/arm/sandisk/sansa-e200/button-e200.c | 391 | target/arm/sandisk/sansa-e200/button-e200.c |
388 | target/arm/sandisk/sansa-e200/power-e200.c | 392 | target/arm/sandisk/sansa-e200/power-e200.c |
393 | target/arm/sandisk/sansa-e200/powermgmt-e200.c | ||
389 | target/arm/i2s-pp.c | 394 | target/arm/i2s-pp.c |
390 | #ifndef BOOTLOADER | 395 | #ifndef BOOTLOADER |
391 | target/arm/sandisk/sansa-e200/audio-e200.c | 396 | target/arm/sandisk/sansa-e200/audio-e200.c |
@@ -401,6 +406,7 @@ target/coldfire/iaudio/adc-iaudio.c | |||
401 | target/coldfire/iaudio/ata-iaudio.c | 406 | target/coldfire/iaudio/ata-iaudio.c |
402 | target/coldfire/iaudio/lcd-remote-iaudio.c | 407 | target/coldfire/iaudio/lcd-remote-iaudio.c |
403 | target/coldfire/iaudio/pcf50606-iaudio.c | 408 | target/coldfire/iaudio/pcf50606-iaudio.c |
409 | target/coldfire/iaudio/powermgmt-iaudio.c | ||
404 | target/coldfire/iaudio/system-iaudio.c | 410 | target/coldfire/iaudio/system-iaudio.c |
405 | target/coldfire/iaudio/usb-iaudio.c | 411 | target/coldfire/iaudio/usb-iaudio.c |
406 | target/coldfire/iaudio/x5/backlight-x5.c | 412 | target/coldfire/iaudio/x5/backlight-x5.c |
@@ -429,6 +435,7 @@ target/coldfire/iaudio/m5/lcd-as-m5.S | |||
429 | target/coldfire/iaudio/m5/lcd-m5.c | 435 | target/coldfire/iaudio/m5/lcd-m5.c |
430 | target/coldfire/iaudio/m5/power-m5.c | 436 | target/coldfire/iaudio/m5/power-m5.c |
431 | target/coldfire/iaudio/pcf50606-iaudio.c | 437 | target/coldfire/iaudio/pcf50606-iaudio.c |
438 | target/coldfire/iaudio/powermgmt-iaudio.c | ||
432 | target/coldfire/iaudio/system-iaudio.c | 439 | target/coldfire/iaudio/system-iaudio.c |
433 | target/coldfire/iaudio/usb-iaudio.c | 440 | target/coldfire/iaudio/usb-iaudio.c |
434 | #ifndef BOOTLOADER | 441 | #ifndef BOOTLOADER |
@@ -459,6 +466,7 @@ target/coldfire/iriver/h300/pcf50606-h300.c | |||
459 | target/coldfire/iriver/h300/lcd-as-h300.S | 466 | target/coldfire/iriver/h300/lcd-as-h300.S |
460 | target/coldfire/iriver/h300/lcd-h300.c | 467 | target/coldfire/iriver/h300/lcd-h300.c |
461 | target/coldfire/iriver/h300/power-h300.c | 468 | target/coldfire/iriver/h300/power-h300.c |
469 | target/coldfire/iriver/h300/powermgmt-h300.c | ||
462 | target/coldfire/iriver/h300/usb-h300.c | 470 | target/coldfire/iriver/h300/usb-h300.c |
463 | #ifndef BOOTLOADER | 471 | #ifndef BOOTLOADER |
464 | target/coldfire/iriver/audio-iriver.c | 472 | target/coldfire/iriver/audio-iriver.c |
@@ -479,6 +487,7 @@ target/coldfire/iriver/h100/button-h100.c | |||
479 | target/coldfire/iriver/h100/lcd-as-h100.S | 487 | target/coldfire/iriver/h100/lcd-as-h100.S |
480 | target/coldfire/iriver/h100/lcd-h100.c | 488 | target/coldfire/iriver/h100/lcd-h100.c |
481 | target/coldfire/iriver/h100/power-h100.c | 489 | target/coldfire/iriver/h100/power-h100.c |
490 | target/coldfire/iriver/h100/powermgmt-h100.c | ||
482 | #ifndef BOOTLOADER | 491 | #ifndef BOOTLOADER |
483 | target/coldfire/iriver/audio-iriver.c | 492 | target/coldfire/iriver/audio-iriver.c |
484 | target/coldfire/iriver/h100/spdif-h100.c | 493 | target/coldfire/iriver/h100/spdif-h100.c |
@@ -498,6 +507,7 @@ target/arm/iriver/h10/backlight-h10.c | |||
498 | target/arm/iriver/h10/button-h10.c | 507 | target/arm/iriver/h10/button-h10.c |
499 | target/arm/iriver/h10/lcd-h10_20gb.c | 508 | target/arm/iriver/h10/lcd-h10_20gb.c |
500 | target/arm/iriver/h10/power-h10.c | 509 | target/arm/iriver/h10/power-h10.c |
510 | target/arm/iriver/h10/powermgmt-h10.c | ||
501 | target/arm/usb-fw-pp502x.c | 511 | target/arm/usb-fw-pp502x.c |
502 | #endif /* SIMULATOR */ | 512 | #endif /* SIMULATOR */ |
503 | #endif /* IRIVER_H10 */ | 513 | #endif /* IRIVER_H10 */ |
@@ -513,6 +523,7 @@ target/arm/iriver/h10/backlight-h10.c | |||
513 | target/arm/iriver/h10/button-h10.c | 523 | target/arm/iriver/h10/button-h10.c |
514 | target/arm/iriver/h10/lcd-h10_5gb.c | 524 | target/arm/iriver/h10/lcd-h10_5gb.c |
515 | target/arm/iriver/h10/power-h10.c | 525 | target/arm/iriver/h10/power-h10.c |
526 | target/arm/iriver/h10/powermgmt-h10.c | ||
516 | target/arm/usb-fw-pp502x.c | 527 | target/arm/usb-fw-pp502x.c |
517 | #endif /* SIMULATOR */ | 528 | #endif /* SIMULATOR */ |
518 | #endif /* IRIVER_H10_5GB */ | 529 | #endif /* IRIVER_H10_5GB */ |
@@ -528,6 +539,7 @@ target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c | |||
528 | target/arm/s3c2440/gigabeat-fx/lcd-as-meg-fx.S | 539 | target/arm/s3c2440/gigabeat-fx/lcd-as-meg-fx.S |
529 | target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | 540 | target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c |
530 | target/arm/s3c2440/gigabeat-fx/power-meg-fx.c | 541 | target/arm/s3c2440/gigabeat-fx/power-meg-fx.c |
542 | target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c | ||
531 | target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c | 543 | target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c |
532 | target/arm/s3c2440/gigabeat-fx/timer-meg-fx.c | 544 | target/arm/s3c2440/gigabeat-fx/timer-meg-fx.c |
533 | target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c | 545 | target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c |
@@ -552,6 +564,7 @@ target/arm/tatung/tpj1022/backlight-tpj1022.c | |||
552 | target/arm/tatung/tpj1022/button-tpj1022.c | 564 | target/arm/tatung/tpj1022/button-tpj1022.c |
553 | target/arm/tatung/tpj1022/lcd-tpj1022.c | 565 | target/arm/tatung/tpj1022/lcd-tpj1022.c |
554 | target/arm/tatung/tpj1022/power-tpj1022.c | 566 | target/arm/tatung/tpj1022/power-tpj1022.c |
567 | target/arm/tatung/tpj1022/powermgmt-tpj1022.c | ||
555 | target/arm/usb-fw-pp502x.c | 568 | target/arm/usb-fw-pp502x.c |
556 | #endif /* SIMULATOR */ | 569 | #endif /* SIMULATOR */ |
557 | #endif /* ELIO_TPJ1022 */ | 570 | #endif /* ELIO_TPJ1022 */ |
@@ -568,6 +581,7 @@ target/arm/ipod/backlight-4g_color.c | |||
568 | target/arm/ipod/button-clickwheel.c | 581 | target/arm/ipod/button-clickwheel.c |
569 | target/arm/ipod/lcd-gray.c | 582 | target/arm/ipod/lcd-gray.c |
570 | target/arm/ipod/power-ipod.c | 583 | target/arm/ipod/power-ipod.c |
584 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
571 | target/arm/usb-fw-pp502x.c | 585 | target/arm/usb-fw-pp502x.c |
572 | #endif /* SIMULATOR */ | 586 | #endif /* SIMULATOR */ |
573 | #endif /* IPOD_4G */ | 587 | #endif /* IPOD_4G */ |
@@ -584,6 +598,7 @@ target/arm/ipod/backlight-4g_color.c | |||
584 | target/arm/ipod/button-clickwheel.c | 598 | target/arm/ipod/button-clickwheel.c |
585 | target/arm/ipod/lcd-color_nano.c | 599 | target/arm/ipod/lcd-color_nano.c |
586 | target/arm/ipod/power-ipod.c | 600 | target/arm/ipod/power-ipod.c |
601 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
587 | target/arm/usb-fw-pp502x.c | 602 | target/arm/usb-fw-pp502x.c |
588 | #endif /* SIMULATOR */ | 603 | #endif /* SIMULATOR */ |
589 | #endif /* IPOD_COLOR */ | 604 | #endif /* IPOD_COLOR */ |
@@ -600,6 +615,7 @@ target/arm/ipod/backlight-nano_video.c | |||
600 | target/arm/ipod/button-clickwheel.c | 615 | target/arm/ipod/button-clickwheel.c |
601 | target/arm/ipod/lcd-color_nano.c | 616 | target/arm/ipod/lcd-color_nano.c |
602 | target/arm/ipod/power-ipod.c | 617 | target/arm/ipod/power-ipod.c |
618 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
603 | target/arm/usb-fw-pp502x.c | 619 | target/arm/usb-fw-pp502x.c |
604 | #endif /* SIMULATOR */ | 620 | #endif /* SIMULATOR */ |
605 | #endif /* IPOD_NANO */ | 621 | #endif /* IPOD_NANO */ |
@@ -615,6 +631,7 @@ target/arm/ipod/adc-ipod-pcf.c | |||
615 | target/arm/ipod/backlight-nano_video.c | 631 | target/arm/ipod/backlight-nano_video.c |
616 | target/arm/ipod/button-clickwheel.c | 632 | target/arm/ipod/button-clickwheel.c |
617 | target/arm/ipod/power-ipod.c | 633 | target/arm/ipod/power-ipod.c |
634 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
618 | target/arm/ipod/video/lcd-video.c | 635 | target/arm/ipod/video/lcd-video.c |
619 | target/arm/usb-fw-pp502x.c | 636 | target/arm/usb-fw-pp502x.c |
620 | #endif /* SIMULATOR */ | 637 | #endif /* SIMULATOR */ |
@@ -631,6 +648,7 @@ target/arm/ipod/3g/backlight-3g.c | |||
631 | target/arm/ipod/button-1g-3g.c | 648 | target/arm/ipod/button-1g-3g.c |
632 | target/arm/ipod/lcd-gray.c | 649 | target/arm/ipod/lcd-gray.c |
633 | target/arm/ipod/power-ipod.c | 650 | target/arm/ipod/power-ipod.c |
651 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
634 | target/arm/usb-fw-pp5002.c | 652 | target/arm/usb-fw-pp5002.c |
635 | #endif /* SIMULATOR */ | 653 | #endif /* SIMULATOR */ |
636 | #endif /* IPOD_3G */ | 654 | #endif /* IPOD_3G */ |
@@ -642,6 +660,7 @@ target/arm/wmcodec-pp.c | |||
642 | target/arm/i2s-pp.c | 660 | target/arm/i2s-pp.c |
643 | target/arm/ipod/1g2g/adc-ipod-1g2g.c | 661 | target/arm/ipod/1g2g/adc-ipod-1g2g.c |
644 | target/arm/ipod/1g2g/backlight-1g2g.c | 662 | target/arm/ipod/1g2g/backlight-1g2g.c |
663 | target/arm/ipod/1g2g/powermgmt-1g2g.c | ||
645 | target/arm/ipod/button-1g-3g.c | 664 | target/arm/ipod/button-1g-3g.c |
646 | target/arm/ipod/lcd-gray.c | 665 | target/arm/ipod/lcd-gray.c |
647 | target/arm/ipod/power-ipod.c | 666 | target/arm/ipod/power-ipod.c |
@@ -661,6 +680,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c | |||
661 | target/arm/ipod/button-mini1g.c | 680 | target/arm/ipod/button-mini1g.c |
662 | target/arm/ipod/lcd-gray.c | 681 | target/arm/ipod/lcd-gray.c |
663 | target/arm/ipod/power-ipod.c | 682 | target/arm/ipod/power-ipod.c |
683 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
664 | target/arm/usb-fw-pp502x.c | 684 | target/arm/usb-fw-pp502x.c |
665 | #endif /* SIMULATOR */ | 685 | #endif /* SIMULATOR */ |
666 | #endif /* IPOD_MINI */ | 686 | #endif /* IPOD_MINI */ |
@@ -677,6 +697,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c | |||
677 | target/arm/ipod/button-clickwheel.c | 697 | target/arm/ipod/button-clickwheel.c |
678 | target/arm/ipod/lcd-gray.c | 698 | target/arm/ipod/lcd-gray.c |
679 | target/arm/ipod/power-ipod.c | 699 | target/arm/ipod/power-ipod.c |
700 | target/arm/ipod/powermgmt-ipod-pcf.c | ||
680 | target/arm/usb-fw-pp502x.c | 701 | target/arm/usb-fw-pp502x.c |
681 | #endif /* SIMULATOR */ | 702 | #endif /* SIMULATOR */ |
682 | #endif /* IPOD_MINI2G */ | 703 | #endif /* IPOD_MINI2G */ |
@@ -688,6 +709,7 @@ target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c | |||
688 | target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c | 709 | target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c |
689 | target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c | 710 | target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c |
690 | target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c | 711 | target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c |
712 | target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c | ||
691 | target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c | 713 | target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c |
692 | #endif | 714 | #endif |
693 | #endif | 715 | #endif |
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 17f06b5cea..5a23b276eb 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h | |||
@@ -106,14 +106,11 @@ | |||
106 | 106 | ||
107 | #define HAVE_MULTIVOLUME | 107 | #define HAVE_MULTIVOLUME |
108 | 108 | ||
109 | /* Type of mobile power */ | ||
110 | #define CONFIG_BATTERY BATT_LIION750 | ||
111 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ | 109 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ |
112 | #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ | 110 | #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ |
113 | #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ | 111 | #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ |
114 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ | 112 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ |
115 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 113 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
116 | #define BATTERY_SCALE_FACTOR 5005 /* ADC should read 0x3ff=5.12V */ | ||
117 | 114 | ||
118 | /* Hardware controlled charging? FIXME */ | 115 | /* Hardware controlled charging? FIXME */ |
119 | #define CONFIG_CHARGING CHARGING_SIMPLE | 116 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index a41c69a7bf..b237bd5804 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -60,15 +60,11 @@ | |||
60 | 60 | ||
61 | #define CONFIG_I2C I2C_PLAYREC | 61 | #define CONFIG_I2C I2C_PLAYREC |
62 | 62 | ||
63 | /* Type of mobile power */ | ||
64 | #define CONFIG_BATTERY BATT_LIION2200 | ||
65 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | 63 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ |
66 | #define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ | 64 | #define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ |
67 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 65 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
68 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 66 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
69 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 67 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
70 | /* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ | ||
71 | #define BATTERY_SCALE_FACTOR 8081 | ||
72 | 68 | ||
73 | /* Hardware controlled charging with monitoring */ | 69 | /* Hardware controlled charging with monitoring */ |
74 | #define CONFIG_CHARGING CHARGING_MONITOR | 70 | #define CONFIG_CHARGING CHARGING_MONITOR |
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 319ad4e916..ba6b714a17 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -79,15 +79,11 @@ | |||
79 | 79 | ||
80 | #define HAVE_HEADPHONE_DETECTION | 80 | #define HAVE_HEADPHONE_DETECTION |
81 | 81 | ||
82 | /* Type of mobile power - check this out */ | ||
83 | #define CONFIG_BATTERY BATT_LIION830 /* could change this later */ | ||
84 | #define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ | 82 | #define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ |
85 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | 83 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ |
86 | #define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */ | 84 | #define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */ |
87 | #define BATTERY_CAPACITY_INC 25 /* capacity increment */ | 85 | #define BATTERY_CAPACITY_INC 25 /* capacity increment */ |
88 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 86 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
89 | /* ADC[0] is (530) at discharge and 625 at full charge */ | ||
90 | #define BATTERY_SCALE_FACTOR 6450 | ||
91 | 87 | ||
92 | /* Hardware controlled charging with monitoring */ | 88 | /* Hardware controlled charging with monitoring */ |
93 | #define CONFIG_CHARGING CHARGING_MONITOR | 89 | #define CONFIG_CHARGING CHARGING_MONITOR |
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 502b5b106e..b54397f46c 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h | |||
@@ -93,14 +93,11 @@ | |||
93 | 93 | ||
94 | #define AB_REPEAT_ENABLE 1 | 94 | #define AB_REPEAT_ENABLE 1 |
95 | 95 | ||
96 | /* Type of mobile power */ | ||
97 | #define CONFIG_BATTERY BATT_LPCS355385 | ||
98 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ | 96 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ |
99 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | 97 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ |
100 | #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ | 98 | #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ |
101 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 99 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
102 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 100 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
103 | #define BATTERY_SCALE_FACTOR 4688 | ||
104 | 101 | ||
105 | /* Hardware controlled charging */ | 102 | /* Hardware controlled charging */ |
106 | #define CONFIG_CHARGING CHARGING_SIMPLE | 103 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 3d6f217ebb..c661e1df14 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -91,14 +91,11 @@ | |||
91 | 91 | ||
92 | #define HAVE_AGC | 92 | #define HAVE_AGC |
93 | 93 | ||
94 | /* Type of mobile power */ | ||
95 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
96 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | 94 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ |
97 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ | 95 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ |
98 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 96 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
99 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 97 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
100 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 98 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
101 | #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ | ||
102 | 99 | ||
103 | /* Hardware controlled charging */ | 100 | /* Hardware controlled charging */ |
104 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 101 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 254f59fa35..d45b6e3064 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h | |||
@@ -79,14 +79,11 @@ | |||
79 | 79 | ||
80 | #define AB_REPEAT_ENABLE 1 | 80 | #define AB_REPEAT_ENABLE 1 |
81 | 81 | ||
82 | /* Type of mobile power */ | ||
83 | #define CONFIG_BATTERY BATT_BP009 | ||
84 | #define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ | 82 | #define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ |
85 | #define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ | 83 | #define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ |
86 | #define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */ | 84 | #define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */ |
87 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 85 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
88 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 86 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
89 | #define BATTERY_SCALE_FACTOR 4688 | ||
90 | 87 | ||
91 | /* Hardware controlled charging */ | 88 | /* Hardware controlled charging */ |
92 | #define CONFIG_CHARGING CHARGING_SIMPLE | 89 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index bf13f3e1d7..6fc9aa2406 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -91,13 +91,11 @@ | |||
91 | 91 | ||
92 | #define HAVE_AGC | 92 | #define HAVE_AGC |
93 | 93 | ||
94 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
95 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | 94 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ |
96 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ | 95 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ |
97 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 96 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
98 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 97 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
99 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 98 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
100 | #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ | ||
101 | 99 | ||
102 | /* Hardware controlled charging */ | 100 | /* Hardware controlled charging */ |
103 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 101 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 91c175fc7d..483582080e 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -88,14 +88,11 @@ | |||
88 | 88 | ||
89 | #define HAVE_AGC | 89 | #define HAVE_AGC |
90 | 90 | ||
91 | /* Type of mobile power */ | ||
92 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
93 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | 91 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ |
94 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ | 92 | #define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ |
95 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 93 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
96 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 94 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
97 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 95 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
98 | #define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ | ||
99 | 96 | ||
100 | /* Hardware controlled charging with monitoring */ | 97 | /* Hardware controlled charging with monitoring */ |
101 | #define CONFIG_CHARGING CHARGING_MONITOR | 98 | #define CONFIG_CHARGING CHARGING_MONITOR |
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index 4ab8e2c0dc..3e98f4e748 100644 --- a/firmware/export/config-iaudiom5.h +++ b/firmware/export/config-iaudiom5.h | |||
@@ -84,15 +84,11 @@ | |||
84 | /* TLV320 has no tone controls, so we use the software ones */ | 84 | /* TLV320 has no tone controls, so we use the software ones */ |
85 | #define HAVE_SW_TONE_CONTROLS | 85 | #define HAVE_SW_TONE_CONTROLS |
86 | 86 | ||
87 | /* Type of mobile power */ | ||
88 | #define X5_BATT_CONFIG 2 | ||
89 | #define CONFIG_BATTERY BATT_IAUDIO_X5M5 | ||
90 | #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ | 87 | #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ |
91 | #define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ | 88 | #define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ |
92 | #define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ | 89 | #define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ |
93 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 90 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
94 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 91 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
95 | #define BATTERY_SCALE_FACTOR 5859 /* (420703125 + 35900) / 71800 */ | ||
96 | 92 | ||
97 | /* Hardware controlled charging? FIXME */ | 93 | /* Hardware controlled charging? FIXME */ |
98 | #define CONFIG_CHARGING CHARGING_SIMPLE | 94 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index c02b2a78f4..c78137c721 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -98,15 +98,11 @@ | |||
98 | /* TLV320 has no tone controls, so we use the software ones */ | 98 | /* TLV320 has no tone controls, so we use the software ones */ |
99 | #define HAVE_SW_TONE_CONTROLS | 99 | #define HAVE_SW_TONE_CONTROLS |
100 | 100 | ||
101 | /* Type of mobile power */ | ||
102 | #define X5_BATT_CONFIG 2 | ||
103 | #define CONFIG_BATTERY BATT_IAUDIO_X5M5 | ||
104 | #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ | 101 | #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ |
105 | #define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ | 102 | #define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ |
106 | #define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ | 103 | #define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ |
107 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 104 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
108 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 105 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
109 | #define BATTERY_SCALE_FACTOR 5859 /* (420703125 + 35900) / 71800 */ | ||
110 | 106 | ||
111 | /* Hardware controlled charging? FIXME */ | 107 | /* Hardware controlled charging? FIXME */ |
112 | #define CONFIG_CHARGING CHARGING_SIMPLE | 108 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index 65915df30e..20421ea5be 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h | |||
@@ -60,14 +60,14 @@ | |||
60 | /* define this if you have a flash memory storage */ | 60 | /* define this if you have a flash memory storage */ |
61 | #define HAVE_FLASH_STORAGE | 61 | #define HAVE_FLASH_STORAGE |
62 | 62 | ||
63 | /* Type of mobile power */ | ||
64 | #define CONFIG_BATTERY BATT_1AA | ||
65 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ | 63 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ |
66 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ | 64 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ |
67 | #define BATTERY_CAPACITY_MAX 2800 /* max. capacity selectable */ | 65 | #define BATTERY_CAPACITY_MAX 2800 /* max. capacity selectable */ |
68 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 66 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
69 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ | 67 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ |
70 | #define BATTERY_SCALE_FACTOR 3000 /* TODO: only roughly correct */ | 68 | |
69 | /* define this if the unit should not shut down on low battery. */ | ||
70 | #define NO_LOW_BATTERY_SHUTDOWN | ||
71 | 71 | ||
72 | #ifndef SIMULATOR | 72 | #ifndef SIMULATOR |
73 | 73 | ||
diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index ff3e7b5636..d51a7437ec 100644 --- a/firmware/export/config-ipod1g2g.h +++ b/firmware/export/config-ipod1g2g.h | |||
@@ -69,14 +69,11 @@ | |||
69 | /* Define this if you can detect headphones */ | 69 | /* Define this if you can detect headphones */ |
70 | #define HAVE_HEADPHONE_DETECTION | 70 | #define HAVE_HEADPHONE_DETECTION |
71 | 71 | ||
72 | /* Type of mobile power */ | ||
73 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
74 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | 72 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ |
75 | #define BATTERY_CAPACITY_MIN 1200 /* min. capacity selectable */ | 73 | #define BATTERY_CAPACITY_MIN 1200 /* min. capacity selectable */ |
76 | #define BATTERY_CAPACITY_MAX 1900 /* max. capacity selectable */ | 74 | #define BATTERY_CAPACITY_MAX 1900 /* max. capacity selectable */ |
77 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 75 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
78 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 76 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
79 | #define BATTERY_SCALE_FACTOR 25882 | ||
80 | 77 | ||
81 | /* Hardware controlled charging? FIXME */ | 78 | /* Hardware controlled charging? FIXME */ |
82 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 79 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 64aa14941b..e4be8c7d6e 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h | |||
@@ -72,14 +72,11 @@ | |||
72 | /* Define this if you can detect headphones */ | 72 | /* Define this if you can detect headphones */ |
73 | #define HAVE_HEADPHONE_DETECTION | 73 | #define HAVE_HEADPHONE_DETECTION |
74 | 74 | ||
75 | /* Type of mobile power */ | ||
76 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
77 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | 75 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ |
78 | #define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ | 76 | #define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ |
79 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ | 77 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ |
80 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 78 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
81 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 79 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
82 | #define BATTERY_SCALE_FACTOR 5865 | ||
83 | 80 | ||
84 | /* Hardware controlled charging? FIXME */ | 81 | /* Hardware controlled charging? FIXME */ |
85 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 82 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 46c1e53235..84c38f8506 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -82,14 +82,11 @@ | |||
82 | /* Define this if you can detect headphones */ | 82 | /* Define this if you can detect headphones */ |
83 | #define HAVE_HEADPHONE_DETECTION | 83 | #define HAVE_HEADPHONE_DETECTION |
84 | 84 | ||
85 | /* Type of mobile power */ | ||
86 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
87 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | 85 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ |
88 | #define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ | 86 | #define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ |
89 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ | 87 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ |
90 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 88 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
91 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 89 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
92 | #define BATTERY_SCALE_FACTOR 5865 | ||
93 | 90 | ||
94 | /* Hardware controlled charging? FIXME */ | 91 | /* Hardware controlled charging? FIXME */ |
95 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 92 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 586d6727bc..c1098c71fe 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -73,14 +73,11 @@ | |||
73 | /* Define this if you can detect headphones */ | 73 | /* Define this if you can detect headphones */ |
74 | #define HAVE_HEADPHONE_DETECTION | 74 | #define HAVE_HEADPHONE_DETECTION |
75 | 75 | ||
76 | /* Type of mobile power */ | ||
77 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
78 | #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ | 76 | #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ |
79 | #define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ | 77 | #define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ |
80 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ | 78 | #define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ |
81 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 79 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
82 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 80 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
83 | #define BATTERY_SCALE_FACTOR 5865 | ||
84 | 81 | ||
85 | /* Hardware controlled charging? FIXME */ | 82 | /* Hardware controlled charging? FIXME */ |
86 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 83 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 3b215a43c5..54d0e2c230 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h | |||
@@ -78,14 +78,11 @@ | |||
78 | /* Define this if you can detect headphones */ | 78 | /* Define this if you can detect headphones */ |
79 | #define HAVE_HEADPHONE_DETECTION | 79 | #define HAVE_HEADPHONE_DETECTION |
80 | 80 | ||
81 | /* Type of mobile power */ | ||
82 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
83 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ | 81 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ |
84 | #define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ | 82 | #define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ |
85 | #define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ | 83 | #define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ |
86 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 84 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
87 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 85 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
88 | #define BATTERY_SCALE_FACTOR 5865 | ||
89 | 86 | ||
90 | /* Hardware controlled charging? FIXME */ | 87 | /* Hardware controlled charging? FIXME */ |
91 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 88 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 76c64f47d4..5a851fffee 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h | |||
@@ -78,14 +78,11 @@ | |||
78 | /* Define this if you can detect headphones */ | 78 | /* Define this if you can detect headphones */ |
79 | #define HAVE_HEADPHONE_DETECTION | 79 | #define HAVE_HEADPHONE_DETECTION |
80 | 80 | ||
81 | /* Type of mobile power */ | ||
82 | #define CONFIG_BATTERY BATT_LIPOL1300 | ||
83 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ | 81 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ |
84 | #define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ | 82 | #define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ |
85 | #define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ | 83 | #define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ |
86 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 84 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
87 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 85 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
88 | #define BATTERY_SCALE_FACTOR 5865 | ||
89 | 86 | ||
90 | /* Hardware controlled charging? FIXME */ | 87 | /* Hardware controlled charging? FIXME */ |
91 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 88 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index a2f9e3249b..d3c229593f 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -79,8 +79,6 @@ | |||
79 | /* define this if you have a flash memory storage */ | 79 | /* define this if you have a flash memory storage */ |
80 | #define HAVE_FLASH_STORAGE | 80 | #define HAVE_FLASH_STORAGE |
81 | 81 | ||
82 | /* Type of mobile power */ | ||
83 | #define CONFIG_BATTERY BATT_LIION300 | ||
84 | #define BATTERY_CAPACITY_DEFAULT 300 /* default battery capacity */ | 82 | #define BATTERY_CAPACITY_DEFAULT 300 /* default battery capacity */ |
85 | #define BATTERY_CAPACITY_MIN 200 /* min. capacity selectable */ | 83 | #define BATTERY_CAPACITY_MIN 200 /* min. capacity selectable */ |
86 | #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ | 84 | #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ |
@@ -101,8 +99,6 @@ | |||
101 | /* Define this if you want to use the PP5020 i2c interface */ | 99 | /* Define this if you want to use the PP5020 i2c interface */ |
102 | #define CONFIG_I2C I2C_PP5020 | 100 | #define CONFIG_I2C I2C_PP5020 |
103 | 101 | ||
104 | #define BATTERY_SCALE_FACTOR 5840 | ||
105 | |||
106 | /* define this if the hardware can be powered off while charging */ | 102 | /* define this if the hardware can be powered off while charging */ |
107 | //#define HAVE_POWEROFF_WHILE_CHARGING | 103 | //#define HAVE_POWEROFF_WHILE_CHARGING |
108 | 104 | ||
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 0f2da5360a..b792f6f5dc 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -8,9 +8,6 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 5 | 9 | #define MODEL_NUMBER 5 |
10 | 10 | ||
11 | /* For battery type (30GB by default, undefine here to use 60/80GB model) */ | ||
12 | #define CONFIG_BATTERY_IPOD_VIDEO_30GB | ||
13 | |||
14 | /* define this if you have recording possibility */ | 11 | /* define this if you have recording possibility */ |
15 | #define HAVE_RECORDING | 12 | #define HAVE_RECORDING |
16 | 13 | ||
@@ -81,22 +78,16 @@ | |||
81 | 78 | ||
82 | /* Type of mobile power */ | 79 | /* Type of mobile power */ |
83 | #if (MEM==32) /* this is the 30GB-model */ | 80 | #if (MEM==32) /* this is the 30GB-model */ |
84 | # define CONFIG_BATTERY BATT_LIION400 | 81 | # define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */ |
85 | # define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */ | 82 | # define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ |
86 | # define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ | 83 | # define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ |
87 | # define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ | ||
88 | # define BATTERY_CAPACITY_INC 50 /* capacity increment */ | ||
89 | # define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
90 | # define BATTERY_SCALE_FACTOR 5865 | ||
91 | #else /* these are the 60/80GB-models */ | 84 | #else /* these are the 60/80GB-models */ |
92 | # define CONFIG_BATTERY BATT_LIION400 /* FIXME: we assume to have same discharge behaviour as 30GB iPOD */ | 85 | # define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */ |
93 | # define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */ | 86 | # define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ |
94 | # define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ | 87 | # define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ |
95 | # define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ | ||
96 | # define BATTERY_CAPACITY_INC 50 /* capacity increment */ | ||
97 | # define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
98 | # define BATTERY_SCALE_FACTOR 5865 | ||
99 | #endif | 88 | #endif |
89 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | ||
90 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
100 | 91 | ||
101 | /* Hardware controlled charging with monitoring */ | 92 | /* Hardware controlled charging with monitoring */ |
102 | #define CONFIG_CHARGING CHARGING_MONITOR | 93 | #define CONFIG_CHARGING CHARGING_MONITOR |
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 335ce855fc..1a288c5c87 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -52,14 +52,14 @@ | |||
52 | /* define this if more than one device/partition can be used */ | 52 | /* define this if more than one device/partition can be used */ |
53 | #define HAVE_MULTIVOLUME | 53 | #define HAVE_MULTIVOLUME |
54 | 54 | ||
55 | /* Type of mobile power */ | ||
56 | #define CONFIG_BATTERY BATT_3AAA | ||
57 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ | 55 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ |
58 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ | 56 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ |
59 | #define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ | 57 | #define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ |
60 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 58 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
61 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ | 59 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ |
62 | #define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */ | 60 | |
61 | /* define this if the unit should not shut down on low battery. */ | ||
62 | #define NO_LOW_BATTERY_SHUTDOWN | ||
63 | 63 | ||
64 | /* define this if the unit can be powered or charged via USB */ | 64 | /* define this if the unit can be powered or charged via USB */ |
65 | #define HAVE_USB_POWER | 65 | #define HAVE_USB_POWER |
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 0ceb72e936..9d3dd729f2 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h | |||
@@ -41,14 +41,14 @@ | |||
41 | /* define this if more than one device/partition can be used */ | 41 | /* define this if more than one device/partition can be used */ |
42 | #define HAVE_MULTIVOLUME | 42 | #define HAVE_MULTIVOLUME |
43 | 43 | ||
44 | /* Type of mobile power */ | ||
45 | #define CONFIG_BATTERY BATT_3AAA | ||
46 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ | 44 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ |
47 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ | 45 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ |
48 | #define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ | 46 | #define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ |
49 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 47 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
50 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ | 48 | #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ |
51 | #define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */ | 49 | |
50 | /* define this if the unit should not shut down on low battery. */ | ||
51 | #define NO_LOW_BATTERY_SHUTDOWN | ||
52 | 52 | ||
53 | /* define this if the unit can be powered or charged via USB */ | 53 | /* define this if the unit can be powered or charged via USB */ |
54 | #define HAVE_USB_POWER | 54 | #define HAVE_USB_POWER |
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index bd89b0bb2e..723b852d3d 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -27,14 +27,14 @@ | |||
27 | /* Define this for LCD backlight available */ | 27 | /* Define this for LCD backlight available */ |
28 | #define HAVE_BACKLIGHT | 28 | #define HAVE_BACKLIGHT |
29 | 29 | ||
30 | /* Type of mobile power */ | ||
31 | #define CONFIG_BATTERY BATT_4AA_NIMH | ||
32 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | 30 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ |
33 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | 31 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ |
34 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 32 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
35 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 33 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
36 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 34 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
37 | #define BATTERY_SCALE_FACTOR 6546 | 35 | |
36 | /* define this if the unit should not shut down on low battery. */ | ||
37 | #define NO_LOW_BATTERY_SHUTDOWN | ||
38 | 38 | ||
39 | /* Hardware controlled charging */ | 39 | /* Hardware controlled charging */ |
40 | #define CONFIG_CHARGING CHARGING_SIMPLE | 40 | #define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 4569c8bfd0..bb57ba5666 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -51,14 +51,14 @@ | |||
51 | 51 | ||
52 | #define CONFIG_I2C I2C_PLAYREC | 52 | #define CONFIG_I2C I2C_PLAYREC |
53 | 53 | ||
54 | /* Type of mobile power */ | ||
55 | #define CONFIG_BATTERY BATT_4AA_NIMH | ||
56 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | 54 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ |
57 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | 55 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ |
58 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 56 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
59 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 57 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
60 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 58 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
61 | #define BATTERY_SCALE_FACTOR 6465 | 59 | |
60 | /* define this if the unit should not shut down on low battery. */ | ||
61 | #define NO_LOW_BATTERY_SHUTDOWN | ||
62 | 62 | ||
63 | /* Software controlled charging */ | 63 | /* Software controlled charging */ |
64 | #define CONFIG_CHARGING CHARGING_CONTROL | 64 | #define CONFIG_CHARGING CHARGING_CONTROL |
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index d28595d154..f06aa92550 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -57,15 +57,11 @@ | |||
57 | 57 | ||
58 | #define CONFIG_I2C I2C_PLAYREC | 58 | #define CONFIG_I2C I2C_PLAYREC |
59 | 59 | ||
60 | /* Type of mobile power */ | ||
61 | #define CONFIG_BATTERY BATT_LIION2200 | ||
62 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | 60 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ |
63 | #define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ | 61 | #define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ |
64 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | 62 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ |
65 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 63 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
66 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 64 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
67 | /* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ | ||
68 | #define BATTERY_SCALE_FACTOR 8081 | ||
69 | 65 | ||
70 | /* Hardware controlled charging with monitoring */ | 66 | /* Hardware controlled charging with monitoring */ |
71 | #define CONFIG_CHARGING CHARGING_MONITOR | 67 | #define CONFIG_CHARGING CHARGING_MONITOR |
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h index be2da37412..067bb4f6f2 100644 --- a/firmware/export/config-tpj1022.h +++ b/firmware/export/config-tpj1022.h | |||
@@ -57,8 +57,6 @@ | |||
57 | /* Define this for LCD backlight available */ | 57 | /* Define this for LCD backlight available */ |
58 | #define HAVE_BACKLIGHT | 58 | #define HAVE_BACKLIGHT |
59 | 59 | ||
60 | /* Type of mobile power */ | ||
61 | #define CONFIG_BATTERY BATT_LPCS355385 | ||
62 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity | 60 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity |
63 | TODO: check this, probably different | 61 | TODO: check this, probably different |
64 | for different models too */ | 62 | for different models too */ |
@@ -66,7 +64,6 @@ | |||
66 | #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ | 64 | #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ |
67 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ | 65 | #define BATTERY_CAPACITY_INC 10 /* capacity increment */ |
68 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 66 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
69 | #define BATTERY_SCALE_FACTOR 5865 | ||
70 | 67 | ||
71 | /* Hardware controlled charging? FIXME */ | 68 | /* Hardware controlled charging? FIXME */ |
72 | //#define CONFIG_CHARGING CHARGING_SIMPLE | 69 | //#define CONFIG_CHARGING CHARGING_SIMPLE |
diff --git a/firmware/export/config.h b/firmware/export/config.h index df5300c0b8..44583183b1 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -71,20 +71,6 @@ | |||
71 | #define H300_REMOTE 2 | 71 | #define H300_REMOTE 2 |
72 | #define X5_REMOTE 3 | 72 | #define X5_REMOTE 3 |
73 | 73 | ||
74 | /* CONFIG_BATTERY */ | ||
75 | #define BATT_LIION2200 2200 /* FM/V2 recorder type */ | ||
76 | #define BATT_4AA_NIMH 1500 | ||
77 | #define BATT_3AAA 1000 /* Ondio */ | ||
78 | #define BATT_IAUDIO_X5M5 950 | ||
79 | #define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */ | ||
80 | #define BATT_LPCS355385 1550 /* iriver h10 20Gb - SKC LPCS355385 */ | ||
81 | #define BATT_BP009 820 /* iriver H10 5/6Gb - iriver BP009 */ | ||
82 | #define BATT_LIION830 830 /* Toshiba Gigabeat Fxx and Xxx series MK11-2740 */ | ||
83 | #define BATT_LIION750 750 /* Sansa e200 LiIon 3,7V */ | ||
84 | #define BATT_LIION400 400 /* iPOD 5G/5.5G Video 30GB LiIon 400mAh */ | ||
85 | #define BATT_LIION300 300 /* iPOD nano LiIon 300mAh */ | ||
86 | #define BATT_1AA 333 /* iRiver iFP: Alkaline, NiHM */ | ||
87 | |||
88 | /* CONFIG_CHARGING */ | 74 | /* CONFIG_CHARGING */ |
89 | #define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */ | 75 | #define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */ |
90 | #define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */ | 76 | #define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */ |
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 89a0350bb7..858b5015ec 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef _POWERMGMT_H_ | 19 | #ifndef _POWERMGMT_H_ |
20 | #define _POWERMGMT_H_ | 20 | #define _POWERMGMT_H_ |
21 | 21 | ||
22 | #include <stdbool.h> | ||
23 | |||
22 | #define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */ | 24 | #define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */ |
23 | 25 | ||
24 | #define CHARGE_END_SHORTD 6 /* stop when N minutes have passed with | 26 | #define CHARGE_END_SHORTD 6 /* stop when N minutes have passed with |
@@ -137,6 +139,12 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute | |||
137 | #endif /* not HAVE_MMC */ | 139 | #endif /* not HAVE_MMC */ |
138 | 140 | ||
139 | extern unsigned short power_history[POWER_HISTORY_LEN]; | 141 | extern unsigned short power_history[POWER_HISTORY_LEN]; |
142 | extern const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT]; | ||
143 | extern const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT]; | ||
144 | extern const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11]; | ||
145 | #if CONFIG_CHARGING | ||
146 | extern const unsigned short percent_to_volt_charge[11]; | ||
147 | #endif | ||
140 | 148 | ||
141 | /* Start up power management thread */ | 149 | /* Start up power management thread */ |
142 | void powermgmt_init(void); | 150 | void powermgmt_init(void); |
@@ -146,7 +154,7 @@ void powermgmt_init(void); | |||
146 | /* Returns battery statust */ | 154 | /* Returns battery statust */ |
147 | int battery_level(void); /* percent */ | 155 | int battery_level(void); /* percent */ |
148 | int battery_time(void); /* minutes */ | 156 | int battery_time(void); /* minutes */ |
149 | int battery_adc_voltage(void); /* voltage from ADC in millivolts */ | 157 | unsigned int battery_adc_voltage(void); /* voltage from ADC in millivolts */ |
150 | unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */ | 158 | unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */ |
151 | 159 | ||
152 | /* read unfiltered battery info */ | 160 | /* read unfiltered battery info */ |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 570fcfa065..50a2579cb5 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -175,143 +175,6 @@ static const unsigned char poweroff_idle_timeout_value[15] = | |||
175 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60 | 175 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60 |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
179 | { | ||
180 | #if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder, LiIon */ | ||
181 | 2800 | ||
182 | #elif CONFIG_BATTERY == BATT_3AAA /* Ondio: Alkaline, NiHM */ | ||
183 | 3100, 3450 | ||
184 | #elif CONFIG_BATTERY == BATT_1AA /* iRiver iFP: Alkaline, NiHM */ | ||
185 | 1050, 1150 | ||
186 | #elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0: LiPolymer */ | ||
187 | 3380 | ||
188 | #elif CONFIG_BATTERY == BATT_LIION300 /* ipod nano */ | ||
189 | 3330 | ||
190 | #elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */ | ||
191 | 3450 | ||
192 | #elif CONFIG_BATTERY == BATT_LIION750 /* Sansa e200 */ | ||
193 | 3400 | ||
194 | #elif CONFIG_BATTERY == BATT_LIION830 /* Gigabeat F */ | ||
195 | 3450 | ||
196 | #elif CONFIG_BATTERY == BATT_IAUDIO_X5M5 /* iAudio X5 */ | ||
197 | 3540 | ||
198 | #elif CONFIG_BATTERY == BATT_LPCS355385 /* iriver H10 20GB: LiPolymer*/ | ||
199 | 3760 | ||
200 | #elif CONFIG_BATTERY == BATT_BP009 /* iriver H10 5/6GB: LiPolymer */ | ||
201 | 3720 | ||
202 | #else /* Player/recorder: NiMH */ | ||
203 | 4750 | ||
204 | #endif | ||
205 | }; | ||
206 | |||
207 | static const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
208 | { | ||
209 | #if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder */ | ||
210 | 2580 | ||
211 | #elif CONFIG_BATTERY == BATT_3AAA /* Ondio */ | ||
212 | 2700, 2800 | ||
213 | #elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver Hxxx */ | ||
214 | 3020 | ||
215 | #elif CONFIG_BATTERY == BATT_LIION300 /* ipod nano */ | ||
216 | 3230 | ||
217 | #elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */ | ||
218 | 3450 | ||
219 | #elif CONFIG_BATTERY == BATT_LIION750 /* Sansa e200 */ | ||
220 | 3300 | ||
221 | #elif CONFIG_BATTERY == BATT_LIION830 /* Gigabeat F */ | ||
222 | 3400 | ||
223 | #elif CONFIG_BATTERY == BATT_IAUDIO_X5M5 /* iAudio X5 */ | ||
224 | 3500 | ||
225 | #elif CONFIG_BATTERY == BATT_LPCS355385 /* iriver H10 20GB */ | ||
226 | 3650 | ||
227 | #elif CONFIG_BATTERY == BATT_BP009 /* iriver H10 5/6GB */ | ||
228 | 3650 | ||
229 | #else /* Player/recorder: NiMH */ | ||
230 | 4400 | ||
231 | #endif | ||
232 | }; | ||
233 | |||
234 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
235 | static const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
236 | { | ||
237 | #if CONFIG_BATTERY == BATT_LIION2200 | ||
238 | /* measured values */ | ||
239 | { 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 } | ||
240 | #elif CONFIG_BATTERY == BATT_3AAA | ||
241 | /* measured values */ | ||
242 | { 2800, 3250, 3410, 3530, 3640, 3740, 3850, 3950, 4090, 4270, 4750 }, /* Alkaline */ | ||
243 | { 3100, 3550, 3630, 3690, 3720, 3740, 3760, 3780, 3800, 3860, 4050 } /* NiMH */ | ||
244 | #elif CONFIG_BATTERY == BATT_LIPOL1300 | ||
245 | /* Below 3370 the backlight starts flickering during HD access */ | ||
246 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
247 | #elif CONFIG_BATTERY == BATT_IAUDIO_X5M5 | ||
248 | /* average measured values from X5 and M5L */ | ||
249 | { 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 } | ||
250 | #elif CONFIG_BATTERY == BATT_LPCS355385 | ||
251 | /* iriver H10 20GB */ | ||
252 | { 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 } | ||
253 | #elif CONFIG_BATTERY == BATT_BP009 | ||
254 | /* iriver H10 5/6GB */ | ||
255 | { 3720, 3740, 3800, 3820, 3840, 3880, 3940, 4020, 4060, 4150, 4240 } | ||
256 | #elif CONFIG_BATTERY == BATT_1AA | ||
257 | /* These values are the same as for 3AAA divided by 3. */ | ||
258 | /* May need recalibration. */ | ||
259 | { 930, 1080, 1140, 1180, 1210, 1250, 1280, 1320, 1360, 1420, 1580 }, /* alkaline */ | ||
260 | { 1030, 1180, 1210, 1230, 1240, 1250, 1260, 1270, 1280, 1290, 1350 } /* NiMH */ | ||
261 | #elif CONFIG_BATTERY == BATT_LIION830 | ||
262 | /* Toshiba Gigabeat Li Ion 830mAH figured from discharge curve */ | ||
263 | { 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 }, | ||
264 | #elif CONFIG_BATTERY == BATT_LIION750 | ||
265 | /* Sansa Li Ion 750mAH FIXME this is a first linear approach */ | ||
266 | { 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 }, | ||
267 | #elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */ | ||
268 | /* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */ | ||
269 | { 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 }, | ||
270 | #elif CONFIG_BATTERY == BATT_LIION300 | ||
271 | /* measured values */ | ||
272 | { 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 }, | ||
273 | #else /* NiMH */ | ||
274 | /* original values were taken directly after charging, but it should show | ||
275 | 100% after turning off the device for some hours, too */ | ||
276 | { 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 } | ||
277 | /* orig. values: ...,5280,5600 */ | ||
278 | #endif | ||
279 | }; | ||
280 | |||
281 | #if CONFIG_CHARGING | ||
282 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
283 | static const unsigned short percent_to_volt_charge[11] = | ||
284 | { | ||
285 | #if CONFIG_BATTERY == BATT_LIPOL1300 | ||
286 | /* values measured over one full charging cycle */ | ||
287 | 3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */ | ||
288 | #elif CONFIG_BATTERY == BATT_LIION300 | ||
289 | /* measured values */ | ||
290 | 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 | ||
291 | #elif CONFIG_BATTERY == BATT_LIION400 | ||
292 | /* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */ | ||
293 | 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 | ||
294 | #elif CONFIG_BATTERY == BATT_LIION750 | ||
295 | /* Sansa Li Ion 750mAH FIXME*/ | ||
296 | 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 | ||
297 | #elif CONFIG_BATTERY == BATT_LIION830 | ||
298 | /* Toshiba Gigabeat Li Ion 830mAH */ | ||
299 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 | ||
300 | #elif CONFIG_BATTERY == BATT_LPCS355385 | ||
301 | /* iriver H10 20GB */ | ||
302 | 3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310 | ||
303 | #elif CONFIG_BATTERY == BATT_BP009 | ||
304 | /* iriver H10 5/6GB: Not yet calibrated */ | ||
305 | 3880, 3920, 3960, 4000, 4060, 4100, 4150, 4190, 4240, 4280, 4330 | ||
306 | #else | ||
307 | /* values guessed, see | ||
308 | http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone | ||
309 | measures voltages over a charging cycle */ | ||
310 | 4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */ | ||
311 | #endif | ||
312 | }; | ||
313 | #endif /* CONFIG_CHARGING */ | ||
314 | |||
315 | #if CONFIG_CHARGING == CHARGING_CONTROL | 178 | #if CONFIG_CHARGING == CHARGING_CONTROL |
316 | int long_delta; /* long term delta battery voltage */ | 179 | int long_delta; /* long term delta battery voltage */ |
317 | int short_delta; /* short term delta battery voltage */ | 180 | int short_delta; /* short term delta battery voltage */ |
@@ -340,12 +203,11 @@ int pid_i = 0; /* PID integral term */ | |||
340 | */ | 203 | */ |
341 | static unsigned int avgbat; /* average battery voltage (filtering) */ | 204 | static unsigned int avgbat; /* average battery voltage (filtering) */ |
342 | static unsigned int battery_millivolts;/* filtered battery voltage, millivolts */ | 205 | static unsigned int battery_millivolts;/* filtered battery voltage, millivolts */ |
206 | |||
343 | #ifdef HAVE_CHARGE_CTRL | 207 | #ifdef HAVE_CHARGE_CTRL |
344 | #define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ | 208 | #define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ |
345 | #elif CONFIG_BATTERY == BATT_LIPOL1300 | ||
346 | #define BATT_AVE_SAMPLES 128 /* slow filter for iriver */ | ||
347 | #else | 209 | #else |
348 | #define BATT_AVE_SAMPLES 64 /* medium filter constant for all others */ | 210 | #define BATT_AVE_SAMPLES 128 /* slw filter constant for all others */ |
349 | #endif | 211 | #endif |
350 | 212 | ||
351 | /* battery level (0-100%) of this minute, updated once per minute */ | 213 | /* battery level (0-100%) of this minute, updated once per minute */ |
@@ -373,7 +235,7 @@ static int runcurrent(void); | |||
373 | 235 | ||
374 | void battery_read_info(int *voltage, int *level) | 236 | void battery_read_info(int *voltage, int *level) |
375 | { | 237 | { |
376 | int millivolts = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR / 1000; | 238 | int millivolts = battery_adc_voltage(); |
377 | 239 | ||
378 | if (voltage) | 240 | if (voltage) |
379 | *voltage = millivolts; | 241 | *voltage = millivolts; |
@@ -424,12 +286,6 @@ unsigned int battery_voltage(void) | |||
424 | return battery_millivolts; | 286 | return battery_millivolts; |
425 | } | 287 | } |
426 | 288 | ||
427 | /* Returns battery voltage from ADC [millivolts] */ | ||
428 | int battery_adc_voltage(void) | ||
429 | { | ||
430 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR + 500) / 1000; | ||
431 | } | ||
432 | |||
433 | /* Tells if the battery level is safe for disk writes */ | 289 | /* Tells if the battery level is safe for disk writes */ |
434 | bool battery_level_safe(void) | 290 | bool battery_level_safe(void) |
435 | { | 291 | { |
@@ -487,7 +343,10 @@ static int voltage_to_battery_level(int battery_millivolts) | |||
487 | { | 343 | { |
488 | int level; | 344 | int level; |
489 | 345 | ||
490 | #if defined(CONFIG_CHARGER) && CONFIG_BATTERY == BATT_LIPOL1300 | 346 | #if defined(CONFIG_CHARGER) \ |
347 | && (defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)) | ||
348 | /* Checking for iriver is a temporary kludge. | ||
349 | * This code needs rework/unification */ | ||
491 | if (charger_input_state == NO_CHARGER) { | 350 | if (charger_input_state == NO_CHARGER) { |
492 | /* discharging. calculate new battery level and average with last */ | 351 | /* discharging. calculate new battery level and average with last */ |
493 | level = voltage_to_percent(battery_millivolts, | 352 | level = voltage_to_percent(battery_millivolts, |
@@ -549,7 +408,10 @@ static void battery_status_update(void) | |||
549 | / 100 / (CURRENT_MAX_CHG - runcurrent()); | 408 | / 100 / (CURRENT_MAX_CHG - runcurrent()); |
550 | } | 409 | } |
551 | else | 410 | else |
552 | #elif CONFIG_CHARGING && CONFIG_BATTERY == BATT_LIPOL1300 | 411 | #elif CONFIG_CHARGING \ |
412 | && (defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)) | ||
413 | /* Checking for iriver is a temporary kludge. | ||
414 | * This code needs rework/unification */ | ||
553 | if (charger_inserted()) { | 415 | if (charger_inserted()) { |
554 | #ifdef IRIVER_H300_SERIES | 416 | #ifdef IRIVER_H300_SERIES |
555 | /* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%) | 417 | /* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%) |
@@ -626,9 +488,8 @@ static void handle_auto_poweroff(void) | |||
626 | } | 488 | } |
627 | #endif | 489 | #endif |
628 | 490 | ||
491 | #ifndef NO_LOW_BATTERY_SHUTDOWN | ||
629 | /* switch off unit if battery level is too low for reliable operation */ | 492 | /* switch off unit if battery level is too low for reliable operation */ |
630 | #if (CONFIG_BATTERY!=BATT_4AA_NIMH) && (CONFIG_BATTERY!=BATT_3AAA)&& \ | ||
631 | (CONFIG_BATTERY!=BATT_1AA) | ||
632 | if(battery_millivolts < battery_level_shutoff[battery_type]) { | 493 | if(battery_millivolts < battery_level_shutoff[battery_type]) { |
633 | if(!shutdown_timeout) { | 494 | if(!shutdown_timeout) { |
634 | backlight_on(); | 495 | backlight_on(); |
@@ -837,12 +698,11 @@ static void power_thread_sleep(int ticks) | |||
837 | * likely always be spinning in USB mode). | 698 | * likely always be spinning in USB mode). |
838 | */ | 699 | */ |
839 | if (!ata_disk_is_active() || usb_inserted()) { | 700 | if (!ata_disk_is_active() || usb_inserted()) { |
840 | avgbat += adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR | 701 | avgbat += battery_adc_voltage() - (avgbat / BATT_AVE_SAMPLES); |
841 | - (avgbat / BATT_AVE_SAMPLES); | ||
842 | /* | 702 | /* |
843 | * battery_millivolts is the millivolt-scaled filtered battery value. | 703 | * battery_millivolts is the millivolt-scaled filtered battery value. |
844 | */ | 704 | */ |
845 | battery_millivolts = (avgbat / BATT_AVE_SAMPLES + 500) / 1000; | 705 | battery_millivolts = avgbat / BATT_AVE_SAMPLES; |
846 | 706 | ||
847 | /* update battery status every time an update is available */ | 707 | /* update battery status every time an update is available */ |
848 | battery_status_update(); | 708 | battery_status_update(); |
@@ -858,15 +718,13 @@ static void power_thread_sleep(int ticks) | |||
858 | /* update battery status every time an update is available */ | 718 | /* update battery status every time an update is available */ |
859 | battery_status_update(); | 719 | battery_status_update(); |
860 | 720 | ||
861 | #if (CONFIG_BATTERY!=BATT_4AA_NIMH) && (CONFIG_BATTERY!=BATT_3AAA)&& \ | 721 | #ifndef NO_LOW_BATTERY_SHUTDOWN |
862 | (CONFIG_BATTERY!=BATT_1AA) | ||
863 | if (!shutdown_timeout && | 722 | if (!shutdown_timeout && |
864 | (battery_millivolts < battery_level_shutoff[battery_type])) | 723 | (battery_millivolts < battery_level_shutoff[battery_type])) |
865 | sys_poweroff(); | 724 | sys_poweroff(); |
866 | else | 725 | else |
867 | #endif | 726 | #endif |
868 | avgbat += battery_millivolts * 1000 | 727 | avgbat += battery_millivolts - (avgbat / BATT_AVE_SAMPLES); |
869 | - (avgbat / BATT_AVE_SAMPLES); | ||
870 | } | 728 | } |
871 | 729 | ||
872 | #if CONFIG_CHARGING == CHARGING_CONTROL | 730 | #if CONFIG_CHARGING == CHARGING_CONTROL |
@@ -912,7 +770,7 @@ static void power_thread(void) | |||
912 | #endif | 770 | #endif |
913 | 771 | ||
914 | /* initialize the voltages for the exponential filter */ | 772 | /* initialize the voltages for the exponential filter */ |
915 | avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR + 15000; | 773 | avgbat = battery_adc_voltage() + 15; |
916 | 774 | ||
917 | #ifndef HAVE_MMC /* this adjustment is only needed for HD based */ | 775 | #ifndef HAVE_MMC /* this adjustment is only needed for HD based */ |
918 | /* The battery voltage is usually a little lower directly after | 776 | /* The battery voltage is usually a little lower directly after |
@@ -921,17 +779,18 @@ static void power_thread(void) | |||
921 | if(!charger_inserted()) /* only if charger not connected */ | 779 | if(!charger_inserted()) /* only if charger not connected */ |
922 | #endif | 780 | #endif |
923 | avgbat += (percent_to_volt_discharge[battery_type][6] - | 781 | avgbat += (percent_to_volt_discharge[battery_type][6] - |
924 | percent_to_volt_discharge[battery_type][5]) * 500; | 782 | percent_to_volt_discharge[battery_type][5]) / 2; |
925 | #endif /* not HAVE_MMC */ | 783 | #endif /* not HAVE_MMC */ |
926 | 784 | ||
927 | avgbat = avgbat * BATT_AVE_SAMPLES; | 785 | avgbat = avgbat * BATT_AVE_SAMPLES; |
928 | battery_millivolts = avgbat / BATT_AVE_SAMPLES / 1000; | 786 | battery_millivolts = avgbat / BATT_AVE_SAMPLES; |
929 | 787 | ||
930 | #if CONFIG_CHARGING | 788 | #if CONFIG_CHARGING |
931 | if(charger_inserted()) { | 789 | if(charger_inserted()) { |
932 | battery_percent = voltage_to_percent(battery_millivolts, | 790 | battery_percent = voltage_to_percent(battery_millivolts, |
933 | percent_to_volt_charge); | 791 | percent_to_volt_charge); |
934 | #if CONFIG_BATTERY == BATT_LIPOL1300 | 792 | #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) |
793 | /* Checking for iriver is a temporary kludge. */ | ||
935 | charger_input_state = CHARGER; | 794 | charger_input_state = CHARGER; |
936 | #endif | 795 | #endif |
937 | } else | 796 | } else |
diff --git a/firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c b/firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c new file mode 100644 index 0000000000..fed67f56ef --- /dev/null +++ b/firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | #include "hwcompat.h" | ||
25 | |||
26 | /* FIXME: Properly calibrate values. Current values "inherited" from | ||
27 | * iriver H100 */ | ||
28 | |||
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
30 | { | ||
31 | 3380 | ||
32 | }; | ||
33 | |||
34 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
35 | { | ||
36 | 3020 | ||
37 | }; | ||
38 | |||
39 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
40 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
41 | { | ||
42 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
43 | }; | ||
44 | |||
45 | #if CONFIG_CHARGING | ||
46 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
47 | const unsigned short percent_to_volt_charge[11] = | ||
48 | { | ||
49 | 3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 | ||
50 | }; | ||
51 | #endif /* CONFIG_CHARGING */ | ||
52 | |||
53 | #define BATTERY_SCALE_FACTOR_1G 4200 | ||
54 | #define BATTERY_SCALE_FACTOR_2G 6630 | ||
55 | /* full-scale ADC readout (2^8) in millivolt */ | ||
56 | |||
57 | /* Returns battery voltage from ADC [millivolts] */ | ||
58 | unsigned int battery_adc_voltage(void) | ||
59 | { | ||
60 | unsigned adcval = adc_read(ADC_UNREG_POWER); | ||
61 | |||
62 | if ((IPOD_HW_REVISION >> 16) == 1) | ||
63 | return (adcval * BATTERY_SCALE_FACTOR_1G) >> 8; | ||
64 | else | ||
65 | return (adcval * BATTERY_SCALE_FACTOR_2G) >> 8; | ||
66 | } | ||
diff --git a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c new file mode 100644 index 0000000000..d2f88a20f2 --- /dev/null +++ b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c | |||
@@ -0,0 +1,90 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | #ifdef IPOD_NANO | ||
28 | 3330 | ||
29 | #elif defined IPOD_VIDEO | ||
30 | 3450 | ||
31 | #else | ||
32 | /* FIXME: calibrate value for other 3G+ ipods */ | ||
33 | 3380 | ||
34 | #endif | ||
35 | }; | ||
36 | |||
37 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
38 | { | ||
39 | #ifdef IPOD_NANO | ||
40 | 3230 | ||
41 | #elif defined IPOD_VIDEO | ||
42 | 3450 | ||
43 | #else | ||
44 | /* FIXME: calibrate value for other 3G+ ipods */ | ||
45 | 3020 | ||
46 | #endif | ||
47 | }; | ||
48 | |||
49 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
50 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
51 | { | ||
52 | #ifdef IPOD_NANO | ||
53 | /* measured values */ | ||
54 | { 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 }, | ||
55 | #elif defined IPOD_VIDEO | ||
56 | /* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */ | ||
57 | { 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 }, | ||
58 | #else | ||
59 | /* FIXME: calibrate value for other 3G+ ipods */ | ||
60 | /* Table is "inherited" from iriver H100. */ | ||
61 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
62 | #endif | ||
63 | }; | ||
64 | |||
65 | #if CONFIG_CHARGING | ||
66 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
67 | const unsigned short percent_to_volt_charge[11] = | ||
68 | { | ||
69 | #ifdef IPOD_NANO | ||
70 | /* measured values */ | ||
71 | 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 | ||
72 | #elif defined IPOD_VIDEO | ||
73 | /* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */ | ||
74 | 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 | ||
75 | #else | ||
76 | /* FIXME: calibrate value for other 3G+ ipods */ | ||
77 | /* Table is "inherited" from iriver H100. */ | ||
78 | 3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 | ||
79 | #endif | ||
80 | }; | ||
81 | #endif /* CONFIG_CHARGING */ | ||
82 | |||
83 | #define BATTERY_SCALE_FACTOR 6000 | ||
84 | /* full-scale ADC readout (2^10) in millivolt */ | ||
85 | |||
86 | /* Returns battery voltage from ADC [millivolts] */ | ||
87 | unsigned int battery_adc_voltage(void) | ||
88 | { | ||
89 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
90 | } | ||
diff --git a/firmware/target/arm/iriver/h10/powermgmt-h10.c b/firmware/target/arm/iriver/h10/powermgmt-h10.c new file mode 100644 index 0000000000..18e3879c43 --- /dev/null +++ b/firmware/target/arm/iriver/h10/powermgmt-h10.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | #ifdef IRIVER_H10 | ||
28 | 3760 | ||
29 | #elif defined IRIVER_H10_5GB | ||
30 | 3720 | ||
31 | #endif | ||
32 | }; | ||
33 | |||
34 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
35 | { | ||
36 | #ifdef IRIVER_H10 | ||
37 | 3650 | ||
38 | #elif defined IRIVER_H10_5GB | ||
39 | 3650 | ||
40 | #endif | ||
41 | }; | ||
42 | |||
43 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
44 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
45 | { | ||
46 | #ifdef IRIVER_H10 | ||
47 | { 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 } | ||
48 | #elif defined IRIVER_H10_5GB | ||
49 | { 3720, 3740, 3800, 3820, 3840, 3880, 3940, 4020, 4060, 4150, 4240 } | ||
50 | #endif | ||
51 | }; | ||
52 | |||
53 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
54 | const unsigned short percent_to_volt_charge[11] = | ||
55 | { | ||
56 | #ifdef IRIVER_H10 | ||
57 | 3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310 | ||
58 | #elif defined IRIVER_H10_5GB | ||
59 | /* TODO: Not yet calibrated */ | ||
60 | 3880, 3920, 3960, 4000, 4060, 4100, 4150, 4190, 4240, 4280, 4330 | ||
61 | #endif | ||
62 | }; | ||
63 | |||
64 | #define BATTERY_SCALE_FACTOR 4800 | ||
65 | /* full-scale ADC readout (2^10) in millivolt */ | ||
66 | |||
67 | /* Returns battery voltage from ADC [millivolts] */ | ||
68 | unsigned int battery_adc_voltage(void) | ||
69 | { | ||
70 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
71 | } | ||
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c new file mode 100644 index 0000000000..9fcc150f86 --- /dev/null +++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 1050, 1150 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 1050, 1150 /* FIXME: just copied from above, was missing in powermgmt.c */ | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* These values are the same as for Ondio divided by 3. */ | ||
39 | /* May need recalibration. */ | ||
40 | { 930, 1080, 1140, 1180, 1210, 1250, 1280, 1320, 1360, 1420, 1580 }, /* alkaline */ | ||
41 | { 1030, 1180, 1210, 1230, 1240, 1250, 1260, 1270, 1280, 1290, 1350 } /* NiMH */ | ||
42 | }; | ||
43 | |||
44 | /* TODO: only roughly correct */ | ||
45 | #define BATTERY_SCALE_FACTOR 3072 | ||
46 | /* full-scale ADC readout (2^10) in millivolt */ | ||
47 | |||
48 | /* Returns battery voltage from ADC [millivolts] */ | ||
49 | unsigned int battery_adc_voltage(void) | ||
50 | { | ||
51 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
52 | } | ||
53 | |||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c new file mode 100644 index 0000000000..d38f41dd7b --- /dev/null +++ b/firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3450 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3400 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* Toshiba Gigabeat Li Ion 830mAH figured from discharge curve */ | ||
39 | { 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 }, | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* Toshiba Gigabeat Li Ion 830mAH */ | ||
46 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 | ||
47 | }; | ||
48 | |||
49 | /* ADC[0] is (530) at discharge and 625 at full charge */ | ||
50 | #define BATTERY_SCALE_FACTOR 6605 | ||
51 | /* full-scale ADC readout (2^10) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/arm/sandisk/sansa-e200/powermgmt-e200.c b/firmware/target/arm/sandisk/sansa-e200/powermgmt-e200.c new file mode 100644 index 0000000000..388ebaed43 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-e200/powermgmt-e200.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3400 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3300 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* Sansa Li Ion 750mAH FIXME this is a first linear approach */ | ||
39 | { 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 }, | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* Sansa Li Ion 750mAH FIXME*/ | ||
46 | 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 | ||
47 | }; | ||
48 | |||
49 | /* ADC should read 0x3ff=5.12V */ | ||
50 | #define BATTERY_SCALE_FACTOR 5125 | ||
51 | /* full-scale ADC readout (2^10) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c b/firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c new file mode 100644 index 0000000000..a50932dd92 --- /dev/null +++ b/firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | /* FIXME: All voltages copied from H10 according to the battery type given | ||
26 | * in config-tpj1022.h at the time of splitting. This probably needs changing | ||
27 | * if that port ever gets up to speed. */ | ||
28 | |||
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
30 | { | ||
31 | 3760 | ||
32 | }; | ||
33 | |||
34 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
35 | { | ||
36 | 3650 | ||
37 | }; | ||
38 | |||
39 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
40 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
41 | { | ||
42 | { 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 } | ||
43 | }; | ||
44 | |||
45 | #if CONFIG_CHARGING | ||
46 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
47 | const unsigned short percent_to_volt_charge[11] = | ||
48 | { | ||
49 | 3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310 | ||
50 | }; | ||
51 | #endif /* CONFIG_CHARGING */ | ||
52 | |||
53 | #define BATTERY_SCALE_FACTOR 6000 | ||
54 | /* full-scale ADC readout (2^10) in millivolt */ | ||
55 | |||
56 | /* Returns battery voltage from ADC [millivolts] */ | ||
57 | unsigned int battery_adc_voltage(void) | ||
58 | { | ||
59 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
60 | } | ||
diff --git a/firmware/target/coldfire/iaudio/powermgmt-iaudio.c b/firmware/target/coldfire/iaudio/powermgmt-iaudio.c new file mode 100644 index 0000000000..6e2b19d9b6 --- /dev/null +++ b/firmware/target/coldfire/iaudio/powermgmt-iaudio.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3540 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3500 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* average measured values from X5 and M5L */ | ||
39 | { 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 } | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* TODO: This is identical to the discharge curve. | ||
46 | * Calibrate charging curve using a battery_bench log. */ | ||
47 | 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 | ||
48 | }; | ||
49 | |||
50 | #define BATTERY_SCALE_FACTOR 6000 | ||
51 | /* full-scale ADC readout (2^10) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/coldfire/iriver/h100/powermgmt-h100.c b/firmware/target/coldfire/iriver/h100/powermgmt-h100.c new file mode 100644 index 0000000000..5b3c297715 --- /dev/null +++ b/firmware/target/coldfire/iriver/h100/powermgmt-h100.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3380 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3020 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* Below 3370 the backlight starts flickering during HD access */ | ||
39 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* values measured over one full charging cycle */ | ||
46 | 3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */ | ||
47 | }; | ||
48 | |||
49 | /* FIX: this value is picked at random */ | ||
50 | #define BATTERY_SCALE_FACTOR 4266 | ||
51 | /* full-scale ADC readout (2^8) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 8; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/coldfire/iriver/h300/powermgmt-h300.c b/firmware/target/coldfire/iriver/h300/powermgmt-h300.c new file mode 100644 index 0000000000..b2d844075e --- /dev/null +++ b/firmware/target/coldfire/iriver/h300/powermgmt-h300.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3380 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3020 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* Below 3370 the backlight starts flickering during HD access */ | ||
39 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* values measured over one full charging cycle */ | ||
46 | 3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */ | ||
47 | }; | ||
48 | |||
49 | /* FIX: this value is picked at random */ | ||
50 | #define BATTERY_SCALE_FACTOR 6000 | ||
51 | /* full-scale ADC readout (2^8) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 8; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c b/firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c new file mode 100644 index 0000000000..3b0e7115ed --- /dev/null +++ b/firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 2800 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 2580 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* measured values */ | ||
39 | { 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 } | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* TODO: This is identical to the discharge curve. | ||
46 | * Calibrate charging curve using a battery_bench log. */ | ||
47 | 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 | ||
48 | }; | ||
49 | |||
50 | /* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ | ||
51 | #define BATTERY_SCALE_FACTOR 8275 | ||
52 | /* full-scale ADC readout (2^10) in millivolt */ | ||
53 | |||
54 | /* Returns battery voltage from ADC [millivolts] */ | ||
55 | unsigned int battery_adc_voltage(void) | ||
56 | { | ||
57 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
58 | } | ||
diff --git a/firmware/target/sh/archos/ondio/powermgmt-ondio.c b/firmware/target/sh/archos/ondio/powermgmt-ondio.c new file mode 100644 index 0000000000..8779857db1 --- /dev/null +++ b/firmware/target/sh/archos/ondio/powermgmt-ondio.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3100, 3450 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 2700, 2800 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* measured values */ | ||
39 | { 2800, 3250, 3410, 3530, 3640, 3740, 3850, 3950, 4090, 4270, 4750 }, /* Alkaline */ | ||
40 | { 3100, 3550, 3630, 3690, 3720, 3740, 3760, 3780, 3800, 3860, 4050 } /* NiMH */ | ||
41 | }; | ||
42 | |||
43 | #define BATTERY_SCALE_FACTOR 4849 /* average from 3 Ondios */ | ||
44 | /* full-scale ADC readout (2^10) in millivolt */ | ||
45 | |||
46 | /* Returns battery voltage from ADC [millivolts] */ | ||
47 | unsigned int battery_adc_voltage(void) | ||
48 | { | ||
49 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
50 | } | ||
51 | |||
diff --git a/firmware/target/sh/archos/player/powermgmt-player.c b/firmware/target/sh/archos/player/powermgmt-player.c new file mode 100644 index 0000000000..1a34160d44 --- /dev/null +++ b/firmware/target/sh/archos/player/powermgmt-player.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 4750 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 4400 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* original values were taken directly after charging, but it should show | ||
39 | 100% after turning off the device for some hours, too */ | ||
40 | { 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 } | ||
41 | /* orig. values: ...,5280,5600 */ | ||
42 | }; | ||
43 | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
45 | const unsigned short percent_to_volt_charge[11] = | ||
46 | { | ||
47 | /* values guessed, see | ||
48 | http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone | ||
49 | measures voltages over a charging cycle */ | ||
50 | 4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */ | ||
51 | }; | ||
52 | |||
53 | #define BATTERY_SCALE_FACTOR 6703 | ||
54 | /* full-scale ADC readout (2^10) in millivolt */ | ||
55 | |||
56 | /* Returns battery voltage from ADC [millivolts] */ | ||
57 | unsigned int battery_adc_voltage(void) | ||
58 | { | ||
59 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
60 | } | ||
61 | |||
62 | |||
diff --git a/firmware/target/sh/archos/recorder/powermgmt-recorder.c b/firmware/target/sh/archos/recorder/powermgmt-recorder.c new file mode 100644 index 0000000000..c44076f589 --- /dev/null +++ b/firmware/target/sh/archos/recorder/powermgmt-recorder.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 4750 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 4400 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* original values were taken directly after charging, but it should show | ||
39 | 100% after turning off the device for some hours, too */ | ||
40 | { 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 } | ||
41 | /* orig. values: ...,5280,5600 */ | ||
42 | }; | ||
43 | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
45 | const unsigned short percent_to_volt_charge[11] = | ||
46 | { | ||
47 | /* values guessed, see | ||
48 | http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone | ||
49 | measures voltages over a charging cycle */ | ||
50 | 4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */ | ||
51 | }; | ||
52 | |||
53 | #define BATTERY_SCALE_FACTOR 6620 | ||
54 | /* full-scale ADC readout (2^10) in millivolt */ | ||
55 | |||
56 | /* Returns battery voltage from ADC [millivolts] */ | ||
57 | unsigned int battery_adc_voltage(void) | ||
58 | { | ||
59 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
60 | } | ||