Esempio n. 1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_bfalse=true;
    playform = new QWidget(this);
    playform->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    playform->setAttribute(Qt::WA_OpaquePaintEvent);
    playform->move(110,100);
    playform->setMinimumSize(320,240);
    //playform->hide();
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(play()));
    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(stop()));

    connect(ui->quiet,SIGNAL(clicked()),this,SLOT(quiet()));
    connect(ui->next,SIGNAL(clicked()),this,SLOT(next()));
    connect(ui->pre,SIGNAL(clicked()),this,SLOT(pre()));
    connect(ui->v_,SIGNAL(clicked()),this,SLOT(v_()));
    connect(ui->v2,SIGNAL(clicked()),this,SLOT(v2()));
    connect(ui->fast,SIGNAL(clicked()),this,SLOT(move()));

   // connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(back_messgae()));
   // timer=new QTimer(this);
   // connect(timer,SIGNAL(timeout()),this,SLOT(getTime()));
   // timer->start(1000);
    //退出 quit\n
    i=1;
}
Esempio n. 2
0
int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys)
{
    spml_ucx_mkey_t   *ucx_mkey;
    map_segment_t *mem_seg;
    int segno;
    int my_pe = oshmem_my_proc_id();

    MCA_SPML_CALL(quiet(oshmem_ctx_default));
    if (!mkeys)
        return OSHMEM_SUCCESS;

    if (!mkeys[0].spml_context)
        return OSHMEM_SUCCESS;

    mem_seg  = memheap_find_va(mkeys[0].va_base);
    ucx_mkey = (spml_ucx_mkey_t*)mkeys[0].spml_context;

    if (OPAL_UNLIKELY(NULL == mem_seg)) {
        return OSHMEM_ERROR;
    }
    
    if (MAP_SEGMENT_ALLOC_UCX != mem_seg->type) {
        ucp_mem_unmap(mca_spml_ucx.ucp_context, ucx_mkey->mem_h);
    }
    ucp_rkey_destroy(ucx_mkey->rkey);
    ucx_mkey->rkey = NULL;

    if (0 < mkeys[0].len) {
        ucp_rkey_buffer_release(mkeys[0].u.data);
    }

    free(mkeys);

    return OSHMEM_SUCCESS;
}
Esempio n. 3
0
static void
watchQuietCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
	Boolean	_quiet;
	Boolean	_timeout	= FALSE;

	_quiet = quiet(&_timeout);
	if (_quiet
#if	!TARGET_OS_IPHONE
	    || _timeout
#endif	/* !TARGET_OS_IPHONE */
	   ) {
		watchQuietDisable();
	}

	if (_quiet || _timeout) {
		static int	logged	= 0;

		(void) establishNewPreferences();
		if (_timeout && (logged++ == 0)) {
			SCLog(TRUE, LOG_NOTICE,
			      CFSTR("Network configuration creation timed out waiting for IORegistry"));
		}
	}

	return;
}
Esempio n. 4
0
void CLogicalChannel::start() {

  m_flags = 0;
  m_fPitchBend = 0;
  m_fModWheel = 0;  
  m_fLFO = 0.0;
  m_fPortamentoNote = 0.0;
  m_fDetuneStep = 0.0;  
  m_arpCounter = 0;
  m_arpIndex = 0;
  m_fLFOPhase = 0;
  m_portaTargetNote = 0;
  m_fPortaStep = 0;   
  
  // ensure no sound
  quiet();
  
  // initialise the high divider flags for each voice
  for(int i=m_voiceBegin; i<m_voiceEnd; ++i) {
    Voice[i].div8_high(m_conf->flags & TONE_CONFIG::POKEY_HIHZ);     
  }
  
  // initial calculation of detune spread
  recalc_detune();
}
int main(int argc, char* argv[])
{
  log_init();

  try
  {
    cxxtools::Arg<bool> quiet(argc, argv, 'q');

    if (argc <= 1)
    {
      std::cerr << "usage: " << argv[0]
        << " inifile [-q] [section [key [default]]]" << std::endl;
      return -1;
    }

    const char* fname = argv[1];
    std::ifstream in(fname);
    if (!in)
      throw std::runtime_error(std::string("error reading input file \"") + fname + '"');

    cxxtools::IniFile ini(in);

    if (argc <= 2)
    {
      // list sections
      if (!quiet)
        std::cout << "sections in " << fname << ": ";
      ini.getSections(std::ostream_iterator<std::string>(std::cout, "\t"));
      std::cout << std::endl;
      return 0;
    }

    const char* section = argv[2];
    if (argc <= 3)
    {
      // list keys
      if (!quiet)
        std::cout << "keys in " << fname << " [" << section << "]: ";
      ini.getKeys(section, std::ostream_iterator<std::string>(std::cout, "\t"));
      std::cout << std::endl;
      return 0;
    }

    const char* key = argv[3];
    const char* defvalue = argv[4] ? argv[4] : "";
    if (!quiet)
      std::cout << "value of " << fname << " [" << section << "]." << key << ": ";
    std::cout << ini.getValue(section, key, defvalue) << std::endl;
  }
  catch (const std::exception& e)
  {
    std::cerr << e.what() << std::endl;
  }
}
Esempio n. 6
0
void ConnectionWindow::rfbLog(const char *format, ...)
{
    if ( !quiet() ) {
        va_list args;
        QString message;
        va_start(args, format);
        message.vsprintf(format, args);
        message.prepend(tr("RFB") + ": ");
        va_end(args);
        VncMainWindow::log(message);
    }
}
Esempio n. 7
0
void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
{
    MCA_SPML_CALL(quiet(ctx));

    SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
    _ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx);
    _ctx_add(&mca_spml_ucx.idle_array, (mca_spml_ucx_ctx_t *)ctx);
    SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex);

    if (!mca_spml_ucx.active_array.ctxs_count) {
        opal_progress_unregister(spml_ucx_ctx_progress);
    }
}
Esempio n. 8
0
/* Set the currently used note waveform 
 */
void set_waveform(uint8_t wavetype) {
	//0==square, 1==triangle, 2=sin

	/* Stop the current note */
	quiet();
	
	/* Toggle the waveform */
	if (waveform != wavetype) {
		waveform = wavetype;
	} else {
		waveform = 0;
	}
	
	/* Continue the current note */
	start_note();
}
Esempio n. 9
0
/* Play a note.
**
** Setup timer 1 to generate an interrupt at twice the frequency
** of the desired note for square waves, and twice*no. of steps
** for triangular waves. We then change the value being sent to 
** the D2A. Timer 1 is configured to count the system clock
** and to reset on output compare match.
*/
void start_note(void) 
{
	uint16_t clockVal = 0;
	const uint16_t noteClocks[] = {15287,13620,12133,11452,10203,9089,8098,7643};
	
	/* Select precalculated clock times matching a note
	** length for the compare register. 
	** period=1/(frequency)
	** clocksteps=8MHz *period
	**/
	//c4 261.30hz	//d4 293.66hz	//e4 329.63hz	//f4 349.23hz
	//g4 392.00hz	//a4 440.00hz	//b4 493.88hz	//c5 523.25hz
	
	if (note<=7) {
		clockVal = noteClocks[note];
	} else {
		quiet();
		return;
	}
	
	/* Allow for waveforms: divide by no. steps needed
	** then subtract 1, as clk starts at 0 */
	if (waveform==1) clockVal = clockVal/(triWaveSteps);
	if (waveform==2) clockVal = clockVal/(16);
	if (octave==1) clockVal = clockVal/2;
		//if (waveform==0) clockVal = clockVal;
	clockVal--;
	
	/* Write to the timer compare register */
	OCR1A = clockVal;
	
	/* Set up timer so that it resets on output compare match
	** and is clocked by the system clock. This turns the timer
	** on - so the interrupt handler will fire when it reaches
	** the output compare value - and sound will be generated.
	*/
	TCCR1B = (1<<WGM12)|(1<<CS10);
}
Esempio n. 10
0
//-----------------------------------------------------------------------------
int KMFolder::compact(void)
{
  KMFolder* tempFolder;
  KMMessage* msg;
  QString tempName, msgStr;
  int openCount = mOpenCount;
  int num, numStatus;


  if (!needsCompact)
  {
    //debug ("Not compacting %s; it's clean", name().data());
    return 0;
  }
  
  debug ("Compacting %s ", name().data());
  
  tempName = "." + name();
  tempName.detach();
  tempName += ".compacted";
  unlink(tempName);
  //tempFolder = parent()->createFolder(tempName); //sven: shouldn't be in list
  tempFolder = new KMFolder(parent(), tempName);   //sven: we create it
  if(tempFolder->create()) {
    debug("KMFolder::compact() Creating tempFolder failed!\n");
    delete tempFolder;                             //sven: and we delete it
    return 0;
  }

  quiet(TRUE);
  tempFolder->open();
  open();

  for(num=1,numStatus=9; count() > 0; num++, numStatus--)
  {
    if (numStatus <= 0)
    {
      msgStr.sprintf(i18n("Compacting folder: %d messages done"), num);
      emit statusMsg(msgStr);
      numStatus = 10;
    }

    msg = getMsg(0);
    if(msg)
      tempFolder->moveMsg(msg);
  }
  tempName = tempFolder->location();
  tempFolder->close(TRUE);
  close(TRUE);
  mMsgList.clear(TRUE);

  _rename(tempName, location());
  _rename(tempFolder->indexLocation(), indexLocation());

  // Now really free all memory
  delete tempFolder;                //sven: we delete it, not the manager

  if (openCount > 0)
  {
    open();
    mOpenCount = openCount;
  }
  quiet(FALSE);

  if (!mQuiet) emit changed();
  needsCompact = false;             // We are clean now
  return 0;
}
Esempio n. 11
0
int
main (int argc, char **argv) {
    int c, s, fd;
    unsigned int address, length;
    unsigned int count, param;
    char filename[PATH_MAX], ifname[IFNAMSIZ];
    unsigned int cmd;
    struct ifreq ifr;
    char *buffer;
    struct stat filestat;
    int flag;
    int target_version = -1;
    int target_type = -1;
    unsigned int bitwise_mask;
    
    progname = argv[0];
    if (argc == 1) usage();

    flag = 0;
    memset(filename, '\0', sizeof(filename));
    memset(ifname, '\0', IFNAMSIZ);
    strcpy(ifname, "eth1");
    s = socket(AF_INET, SOCK_DGRAM, 0);
    if (s < 0) err(1, "socket");

    while (1) {
        int option_index = 0;
        static struct option long_options[] = {
            {"get", 0, NULL, 'g'},
            {"set", 0, NULL, 's'},
            {"read", 0, NULL, 'r'},
            {"test", 0, NULL, 't'},
            {"file", 1, NULL, 'f'},
            {"done", 0, NULL, 'd'},
            {"write", 0, NULL, 'w'},
            {"begin", 0, NULL, 'b'},
            {"count", 1, NULL, 'c'},
            {"param", 1, NULL, 'p'},
            {"length", 1, NULL, 'l'},
            {"execute", 0, NULL, 'e'},
            {"address", 1, NULL, 'a'},
            {"interface", 1, NULL, 'i'},
            {"info", 0, NULL, 'I'},
            {"and", 1, NULL, 'n'},
            {"or", 1, NULL, 'o'},
            {"quiet", 0, NULL, 'q'},
            {"uncompress", 0, NULL, 'u'},
            {0, 0, 0, 0}
        };

        c = getopt_long (argc, argv, "rwtebdgsIqf:l:a:p:i:c:n:o:",
                         long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
        case 'r':
            cmd = BMI_READ_MEMORY;
            break;

        case 'w':
            cmd = BMI_WRITE_MEMORY;
            break;

        case 'e':
            cmd = BMI_EXECUTE;
            break;

        case 'b':
            cmd = BMI_SET_APP_START;
            break;

        case 'd':
            cmd = BMI_DONE;
            break;

        case 'g':
            cmd = BMI_READ_SOC_REGISTER;
            break;

        case 's':
            cmd = BMI_WRITE_SOC_REGISTER;
            break;

        case 't':
            cmd = BMI_TEST;
            break;

        case 'f':
            memset(filename, '\0', sizeof(filename));
            strncpy(filename, optarg, sizeof(filename));
            flag |= FILE_FLAG;
            break;

        case 'l':
            length = atoi(optarg);
            flag |= LENGTH_FLAG;
            break;

        case 'a':
            address = strtoul(optarg, NULL, 0);
            flag |= ADDRESS_FLAG;
            break;

        case 'p':
            param = strtoul(optarg, NULL, 0);
            flag |= PARAM_FLAG;
            break;

        case 'c':
            count = atoi(optarg);
            flag |= COUNT_FLAG;
            break;

        case 'i':
            memset(ifname, '\0', 8);
            strcpy(ifname, optarg);
            break;

        case 'I':
            cmd = BMI_GET_TARGET_INFO;
            break;
            
        case 'n':
            flag |= PARAM_FLAG | AND_OP_FLAG | BITWISE_OP_FLAG;
            bitwise_mask = strtoul(optarg, NULL, 0);
            break;
            
        case 'o':                
            flag |= PARAM_FLAG | BITWISE_OP_FLAG;
            bitwise_mask = strtoul(optarg, NULL, 0);
            break;

        case 'q':
            flag |= QUIET_FLAG;
            break;
            
        case 'u':
            flag |= UNCOMPRESS_FLAG;
            break;
            
        default:
            usage();
        }
    }

    strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
    /* Verify that the Target is alive.  If not, wait for it. */
    {
        int rv;
        static int waiting_msg_printed = 0;

        buffer = (char *)MALLOC(sizeof(struct bmi_target_info));
        ((int *)buffer)[0] = AR6000_XIOCTL_TARGET_INFO;
        ifr.ifr_data = buffer;
        while ((rv=ioctl(s, AR6000_IOCTL_EXTENDED, &ifr)) < 0)
        {
            if (errno == ENODEV) {
                /* 
                 * Give the Target device a chance to start.
                 * Then loop back and see if it's alive.
                 */
                if (!waiting_msg_printed) {
                    nqprintf("bmiloader is waiting for Target....\n");
                    waiting_msg_printed = 1;
                }
                usleep(100000); /* Wait for 100ms */
            } else {
                printf("Unexpected error on AR6000_XIOCTL_TARGET_INFO: %d\n", rv);
                exit(1);
            }
        }
        target_version = ((int *)buffer)[0];
        target_type = ((int *)buffer)[1];
        free(buffer);
    }
    switch(cmd)
    {
    case BMI_DONE:
        nqprintf("BMI Done\n");
        buffer = (char *)MALLOC(4);
        ((int *)buffer)[0] = AR6000_XIOCTL_BMI_DONE;
        ifr.ifr_data = buffer;
        if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
        {
            err(1, ifr.ifr_name);
        }
        free(buffer);
        break;

    case BMI_TEST:
        if ((flag & (COUNT_FLAG | LENGTH_FLAG | ADDRESS_FLAG)) == 
            (COUNT_FLAG | LENGTH_FLAG | ADDRESS_FLAG))
        {
            nqprintf("BMI Test (address: 0x%x, length: %d, count: %d)\n", 
                    address, length, count);
            buffer = (char *)MALLOC(16);
            ((int *)buffer)[0] = AR6000_XIOCTL_BMI_TEST;
            ((int *)buffer)[1] = address;
            ((int *)buffer)[2] = length;
            ((int *)buffer)[3] = count;
            ifr.ifr_data = buffer;
            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
            {
                err(1, ifr.ifr_name);
            }
            free(buffer);
        }
        else usage();
        break;

    case BMI_READ_MEMORY:
        if ((flag & (ADDRESS_FLAG | LENGTH_FLAG | FILE_FLAG)) == 
            (ADDRESS_FLAG | LENGTH_FLAG | FILE_FLAG))
        {
            nqprintf(
                 "BMI Read Memory (address: 0x%x, length: %d, filename: %s)\n",
                  address, length, filename);

            if ((fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 00644)) < 0)
            {
                perror("Could not create a file");
                exit(1);
            }
            buffer = (char *)MALLOC(MAX_BUF + 12);

            {
                unsigned int remaining = length;

                while (remaining)
                {
                    length = (remaining > MAX_BUF) ? MAX_BUF : remaining;
                    ((int *)buffer)[0] = AR6000_XIOCTL_BMI_READ_MEMORY;
                    ((int *)buffer)[1] = address;

                    /*
                     * We round up the requested length because some
                     * SDIO Host controllers can't handle other lengths;
                     * but we still only write the requested number of
                     * bytes to the file.
                     */
                    ((int *)buffer)[2] = A_ROUND_UP(length, 4);
                    ifr.ifr_data = buffer;
                    if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
                    {
                        err(1, ifr.ifr_name);
                    }
                    else
                    {
                        write(fd, buffer, length);
                    }

                    remaining -= length;
                    address += length;
                }
            }

            close(fd);
            free(buffer);
        }
        else usage();
        break;

    case BMI_WRITE_MEMORY:
        if (!(flag & ADDRESS_FLAG))
        {
            usage(); /* no address specified */
        }
        if (!(flag & (FILE_FLAG | PARAM_FLAG)))
        {
            usage(); /* no data specified */
        }
        if ((flag & FILE_FLAG) && (flag & PARAM_FLAG))
        {
            usage(); /* too much data specified */
        }
        if ((flag & UNCOMPRESS_FLAG) && !(flag & FILE_FLAG))
        {
            usage(); /* uncompress only works with a file */
        }

        if (flag & FILE_FLAG)
        {
            nqprintf(
                 "BMI Write %sMemory (address: 0x%x, filename: %s)\n",
                  ((flag & UNCOMPRESS_FLAG) ? "compressed " : ""),
                  address, filename);
            if ((fd = open(filename, O_RDONLY)) < 0)
            {
                perror("Could not open file");
                exit(1);
            }
            memset(&filestat, '\0', sizeof(struct stat));
            buffer = (char *)MALLOC(MAX_BUF + 12);
            fstat(fd, &filestat);
            length = filestat.st_size;

            if (flag & UNCOMPRESS_FLAG) {
                /* Initiate compressed stream */
                ((int *)buffer)[0] = AR6000_XIOCTL_BMI_LZ_STREAM_START;
                ((int *)buffer)[1] = address;
                if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
                {
                    err(1, ifr.ifr_name);
                }
            }
        }
        else
        { /* PARAM_FLAG */
            nqprintf(
                 "BMI Write Memory (address: 0x%x, value: 0x%x)\n",
                  address, param);
            length = sizeof(param);
            buffer = (char *)MALLOC(length + 12);
            *(unsigned int *)(&buffer[12]) = param;
            fd = -1;
        }

        /*
         * Write length bytes of data to memory.
         * Data is either present in buffer OR
         * needs to be read from fd in MAX_BUF chunks.
         *
         * Within the kernel, the implementation of
         * AR6000_XIOCTL_BMI_WRITE_MEMORY further
         * limits the size of each transfer over the
         * interconnect according to BMI protocol
         * limitations.
         */ 
        {
            unsigned int remaining = length;
            int *pLength;

            while (remaining)
            {
                length = (remaining > MAX_BUF) ? MAX_BUF : remaining;
                if (flag & UNCOMPRESS_FLAG) {
                    /* 0 pad last word of data to avoid messy uncompression */
                    ((A_UINT32 *)buffer)[2+((length-1)/4)] = 0;

                    if (read(fd, &buffer[8], length) != length)
                    {
                        perror("read from compressed file failed");
                        exit(1);
                    }
                    ((int *)buffer)[0] = AR6000_XIOCTL_BMI_LZ_DATA;
                    pLength = &((int *)buffer)[1];
                } else {
                    if (fd > 0)
                    {
                        if (read(fd, &buffer[12], length) != length)
                        {
                            perror("read from file failed");
                            exit(1);
                        }
                    }

                    ((int *)buffer)[0] = AR6000_XIOCTL_BMI_WRITE_MEMORY;
                    ((int *)buffer)[1] = address;
                    pLength = &((int *)buffer)[2];
                }

                /*
                 * We round up the requested length because some
                 * SDIO Host controllers can't handle other lengths.
                 * This generally isn't a problem for users, but it's
                 * something to be aware of.
                 */
                *pLength = A_ROUND_UP(length, 4);
                ifr.ifr_data = buffer;
                while (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
                {
                    err(1, ifr.ifr_name);
                }

                remaining -= length;
                address += length;
            }
        }

        free(buffer);
        if (fd > 0)
        {
            close(fd);
            if (flag & UNCOMPRESS_FLAG) {
                /*
                 * Close compressed stream and open a new (fake)
                 * one.  This serves mainly to flush Target caches.
                 */
                ((int *)buffer)[0] = AR6000_XIOCTL_BMI_LZ_STREAM_START;
                ((int *)buffer)[1] = 0;
                if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
                {
                    err(1, ifr.ifr_name);
                }
            }
        }

        break;

    case BMI_READ_SOC_REGISTER:
        if ((flag & (ADDRESS_FLAG)) == (ADDRESS_FLAG))
        {
            nqprintf("BMI Read Register (address: 0x%x)\n", address);
            buffer = (char *)MALLOC(8);
            ((int *)buffer)[0] = AR6000_XIOCTL_BMI_READ_SOC_REGISTER;
            ((int *)buffer)[1] = address;
            ifr.ifr_data = buffer;
            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
            {
                err(1, ifr.ifr_name);
            }
            param = ((int *)buffer)[0];
            if (quiet()) {
                printf("0x%x\n", param);
            } else {
                printf("Return Value from target: 0x%x\n", param);
            }
            free(buffer);
        }
        else usage();
        break;

    case BMI_WRITE_SOC_REGISTER:
        if ((flag & (ADDRESS_FLAG | PARAM_FLAG)) == (ADDRESS_FLAG | PARAM_FLAG))
        {
            int origvalue = 0;
            
            if (flag & BITWISE_OP_FLAG) {
                /* first read */    
                buffer = (char *)MALLOC(8);
                ((int *)buffer)[0] = AR6000_XIOCTL_BMI_READ_SOC_REGISTER;
                ((int *)buffer)[1] = address;
                ifr.ifr_data = buffer;
                if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
                {
                    err(1, ifr.ifr_name);
                }
                param = ((int *)buffer)[0];
                origvalue = param;
                free(buffer);
                
                /* now modify */
                if (flag & AND_OP_FLAG) {
                    param &= bitwise_mask;        
                } else {
                    param |= bitwise_mask;
                }               
            
                /* fall through to write out the parameter */
            }
            
            if (flag & BITWISE_OP_FLAG) {
                if (quiet()) {
                    printf("0x%x\n", origvalue);
                } else {
                    printf("BMI Bit-Wise (%s) modify Register (address: 0x%x, orig:0x%x, new: 0x%x,  mask:0x%X)\n", 
                       (flag & AND_OP_FLAG) ? "AND" : "OR", address, origvalue, param, bitwise_mask );   
                }
            } else{ 
                nqprintf("BMI Write Register (address: 0x%x, param: 0x%x)\n", address, param);
            }
            
            buffer = (char *)MALLOC(12);
            ((int *)buffer)[0] = AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER;
            ((int *)buffer)[1] = address;
            ((int *)buffer)[2] = param;
            ifr.ifr_data = buffer;
            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
            {
                err(1, ifr.ifr_name);
            }
            free(buffer);
        }
        else usage();
        break;

    case BMI_EXECUTE:
        if ((flag & (ADDRESS_FLAG | PARAM_FLAG)) == (ADDRESS_FLAG | PARAM_FLAG))
        {
            nqprintf("BMI Execute (address: 0x%x, param: 0x%x)\n", address, param);
            buffer = (char *)MALLOC(12);
            ((int *)buffer)[0] = AR6000_XIOCTL_BMI_EXECUTE;
            ((int *)buffer)[1] = address;
            ((int *)buffer)[2] = param;
            ifr.ifr_data = buffer;
            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
            {
                err(1, ifr.ifr_name);
            }
            param = ((int *)buffer)[0];
            if (quiet()) {
                printf("0x%x\n", param);
            } else {
                printf("Return Value from target: 0x%x\n", param);
            }
            free(buffer);
        }
        else usage();
        break;

    case BMI_SET_APP_START:
        if ((flag & ADDRESS_FLAG) == ADDRESS_FLAG)
        {
            nqprintf("BMI Set App Start (address: 0x%x)\n", address);
            buffer = (char *)MALLOC(8);
            ((int *)buffer)[0] = AR6000_XIOCTL_BMI_SET_APP_START;
            ((int *)buffer)[1] = address;
            ifr.ifr_data = buffer;
            if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0)
            {
                err(1, ifr.ifr_name);
            }
            free(buffer);
        }
        else usage();
        break;
    case BMI_GET_TARGET_INFO:
        nqprintf("BMI Target Info:\n");
        printf("TARGET_TYPE=%s\n",
                (target_type == TARGET_TYPE_AR6001) ? "AR6001" :
                ((target_type == TARGET_TYPE_AR6002) ? "AR6002" : 
                (((target_type == TARGET_TYPE_AR6003) ? "AR6003" : "unknown"))));
        printf("TARGET_VERSION=0x%x\n", target_version);
        break;

    default:
        usage();
    }

    exit (0);
}
Esempio n. 12
0
void shmem_quiet_f(void)
{
    MCA_SPML_CALL(quiet(oshmem_ctx_default));
}
Esempio n. 13
0
void CLogicalChannel::handleCC(char cc, char value)
{
  switch(cc) {    
  case CC_POKEYCFG:
    {
      byte mode;
      switch(ccMapValue(value, TONE_CONFIG::POKEY_MAX)) {
        case TONE_CONFIG::POKEY_8_HPF:
          mode = CPokey::MODE_8BITHPF;
          break;        
        case TONE_CONFIG::POKEY_16:
          mode = CPokey::MODE_16BIT;
          break;        
        case TONE_CONFIG::POKEY_8:  
        default:
          mode = CPokey::MODE_8BIT;
          break;
      }
      if(mode != m_conf->ePokeyMode) {
        m_conf->ePokeyMode = mode;
//        m_flags |= SF_RECONFIG;
      }
    }
    break;
  case CC_POKEYDUAL:
    {
      byte flags = m_conf->flags;
      ccFlag(&flags, TONE_CONFIG::POKEY_DUAL, value); 
      if(flags != m_conf->flags) {
//        m_flags |= SF_RECONFIG;
        m_conf->flags = flags;
      }
    }
    break;
  case CC_POKEYRANGE: 
    ccFlag(&m_conf->flags, TONE_CONFIG::POKEY_HIHZ, value); 
    div8_high(!!(m_conf->flags & TONE_CONFIG::POKEY_HIHZ)); 
    break;    
  case CC_MIDIVEL: 
    ccFlag(&m_conf->flags, TONE_CONFIG::USE_VELOCITY, value); 
    break;
  case CC_MONO: 
    ccFlag(&m_conf->flags, TONE_CONFIG::MONO, 127); 
    break;
  case CC_POLY: 
    ccFlag(&m_conf->flags, TONE_CONFIG::MONO, 0); 
    break;
  case CC_ARPENABLE: 
    ccFlag(&m_conf->flags, TONE_CONFIG::ARPEGGIATE, value); 
    break;
  case CC_ARP2ENV: 
    ccFlag(&m_conf->flags, TONE_CONFIG::ARP2ENV, value); 
    break;
  case CC_MOD:  
    m_fModWheel = (float)value/127; 
    break;
  case CC_PORTATIME: 
    m_conf->portaTime = value; 
    break;  
  case CC_TRANSPOSE: 
    m_conf->transpose = value - 64; 
    break;
  case CC_FINETUNE: 
    m_conf->fFineTune = ((float)value - 64)/10.0; 
    break;
  case CC_ARPRATE: 
    m_conf->arpRate = value;
    break;
  case CC_ARPCOUNT: 
    m_conf->arpCount = 1 + value/16; 
    break;
  case CC_LFORATE: 
    m_conf->lfoRate = value; 
    break;
  case CC_LFODEPTH: 
    m_conf->lfoDepth = value; 
    break;
  case CC_AENVATTACK: 
    m_conf->ampEnv.attackSlope = envSlope(value,0);
    break;
  case CC_AENVRELEASE: 
    m_conf->ampEnv.releaseSlope = envSlope(value,1);
    break;
  case CC_AENVMODE:
    m_conf->ampEnv.mode = ccMapValue(value, ENVELOPE::MAX_MODE); 
    break;
  case CC_MENVATTACK: 
    m_conf->modEnv.attackSlope = envSlope(value,0);
    break;
  case CC_MENVRELEASE: 
    m_conf->modEnv.releaseSlope = envSlope(value,1);
    break;
  case CC_MENVMODE: 
    m_conf->modEnv.mode = ccMapValue(value, ENVELOPE::MAX_MODE); 
    break;    
  case CC_PBRANGE: 
    m_conf->pitchBendRange = 12.0 * (value/127.0); 
    break;
  case CC_HPF: 
    m_conf->hpf = value;
    break;
  case CC_DIST: 
    m_conf->dist = value; 
    break;    
  case CC_DETUNELEVEL: 
    m_conf->detuneLevel = value; 
    break;
  case CC_UNISONTYPE: 
    m_conf->eUnisonMode = ccMapValue(value, TONE_CONFIG::UNISON_MAX); 
    recalc_detune(); 
    break;    
  case CC_LFOMODE: 
    m_conf->eLFOMode = ccMapValue(value, TONE_CONFIG::LFO_MAX); 
    break;    
  case CC_LFOWAVE: 
    m_conf->eLFOWave = ccMapValue(value, TONE_CONFIG::WAVE_MAX); 
    break;    


  case CC_LFODEPTH_MODSRC:
    m_conf->lfoDepthModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
  case CC_DETUNE_MODSRC:
    m_conf->detuneModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
  case CC_HPF_MODSRC:
    m_conf->hpfModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
  case CC_DIST_MODSRC:
    m_conf->distModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
  case CC_LFORATE_MODSRC:
    m_conf->lfoRateModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
  case CC_ARPATE_MODSRC:
    m_conf->arpRateModSrc = ccMapValue(value, TONE_CONFIG::MODSRC_MAX); 
    break;    
      
  // MOD MATRIX SETTINGS FOR LFO
  case CC_LFO_2_PITCH:
    m_conf->lfoToPitch = ccModDepth(value); 
    break;    
  case CC_LFO_2_VOL:
    m_conf->lfoToAmp = ccModDepth(value); 
    break;

  case CC_ENV_2_PITCH:
    m_conf->modEnvToPitch = ccModDepth(value); 
    break;    

  case CC_ALL_SOUND_OFF:
  case CC_ALL_NOTES_OFF:
    quiet();
    break;
  case CC_RESET_CTRL:
    //TODO
    break;
  case CC_FROM_NOTE:
    m_fromNote = value;
    if(m_toNote < m_fromNote) {
      m_fromNote = m_toNote;
      m_toNote = value;
    }
    break;
  case CC_TO_NOTE:    
    m_toNote = value;
    if(m_toNote < m_fromNote) {
      m_toNote = m_fromNote;
      m_fromNote = value;
    }
    break;
  }
}