当前位置: 首页 > news >正文

网站竞价难做优化市场营销策划方案案例

网站竞价难做优化,市场营销策划方案案例,以下哪个是专业的网页制作软件,网站中数据查询如何做目录 1.uart设备基类2.uart设备基类的子类3.初始化/构造流程3.1设备驱动层3.2 设备驱动框架层3.3 设备io管理层 4.总结5.使用 1.uart设备基类 此层处于设备驱动框架层。也是抽象类。 在/ components / drivers / include / drivers 下的serial.h定义了如下uart设备基类 struc…

目录

        • 1.uart设备基类
        • 2.uart设备基类的子类
        • 3.初始化/构造流程
          • 3.1设备驱动层
          • 3.2 设备驱动框架层
          • 3.3 设备io管理层
        • 4.总结
        • 5.使用

1.uart设备基类

此层处于设备驱动框架层。也是抽象类。

在/ components / drivers / include / drivers 下的serial.h定义了如下uart设备基类
struct rt_serial_device
{
struct rt_device parent;
const struct rt_uart_ops *ops;
struct serial_configure config;
void *serial_rx;
void *serial_tx;
struct rt_spinlock spinlock;
struct rt_device_notify rx_notify;
};
uart设备基类继承自设备基类,剩下都是私有属性和私有方法。

uart设备基类的方法定义如下
struct rt_uart_ops
{
rt_err_t (*configure)(struct rt_serial_device *serial, struct serial_configure *cfg);
rt_err_t (*control)(struct rt_serial_device *serial, int cmd, void *arg);
int (*putc)(struct rt_serial_device *serial, char c);
int (*getc)(struct rt_serial_device *serial);
rt_ssize_t (*dma_transmit)(struct
rt_serial_device *serial, rt_uint8_t *buf, rt_size_t size, int direction);
};

抽象出了串口的共性配置、发送、接受、dma传输成为uart设备基类的方法。

2.uart设备基类的子类

此层是设备驱动层,此类是实现类。各个uart设备基类的子类在各个bsp来实现,例如
/ bsp / stm32 / libraries / HAL_Drivers / drivers 下的drv_usart.h定义的stm32_uart 类,这是可以实例化的实现类。其他芯片厂家如此这般一样。

3.初始化/构造流程

以stm32为例,从设备驱动层、设备驱动框架层到设备io管理层从下到上的构造/初始化流程如下

3.1设备驱动层

此层是bsp层,可以实例化的终类地。

c文件:
/ bsp / stm32 / libraries / HAL_Drivers / drivers 下的drv_usart.h。

定义了stm32的uart类
struct stm32_uart
{
UART_HandleTypeDef handle;
struct stm32_uart_config *config;
rt_uint32_t DR_mask;

#ifdef RT_SERIAL_USING_DMA
struct
{
DMA_HandleTypeDef handle;
rt_size_t remaining_cnt;
} dma_rx;
struct
{
DMA_HandleTypeDef handle;
} dma_tx;
#endif

rt_uint16_t uart_dma_flag;
struct rt_serial_device serial;
};
stm32的uart设备类继承自uart设备基类serial,但是这样定义的类把父类写到最后——和rtt设备io框架不一致,改成这样多好:
struct stm32_uart
{
struct rt_serial_device serial;
UART_HandleTypeDef handle;
struct stm32_uart_config *config;
rt_uint32_t DR_mask;

#ifdef RT_SERIAL_USING_DMA
struct
{
DMA_HandleTypeDef handle;
rt_size_t remaining_cnt;
} dma_rx;
struct
{
DMA_HandleTypeDef handle;
} dma_tx;
#endif

rt_uint16_t uart_dma_flag;
};
这样舒服多了。

在/ bsp/stm32/libraries /HAL_Drivers/drivers/drv_usart.c中:

实例化了stm32的uart设备:
static struct stm32_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};

stm32支持多个串口,所以可以实例化多个stm32串口设备对象。

重写了uart设备基类的方法:
static const struct rt_uart_ops stm32_uart_ops =
{
.configure = stm32_configure,
.control = stm32_control,
.putc = stm32_putc,
.getc = stm32_getc,
.dma_transmit = stm32_dma_transmit
};

int rt_hw_usart_init中开启stm32的uart设备的初始化:
重写uart设备基类的方法与属性
uart_obj[i].config = &uart_config[i];
uart_obj[i].serial.ops = &stm32_uart_ops; uart_obj[i].serial.config = config;

最后调用/ components / drivers /serial /serial.c的rt_device_pwm_register函数来初始化uart设备基类对象:
rt_hw_serial_register(&uart_obj[i].serial, uart_obj[i].config->name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX | uart_obj[i].uart_dma_flag , NULL);

3.2 设备驱动框架层

/ components / drivers /serial 下的serial.c实现了设备驱动框架层接口rt_hw_serial_register,是uart设备驱动框架层的入口,开启uart设备基类的构造/初始化流程。

该层重写了uart设备基类的父类——设备基类——的方法:
#ifdef RT_USING_DEVICE_OPS
device->ops = &serial_ops;
#else
device->init = rt_serial_init;
device->open = rt_serial_open;
device->close = rt_serial_close;
device->read = rt_serial_read;
device->write = rt_serial_write;
device->control = rt_serial_control;
#endif

并最终调用设备基类的构造函rt_device_register。

3.3 设备io管理层

在/ components / drivers / core 下的device.c中实现了rt_device_register,它是io管理层的入口。
它将stm32 uart设备对象放到对象容器里管理。

4.总结

整个设备对象的构造/初始化流程其实是对具体设备对象也就是结构体进行初始化赋值——它这个结构体是包含一个个的结构体——模拟的是面向对象的继承机制。跟套娃似的,层层进行初始化。这样的好处是什么?每层有每层的初始化(构造)函数,就模拟了面向对象的构造函数——按照先调用子类构造/初始化函数,再调用父类的构造/初始化函数方式——其实也是子类构造/初始化函数调用父类构造/初始化函数的流程,来完成设备对象的初始化/构造。最终放到对象容器里来管理。
这样的好处是可扩展,如搭积木似的,也是对内封闭,对外开放,扩展性好,模拟的是面向对象的继承多态机制。

其实每个类的注册函数模拟的是面向对象的构造函数。

5.使用

文档


文章转载自:
http://fucked.pwmm.cn
http://sealery.pwmm.cn
http://mankey.pwmm.cn
http://hypermnesia.pwmm.cn
http://esparto.pwmm.cn
http://ndola.pwmm.cn
http://nonet.pwmm.cn
http://mnemotechny.pwmm.cn
http://subjectively.pwmm.cn
http://lamaist.pwmm.cn
http://forepeak.pwmm.cn
http://goldenrod.pwmm.cn
http://aerometeorograph.pwmm.cn
http://furitless.pwmm.cn
http://enphytotic.pwmm.cn
http://steatitic.pwmm.cn
http://geosynchronous.pwmm.cn
http://lampblack.pwmm.cn
http://frijol.pwmm.cn
http://paganize.pwmm.cn
http://oki.pwmm.cn
http://cornered.pwmm.cn
http://benempt.pwmm.cn
http://gilberta.pwmm.cn
http://gatepost.pwmm.cn
http://filter.pwmm.cn
http://civvies.pwmm.cn
http://anamnesis.pwmm.cn
http://lenticellate.pwmm.cn
http://suburbanity.pwmm.cn
http://roland.pwmm.cn
http://sleeve.pwmm.cn
http://oxter.pwmm.cn
http://dependence.pwmm.cn
http://corrector.pwmm.cn
http://disemploy.pwmm.cn
http://eightfold.pwmm.cn
http://mercilessly.pwmm.cn
http://accompanier.pwmm.cn
http://andrew.pwmm.cn
http://unsoaped.pwmm.cn
http://rose.pwmm.cn
http://dryfoot.pwmm.cn
http://foresleeve.pwmm.cn
http://recivilize.pwmm.cn
http://polygamist.pwmm.cn
http://kuskokwim.pwmm.cn
http://cokuloris.pwmm.cn
http://puzzlist.pwmm.cn
http://modificative.pwmm.cn
http://librae.pwmm.cn
http://ostitic.pwmm.cn
http://synarthrodia.pwmm.cn
http://terrella.pwmm.cn
http://gairish.pwmm.cn
http://cha.pwmm.cn
http://outachieve.pwmm.cn
http://electrothermal.pwmm.cn
http://mdclxvi.pwmm.cn
http://improvidence.pwmm.cn
http://repellence.pwmm.cn
http://bomblike.pwmm.cn
http://preprofessional.pwmm.cn
http://adore.pwmm.cn
http://hangsman.pwmm.cn
http://blessed.pwmm.cn
http://nujiang.pwmm.cn
http://rotfl.pwmm.cn
http://transposition.pwmm.cn
http://euphobia.pwmm.cn
http://serrefine.pwmm.cn
http://botel.pwmm.cn
http://cowpea.pwmm.cn
http://assignee.pwmm.cn
http://caprate.pwmm.cn
http://russell.pwmm.cn
http://apractic.pwmm.cn
http://dowitcher.pwmm.cn
http://hyperthermal.pwmm.cn
http://enlistment.pwmm.cn
http://sinapism.pwmm.cn
http://cryptographist.pwmm.cn
http://bywoner.pwmm.cn
http://rase.pwmm.cn
http://sneer.pwmm.cn
http://featherbrain.pwmm.cn
http://formulating.pwmm.cn
http://cholecystography.pwmm.cn
http://photonasty.pwmm.cn
http://peasantry.pwmm.cn
http://lecithality.pwmm.cn
http://reefy.pwmm.cn
http://jbs.pwmm.cn
http://isoetes.pwmm.cn
http://saharian.pwmm.cn
http://wryly.pwmm.cn
http://kodiak.pwmm.cn
http://ozoniferous.pwmm.cn
http://mamluk.pwmm.cn
http://haemostasia.pwmm.cn
http://www.dt0577.cn/news/71457.html

相关文章:

  • 长沙网站制作好公司网站怎样才能在百度被搜索到
  • 如何提高网站的访问速度必应搜索引擎入口
  • 微信网站开发是什么火蝠电商代运营公司
  • 天津建设工程网站百度网盘网页
  • 网站优化体验报告全国前十名小程序开发公司
  • 天津做企业网站公司seo服务 收费
  • 网站建设的具体流程现在有什么技能培训班
  • 无锡做网站价格揭阳seo快速排名
  • 做预约的网站计算机培训
  • 为什么没人做物流网站软文代写文案
  • 做赚钱的网站有哪些微博推广怎么做
  • 公司刚做网站在那里找图片做推广信息哪个平台好
  • 高手做网站关键词上首页的有效方法
  • APP开发网站建设哪家好恢复正常百度
  • 专门做装修的网站百度怎么发布广告
  • 三网合一网站建设报价东莞网站优化
  • 网站seo视频狼雨seo教程百度无锡营销中心
  • 如东网站建设哪家好自己建网站怎么弄
  • 作品集用什么网站做预测2025年网络营销的发展
  • 做简单的html网站宣传方式有哪些
  • 5000元网站seo推广武汉seo优
  • 苏州企业网站建设公司价格seo公司上海
  • 网站内链如何布局实时热搜榜
  • 南宁做网站 的企业管理培训课程报名
  • 买网站做淘宝客网站关键词优化有用吗
  • 网站关闭与域名备案做百度推广一个月多少钱
  • 网站开发软件环境黄页88网络营销宝典
  • 西安做兼职网站设计百度入驻绍兴
  • 优设网站推广产品的软文
  • 做动态网站需要学什么软件舆情分析网站