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

Linux UWB Stack实现——MCPS调度接口(API)

在上一篇文章中,介绍了MCPS调度接口涉及的相关数据结构实现MCPS调度接口(数据结构),本文继续介绍调度相关的方法的实现。

1. 域处理

1.1 域注册与注销

注册/注销一个mcps802154_region,分别在模块加载(module_init)和模块卸载(module_exit)时调用。

int mcps802154_region_register(struct mcps802154_region_ops *region_ops);
void mcps802154_region_unregister(struct mcps802154_region_ops *region_ops);

1.2 域操作

域的操作包括:打开和关闭一个域,域的参数设置,域的调用以及发送域的事件。

// 打开一个域,然后设置参数。需要打开域的名称,底层设备指针
// 返回指向打开域的指针
struct mcps802154_region *
mcps802154_region_open(struct mcps802154_llhw *llhw, const char *name,const struct nlattr *params_attr,struct netlink_ext_ack *extack);
// 关闭一个域		  
void mcps802154_region_close(struct mcps802154_llhw *llhw,struct mcps802154_region *region);// 设置一个打开域的参数
int mcps802154_region_set_parameters(struct mcps802154_llhw *llhw,struct mcps802154_region *region,const struct nlattr *params_attr,struct netlink_ext_ack *extack);// 调用域中的一个特定的处理程序,通过域特定的程序的标识符call_id来标识调用的程序
int mcps802154_region_call(struct mcps802154_llhw *llhw,struct mcps802154_region *region, u32 call_id,const struct nlattr *params_attr,const struct genl_info *info);// 分配缓冲区以发送域的通知,返回已分配且提前填充的buffer
struct sk_buff *
mcps802154_region_event_alloc_skb(struct mcps802154_llhw *llhw,struct mcps802154_region *region, u32 call_id,u32 portid, int approx_len, gfp_t gfp);// 发送已分配的且已经填充的buffer,需要传递底层硬件指针
int mcps802154_region_event(struct mcps802154_llhw *llhw, struct sk_buff *skb);

2. 调度器

2.1 调度器注册与注销

在模块加载时注册一个mcps802154_scheduler调度器;模块卸载时,注销调度器。与mcps802154_region处理类似。

int mcps802154_scheduler_register(struct mcps802154_scheduler_ops *scheduler_ops);
void mcps802154_scheduler_unregister(struct mcps802154_scheduler_ops *scheduler_ops);

2.2 调度器操作

对于调度器而言,可能更改调度开始的时间、清除或回收当前的调度、向调度中增加新的域、更改调度访问、无效调度等,主要通过以下的外部API调用。

// 改变当前已经更新调度开始时间戳:需要调度计划上下文,同时设置新的时间戳(DTU)
int mcps802154_schedule_set_start(const struct mcps802154_schedule_update *schedule_update,u32 start_timestamp_dtu);// 清除或回收当前的调度计划(schedule)
// n_keeps:保留上一调度计划的域数
// last_region_duration_dtu:最后域的持续时间,若为MCPS802154_DURATION_NO_CHANGE则保持不变
int mcps802154_schedule_recycle(const struct mcps802154_schedule_update *schedule_update,size_t n_keeps, int last_region_duration_dtu);// 向当前更新的调度计划中增加一个新的域,包括开始时间以及持续时间
int mcps802154_schedule_add_region(const struct mcps802154_schedule_update *schedule_update,struct mcps802154_region *region, int start_dtu, int duration_dtu);	// 请求尽可能更改访问
// 当有新的可用数据时,则使用此函数重新评估当前访问的时间。
// 如设备在休眠或等待接收帧,有新的数据需要发送,则需要调用请求重新评估,更改访问。
// 如果设备处于忙碌状态,将忽略请求,这种情况下,当前访问完成后才会检查新的访问。
void mcps802154_reschedule(struct mcps802154_llhw *llhw);// 请求无效调度计划(schedule)
// 有限状态机锁应该入锁。要无效当前的schedule,将导致调度计划更改。
// 当例如某些参数更改时,应从外部模块调用此API以强制进行调度计划更改。
void mcps802154_schedule_invalidate(struct mcps802154_llhw *llhw);
http://www.lryc.cn/news/186825.html

相关文章:

  • el-tree中插入图标并且带提示信息
  • 竞赛选题 深度学习 YOLO 实现车牌识别算法
  • Direct3D网格(一)
  • C语言打印菱形
  • ElasticSearch搜索引擎:数据的写入流程
  • python3 调用 另外一个python脚本
  • 【13】c++设计模式——>简单工厂模式
  • 系统架构设计:2 论软件设计方法及其应用
  • 基于Winform的UDP通信
  • 掌握 BERT:自然语言处理 (NLP) 从初级到高级的综合指南(1)
  • Linux Ftrace介绍
  • Go语言进阶------>init()函数
  • 云计算:常用微服务框架
  • jmeter添加断言(详细图解)
  • few shot object detection via feature reweight笔记
  • 工会排队模式:电商新营销模式吸引消费者,提升销售!
  • 定档通知2024中国(北京)国际红外技术及设备展览会
  • 自助建站系统,一建建站系统api版,自动建站
  • 算法框架-LLM-1-Prompt设计(一)
  • 一个rar压缩包如何分成三个?
  • 批量获取拼多多商品详情数据,拼多多商品详情API接口
  • Redis Cluster Gossip Protocol: 目录
  • HarmonyOS/OpenHarmony原生应用-ArkTS万能卡片组件Span
  • 这些负载均衡都解决哪些问题?服务、网关、NGINX
  • Lambda表达式在C++中的定义
  • sheng的学习笔记-【中文】【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验
  • 前端代码格式化规范总结
  • Windows10打开应用总是会弹出提示窗口的解决方法
  • 易点易动固定资产管理系统: 帮助您应对2023年年终固定资产大盘点
  • OpenGLES:绘制一个混色旋转的3D立方体