diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-13 23:21:54 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-13 23:21:54 +0000 |
commit | cc50c149e9452e7c8ea199fd72f7458ead96bad7 (patch) | |
tree | 78efc4e2c391f0cfcab8fe76777dab63070e64d9 /apps | |
parent | da55588fc7e0134decd4ba8cc573f507302a5664 (diff) | |
download | rockbox-cc50c149e9452e7c8ea199fd72f7458ead96bad7.tar.gz rockbox-cc50c149e9452e7c8ea199fd72f7458ead96bad7.zip |
H100/General: HAL for S/PDIF and refinement/bufixes in optical output powering/source selection.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11523 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 15 | ||||
-rw-r--r-- | apps/recorder/recording.c | 38 |
2 files changed, 26 insertions, 27 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 4620adaaec..e1bb5ccb9f 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -74,6 +74,9 @@ | |||
74 | #if CONFIG_CODEC == SWCODEC | 74 | #if CONFIG_CODEC == SWCODEC |
75 | #include "pcmbuf.h" | 75 | #include "pcmbuf.h" |
76 | #include "pcm_playback.h" | 76 | #include "pcm_playback.h" |
77 | #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN) | ||
78 | #include "spdif.h" | ||
79 | #endif | ||
77 | #endif | 80 | #endif |
78 | 81 | ||
79 | #ifdef IAUDIO_X5 | 82 | #ifdef IAUDIO_X5 |
@@ -774,14 +777,17 @@ bool dbg_spdif(void) | |||
774 | unsigned int interruptstat; | 777 | unsigned int interruptstat; |
775 | bool valnogood, symbolerr, parityerr; | 778 | bool valnogood, symbolerr, parityerr; |
776 | bool done = false; | 779 | bool done = false; |
780 | bool spdif_src_on; | ||
781 | int spdif_source = spdif_get_output_source(&spdif_src_on); | ||
782 | spdif_set_output_source(AUDIO_SRC_SPDIF, true); | ||
777 | 783 | ||
778 | lcd_setmargins(0, 0); | 784 | lcd_setmargins(0, 0); |
779 | lcd_clear_display(); | 785 | lcd_clear_display(); |
780 | lcd_setfont(FONT_SYSFIXED); | 786 | lcd_setfont(FONT_SYSFIXED); |
787 | |||
781 | #ifdef HAVE_SPDIF_POWER | 788 | #ifdef HAVE_SPDIF_POWER |
782 | spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */ | 789 | spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */ |
783 | #endif | 790 | #endif |
784 | PHASECONFIG = 0x34; /* Gain = 3*2^13, source = EBUIN */ | ||
785 | 791 | ||
786 | while (!done) | 792 | while (!done) |
787 | { | 793 | { |
@@ -914,15 +920,18 @@ bool dbg_spdif(void) | |||
914 | 920 | ||
915 | #ifndef SIMULATOR | 921 | #ifndef SIMULATOR |
916 | snprintf(buf, sizeof(buf), "Measured freq: %ldHz", | 922 | snprintf(buf, sizeof(buf), "Measured freq: %ldHz", |
917 | (long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128)); | 923 | spdif_measure_frequency()); |
918 | lcd_puts(0, line++, buf); | 924 | lcd_puts(0, line++, buf); |
919 | #endif | 925 | #endif |
920 | 926 | ||
921 | lcd_update(); | 927 | lcd_update(); |
922 | 928 | ||
923 | if (action_userabort(HZ/10)) | 929 | if (action_userabort(HZ/10)) |
924 | return false; | 930 | break; |
925 | } | 931 | } |
932 | |||
933 | spdif_set_output_source(spdif_source, spdif_src_on); | ||
934 | |||
926 | #ifdef HAVE_SPDIF_POWER | 935 | #ifdef HAVE_SPDIF_POWER |
927 | spdif_power_enable(global_settings.spdif_enable); | 936 | spdif_power_enable(global_settings.spdif_enable); |
928 | #endif | 937 | #endif |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index d38856db23..4c2b00c33c 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -34,7 +34,10 @@ | |||
34 | #include "pcm_playback.h" | 34 | #include "pcm_playback.h" |
35 | #include "playback.h" | 35 | #include "playback.h" |
36 | #include "enc_config.h" | 36 | #include "enc_config.h" |
37 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) | ||
38 | #include "spdif.h" | ||
37 | #endif | 39 | #endif |
40 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
38 | #ifdef HAVE_UDA1380 | 41 | #ifdef HAVE_UDA1380 |
39 | #include "uda1380.h" | 42 | #include "uda1380.h" |
40 | #endif | 43 | #endif |
@@ -587,12 +590,6 @@ static void rec_boost(bool state) | |||
587 | #define ac_set_monitor tlv320_set_monitor | 590 | #define ac_set_monitor tlv320_set_monitor |
588 | #endif | 591 | #endif |
589 | 592 | ||
590 | #ifdef HAVE_SPDIF_IN | ||
591 | #define rec_spdif_set_monitor(m) audio_spdif_set_monitor(m) | ||
592 | #else | ||
593 | #define rec_spdif_set_monitor(m) | ||
594 | #endif | ||
595 | |||
596 | void rec_set_source(int source, unsigned flags) | 593 | void rec_set_source(int source, unsigned flags) |
597 | { | 594 | { |
598 | /* Prevent pops from unneeded switching */ | 595 | /* Prevent pops from unneeded switching */ |
@@ -613,15 +610,23 @@ void rec_set_source(int source, unsigned flags) | |||
613 | /* Always boost for SPDIF */ | 610 | /* Always boost for SPDIF */ |
614 | if ((source == AUDIO_SRC_SPDIF) != (source == last_source)) | 611 | if ((source == AUDIO_SRC_SPDIF) != (source == last_source)) |
615 | rec_boost(source == AUDIO_SRC_SPDIF); | 612 | rec_boost(source == AUDIO_SRC_SPDIF); |
613 | #endif /* HAVE_SPDIF_IN */ | ||
616 | 614 | ||
617 | #ifdef HAVE_SPDIF_POWER | 615 | #ifdef HAVE_SPDIF_POWER |
618 | /* Check if S/PDIF output power should be switched off or on. NOTE: assumes | 616 | /* Check if S/PDIF output power should be switched off or on. NOTE: assumes |
619 | both optical in and out is controlled by the same power source, which is | 617 | both optical in and out is controlled by the same power source, which is |
620 | the case on H1x0. */ | 618 | the case on H1x0. */ |
621 | spdif_power_enable((source == AUDIO_SRC_SPDIF) || | 619 | spdif_power_enable((source == AUDIO_SRC_SPDIF) || |
622 | audio_get_spdif_power_setting()); | 620 | global_settings.spdif_enable); |
621 | /* Set the appropriate feed for spdif output */ | ||
622 | #ifdef HAVE_SPDIF_OUT | ||
623 | spdif_set_output_source(source, global_settings.spdif_enable); | ||
623 | #endif | 624 | #endif |
625 | #else /* !HAVE_SPDIF_POWER */ | ||
626 | #ifdef HAVE_SPDIF_OUT | ||
627 | spdif_set_output_source(source, true); | ||
624 | #endif | 628 | #endif |
629 | #endif /* !HAVE_SPDIF_POWER */ | ||
625 | 630 | ||
626 | /** Tuner **/ | 631 | /** Tuner **/ |
627 | #ifdef CONFIG_TUNER | 632 | #ifdef CONFIG_TUNER |
@@ -645,7 +650,6 @@ void rec_set_source(int source, unsigned flags) | |||
645 | ac_disable_recording(); | 650 | ac_disable_recording(); |
646 | ac_set_monitor(false); | 651 | ac_set_monitor(false); |
647 | pcm_rec_mux(0); /* line in */ | 652 | pcm_rec_mux(0); /* line in */ |
648 | rec_spdif_set_monitor(-1); /* silence it */ | ||
649 | break; | 653 | break; |
650 | 654 | ||
651 | case AUDIO_SRC_MIC: /* recording only */ | 655 | case AUDIO_SRC_MIC: /* recording only */ |
@@ -653,7 +657,6 @@ void rec_set_source(int source, unsigned flags) | |||
653 | break; | 657 | break; |
654 | ac_enable_recording(true); /* source mic */ | 658 | ac_enable_recording(true); /* source mic */ |
655 | pcm_rec_mux(0); /* line in */ | 659 | pcm_rec_mux(0); /* line in */ |
656 | rec_spdif_set_monitor(0); | ||
657 | break; | 660 | break; |
658 | 661 | ||
659 | case AUDIO_SRC_LINEIN: /* recording only */ | 662 | case AUDIO_SRC_LINEIN: /* recording only */ |
@@ -661,7 +664,6 @@ void rec_set_source(int source, unsigned flags) | |||
661 | break; | 664 | break; |
662 | pcm_rec_mux(0); /* line in */ | 665 | pcm_rec_mux(0); /* line in */ |
663 | ac_enable_recording(false); /* source line */ | 666 | ac_enable_recording(false); /* source line */ |
664 | rec_spdif_set_monitor(0); | ||
665 | break; | 667 | break; |
666 | 668 | ||
667 | #ifdef HAVE_SPDIF_IN | 669 | #ifdef HAVE_SPDIF_IN |
@@ -669,7 +671,6 @@ void rec_set_source(int source, unsigned flags) | |||
669 | if (source == last_source) | 671 | if (source == last_source) |
670 | break; | 672 | break; |
671 | ac_disable_recording(); | 673 | ac_disable_recording(); |
672 | audio_spdif_set_monitor(1); | ||
673 | break; | 674 | break; |
674 | #endif /* HAVE_SPDIF_IN */ | 675 | #endif /* HAVE_SPDIF_IN */ |
675 | 676 | ||
@@ -690,7 +691,6 @@ void rec_set_source(int source, unsigned flags) | |||
690 | break; | 691 | break; |
691 | /* I2S recording and playback */ | 692 | /* I2S recording and playback */ |
692 | uda1380_enable_recording(false); /* source line */ | 693 | uda1380_enable_recording(false); /* source line */ |
693 | uda1380_set_monitor(true); | ||
694 | #endif | 694 | #endif |
695 | #ifdef HAVE_TLV320 | 695 | #ifdef HAVE_TLV320 |
696 | /* I2S recording and analog playback */ | 696 | /* I2S recording and analog playback */ |
@@ -707,8 +707,6 @@ void rec_set_source(int source, unsigned flags) | |||
707 | tlv320_set_monitor(true); /* analog bypass */ | 707 | tlv320_set_monitor(true); /* analog bypass */ |
708 | } | 708 | } |
709 | #endif | 709 | #endif |
710 | |||
711 | rec_spdif_set_monitor(0); | ||
712 | break; | 710 | break; |
713 | /* #elif defined(CONFIG_TUNER) */ | 711 | /* #elif defined(CONFIG_TUNER) */ |
714 | /* Have radio but cannot record it */ | 712 | /* Have radio but cannot record it */ |
@@ -745,18 +743,10 @@ void rec_set_recording_options(struct audio_recording_options *options) | |||
745 | #if CONFIG_CODEC != SWCODEC | 743 | #if CONFIG_CODEC != SWCODEC |
746 | if (global_settings.rec_prerecord_time) | 744 | if (global_settings.rec_prerecord_time) |
747 | talk_buffer_steal(); /* will use the mp3 buffer */ | 745 | talk_buffer_steal(); /* will use the mp3 buffer */ |
748 | #endif | 746 | #else /* == SWOCODEC */ |
749 | |||
750 | #ifdef HAVE_SPDIF_IN | ||
751 | #ifdef HAVE_SPDIF_POWER | ||
752 | audio_set_spdif_power_setting(global_settings.spdif_enable); | ||
753 | #endif | ||
754 | #endif | ||
755 | |||
756 | #if CONFIG_CODEC == SWCODEC | ||
757 | rec_set_source(options->rec_source, | 747 | rec_set_source(options->rec_source, |
758 | options->rec_source_flags | SRCF_RECORDING); | 748 | options->rec_source_flags | SRCF_RECORDING); |
759 | #endif | 749 | #endif /* CONFIG_CODEC != SWCODEC */ |
760 | 750 | ||
761 | audio_set_recording_options(options); | 751 | audio_set_recording_options(options); |
762 | } | 752 | } |