查看: 4346|回复: 5

[原创] 【LPC54114双核使用指南翻译】+任务八

[复制链接]
  • TA的每日心情
    无聊
    2019-4-1 22:48
  • 签到天数: 302 天

    连续签到: 1 天

    [LV.8]以坛为家I

    87

    主题

    7322

    帖子

    4

    金牌会员

    Rank: 6Rank: 6

    积分
    4635
    最后登录
    2021-1-25
    发表于 2017-6-8 18:30:02 | 显示全部楼层 |阅读模式
    本帖最后由 feixiang20 于 2017-7-9 22:56 编辑

    advanced Inter-core operations
    高级Intel Core操作


    Shared data implementation

    共享数据的实现

    Share the same RAM range between two cores.
    User code define and interpret the data structure
    Define the “shared data” struct and put in a “.h” file.
    Both projects need to include this header.
    Both project define exactly one instance of this struct
    Must make sure the address of the shared object is manually set
    Need to configure linker to put the shared data to designated place.
    (LPC541xx): Can use IRQ0/1 registers to pass the address of shared data.
    Code can poll the shared data periodically, or send IRQ to the other when the code update some fields in the shared data.
    Don’t forget “volatile” keyword to ensure compiler always access true variable.

    在两个内核之间共享相同的RAM范围。
    用户代码定义和解释数据结构
    定义这个“共享数据”结构并放入“h”文件中。
    这两个项目都需要包含此头文件。
    这两个项目都确切地定义了这个结构的一个情况。
    必须确保共享对象的地址是手动设置的。
    需要配置链接器将共享数据放到指定的位置。
    (lpc541xx):可以使用IRQ0 / 1寄存器来传递共享数据的地址。
    代码可以共享数据的定期调查,或发送IRQ的其他当代码更新共享数据等。
    不要忘记“易失”关键字,以确保编译程序总是获取正确的变量。


    Extension of mailbox: Software Message pool

    邮箱扩展:软件消息池

    Each item in pool is a message
    Message items have fixed length.
    Item has 3 status: New, Idle, Preprocessed
    Sender traverses the pool to scan idle item
    Write message data to idle item and update item to “new”
    Receiver side:
    ISR traverses the pool to scan new items, and do first step processing.
    If ISR can process it completely, update the item status to “idle” again.
    If ISR can’t do all job, mark a “new” item to “preprocessed”
    RTOS can then dispatch preprocessed items to tasks
    Drawbacks:
    Message items can’t be too many to make traverse time too long.
    Risk: Insufficient items when messages are flooding.

    池中的每个项目都是一个信息
    消息项有固定长度。
    项目有3个状态:新的,空闲的,预处理
    发送者通过池扫描空闲项
    将消息数据写入空闲项并将项目更新为“新的”
    接收端:
    ISR通过池扫描新项目,并进行第一步处理。
    如果ISR可以完全处理,更新项目状态为“空闲”。
    如果ISR不能做所有的工作,标记一个“新的”项目到“预处理”
    RTOS随后可以将预处理的项目分派给任务。
    缺点:
    消息项不能太多,使通过时间过长。
    风险:消息超出范围时项目不足。


    From store structure view, message pool is simplified message queue and they are based on array structure, they don’t have the indces for read and write. Each element in pool corresponds to a message, and it has one byte to show its state: Idle(processed), new, preprocessed. When sender writes message, it scans the array to check the first idle element; when receiver reads message, it also scans the array for all non idle elements.
    Message pool can be scanned in parallel without the risk of race condition, because sender and receiver do not compete. Furthermore, elements can be processed in two passes. The first pass is in IRQ context to handle real-time part. If IRQ context part completes the element then mark it as idle, else mark it as preprocessed. Then in background context or task context if RTOS is used, continue processing the preprocessed message.
    There is a major drawback of message pool: The capacity of pool can’t be too high, otherwise it will take too much time to scan the array.

    从存储结构来看,消息池简化消息队列,它们是基于阵列结构,他们没有读写的indces。池中的每个元素对应一条消息,它有一个字节来显示它的状态:空闲(处理)、新的、预处理的。当发送方写入消息时,它会扫描数组以检查第一个空闲元素;当接收方读取消息时,它也将扫描所有非空闲元素的数组。
    消息池可以并行扫描而不受比赛条件的影响,因为发送方和接收方不竞争。此外,元素可以在两个通行证处理。第一关是在中断上下文处理实时部分。如果中断上下文部分完成的元素,将其标记为空闲,其他标记为预处理。然后在后台上下文或任务上下文中使用RTOS,继续处理预处理消息。
    消息池的主要缺点是:池的容量不能太高,否则要花费太多的时间扫描数组。


    Alternate inter-core messaging: unidirectional ring queue pair

    交替inter-core队列:单向环队列对

    As an alternative of Software messaging pool
    Two unidirectional ring queues, one is M4 to M0, the other is M0 to M4,
    Sender core is write-only, receiver core is read-only.
    Sender to judge when queue is full, receiver to judge when queue is empty
    Both sender and receiver update write/read indexes after they processed the item.
    Queues have fixed size items or work as byte streams (Special case when item size is 1 byte).
    Queues have write index and read index and they rollback to form ring structure.
    If capacity is 2**n (8,16,32,…),  rollback can be simplified as “index = (index + 1) & (cap - 1)”
    Queues can also have “count” field to ease judging empty and full conditions.
    Or Just omit “count” field by wasting one item space:
    When read == write means empty, When (write+1)%capacity == read means full
    If capacity is 2**n (8,16,32,…), “%” can be converted to “&” ---- Makes M0+ happy.
    Sender can send IRQ to receiver after it produces new item(s), and vice versa.
    May use additional s/w IRQ flags to specify the reason of IRQs.

    作为软件消息池的另一种选择
    两单向环形队列,一个是M4 M0,其他是M0到M4,
    发送方核心只写,接收方核心为只读。
    发送方判断队列是否满时,接收方判断队列是否为空
    发送方和接收方在处理该项目后更新写/读索引。
    队列有固定大小的项目或工作字节流(特殊情况下,当项目大小为1字节)。
    队列有写索引和读索引,它们回滚形成环结构。
    如果容量是2×N(8,16,32,…),回滚可以简化为“指数=(指数+ 1)和(第1)”
    队列也可以有“计数”字段以便于判断空和满条件。
    或省略“计数”字段浪费一个项目空间:
    当读=写的意思是空的,当(写+ 1)%的能力=阅读意味着充分
    如果容量是2×N(8,16,32,…),“%”可以转化为“&”----让M0 +快乐。
    发送者可以产生以后新项目接收发送IRQ(S),反之亦然。
    可以使用附加的S / W的IRQ标志指定IRQ的原因。


    Further Mutual exclusion besides hardware MUTEX
    进一步互斥除硬件互斥

    For shared ring buffer/queue structures, enforce below constraints:
    Only sender is allowed to modify write index
    Only receiver is allowed to modify read index
    For message pool:
    Only sender is allowed to change “idle” state to “new” state
    Only receiver is allowed to change “new” state to “preprocessed” or “idle” state.
    When pointers are involved:Only one core is allowed to modify pointer
    The other core can set some flags to ask pointer owner to modify pointer
    Note: LPC4300 does not support hardware MUTEX, above are only choices.

    对于共享环缓冲/队列结构,强制执行以下约束:
    只有发送方允许修改写入索引
    只允许修改读索引
    用于消息池:
    只有发送方允许将“空闲”状态更改为“新”状态
    只有接收方允许将“新”状态改为“预处理”或“空闲”状态。
    当涉及到指针时,只允许一个内核修改指针。
    另一个核心可以设置一些标志,要求指针所有者修改指针
    注:lpc4300不支持硬件互斥,以上只是选择。

    回复

    使用道具 举报

  • TA的每日心情
    擦汗
    2021-7-5 15:45
  • 签到天数: 664 天

    连续签到: 1 天

    [LV.9]以坛为家II

    42

    主题

    1594

    帖子

    19

    金牌会员

    Rank: 6Rank: 6

    积分
    5650
    最后登录
    2021-12-22
    发表于 2017-6-15 15:29:04 | 显示全部楼层
    这翻译 不知道说什么了?
    Inter-core  operations  怎么成了 Intel(英特尔)研发的微处理器???

    那本是指核间操作,这里事实上是指M4和M0核之间的通信、数据共享、内存共享
    该会员没有填写今日想说内容.
    回复 支持 1 反对 0

    使用道具 举报

  • TA的每日心情
    慵懒
    2016-11-4 16:56
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]初来乍到

    8

    主题

    602

    帖子

    0

    金牌会员

    Rank: 6Rank: 6

    积分
    1842
    最后登录
    2020-8-25
    发表于 2017-6-21 11:33:53 | 显示全部楼层
    okwh 发表于 2017-6-15 15:29
    这翻译 不知道说什么了?
      Inter-core  operations  怎么成了 Intel(英特尔)研发的微处理器???

    哎,
    组织者的问题在于没有试翻就仓促开始了这个活动。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2017-5-3 11:19
  • 签到天数: 10 天

    连续签到: 1 天

    [LV.3]偶尔看看II

    50

    主题

    1万

    帖子

    0

    金牌会员

    Rank: 6Rank: 6

    积分
    14090
    最后登录
    2024-4-19
    发表于 2017-6-26 21:30:50 | 显示全部楼层
    inter-core我觉得应该翻译成“内联核”。
    还有楼主是用电脑翻译的吧!!!这翻译的是什么哦。。。。既然领了任务就要负责点。
    该会员没有填写今日想说内容.
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2021-1-28 20:09
  • 签到天数: 317 天

    连续签到: 1 天

    [LV.8]以坛为家I

    61

    主题

    1582

    帖子

    6

    金牌会员

    Rank: 6Rank: 6

    积分
    9420
    最后登录
    2022-5-12
    发表于 2017-6-27 14:33:12 | 显示全部楼层

    advanced Inter-core operations
    先进的Intel Core操作   【Intel Core是一种Intel(英特尔)研发的微处理器】

    括号里面的解释 亮了
    好好
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2021-11-30 16:16
  • 签到天数: 206 天

    连续签到: 1 天

    [LV.7]常住居民III

    74

    主题

    2793

    帖子

    5

    金牌会员

    Rank: 6Rank: 6

    积分
    7911
    最后登录
    2025-4-11
    发表于 2017-6-27 14:42:40 | 显示全部楼层
    机翻,也没有后期校对
    来根华子
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-9-17 07:43 , Processed in 0.102802 second(s), 25 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

    快速回复 返回顶部 返回列表