add basic library for flexki messaging
This commit is contained in:
parent
a9aa746f81
commit
db3ff44066
4
env/ehrenberg/platform.h
vendored
4
env/ehrenberg/platform.h
vendored
@ -36,7 +36,9 @@
|
|||||||
#define i2s PERIPH(i2s_t, APB_BASE + 0x90000)
|
#define i2s PERIPH(i2s_t, APB_BASE + 0x90000)
|
||||||
#define camera PERIPH(camera_t, APB_BASE + 0xA0000)
|
#define camera PERIPH(camera_t, APB_BASE + 0xA0000)
|
||||||
#define dma PERIPH(dma_t, APB_BASE + 0xB0000)
|
#define dma PERIPH(dma_t, APB_BASE + 0xB0000)
|
||||||
#define msgif PERIPH(msgif_t, APB_BASE + 0xC0000)
|
#define msgif PERIPH(mkcontrolclusterstreamcontroller_t, APB_BASE + 0xC0000)
|
||||||
|
|
||||||
|
#include "ehrenberg/devices/flexki_messages.h"
|
||||||
|
|
||||||
#define XIP_START_LOC 0xE0040000
|
#define XIP_START_LOC 0xE0040000
|
||||||
#define RAM_START_LOC 0x80000000
|
#define RAM_START_LOC 0x80000000
|
||||||
|
57
include/ehrenberg/devices/flexki_messages.h
Normal file
57
include/ehrenberg/devices/flexki_messages.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#ifndef _FLEXKI_MESSAGES_H
|
||||||
|
#define _FLEXKI_MESSAGES_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static void send_msg(uint32_t cluster, uint32_t component, uint32_t msg_len, uint32_t msg_id, uint32_t* words) {
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_HEADER_RECIPIENT_COMPONENT(msgif, component);
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_HEADER_RECIPIENT_CLUSTER(msgif, cluster);
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_HEADER_MESSAGE_LENGTH(msgif, msg_len);
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_HEADER_MESSAGE_ID(msgif, msg_id);
|
||||||
|
for (uint32_t i = 0; i < msg_len; i = i + 1) {
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_0(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_1(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_2(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_3(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_4(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_5(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_6(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_PAYLOAD_7(msgif, words[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_SEND(msgif, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t wait_response(uint32_t msg_id) {
|
||||||
|
while (true) {
|
||||||
|
if (get_mkcontrolclusterstreamcontroller_REG_ACK_PENDING_RESPONSE(msgif) != 0) {
|
||||||
|
if (get_mkcontrolclusterstreamcontroller_REG_RECV_ID_RECV_ID(msgif) == msg_id) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint32_t response_payload = get_mkcontrolclusterstreamcontroller_REG_RECV_PAYLOAD(msgif);
|
||||||
|
set_mkcontrolclusterstreamcontroller_REG_ACK_ACK(msgif, 1);
|
||||||
|
return response_payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _FLEXKI_MESSAGES_H */
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef _DEVICES_MSG_IF_H
|
#ifndef _DEVICES_MSG_IF_H
|
||||||
#define _DEVICES_MSG_IF_H
|
#define _DEVICES_MSG_IF_H
|
||||||
|
|
||||||
#include "gen/msgif.h"
|
#include "gen/mkcontrolclusterstreamcontroller.h"
|
||||||
|
|
||||||
#endif /* _DEVICES_MSG_IF_H */
|
#endif /* _DEVICES_MSG_IF_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user