int xmitTest(void){ // initialize strings char* myname; myname = "Ashley Towne"; serial_init(9600); // initialize LCD LCD_init(); LCD_display_on(); set_output_device(2); // select LCD as output // output to LCD LCD_clear(); LCD_setpos(0,0); printf("%s",myname); LCD_setpos(1,0); // output to terminal set_output_device(1); // select UART as output device printf("This goes to terminal\n"); // write to the screen printf("%s\n", myname); // loop int foo = 0; unsigned char mystr; int ctr = 0; while(ctr<10) { ctr = ctr + 1; if (foo==0){mystr='0';} else if(foo==1){mystr = '1';} else if(foo==2){mystr = '2';} else if(foo==3){mystr = '3';} else if(foo==4){mystr = '4';} else if(foo==5){mystr = '5';} else if(foo==6){mystr = '6';} else if(foo==7){mystr = '7';} else if(foo==8){mystr = '8';} else if(foo==9){ mystr = '9'; foo = -1; } set_output_device(2); putu((char)(100+foo)); set_output_device(1); LCD_char((char)(100+foo)); foo = foo + 1; } putu('z'); LCD_char('z'); putu(EOF); return 1; }
/*! \brief Start the receiver. */ void receiver::start() { /* FIXME: Check that flow graph is not running */ if (!d_running) { #ifndef WITH_PULSEAUDIO if(d_demod != RX_DEMOD_OFF) set_output_device(""); #endif tb->start(); d_running = true; } }
int check_mixer_ioctls(int fd_mixer) { int nb_err, err = 0; int ret, val; ret = ioctl(fd_mixer, SOUND_MIXER_READ_DEVMASK, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_DEVMASK %d\n", ret); err++; } #ifdef CONFIG_MX21ADS if (val != (SOUND_MASK_VOLUME | SOUND_MASK_LINE | SOUND_MASK_MIC)) { #else if (val != (SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_PHONEOUT | SOUND_MASK_LINE | SOUND_MASK_PHONEIN | SOUND_MASK_MIC)) { #endif DPRINTF("Error with IOCTL SOUND_MIXER_READ_DEVMASK %x\n", val); err++; } ret = ioctl(fd_mixer, SOUND_MIXER_READ_RECMASK, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_RECMASK\n"); err++; } #ifdef CONFIG_MX21ADS if (val != (SOUND_MASK_LINE | SOUND_MASK_MIC)) { #else if (val != (SOUND_MASK_LINE | SOUND_MASK_PHONEIN | SOUND_MASK_MIC)) { #endif DPRINTF("Error with IOCTL SOUND_MIXER_READ_RECMASK %x\n", val); err++; } ret = ioctl(fd_mixer, SOUND_MIXER_READ_OUTMASK, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_OUTMASK\n"); err++; } #ifdef CONFIG_MX21ADS if (val != SOUND_MASK_VOLUME) { #else if (val != (SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_PHONEOUT)) { #endif DPRINTF("Error with IOCTL SOUND_MIXER_READ_OUTMASK\n"); err++; } ret = ioctl(fd_mixer, SOUND_MIXER_READ_STEREODEVS, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_STEREODEVS\n"); err++; } #ifdef CONFIG_MX21ADS if (val != (SOUND_MASK_VOLUME | SOUND_MASK_LINE)) { #else if (val != (SOUND_MASK_VOLUME | SOUND_MASK_PHONEIN | SOUND_MASK_PCM)) { #endif DPRINTF("Error with IOCTL SOUND_MIXER_READ_STEREODEVS\n"); err++; } ret = ioctl(fd_mixer, SOUND_MIXER_READ_CAPS, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_CAPS\n"); err++; } if (val != SOUND_CAP_EXCL_INPUT) { DPRINTF("Error with IOCTL SOUND_MIXER_READ_CAPS\n"); err++; } ret = ioctl(fd_mixer, SOUND_MIXER_READ_RECSRC, &val); if (ret != 0) { DPRINTF ("Returned Value Error with IOCTL SOUND_MIXER_READ_RECSRC\n"); err++; } #ifdef CONFIG_MX21ADS if ((val != SOUND_MASK_LINE) && (val != SOUND_MASK_MIC)) { #else if ((val != SOUND_MASK_LINE) && (val != SOUND_MASK_PHONEIN) && (val != SOUND_MASK_MIC)) { #endif DPRINTF("Error with IOCTL SOUND_MIXER_READ_RECSRC\n"); err++; } /** Input source selection and volume control */ #ifndef CONFIG_MX21ADS nb_err = set_input_device(fd_mixer, SOUND_MASK_PHONEIN); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_RECSRC (SOUND_MASK_PHONEIN)\n"); err += nb_err; } #endif nb_err = set_input_device(fd_mixer, SOUND_MASK_LINE); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_RECSRC (SOUND_MASK_LINE)\n"); err += nb_err; } nb_err = set_input_device(fd_mixer, SOUND_MASK_MIC); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_RECSRC (SOUND_MASK_MIC)\n"); err += nb_err; } #ifndef CONFIG_MX21ADS nb_err = set_input_device(fd_mixer, SOUND_MASK_PHONEIN); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_RECSRC (SOUND_MASK_PHONEIN)\n"); err += nb_err; } #endif #ifndef CONFIG_MX21ADS nb_err = set_input_device(fd_mixer, SOUND_MASK_PHONEIN); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_RECSRC (SOUND_MASK_PHONEIN)\n"); err += nb_err; } #endif /** Output source selection and volume control */ nb_err = set_output_device(fd_mixer, SOUND_MASK_VOLUME); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_OUTSRC (SOUND_MASK_VOLUME) \n"); err += nb_err; } #ifndef CONFIG_MX21ADS nb_err = set_output_device(fd_mixer, SOUND_MASK_PCM); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_OUTSRC (SOUND_MASK_PCM)\n"); err += nb_err; } #endif #ifndef CONFIG_MX21ADS nb_err = set_output_device(fd_mixer, SOUND_MASK_SPEAKER); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_OUTSRC (SOUND_MASK_SPEAKER)\n"); err += nb_err; } #endif #ifndef CONFIG_MX21ADS nb_err = set_output_device(fd_mixer, SOUND_MASK_PHONEOUT); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_OUTSRC (SOUND_MASK_PHONEOUT)\n"); err += nb_err; } #endif nb_err = set_output_device(fd_mixer, SOUND_MASK_VOLUME); if (nb_err) { DPRINTF ("Error with IOCTL SOUND_MIXER_WRITE_OUTSRC (SOUND_MASK_VOLUME)\n"); err += nb_err; } return err; } /*! Supposes that StDac is selected. Selects all output lines */ int setup_sound_driver(int fd_audio) { int err = 0; err += set_selector(fd_audio, SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SPEAKER | SOUND_MASK_PHONEOUT); return err; } int main(int ac, char *av[]) { int fd_audio, fd_mixer; int err = 0; DPRINTF("Hi... \n"); if (ac == 1) { DPRINTF ("This program checks that IOCTLs are correctly implemented \n"); DPRINTF(" --> main <no_arg>\n\n"); } if ((fd_audio = open("/dev/sound/dsp1", O_WRONLY)) < 0) { DPRINTF("Error opening /dev/dsp\n"); return 0; } if ((fd_mixer = open("/dev/sound/mixer", O_RDWR)) < 0) { DPRINTF("Error opening /dev/mixer\n"); return 0; } if (setup_sound_driver(fd_audio)) { return 1; } /*************************************** MIXER IOCTLs ****************************************/ err += check_mixer_ioctls(fd_mixer); /*************************************** AUDIO IOCTLs ****************************************/ err += check_audio_ioctls(fd_audio); /*************************************** END ****************************************/ close(fd_audio); close(fd_mixer); if (!err) { printf("All tests passed with success\n"); } else { printf("Encountered %d errors\n", err); } return 0; }
Error Connection::set_output_device(OutputDevice od, bool e){ return set_output_device(od.get_id(),e); }
void setLCDdefaults(void){ LCD_init(); LCD_clear(); LCD_setpos(0,0); set_output_device(1); }