예제 #1
0
파일: ts570.c 프로젝트: jessicalh/hamlib
int ts570_set_channel (RIG * rig, const channel_t * chan)
{
                char cmdbuf[30];
                int retval, cmd_len;
		int num,freq,tx_freq,tone;
		char mode,tx_mode,tones;

		num=chan->channel_num;
		freq=(int)chan->freq;
		mode=mode_to_char(chan->mode);
		if(chan->split==RIG_SPLIT_ON) {
			tx_freq=(int)chan->tx_freq;
			tx_mode=mode_to_char(chan->tx_mode);
		} else {
			tx_freq=0;
			tx_mode='\0';
		}

        	for (tone = 1; rig->caps->ctcss_list[tone-1] != 0 && tone<39; tone++) {
                        if (rig->caps->ctcss_list[tone-1] == chan->ctcss_tone)
                                        break;
        	}
		if(chan->ctcss_tone!=0) {
			tones='1';
		} else {
			tones='0';
			tone=0;
		}

                cmd_len = sprintf(cmdbuf, "MW0 %02d%011d%c0%c%02d ",
		 num,freq,mode,tones,tone);
		if (cmd_len < 0)
			return -RIG_ETRUNC;

                retval = kenwood_transaction (rig, cmdbuf, NULL, 0);
                if (retval != RIG_OK)
                                return retval;

                cmd_len = sprintf(cmdbuf, "MW1 %02d%011d%c0%c%02d ",
		 num,tx_freq,tx_mode,tones,tone);
		if (cmd_len < 0)
			return -RIG_ETRUNC;

                retval = kenwood_transaction (rig, cmdbuf, NULL, 0);
                if (retval != RIG_OK)
                                return retval;

		return RIG_OK;
}
예제 #2
0
void
nm_ap_dump (NMAccessPoint *self,
            const char *prefix,
            const char *ifname)
{
	NMAccessPointPrivate *priv;
	const char *supplicant_id = "-";
	guint32 chan;

	g_return_if_fail (NM_IS_AP (self));

	priv = NM_AP_GET_PRIVATE (self);
	chan = nm_utils_wifi_freq_to_channel (priv->freq);
	if (priv->supplicant_path)
		supplicant_id = strrchr (priv->supplicant_path, '/');

	nm_log_dbg (LOGD_WIFI_SCAN, "%s[%s%c] %-32s[%s%u %s%u%% %c W:%04X R:%04X] [%3u] %s%s",
	            prefix,
	            str_if_set (priv->address, "(none)"),
	            mode_to_char (self),
	            priv->ssid ? nm_utils_escape_ssid (priv->ssid->data, priv->ssid->len) : "(none)",
	            chan > 99 ? "" : (chan > 9 ? " " : "  "),
	            chan,
	            priv->strength < 100 ? " " : "",
	            priv->strength,
	            priv->flags & NM_802_11_AP_FLAGS_PRIVACY ? 'P' : ' ',
	            priv->wpa_flags & 0xFFFF,
	            priv->rsn_flags & 0xFFFF,
	            priv->last_seen > 0 ? (nm_utils_get_monotonic_timestamp_s () - priv->last_seen) : -1,
	            ifname,
	            supplicant_id);
}
예제 #3
0
static void sifive_plic_print_state(SiFivePLICState *plic)
{
    int i;
    int addrid;

    /* pending */
    qemu_log("pending       : ");
    for (i = plic->bitfield_words - 1; i >= 0; i--) {
        qemu_log("%08x", plic->pending[i]);
    }
    qemu_log("\n");

    /* pending */
    qemu_log("claimed       : ");
    for (i = plic->bitfield_words - 1; i >= 0; i--) {
        qemu_log("%08x", plic->claimed[i]);
    }
    qemu_log("\n");

    for (addrid = 0; addrid < plic->num_addrs; addrid++) {
        qemu_log("hart%d-%c enable: ",
            plic->addr_config[addrid].hartid,
            mode_to_char(plic->addr_config[addrid].mode));
        for (i = plic->bitfield_words - 1; i >= 0; i--) {
            qemu_log("%08x", plic->enable[addrid * plic->bitfield_words + i]);
        }
        qemu_log("\n");
    }
}
예제 #4
0
파일: ts570.c 프로젝트: jessicalh/hamlib
static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
  char buf[16];
  int kmode, retval;

  if ((kmode = mode_to_char(mode)) == RIG_MODE_NONE)
     return -RIG_EINVAL;

  sprintf(buf, "MD%c", kmode);
  retval = kenwood_transaction(rig, buf, NULL, 0);
  if (retval != RIG_OK) return retval;

  switch (mode)
  {
    case RIG_MODE_CW:
    case RIG_MODE_CWR:
    case RIG_MODE_RTTY:
    case RIG_MODE_RTTYR:
      sprintf(buf, "FW%04d", (int)width);
      retval = kenwood_transaction(rig, buf, NULL, 0);
      if (retval != RIG_OK) return retval;
      break;
    case RIG_MODE_USB:
    case RIG_MODE_LSB:
    case RIG_MODE_FM:
    case RIG_MODE_AM:
      sprintf(buf, "SL%02d", (int)width/50);
      retval = kenwood_transaction(rig, buf, NULL, 0);
      if (retval != RIG_OK) return retval;
      break;
    default:
      return -RIG_EINVAL;
  }

  return RIG_OK;
}