Linux ALSA架构:PCM_OPEN流程 (二)

一   应用端

源码路径:  external\tinyalsa\pcm.c   external\tinyalsa\pcm_hw.c

struct pcm *pcm_open(unsigned int card, unsigned int device,unsigned int flags, struct pcm_config *config)
{...pcm->ops = &hw_ops;pcm->fd = pcm->ops->open(card, device, flags, &pcm->data, pcm->snd_node);/*实际是调用 pcm_hw.c 的pcm_hw_open 接口  open("/dev/snd/pcmC0D0c") 打开节点*/if (pcm->ops->ioctl(pcm->data, SNDRV_PCM_IOCTL_INFO, &info)) {oops(&bad_pcm, errno, "cannot get info");goto fail_close;}if (pcm->ops->ioctl(pcm->data, SNDRV_PCM_IOCTL_HW_PARAMS, &params)) {oops(&bad_pcm, errno, "cannot set hw params");goto fail_close;}/* get our refined hw_params */config->period_size = param_get_int(&params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);config->period_count = param_get_int(&params, SNDRV_PCM_HW_PARAM_PERIODS);pcm->buffer_size = config->period_count * config->period_size;if (pcm->ops->ioctl(pcm->data, SNDRV_PCM_IOCTL_SW_PARAMS, &sparams)) {oops(&bad_pcm, errno, "cannot set sw params");goto fail;}
}

二 audio 节点 介绍

1. /dev/snd下的pcm设备节点介绍

我们 adb shell, 进入手机中,ls -al /dev/snd 看下,可以看到很多设备节点。
简化如下:

$ cd /dev/snd 
$ ls –l 
crw-rw----+ 1 root audio 116, 8 2011-02-23 21:38 controlC0  ---> 用于声卡的控制,例如通道选择,混音,麦克风的控制等 
crw-rw----+ 1 root audio 116, 4 2011-02-23 21:38 midiC0D0 	---> 用于播放midi 音频 
crw-rw----+ 1 root audio 116, 7 2011-02-23 21:39 pcmC0D0c 	---> 用于录音的pcm 设备 1
crw-rw----+ 1 root audio 116, 6 2011-02-23 21:56 pcmC0D0p 	---> 用于播放的pcm 设备 1
crw-rw----+ 1 root audio 116, 5 2011-02-23 21:38 pcmC0D1p 	---> 用于播放的pcm 设备 2
crw-rw----+ 1 root audio 116, 3 2011-02-23 21:38 seq 		---> 音序器 
crw-rw----+ 1 root audio 116, 2 2011-02-23 21:38 timer 		---> 定时器 

其中,
C0D0 代表的是声卡0 中的设备0,
pcmC0D0c 最后一个c 代表capture,
pcmC0D0p 最后一个p 代表 playback,
这些都是alsa-driver 中的命名规则。

2. /dev/snd下的pcm设备节点 创建过程分析

另外,还有一个发现,就,/dev/snd 下面所有的节点的主设备号 都是 116 ,面次设备号各不相同。

原因是因为,
在alsa 中所有的节点都是同一个主设备号,到时访问open 节点的时候就会先调用同一个主设备号的open 函数,
接着,在主设备号的open 函数中,再来分发调用,各个不同次设备号的open 函数。

2.1 CONFIG_SND_MAJOR 主设备号 116

代码可以参考 sound.c 中的代码:
主设备号注册

@\kernel\msm-3.18\include\sound\core.h
#define CONFIG_SND_MAJOR	116	/* standard configuration */  定义主设备号@ \kernel\msm-3.18\sound\core\sound.c
static int major = CONFIG_SND_MAJOR; // 主设备号
module_param(major, int, 0444);
MODULE_PARM_DESC(major, "Major # for sound driver.");static const struct file_operations snd_fops =
{.owner =	THIS_MODULE,.open =		snd_open,.llseek =	noop_llseek,
};static int __init alsa_sound_init(void)
{snd_major = major;snd_ecards_limit = cards_limit;if (register_chrdev(major, "alsa", &snd_fops)) {  // 主册一个主设备号pr_err("ALSA core: unable to register native major device number %d\n", major);return -EIO;}snd_info_minor_register();return 0;
}
2.2 snd_minors 数组分析

在 snd_register_device_for_dev 函数中,主要作用就是创建不同的次设备号节点,保存在 snd_minors[] 数组中。

其主要是在pcm.c 创建节点时被调用的。
可以发现在代码中,会根据声卡号和设备索引号,依次创建 pcmC%iD%ip 和 pcmC%iD%ic 两个设备节点的名字。
接着,调用 snd_register_device_for_dev 来创建设备节点,传入换参数就是 设备节点的名字。

@\kernel\msm-3.18\sound\core\pcm.cstatic int snd_pcm_dev_register(struct snd_device *device)
{pcm = device->device_data;err = snd_pcm_add(pcm);for (cidx = 0; cidx < 2; cidx++) {int devtype = -1;switch (cidx) {case SNDRV_PCM_STREAM_PLAYBACK:sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->device);devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK;break;case SNDRV_PCM_STREAM_CAPTURE:sprintf(str, "pcmC%iD%ic", pcm->card->number, pcm->device);devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;break;}/* device pointer to use, pcm->dev takes precedence if* it is assigned, otherwise fall back to card's device* if possible */dev = pcm->dev;/* register pcm */err = snd_register_device_for_dev(devtype, pcm->card,pcm->device,&snd_pcm_f_ops[cidx],pcm, str, dev);dev = snd_get_device(devtype, pcm->card, pcm->device);if (dev) {err = sysfs_create_groups(&dev->kobj,pcm_dev_attr_groups);put_device(dev);}for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)snd_pcm_timer_init(substream);}list_for_each_entry(notify, &snd_pcm_notify_list, list)notify->n_register(pcm);return 0;
}

在snd_register_device_for_dev() 中,会根据传入的字符串名字,创建不同的设备节点。
看 snd_register_device_for_dev() 代码前,我们来看一下snd_minors[] 这个数组。

static struct snd_minor *snd_minors[SNDRV_OS_MINORS];其结构体描述如下:
@ \kernel\msm-3.18\include\sound\core.hstruct snd_minor {int type;			/* SNDRV_DEVICE_TYPE_XXX */  // 声卡类型: SNDRV_DEVICE_TYPE_PCM_PLAYBACK 和  SNDRV_DEVICE_TYPE_PCM_CAPTURE 两种int card;			/* card number */ 							//声卡号int device;			/* device number */							// 设备号const struct file_operations *f_ops;	/* file operations */ 	// 该节点换操作节构体void *private_data;		/* private data for f_ops->open */		// 私有参数struct device *dev;		/* device for sysfs */					// sys 设备节点描述符struct snd_card *card_ptr;	/* assigned card instance */		//声卡结构体
};

从上面的结构体可以看出,snd_minors中 主要是包含了 card声卡下 device设备的操作方法 f_ops。
这样就很清楚了。

通过snd_minors[] 这个 数组,我人能够找到任意一个 声卡下的设备 的操作方法。

2.3 pcm设备节点创建代码

接下来,我们来分析snd_register_device_for_dev() 这个函数,

这个函数主要工作 如下:
step 1. 使用 snd_minor 指针将 要创建的声卡设备的信息保存下来
step 2. 给声卡设备分配 次设备号,如果定义了动态分配,则分配次设备号
step 3. 以次设备号为索引,将声卡设备的信息保存在 snd_minors[minor]数组中。
step 4. 通过 device_create 创建一个 主设备号 majore=116, 次设备号minor 的设备节点,节点名字就是字符串 pcmC%iD%ip 或 pcmC%iD%ic

@ \kernel\msm-3.18\sound\core\sound.c
/*** snd_register_device_for_dev - Register the ALSA device file for the card* @type: the device type, SNDRV_DEVICE_TYPE_XXX* @card: the card instance* @dev: the device index* @f_ops: the file operations* @private_data: user pointer for f_ops->open()* @name: the device file name* @device: the &struct device to link this new device to** Registers an ALSA device file for the given card.* The operators have to be set in reg parameter.** Return: Zero if successful, or a negative error code on failure.*/
int snd_register_device_for_dev(int type, struct snd_card *card, int dev,const struct file_operations *f_ops,void *private_data,const char *name, struct device *device)
{int minor;struct snd_minor *preg;preg = kmalloc(sizeof *preg, GFP_KERNEL);// step 1. 使用 snd_minor  指针将 要创建的声卡设备的信息保存下来preg->type = type;preg->card = card ? card->number : -1;preg->device = dev;preg->f_ops = f_ops;preg->private_data = private_data;preg->card_ptr = card;// step 2. 给声卡设备分配 次设备号,如果定义了动态分配,则分配次设备号
#ifdef CONFIG_SND_DYNAMIC_MINORSminor = snd_find_free_minor(type);
#elseminor = snd_kernel_minor(type, card, dev);if (minor >= 0 && snd_minors[minor])minor = -EBUSY;
#endif// step 3. 以次设备号为索引,将声卡设备的信息保存在 snd_minors[minor]数组中。snd_minors[minor] = preg;// step 4. 通过 device_create 创建一个 主设备号 majore=116, 次设备号minor 的设备节点,节点名字就是字符串 pcmC%iD%ip 或 pcmC%iD%icpreg->dev = device_create(sound_class, device, MKDEV(major, minor),private_data, "%s", name);return 0;
}
2.4 pcm设备节点创建open 过程分析

前面讲了pcm设备节点的创建过程,接下来我们来看下如何打开的。

先看下如下代码,在 snd_fops 文件操作节构全中,包含了 snd_open方法 。
在init 代码中,是通过 register_chrdev(major, “alsa”, &snd_fops) 来将 major=116 的主设备号 和 snd_fops绑定在一起。

也就是说,凡是打开 设备节点major 为 116 的节点时,都会调用该 snd_fop 的open方法 snd_open()。

@ \kernel\msm-3.18\sound\core\sound.cstatic const struct file_operations snd_fops =
{.owner =	THIS_MODULE,.open =		snd_open,.llseek =	noop_llseek,
};
static int __init alsa_sound_init(void)
{snd_major = major;snd_ecards_limit = cards_limit;if (register_chrdev(major, "alsa", &snd_fops)) {pr_err("ALSA core: unable to register native major device number %d\n", major);return -EIO;}snd_info_minor_register();return 0;
}

在 snd_open() 方法中,整个过程为:
step 1:获取次设备号
step 2:初始化一个 snd_minor 类型的指针, 和file_operations 类型的操作方法指针
step 3:根据设备的次设备号,从 snd_minors[minor]数组中获取对应设备的snd_minor 结构体信息
step 4:解析出该设备的 操作方法
step 5:替换文件的操作方法
step 6:调用open 方法

@ \kernel\msm-3.18\sound\core\sound.c
static int snd_open(struct inode *inode, struct file *file)
{// step 1: 获取次设备号unsigned int minor = iminor(inode);// step 2:初始化一个 snd_minor 类型的指针, 和file_operations 类型的操作方法指针struct snd_minor *mptr = NULL;const struct file_operations *new_fops;// step 3:根据设备的次设备号,从 snd_minors[minor]数组中获取对应设备的snd_minor 结构体信息。mptr = snd_minors[minor];// step 4:解析出该设备的 操作方法new_fops = fops_get(mptr->f_ops);// step 5: 替换文件的操作方法replace_fops(file, new_fops);// step 6: 调用open 方法if (file->f_op->open)err = file->f_op->open(inode, file);return err;
}
2.5 pcm设备节点 file_operations 介绍

前面,我们说了pcm设备节点的 open() 方法的调用流程,
不知道你有没有好奇心,是否想进去看下它做了啥呢? 哈哈。

在前面的代码中,fops 是在 snd_pcm_f_ops[cidx] 中传递过来的。

/* register pcm */err = snd_register_device_for_dev(devtype, pcm->card,pcm->device,&snd_pcm_f_ops[cidx],pcm, str, dev);

我们看下 snd_pcm_f_ops[cidx] 中的定义:

@ \kernel\msm-3.18\sound\core\pcm_native.cconst struct file_operations snd_pcm_f_ops[2] = {{	// SNDRV_PCM_STREAM_PLAYBACK.owner =		THIS_MODULE,.write =		snd_pcm_write,.aio_write =		snd_pcm_aio_write,.open =			snd_pcm_playback_open,.release =		snd_pcm_release,.llseek =		no_llseek,.poll =			snd_pcm_playback_poll,.unlocked_ioctl =	snd_pcm_playback_ioctl,.compat_ioctl = 	snd_pcm_ioctl_compat,.mmap =			snd_pcm_mmap,.fasync =		snd_pcm_fasync,.get_unmapped_area =	snd_pcm_get_unmapped_area,},{	// SNDRV_PCM_STREAM_CAPTURE.owner =		THIS_MODULE,.read =			snd_pcm_read,.aio_read =		snd_pcm_aio_read,.open =			snd_pcm_capture_open,.release =		snd_pcm_release,.llseek =		no_llseek,.poll =			snd_pcm_capture_poll,.unlocked_ioctl =	snd_pcm_capture_ioctl,.compat_ioctl = 	snd_pcm_ioctl_compat,.mmap =			snd_pcm_mmap,.fasync =		snd_pcm_fasync,.get_unmapped_area =	snd_pcm_get_unmapped_area,}
};

可以看出,在 snd_pcm_f_ops 数组中,主要就是定义了 playback 和 capture 的各个操作方法。

2.6 pcm设备节点 snd_pcm_playback_open() 代码分析

我们以 playback 来分析下 其open 方法: snd_pcm_playback_open()

其主要工作 为:
step 1: 通过nonseekable_open函数,告诉内核,当前文件open 时,是不可 llseek 定位的
step 2: 获得 snd_minor 结构体中的 privdata 私有数据,其中保存了声卡的相关信息
step 3: 调用 snd_pcm_open() open 函数,传参为 pcm 和 SNDRV_PCM_STREAM_CAPTURE;

static int snd_pcm_playback_open(struct inode *inode, struct file *file)
{struct snd_pcm *pcm;// step 1: 通过nonseekable_open函数,告诉内核,当前文件open 时,是不可 llseek 定位的int err = nonseekable_open(inode, file);// step 2: 获得 snd_minor 结构体中的 privdata 私有数据,其中保存了声卡的相关信息pcm = snd_lookup_minor_data(iminor(inode),SNDRV_DEVICE_TYPE_PCM_PLAYBACK);-------->+	private_data = mreg->private_data;+	return private_data;<-------// step 3: 调用 snd_pcm_open() open 函数,err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);return err;
}
2.7 snd_pcm_open() 代码分析

主要工作如下:

  1. 将 pcm->card 和 file 添加链表
  2. 构造当前进程对应的等待队列 wait
  3. 将wait 保存在 pcm->open_wait 中
  4. 上锁
  5. 在while(1) 中打开文件,如果失败就退出
  6. 在阻塞模式下,设置SO_RCVTIMEO和SO_SNDTIMEO会导致read/write函数返回EAGAIN
    我们此返回 -EAGAIN 说明是正常的,数据还没写完
  7. 设置当前进和为可被中断
  8. 调度,让更高优先及的任务得到处理,或者让其他任务得到处理
  9. 等待调度到来,继续写播放数据
@ \kernel\msm-3.18\sound\core\pcm_native.cstatic int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
{int err;wait_queue_t wait;// 1. 将 pcm->card 和 file 添加链表err = snd_card_file_add(pcm->card, file);if (!try_module_get(pcm->card->module)) {err = -EFAULT;goto __error2;}// 2. 构造当前进程对应的等待队列 waitinit_waitqueue_entry(&wait, current);// 3. 将wait 保存在 pcm->open_wait 中add_wait_queue(&pcm->open_wait, &wait);// 4. 上锁mutex_lock(&pcm->open_mutex);while (1) {// 5. 在while(1) 中打开文件,如果失败就退出err = snd_pcm_open_file(file, pcm, stream);if (err >= 0)break;// 6. 在阻塞模式下,设置SO_RCVTIMEO和SO_SNDTIMEO会导致read/write函数返回EAGAIN// 我们此返回 -EAGAIN 说明是正常的if (err == -EAGAIN) {if (file->f_flags & O_NONBLOCK) {  // 如果是非阻塞模式下,则直接退出,在非阻塞模式下,write或read返回-1,errno为EAGAIN,表示相应的操作还没执行完成。err = -EBUSY;break;}} elsebreak;// 7. 设置当前进和为可被中断set_current_state(TASK_INTERRUPTIBLE);mutex_unlock(&pcm->open_mutex);// 8. 调度,让更高优先及的任务得到处理,或者让其他任务得到处理schedule();// 9. 等待调度到来,继续写播放数据mutex_lock(&pcm->open_mutex);if (pcm->card->shutdown) {err = -ENODEV;break;}if (signal_pending(current)) {err = -ERESTARTSYS;break;}}remove_wait_queue(&pcm->open_wait, &wait);mutex_unlock(&pcm->open_mutex);return err;
}

接下往下看snd_pcm_open_file

static int snd_pcm_open_file(struct file *file,struct snd_pcm *pcm,int stream)
{struct snd_pcm_file *pcm_file;struct snd_pcm_substream *substream;int err;err = snd_pcm_open_substream(pcm, stream, file, &substream);if (err < 0)return err;pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);if (pcm_file == NULL) {snd_pcm_release_substream(substream);return -ENOMEM;}pcm_file->substream = substream;if (substream->ref_count == 1)substream->pcm_release = pcm_release_private;file->private_data = pcm_file;return 0;
}

继续跟踪snd_pcm_open_substream

int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,struct file *file,struct snd_pcm_substream **rsubstream)
{struct snd_pcm_substream *substream;int err;err = snd_pcm_attach_substream(pcm, stream, file, &substream);if (err < 0)return err;if (substream->ref_count > 1) {*rsubstream = substream;return 0;}err = snd_pcm_hw_constraints_init(substream);if (err < 0) {pcm_dbg(pcm, "snd_pcm_hw_constraints_init failed\n");goto error;}err = substream->ops->open(substream);if (err < 0)goto error;substream->hw_opened = 1;err = snd_pcm_hw_constraints_complete(substream);if (err < 0) {pcm_dbg(pcm, "snd_pcm_hw_constraints_complete failed\n");goto error;}*rsubstream = substream;return 0;error:snd_pcm_release_substream(substream);return err;
}

 substream->ops->open(substream);会调用创建PCM注册的ops

int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
{....../* ASoC PCM operations */if (rtd->dai_link->dynamic) {rtd->ops.open		= dpcm_fe_dai_open;rtd->ops.hw_params	= dpcm_fe_dai_hw_params;rtd->ops.prepare	= dpcm_fe_dai_prepare;rtd->ops.trigger	= dpcm_fe_dai_trigger;rtd->ops.hw_free	= dpcm_fe_dai_hw_free;rtd->ops.close		= dpcm_fe_dai_close;rtd->ops.pointer	= soc_pcm_pointer;} else {rtd->ops.open		= soc_pcm_open;rtd->ops.hw_params	= soc_pcm_hw_params;rtd->ops.prepare	= soc_pcm_prepare;rtd->ops.trigger	= soc_pcm_trigger;rtd->ops.hw_free	= soc_pcm_hw_free;rtd->ops.close		= soc_pcm_close;rtd->ops.pointer	= soc_pcm_pointer;}......
}

2.8 soc_pcm端的open() 代码分析

MTK平台是dynamic 调用FE的open,该接口作用有:

1.获取路由信息,计算当前FE绑定的BE

2.分别Open BE和FE pcm

static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
{struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);struct snd_soc_dapm_widget_list *list;int ret;int stream = fe_substream->stream;snd_soc_dpcm_mutex_lock(fe);fe->dpcm[stream].runtime = fe_substream->runtime;ret = dpcm_path_get(fe, stream, &list);if (ret < 0)goto open_end;/* calculate valid and active FE <-> BE dpcms */dpcm_process_paths(fe, stream, &list, 1);ret = dpcm_fe_dai_startup(fe_substream);if (ret < 0)dpcm_fe_dai_cleanup(fe_substream);dpcm_clear_pending_state(fe, stream);dpcm_path_put(&list);
open_end:snd_soc_dpcm_mutex_unlock(fe);return ret;
}

继续看函数dpcm_fe_dai_startup

其中 dpcm_be_dai_startup 会调用BE端 __soc_pcm_open(be, be_substream);

    /* start the DAI frontend */
ret = __soc_pcm_open(fe, fe_substream);

static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
{struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);int stream = fe_substream->stream, ret = 0;dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);ret = dpcm_be_dai_startup(fe, stream);if (ret < 0)goto be_err;dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);/* start the DAI frontend */ret = __soc_pcm_open(fe, fe_substream);if (ret < 0)goto unwind;fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;dpcm_runtime_setup_fe(fe_substream);dpcm_runtime_setup_be_format(fe_substream);dpcm_runtime_setup_be_chan(fe_substream);dpcm_runtime_setup_be_rate(fe_substream);ret = dpcm_apply_symmetry(fe_substream, stream);unwind:if (ret < 0)dpcm_be_dai_startup_unwind(fe, stream);
be_err:dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);if (ret < 0)dev_err(fe->dev, "%s() failed (%d)\n", __func__, ret);return ret;
}

2.9  __soc_pcm_open 代码分析

 该接口功能如下:

1. soc_pcm_components_open(substream); 调用component drv ops的open

2.snd_soc_link_startup(substream); 调用dai_link的rtd->dai_link->ops->startup(substream);

3.snd_soc_dai_startup调用cpu和codec 的dai->driver->ops->startup(substream, dai);

static int __soc_pcm_open(struct snd_soc_pcm_runtime *rtd,struct snd_pcm_substream *substream)
{struct snd_soc_component *component;struct snd_soc_dai *dai;int i, ret = 0;snd_soc_dpcm_mutex_assert_held(rtd);for_each_rtd_components(rtd, i, component)pinctrl_pm_select_default_state(component->dev);ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);if (ret < 0)goto err;ret = soc_pcm_components_open(substream);if (ret < 0)goto err;ret = snd_soc_link_startup(substream);if (ret < 0)goto err;/* startup the audio subsystem */for_each_rtd_dais(rtd, i, dai) {ret = snd_soc_dai_startup(dai, substream);if (ret < 0)goto err;}/* Dynamic PCM DAI links compat checks use dynamic capabilities */if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm)goto dynamic;/* Check that the codec and cpu DAIs are compatible */soc_pcm_init_runtime_hw(substream);soc_pcm_update_symmetry(substream);ret = soc_hw_sanity_check(substream);if (ret < 0)goto err;soc_pcm_apply_msb(substream);/* Symmetry only applies if we've already got an active stream. */for_each_rtd_dais(rtd, i, dai) {ret = soc_pcm_apply_symmetry(substream, dai);if (ret != 0)goto err;}
dynamic:snd_soc_runtime_activate(rtd, substream->stream);ret = 0;
err:if (ret < 0) {soc_pcm_clean(rtd, substream, 1);dev_err(rtd->dev, "%s() failed (%d)", __func__, ret);}return ret;
}

 整体流程图如下:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/96450.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/96450.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

tp5的tbmember表闭包查询 openid=‘abc‘ 并且(wx_unionid=null或者wx_unionid=‘‘)

闭包查询 tbmember表闭包查询查询 openid‘abc并且islose0并且islogout0并且&#xff08;wx_unionidnull或者wx_unionid’&#xff09; Db::table(tbmember)->where([openid>abc,islose>0,islogout>0])->where(function ($query){$query->where(wx_unioni…

邪修实战系列(3)

1、第一阶段邪修实战总览&#xff08;9.1-9.30&#xff09; 把第一阶段&#xff08;基础夯实期&#xff09;的学习计划拆解成极具操作性的每日行动方案。这个计划充分利用我“在职学习”的特殊优势&#xff0c;强调“用输出倒逼输入”&#xff0c;确保每一分钟的学习都直接服务…

【GD32】ROM Bootloader、自定义Bootloader区别

Bootloader是应用程序跑起来之前&#xff0c;用于初始化的一段程序&#xff0c;它分为两种&#xff0c;ROM Bootloader、自定义Bootloader。GD32芯片出厂时预烧录在ROM中的Bootloader&#xff08;以下简称ROM Bootloader&#xff09;和自己编写的Bootloader&#xff08;以下简称…

Linux防火墙-Firewalld

一、 概述 按表现形式划分&#xff1a; 软件防火墙&#xff1a; 集成在系统内部&#xff0c;Linux系统&#xff1a; iptables、firewalld、ufw&#xff1b; windows系统下&#xff1a; windows defender 硬件防火墙&#xff1a; 华为防火墙、思科防火墙、奇安信防火墙、深信服防…

【Qt】PyQt、原生QT、PySide6三者的多方面比较

目录 引言 一、基本定义 二、核心对比维度 1. 编程语言与开发效率 2. 功能与 API 兼容性 3. 性能表现 4. 许可证与商业使用 5. 社区与文档支持 三、迁移与兼容性 四、适用场景推荐 五、总结对比表 总结 引言 PySide6、PyQt&#xff08;通常指 PyQt5/PyQt6&#xf…

JavaWeb站内信系统 - 技术设计文档

1. 系统概述1.1 项目背景本系统旨在为企业或社区平台提供一套完整的站内信解决方案&#xff0c;支持用户之间的消息发送、接收、管理等功能&#xff0c;提升用户间的沟通效率。1.2 设计目标实现用户间消息发送和接收支持一对一和一对多消息发送提供消息状态跟踪&#xff08;已读…

Java基础 9.10

1.System类常见方法和案例exit&#xff1a;退出当前程序arraycopy&#xff1a;复制数组元素&#xff0c;比较适合底层调用&#xff0c;一般使用 Arrays.copyOf 完成复制数组int[] src{1,2,3};int[] dest new int[3]; System.arraycopy(src, 0, dest, 0, 3);currentTimeMilens&…

详解flink性能优化

1. 简介 Apache Flink是一个强大的流处理框架&#xff0c;其性能很大程度上取决于内存的使用效率。在大规模数据处理场景中&#xff0c;合理的内存配置和优化可以显著提升Flink作业的性能和稳定性。本文将深入探讨Flink内存优化的各个方面&#xff0c;包括状态后端选择、内存配…

VueFlow的箭头怎么调整

正好最近用到了VueFlow组件&#xff0c;发现箭头默认样式太小&#xff0c;无法体现流程展示&#xff0c;因此翻阅相关资料得出下列方法&#xff0c;有什么更好的方法&#xff0c;大家可以推荐推荐&#xff0c;谢谢。方法1&#xff1a;通过边&#xff08;Edge&#xff09;的样式…

【Python】S1 基础篇 P9 文件处理与异常处理技术

目录文件读取操作读取文件的全部内容相对路径和绝对路径逐行访问文件内容文件写入操作写入单行内容写入多行内容结构化数据的存储异常处理机制理解异常的工作原理ZeroDivisionError异常示例try-except语句块的使用else语句块的正确使用静默失败的合理应用本文将深入探讨Python中…

分布式事务实战手册:从四场业务灾难看方案选型与落地陷阱

在分布式系统的稳定性战役中&#xff0c;数据一致性问题如同潜伏的暗礁。某生鲜电商因分布式事务设计缺陷&#xff0c;在春节促销期间出现"下单成功但无库存发货"的悖论&#xff0c;3小时内产生2300笔无效订单&#xff0c;客服投诉量激增300%&#xff1b;某银行转账系…

Java算法题中的输入输出流

在Java算法题中&#xff0c;处理输入输出主要依赖系统流&#xff08;System.in和System.out&#xff09;&#xff0c;常用的方法总结如下&#xff1a; 一、输入方法&#xff08;读取系统输入&#xff09; 主要通过java.util.Scanner类或BufferedReader类实现&#xff0c;适用于…

墨水屏程序

EPD Reader 基于ESP32-C3的电子墨水屏阅读器&#xff0c;支持ap 配网、sntp 时间同步、txt阅读、天气预报、显示节假日信息、农历显示、自动休眠、web配置等功能。这是在另一个项目 一个rust embassy esp32c3 的练习项目-CSDN博客的基础上修改的 。 界面比较粗糙&#xff0c;以…

Git 创建 SSH 密钥

1.生成 SSH 密钥 打开 Git Bash ssh-keygen -t ed25519 -C "your_email@example.com" 把 ”your_email@example.com“ 改成再 github 注册的邮箱 系统会提示您三次输入: 第一个提示:Enter file in which to save the key (/c/Users/86189/.ssh/id_ed25519): 直接…

当前 AI 的主流应用场景

当前AI技术已深度渗透至社会各领域,2025年的主流应用场景呈现出行业垂直化、交互自然化、决策自主化三大特征。以下从六大核心领域展开分析,结合最新技术突破与规模化落地案例,揭示AI如何重塑人类生产生活范式: 一、智能办公与生产力革命 AI正从工具升级为「数字同事」,…

EI会议:第六届电信、光学、计算机科学国际会议(TOCS 2025)

第六届电信、光学、计算机科学国际会议&#xff08;TOCS 2025&#xff09;定于11月21-23日在中国南阳举行&#xff0c;本届会议以“电信、光学、计算机科学”为主题&#xff0c;旨在为相关领域的专家和学者提供一个探讨行业热点问题&#xff0c;促进科技进步&#xff0c;增加科…

回归预测 | MATLAB基于GRU-Attention的多输入单输出回归预测

代码是一个基于 MATLAB 的深度学习时间序列预测模型,结合了 GRU(门控循环单元)和自注意力机制(Self-Attention),用于回归预测任务。 一、主要功能 使用 GRU + Self-Attention 神经网络模型对时间序列数据进行回归预测,评估模型在训练集和测试集上的性能,并可视化预测结…

【JavaEE】(24) Linux 基础使用和程序部署

一、Linux 背景知识 Linux 的第一个版本开发者是 Linus&#xff0c;所以部分人会叫“林纳斯”。Linux 只是一个开源的操作系统内核&#xff0c;有些公司/开源组织基于 Linux 内核&#xff0c;配套了不同的应用程序&#xff0c;构成不同的操作系统&#xff08;比如 vivo、&#…

视觉SLAM第9讲:后端1(EKF、非线性优化)

目标&#xff1a; 1.理解后端的概念&#xff1b; 2.理解以EKF为代表的滤波器后端的工作原理&#xff1b; 3.理解非线性优化的后端&#xff0c;明白稀疏性是如何利用的&#xff1b; 4.使用g2o和Ceres实际操作后端优化。 9.1 概述 9.1.1 状态估计的概率解释 1.后端优化引出 前段…

楼宇自控系统监控建筑变配电系统:功效体现在安全与节能层面

建筑变配电系统是保障建筑电力供应的 “心脏”&#xff0c;负责将外界高压电转化为建筑内设备可使用的低压电&#xff0c;为暖通、照明、电梯等核心系统供电。传统变配电管理依赖人工巡检&#xff0c;不仅存在 “监测滞后、故障难预判” 的安全隐患&#xff0c;还因无法精准调控…