linux驱动(四):platform

        本文主要探讨x210驱动的平台设备类型(platform)以及misc设备。

驱动模型
        
设备驱动模型:总线(bus type)、设备(device)和驱动(driver)
        总线:虚拟总线用于挂接驱动驱动和设备
        总线、设备、驱动关系:/sys/bus下的子目录对应不同总线,总线目录有设备、驱动目录和、总线属性文件

总线

struct bus_type {
    const char        *name;
    struct bus_attribute    *bus_attrs;
    struct device_attribute    *dev_attrs;
    struct driver_attribute    *drv_attrs;

    int (*match)(struct device *dev, struct device_driver *drv);
    int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
    int (*probe)(struct device *dev);
    int (*remove)(struct device *dev);
    void (*shutdown)(struct device *dev);

    int (*suspend)(struct device *dev, pm_message_t state);
    int (*resume)(struct device *dev);

    const struct dev_pm_ops *pm;

    struct bus_type_private *p;
};

        总线属性 

struct bus_attribute {
    struct attribute    attr;
    ssize_t (*show)(struct bus_type *bus, char *buf);
    ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
};

        设备属性 

struct device_attribute {
    struct attribute    attr;
    ssize_t (*show)(struct device *dev, struct device_attribute *attr,
            char *buf);
    ssize_t (*store)(struct device *dev, struct device_attribute *attr,
             const char *buf, size_t count);
};

         驱动属性    

struct driver_attribute {
	struct attribute attr;
	ssize_t (*show)(struct device_driver *driver, char *buf);
	ssize_t (*store)(struct device_driver *driver, const char *buf,
			 size_t count);
};

         公共属性结构体(show(read)和store(write)方法)

struct attribute {
    const char        *name;
    struct module        *owner;
    mode_t            mode;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
    struct lock_class_key    *key;
    struct lock_class_key    skey;
#endif
};

        总线示例

struct bus_type i2c_bus_type = {
        .name           = "i2c",
        .match          = i2c_device_match,
        .probe          = i2c_device_probe,
        .remove         = i2c_device_remove,
        .shutdown       = i2c_device_shutdown,
        .pm             = &i2c_device_pm_ops,
};

        name总线名称,struct bus_attribute,struct device_attribute,struct driver_attribut为总线,设备,驱动属性和方法
        match为设备和驱动匹配函数,uevent内核向用户通知事件,probe探测函数,remove移除函数,shutdown关闭函数,suspend挂起,resume唤醒,struct dev_pm_ops *pm;电源管理,struct bus_type_private *p;私有数据

struct bus_type_private {
    struct kset subsys;
    struct kset *drivers_kset;
    struct kset *devices_kset;
    struct klist klist_devices;
    struct klist klist_drivers;
    struct blocking_notifier_head bus_notifier;
    unsigned int drivers_autoprobe:1;
    struct bus_type *bus;
};

        struct kset subsys;总线子系统,kobj为子系统顶层目录
        struct kset *drivers_kset;struct kset *devices_kset;挂载到该总线上的驱动和设备集合
        struct klist klist_devices;struct klist klist_drivers;设备和驱动链表
        unsigned int drivers_autoprobe:1;注册时自动探测设备
        struct bus_type *bus;回指针

设备

struct device
{
    struct device        *parent;
    struct device_private    *p;
    struct kobject kobj;
    const char        *init_name; /* initial name of the device */
    struct device_type    *type;
    struct mutex        mutex;    /* mutex to synchronize calls to
                     * its driver.
                     */

    struct bus_type    *bus;        /* type of bus device is on */
    struct device_driver *driver;    /* which driver has allocated this
                       device */
    void        *platform_data;    /* Platform specific data, device
                       core doesn't touch it */
    struct dev_pm_info    power;

#ifdef CONFIG_NUMA
    int        numa_node;    /* NUMA node this device is close to */
#endif
    u64        *dma_mask;    /* dma mask (if dma'able device) */
    u64        coherent_dma_mask;/* Like dma_mask, but for
                         alloc_coherent mappings as
                         not all hardware supports
                         64 bit addresses for consistent
                         allocations such descriptors. */

    struct device_dma_parameters *dma_parms;

    struct list_head    dma_pools;    /* dma pools (if dma'ble) */

    struct dma_coherent_mem    *dma_mem; /* internal for coherent mem
                         override */
    /* arch specific additions */
    struct dev_archdata    archdata;
#ifdef CONFIG_OF
    struct device_node    *of_node;
#endif

    dev_t            devt;    /* dev_t, creates the sysfs "dev" */

    spinlock_t        devres_lock;
    struct list_head    devres_head;

    struct klist_node    knode_class;
    struct class        *class;
    const struct attribute_group **groups;    /* optional groups */

    void    (*release)(struct device *dev);
}

        device结构体用于描述设备
        struct device        *parent;父设备
        struct device_private    *p;私有数据

struct device_private {
    struct klist klist_children;
    struct klist_node knode_parent;
    struct klist_node knode_driver;
    struct klist_node knode_bus;
    void *driver_data;
    struct device *device;
};

        const char        *init_name;设备名
        struct bus_type    *bus;指向总线
        struct device_type    *type;设备处理函数

  struct device_type {
    const char *name;
    const struct attribute_group **groups;
    int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
    char *(*devnode)(struct device *dev, mode_t *mode);
    void (*release)(struct device *dev);

    const struct dev_pm_ops *pm;
};

        struct device_driver *driver;设备驱动
        struct kobject kobj;内嵌kobject

struct kobject {
    const char        *name;
    struct list_head    entry;
    struct kobject        *parent;
    struct kset        *kset;
    struct kobj_type    *ktype;
    struct sysfs_dirent    *sd;
    struct kref        kref;
    unsigned int state_initialized:1;
    unsigned int state_in_sysfs:1;
    unsigned int state_add_uevent_sent:1;
    unsigned int state_remove_uevent_sent:1;
    unsigned int uevent_suppress:1;
};

         void    (*release)(struct device *dev);释放设备回调函数
        dev_t            devt;设备号
        struct class        *class;设备类类指针
        void        *platform_data;平台设备数据(gpio、中断号、设备名称等)

设备注册和注销

int device_register(struct device *dev);
void device_unregister(struct device *dev);

宏DEVICE_ATTR定义attribute结构

#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)

创建和删除device目录下的属性文件

int device_create_file(struct device *dev,const struct device_attribute *attr);
void device_remove_file(struct device *dev,const struct device_attribute *attr);

驱动

struct device_driver {
    const char        *name;
    struct bus_type        *bus;

    struct module        *owner;
    const char        *mod_name;    /* used for built-in modules */

    bool suppress_bind_attrs;    /* disables bind/unbind via sysfs */

#if defined(CONFIG_OF)
    const struct of_device_id    *of_match_table;
#endif

    int (*probe) (struct device *dev);
    int (*remove) (struct device *dev);
    void (*shutdown) (struct device *dev);
    int (*suspend) (struct device *dev, pm_message_t state);
    int (*resume) (struct device *dev);
    const struct attribute_group **groups;

    const struct dev_pm_ops *pm;

    struct driver_private *p;
}

        const char        *name;驱动名字与设备名字相同总线match匹配函数才可对应找到
        struct bus_type        *bus;指向驱动总线
        const char        *mod_name;驱动模块名字
        probe驱动探测方法(装载使用),remove删除驱动,shutdown关闭驱动方法,suspend挂起方法,resume唤醒方法
        struct driver_private *p;设备驱动私有数据

struct driver_private {
    struct kobject kobj;
    struct klist klist_devices;
    struct klist_node knode_bus;
    struct module_kobject *mkobj;
    struct device_driver *driver;
};

        const struct attribute_group **groups;驱动属性组

struct attribute_group {
    const char        *name;
    mode_t            (*is_visible)(struct kobject *,
                          struct attribute *, int);
    struct attribute    **attrs;
};

驱动程序注册和注销

int driver_register(struct device_driver *drv);
void driver_unregister(struct device_driver *drv);

驱动属性文件删除和创建

int driver_create_file(struct device_driver *drv, const struct driver_attribute *attr);
void driver_remove_file(struct device_driver *drv,const struct driver_attribute *attr);

platform(drivers/base/platform.c)
        
平台设备:wdt、i2c、i2s、rtc,adc等
        CPU与外部通信:地址总线、专用接口
        平台总线为地址总线式连接设备(soc内部外设)

平台设备(struct platform_device)

struct platform_device {
    const char    * name;
    int        id;
    struct device    dev;
    u32        num_resources;
    struct resource    * resource;

    const struct platform_device_id    *id_entry;

    /* arch specific additions */
    struct pdev_archdata    archdata;
};

        name设备名,struct device    dev;设备结构体
        const struct platform_device_id    *id_entry;设备ID表
        struct pdev_archdata    archdata;预留
        struct resource    * resource;资源数组
        u32 num_resources;设备使用资源数量

struct resource {
    resource_size_t start;
    resource_size_t end;
    const char *name;
    unsigned long flags;
    struct resource *parent, *sibling, *child;
};
static struct resource s3c_wdt_resource[] = {
        [0] = {
                .start  = S3C_PA_WDT,
                .end    = S3C_PA_WDT + SZ_1M - 1,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
                .start  = IRQ_WDT,
                .end    = IRQ_WDT,
                .flags  = IORESOURCE_IRQ,
        }
};

        start资源起始地址(WTCON),资源结束地址,name资源名,flags资源类型(IORESOURCE_MEM内存资源)
        start资源起始地址(IRQ_WDT中断开始信号),资源结束地址(IRQ_WDT中断结束信号),flags资源类型(IORESOURCE_IRQ中断资源)
        flags标志:I/O端口(IORESOURCE_IO)、内存资源(IORESOURCE_MEM)、中断号(IORESOURCE_IRQ)、DMA资源(IORESOURCE_DMA) 
        struct resource *parent, *sibling, *child;构建资源设备树

平台设备函数

int platform_device_add(struct platform_device *pdev);
void platform_device_del(struct platform_device *pdev);
int platform_device_register(struct platform_device *pdev);
void platform_device_unregister(struct platform_device *pdev);
struct resource *platform_get_resource(struct platform_device *dev,unsigned int type, unsigned int num);

平台设备驱动

struct platform_driver {
    int (*probe)(struct platform_device *);
    int (*remove)(struct platform_device *);
    void (*shutdown)(struct platform_device *);
    int (*suspend)(struct platform_device *, pm_message_t state);
    int (*resume)(struct platform_device *);
    struct device_driver driver;
    const struct platform_device_id *id_table;
};

        struct device_driver driver;设备驱动结构体
        const struct platform_device_id *id_table;设备ID表
        probe驱动探测方法(装载使用),remove删除驱动,shutdown关闭驱动方法,suspend挂起方法,resume唤醒方法

平台驱动注册(probe)和注销(remove)

int platform_driver_register(struct platform_driver *drv);
void platform_driver_unregister(struct platform_driver *drv);

misc
       
 杂项主设备号通常为10
        设备类文件:/sys/class/misc

混杂设备

struct miscdevice  {
    int minor;
    const char *name;
    const struct file_operations *fops;
    struct list_head list;
    struct device *parent;
    struct device *this_device;
    const char *nodename;
    mode_t mode;
};

        minor次设备号,name设备名,fops设备操作函数,this_device当前设备指针

混杂设备的注册和注销

int misc_register(struct miscdevice * misc);
int misc_deregister(struct miscdevice *misc);

210蜂鸣器(x210-buzzer.c)

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <linux/interrupt.h>
#include <asm/uaccess.h>
#include <mach/hardware.h>
#include <plat/regs-timer.h>
#include <mach/regs-irq.h>
#include <asm/mach/time.h>
#include <linux/clk.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/gpio.h>
#include <plat/gpio-cfg.h>

//定义设备名
#define DEVICE_NAME     "buzzer"

//定义cmd
#define PWM_IOCTL_SET_FREQ        1
#define PWM_IOCTL_STOP            0

//定义信号量
static struct semaphore lock;

//初始化buzzer,设置频率
// TCFG0在Uboot中设置,这里不再重复设置
// Timer0输入频率Finput=pclk/(prescaler1+1)/MUX1=66M/16/16
// TCFG0 = tcnt = (pclk/16/16)/freq;
// PWM0输出频率Foutput =Finput/TCFG0= freq
static void PWM_Set_Freq( unsigned long freq )
{
    unsigned long tcon;
    unsigned long tcnt;
    unsigned long tcfg1;

    struct clk *clk_p;
    unsigned long pclk;

    //unsigned tmp;
    
    //设置GPD0_2为PWM输出
    s3c_gpio_cfgpin(S5PV210_GPD0(2), S3C_GPIO_SFN(2));

    tcon = __raw_readl(S3C2410_TCON);
    tcfg1 = __raw_readl(S3C2410_TCFG1);

    //mux = 1/16
    tcfg1 &= ~(0xf<<8);
    tcfg1 |= (0x4<<8);
    __raw_writel(tcfg1, S3C2410_TCFG1);
    
    clk_p = clk_get(NULL, "pclk");
    pclk  = clk_get_rate(clk_p);

    tcnt  = (pclk/16/16)/freq;
    
    __raw_writel(tcnt, S3C2410_TCNTB(2));
    __raw_writel(tcnt/2, S3C2410_TCMPB(2));//占空比为50%

    tcon &= ~(0xf<<12);
    tcon |= (0xb<<12);        //disable deadzone, auto-reload, inv-off, update TCNTB0&TCMPB0, start timer 0
    __raw_writel(tcon, S3C2410_TCON);
    
    tcon &= ~(2<<12);            //clear manual update bit
    __raw_writel(tcon, S3C2410_TCON);
}

//停止buzzer(改为输入模式)
void PWM_Stop( void )
{
    //将GPD0_2设置为input
    s3c_gpio_cfgpin(S5PV210_GPD0(2), S3C_GPIO_SFN(0));    
}

//对应open,开锁
static int x210_pwm_open(struct inode *inode, struct file *file)
{
    if (!down_trylock(&lock))
        return 0;
    else
        return -EBUSY;
    
}

//对应close,上锁
static int x210_pwm_close(struct inode *inode, struct file *file)
{
    up(&lock);
    return 0;
}

// PWM:GPF14->PWM0(接收cmd,设置频率,关闭buzzer)
static int x210_pwm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
    switch (cmd) 
    {
        case PWM_IOCTL_SET_FREQ:
            printk("PWM_IOCTL_SET_FREQ:\r\n");
            if (arg == 0)
                return -EINVAL;
            PWM_Set_Freq(arg);
            break;

        case PWM_IOCTL_STOP:
        default:
            printk("PWM_IOCTL_STOP:\r\n");
            PWM_Stop();
            break;
    }

    return 0;
}


static struct file_operations dev_fops = {
    .owner   =   THIS_MODULE,
    .open    =   x210_pwm_open,
    .release =   x210_pwm_close, 
    .ioctl   =   x210_pwm_ioctl,
};


//定义msic设备
static struct miscdevice misc = {
    .minor = MISC_DYNAMIC_MINOR,
    .name = DEVICE_NAME,
    .fops = &dev_fops,
};

//驱动装载
static int __init dev_init(void)
{
    int ret;

    init_MUTEX(&lock);
    ret = misc_register(&misc);
    
    /* GPD0_2 (PWMTOUT2) */
    ret = gpio_request(S5PV210_GPD0(2), "GPD0");
    if(ret)
        printk("buzzer-x210: request gpio GPD0(2) fail");
        
    s3c_gpio_setpull(S5PV210_GPD0(2), S3C_GPIO_PULL_UP);
    s3c_gpio_cfgpin(S5PV210_GPD0(2), S3C_GPIO_SFN(1));
    gpio_set_value(S5PV210_GPD0(2), 0);

    printk ("x210 "DEVICE_NAME" initialized\n");
        return ret;
}

//驱动卸载
static void __exit dev_exit(void)
{
    misc_deregister(&misc);
}

module_init(dev_init);
module_exit(dev_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("www.9tripod.com");
MODULE_DESCRIPTION("x210 PWM Driver");

buzzer.c
 

#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>


#define DEVNAME         "/dev/buzzer"

#define PWM_IOCTL_SET_FREQ              1
#define PWM_IOCTL_STOP                  0


int main(void)
{
        int fd = -1;

        fd = open(DEVNAME, O_RDWR);
        if (fd < 0)
        {
                perror("open");
                return -1;
        }

        ioctl(fd, PWM_IOCTL_SET_FREQ, 10000);
        sleep(3);
        ioctl(fd, PWM_IOCTL_STOP);

        close(fd);
}

demo:

        使用平台总线方式驱动led(模仿leds-s3c24xx.c)

Makefile

KERN_DIR = /root/kernel
 
obj-m   += x210-led.o
 
all:
        make -C $(KERN_DIR) M=`pwd` modules 
 
cp:
        cp *.ko /root/rootfs/driver
 
.PHONY: clean
clean:
        make -C $(KERN_DIR) M=`pwd` modules clean

 x210-led.c

#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/leds.h>
#include <mach/regs-gpio.h>
#include <mach/gpio-bank.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <mach/gpio.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <mach/leds_x210-gpio.h>
 
#define LED_OFF 1
#define LED_ON  0

struct  s5pv210_gpio_led 
{
        struct led_classdev     cdev;
        struct s5pv210_led_platdata *pdata;
};


static inline struct s5pv210_gpio_led *pdev_to_gpio(struct platform_device *dev)
{
        return platform_get_drvdata(dev);
}

static inline struct s5pv210_gpio_led *to_gpio(struct led_classdev *led_cdev)
{
        return container_of(led_cdev, struct s5pv210_gpio_led, cdev);
}
 
static void s5pv210_led_set(struct led_classdev *led_cdev,enum led_brightness value)
{
        struct s5pv210_gpio_led *p = to_gpio(led_cdev);

        if(value == LED_OFF)
        {
                gpio_set_value(p->pdata->gpio,LED_OFF);
        }
        else
        {
                gpio_set_value(p->pdata->gpio,LED_ON);
        }
}
 
int s5pv210_led_probe(struct platform_device *dev)
{
        int ret = -1;
        struct s5pv210_led_platdata *pdata = dev->dev.platform_data;
        struct s5pv210_gpio_led *led;

        led = kzalloc(sizeof(struct s5pv210_gpio_led), GFP_KERNEL);
        if (led == NULL) {
                dev_err(&dev->dev, "No memory for device\n");
                return -ENOMEM;
        }

        platform_set_drvdata(dev, led);

        ret = gpio_request(pdata->gpio, pdata->name);

        if (ret != 0) 
        {
                printk(KERN_ERR "gpio_request failed %d\n",ret);
                return ret;
        } 
        else 
        {
                gpio_direction_output(pdata->gpio,GPIOF_OUT_INIT_HIGH);
        }

        led->cdev.name = pdata->name;
        led->cdev.brightness = 0;
        led->cdev.brightness_set = s5pv210_led_set;
        led->pdata = pdata;

        ret = led_classdev_register(&dev->dev, &led->cdev);
        if (ret < 0) 
        {
                printk(KERN_ERR "led classdev register failed\n");
                kfree(led);
                return ret;
        }

        return 0;
}

static int s5pv210_led_remove(struct platform_device *dev)
{
        struct s5pv210_gpio_led *p = pdev_to_gpio(dev);

        led_classdev_unregister(&p->cdev);
        gpio_free(p->pdata->gpio);
        kfree(p);
        return 0;
}
 
struct platform_driver s5pv210_led_driver[] ={
        [0] = {
        .probe          = s5pv210_led_probe,
        .remove         = s5pv210_led_remove,
        .driver         = {
                .name           = "led1",
                .owner          = THIS_MODULE,
        }},
        [1] = {
        .probe          = s5pv210_led_probe,
        .remove         = s5pv210_led_remove,
        .driver         = {
                .name           = "led2",
                .owner          = THIS_MODULE,
        }},
        [2] = {
        .probe          = s5pv210_led_probe,
        .remove         = s5pv210_led_remove,
        .driver         = {
                .name           = "led3",
                .owner          = THIS_MODULE,
        }},
};

 
static int __init led_dev_init(void)
{
        platform_driver_register(&s5pv210_led_driver[0]);
        platform_driver_register(&s5pv210_led_driver[1]);
        platform_driver_register(&s5pv210_led_driver[2]);

        return 0;
}
 
static void __exit led_dev_exit(void)
{
        platform_driver_unregister(&s5pv210_led_driver[0]);
        platform_driver_unregister(&s5pv210_led_driver[1]);
        platform_driver_unregister(&s5pv210_led_driver[2]);
}
 
 
module_init(led_dev_init);
module_exit(led_dev_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("cxb");
MODULE_DESCRIPTION("led gpio  module");
MODULE_ALIAS("led");

操作流程 

vim arch/arm/mach-s5cpv210/include/mach/leds_x210-gpio.h

添加设备特殊数据结构体(gpio、中断号、设备名称等)

#ifndef __ASM_ARCH_LEDSGPIO_H
#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h"
 
#define S5PV210_LEDF_ACTLOW		(1<<0)		/* LED is on when GPIO low */
#define S5PV210_LEDF_TRISTATE		(1<<1)		/* tristate to turn off */
 
struct s5pv210_led_platdata {
	unsigned int		 gpio;
	unsigned int		 flags;
 
	char			*name;
	char			*def_trigger;
};
 
#endif /* __ASM_ARCH_LEDSGPIO_H */



vim arch/arm/mach-s5pv210/mach-x210.c

添加设备特殊数据结构体

#include <mach/leds_x210-gpio.h>

定义如下平台总线设备到smdkc110_devices[]前

static struct s5pv210_led_platdata x210_led1_pdata = {
	.name		= "led1",
	.gpio		= S5PV210_GPJ0(3),
	.flags		= S5PV210_LEDF_ACTLOW | S5PV210_LEDF_TRISTATE,
	.def_trigger	= "",
};
 
static struct platform_device x210_led1 = {
	.name		= "led1",
	.id		= 0,
	.dev		= {
		.platform_data	= &x210_led1_pdata,
	},
};
 
static struct s5pv210_led_platdata x210_led2_pdata = {
	.name		= "led2",
	.gpio		= S5PV210_GPJ0(4),
	.flags		= S5PV210_LEDF_ACTLOW | S5PV210_LEDF_TRISTATE,
	.def_trigger	= "",
};
 
static struct platform_device x210_led2 = {
	.name		= "led2",
	.id		= 1,
	.dev		= {
		.platform_data	= &x210_led2_pdata,
	},
};


static struct s5pv210_led_platdata x210_led3_pdata = {
	.name		= "led3",
	.gpio		= S5PV210_GPJ0(5),
	.flags		= S5PV210_LEDF_ACTLOW | S5PV210_LEDF_TRISTATE,
	.def_trigger	= "",
};
 
static struct platform_device x210_led3 = {
	.name		= "led3",
	.id		= 2,
	.dev		= {
		.platform_data	= &x210_led3_pdata,
	},
};


添加如下平台总线设备到smdkc110_devices[]

&x210_led1
&x210_led2
&x210_led3



make -j8  && cp arch/arm/boot/zImage ~/tftp -f  

make cp

结果示例:

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

虚拟机Ubuntu网络配置

电脑有两个系统&#xff0c;windows系统和ubuntu系统&#xff0c;那网卡到底给哪一个用呢&#xff0c;所以要选择桥接模式&#xff0c;就可以共用网卡 但是我们电脑网卡&#xff0c;有线网卡&#xff0c;无线网卡&#xff0c;到底使用哪个网卡&#xff0c;所以选择桥接到自动或…

wxWidgets实战:使用mpWindow绘制阻抗曲线

选择模型时&#xff0c;需要查看model的谐振频率&#xff0c;因此需要根据s2p文件绘制一张阻抗曲线。 如下图所示&#xff1a; mpWindow 左侧使用mpWindow&#xff0c;右侧使用什么&#xff1f; wxFreeChart https://forums.wxwidgets.org/viewtopic.php?t44928 https://…

基于ssm的理财通的设计与实现+jsp论文

摘 要 在如今社会上&#xff0c;关于信息上面的处理&#xff0c;没有任何一个企业或者个人会忽视&#xff0c;如何让信息急速传递&#xff0c;并且归档储存查询&#xff0c;采用之前的纸张记录模式已经不符合当前使用要求了。所以&#xff0c;对理财信息管理的提升&#xff0c…

长期使用外接键盘,外物压着自带键盘,容易导致华硕飞行堡垒FX53VD键盘全部失灵【除电源键】

华硕飞行堡垒FX53VD键盘全部失灵【除电源键】 前言一、故障排查二、发现问题三、使用方法总结 前言 版本型号&#xff1a; 型号 ASUS FX53VD&#xff08;华硕-飞行堡垒&#xff09; 板号&#xff1a;GL553VD 故障情况描述&#xff1a; 键盘无法使用&#xff0c;键盘除开机键外…

【题解】—— LeetCode一周小结1

1.经营摩天轮的最大利润 题目链接&#xff1a; 1599. 经营摩天轮的最大利润 你正在经营一座摩天轮&#xff0c;该摩天轮共有 4 个座舱 &#xff0c;每个座舱 最多可以容纳 4 位游客 。你可以 逆时针 轮转座舱&#xff0c;但每次轮转都需要支付一定的运行成本 runningCost 。摩…

使用kennycason.kumo.WordCloud For JAVA 制作词云图

官网&#xff1a;https://kennycason.com/posts/2014-07-03-kumo-wordcloud.html 一&#xff1a;添加POM文件 <!-- 词云 --><dependency><groupId>com.kennycason</groupId><artifactId>kumo-core</artifactId><version>1.27<…

c语言-字符串函数(库函数使用)和模拟实现

文章目录 前言一、库函数strcat()介绍1.1 strcat()介绍1.2 模拟实现strcat() 总结 前言 在写c语言基础系列文章时&#xff0c;介绍了字符串函数strlen(),strcpy(),strcmp()的使用和模拟实现。 本篇文章继续探讨其他字符串函数的使用以及模拟实现。 一、库函数strcat()介绍 1.…

螺旋数字矩阵 - 华为OD统一考试

OD统一考试(C卷) 分值: 100分 题解: Java / Python / C++ 题目描述 疫情期间,小明隔离在家,百无聊赖,在纸上写数字玩。他发明了一种写法: 给出数字个数n和行数m (0 < n <= 999,0 < m <= 999),从左上角的1开始,按照顺时针螺旋向内写方式,依次写出2,3……

RabbitMQ(十一)队列的扩展属性(Arguments)

目录 一、简介二、队列扩展属性清单三、代码示例3.1 实现方式一&#xff1a;channel.queueDeclare()3.2 实现方式二&#xff1a;QueueBuilder.build() 一、简介 RabbitMQ 允许用户在声明队列、交换机或绑定时设置 扩展属性&#xff08;Arguments&#xff09;&#xff0c;这些扩…

求阶乘(优化版)

✨欢迎来到脑子不好的小菜鸟的文章✨ &#x1f388;创作不易&#xff0c;麻烦点点赞哦&#x1f388; 所属专栏&#xff1a;刷题 我的主页&#xff1a;脑子不好的小菜鸟 文章特点&#xff1a;关键点和步骤讲解放在 代码相应位置 明天考试&#xff0c;今天复习&#xff0c;复习…

2.2.3机器学习—— 判定梯度下降是否收敛 + α学习率的选择

2.2.3 判定梯度下降是否收敛 α学习率的选择 2.1、 判定梯度下降是否收敛 有两种方法&#xff0c;如下图&#xff1a; 方法一&#xff1a; 如图&#xff0c;随着迭代次数的增加&#xff0c;J(W,b)损失函数不断下降当 iterations 300 之后&#xff0c;下降的就不太明显了 / …

2024年【安全员-B证】试题及解析及安全员-B证模拟试题

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 安全员-B证试题及解析参考答案及安全员-B证考试试题解析是安全生产模拟考试一点通题库老师及安全员-B证操作证已考过的学员汇总&#xff0c;相对有效帮助安全员-B证模拟试题学员顺利通过考试。 1、【多选题】《北京市…

Angular学习第二天--问题记录

一、问题 1.用脚手架搭建完项目之后&#xff0c;缺少app.modules.ts文件&#xff0c; 2.解决办法&#xff1a; 在终端继续输入命令 ng new 项目名称 --no-standalone --routing --ssrfalse 3.完整目录&#xff1a; 二、问题 1.问题来源&#xff0c;源代码&#xff1a; <fo…

Goby高级食用指南

Goby高级食用指南 1.Goby POC2.自定义字典3.Goby插件生态 - 一些好用的插件分享FOFASubDomainsBruteExportCsvAWVSRedis-cliGoby4waf初级篇参考 - Goby基本使用 1.Goby POC Goby的漏洞模块包含官方自定义的一些初始POC: 红队版的POC会实时更新,普通版则不会 Goby的POC编写…

Helix QAC 2023.4 新版支持C++20语言,带来更多性能提升!

Helix QAC 2023.4 新增功能 Helix QAC 2023.4全面支持MISRA C:2023规则&#xff0c;涵盖100%的指南。此版本还加强了对C20语言的支持&#xff0c;改进了数据流分析性能&#xff0c;并在整个产品中增加了多项用户体验改进。 增强的C20支持 此版本新增了对以下语言特性的支持&a…

LeetCode-杨辉三角公式

杨辉三角公式 ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a225ff66061e4076924e3299b81b98d5.png /*** author wx* description 杨辉三角公式-标准* create 2023/12/26**/ public class Triangle {public static void main(String[] args) {List<List<I…

GPT大模型在生物、地球、农业、气象、生态、环境科学可以应用?

以ChatGPT、LLaMA、Gemini、DALLE、Midjourney、Stable Diffusion、星火大模型、文心一言、千问为代表AI大语言模型带来了新一波人工智能浪潮&#xff0c;可以面向科研选题、思维导图、数据清洗、统计分析、高级编程、代码调试、算法学习、论文检索、写作、翻译、润色、文献辅助…

麒麟系统安装docker、mysql、clickhouse

1、查看麒麟系统版本信息 cat /etc/os-release 麒麟系统版本V10 64位操作系统 # uname -p x86_64 # uname -p aarch64 内核版本 # uname -r 4.19.90-24.4.v2101.ky10.x86_64 本操作为麒麟系统版本V10&#xff0c;x86_64操作系统 一&#xff0c;安装docker 文件&#xff1a…

Python自带爬虫库urllib使用大全

目录 一、urllib库简介 二、发送HTTP请求 三、处理响应 四、解析URLs 五、设置代理 六、总结 在Python中&#xff0c;urllib是一个用于处理URLs的内置库&#xff0c;它提供了用于构建、解析、发送和接收HTTP、HTTPS和其他URLs的强大工具。这个库是Python标准库的一部分&a…

Open CASCADE学习|创建拓朴

目录 1、创建点gp_Pnt 2、创建向量gp_Vec 3、创建边TopoDS_Edge 4、线网络TopoDS_Wire 5、面TopoDS_Face 6、体TopoDS_Shape OpenCascade中的拓朴实体如下图所示&#xff0c;其中Compound可以包含很多Solid&#xff1b;Solid由Shell包围而成&#xff1b;Shell由相连的Fac…