IPC使用指南
此章节着重说明MCU侧的相关使用说明,更多的IPC的原理和使用可以查阅 IPC模块介绍 章节。
IPC配置相关
一个IPC有8个channels,但是共享一个中断,因此一个IPC只能在MCU0或MCU1其中一个系统上使能。
当MCU1使用IPC时,需要配置两部分内容。
- 需要配置回调函数,作用是当IPC收到/发送数据时产生回 调。当然客户可自行定制当传输数据错误时的回调函数。下文以IPC0为例介绍。
static Ipc_ChannelConfigType Ipc_ShmInstance0CfgChannel[8] = {
{
.ChannelId = 0,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_0BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 1,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_1BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 2,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_2BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 3,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_3BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 4,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_4BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 5,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_5BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 6,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_6BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
{
.ChannelId = 7,
.ChannelData = {
.NumPools = 1,
.PoolCfg = Ipc_ShmIpcInstance_0CfgIpcChannel_7BufPool,
.RxCallback = IpcTp_InsCan_RxCallback,
.RxCallbackArg = (NULL_PTR),
.TxErrCallback = DefaultTxErrCallback,
.TxErrCallbackArg = (NULL_PTR),
},
},
};
- 设置receive_coreid。如果是在MCU1上,则需要"receive_coreid=Ipc_Receive_Core1"。同时需要保障MCU0关于IPC设置相同。
- MCU0文件地址:/mcu/Config/McalCdd/gen_s100_sip_B/Ipc/src/Ipc_Cfg.c
- MCU1文件地址:/mcu/Config/McalCdd/gen_s100_sip_B_mcu1/Ipc/src/Ipc_Cfg.c
Ipc_InstanceConfigType Ipc_ShmCfgInstances0 = {
.Ipc_InstanceId = 0U,
.Ipc_ChannelNum = 8U,
.LocalCtlAddr = 0xcdd9e00,
.RemoteCtlAddr = 0xcdd9400,
.CtlShmSize = 0xa00,
.LocalDataAddr = 0xb4080000,
.RemoteDataAddr = 0xb4000000,
.DataShmSize = 0x80000,
.SendDmaChanIdx = 0xffU,
.Async = (TRUE),
.HwInfo = {
.Ipc_HwId = CPU_IPC0,/**< the id of the Hardware */
.RecvIrqUsed = (TRUE),/**< Whether to use Recv interrupt */
.SendMboxId = 0,/**< the mailbox id */
.RecvMboxId = 16,/**< the mailbox id */
.RemoteIrq = 16,
.LocalIrq = 0,
.UseMDMA = (TRUE),
},
.Ipc_ChannelConfigPtr = Ipc_ShmInstance0CfgChannel,
.receive_coreid = Ipc_Receive_Core1,
};
IPC 使用情况
instance0
Instance | Channel | receive core id | Description |
---|---|---|---|
instance0 | 0 | Ipc_Receive_Core1 | CAN Reserve |
instance0 | 1 | Ipc_Receive_Core1 | CAN Reserve |
instance0 | 2 | Ipc_Receive_Core1 | CAN8 |
instance0 | 3 | Ipc_Receive_Core1 | CAN9 |
instance0 | 4 | Ipc_Receive_Core1 | CAN5 |
instance0 | 5 | Ipc_Receive_Core1 | CAN Reserve |
instance0 | 6 | Ipc_Receive_Core1 | CAN6 |
instance0 | 7 | Ipc_Receive_Core1 | CAN7 |
instance1
Instance | Channel | receive core id | Description |
---|---|---|---|
instance1 | 0 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 1 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 2 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 3 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 4 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 5 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 6 | Ipc_Receive_Core0 | Regulatory Reserve |
instance1 | 7 | Ipc_Receive_Core0 | Regulatory Reserve |
instance2
Instance | Channel | receive core id | Description |
---|---|---|---|
instance2 | 0 | Ipc_Receive_Core0 | Regulatory Reserve |
instance2 | 1 | Ipc_Receive_Core0 | Regulatory Reserve |
instance3
Instance | Channel | receive core id | Description |
---|---|---|---|
instance3 | 0 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 1 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 2 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 3 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 4 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 5 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 6 | Ipc_Receive_Core0 | Crypto Reserve |
instance3 | 7 | Ipc_Receive_Core0 | Crypto Reserve |
instance4
Instance | Channel | receive core id | Description |
---|---|---|---|
instance4 | 0 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 1 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 2 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 3 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 4 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 5 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 6 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance4 | 7 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5
Instance | Channel | receive core id | Description |
---|---|---|---|
instance5 | 0 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 1 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 2 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 3 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 4 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 5 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 6 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance5 | 7 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6
Instance | Channel | receive core id | Description |
---|---|---|---|
instance6 | 0 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 1 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 2 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 3 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 4 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 5 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 6 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance6 | 7 | Ipc_Receive_Core0 | 客户预留:Reserve |
instance7
Instance | Channel | receive core id | Description |
---|---|---|---|
instance7 | 0 | Ipc_Receive_Core1 | runcmd |
instance7 | 1 | Ipc_Receive_Core1 | runcmd |
instance7 | 2 | Ipc_Receive_Core1 | SPI |
instance7 | 3 | Ipc_Receive_Core1 | SPI |
instance7 | 4 | Ipc_Receive_Core1 | UART |
instance7 | 5 | Ipc_Receive_Core1 | UART |
instance7 | 6 | Ipc_Receive_Core1 | I2C |
instance7 | 7 | Ipc_Receive_Core1 | I2C |
instance8
Instance | Channel | Function | Description |
---|---|---|---|
instance8 | 0 | Ipc_Receive_Core0 | Reserve |
instance8 | 1 | Ipc_Receive_Core0 | Reserve |
instance8 | 2 | Ipc_Receive_Core0 | Reserve |
instance8 | 3 | Ipc_Receive_Core0 | Reserve |
instance8 | 4 | Ipc_Receive_Core0 | Reserve |
instance8 | 5 | Ipc_Receive_Core0 | Reserve |
instance8 | 6 | Ipc_Receive_Core0 | Reserve |
instance8 | 7 | Ipc_Receive_Core0 | Crypto Reserve |
应用sample
IpcBox功能介绍
IpcBox是IPC的应用扩展,使用instance7用于透传外设数据和执行MCU侧的CMD应用,简称RunCmd应用。
对应的Acore侧应用使用方式见IPC模块介绍 章节。