Add header library with cluster config information

This commit is contained in:
2025-02-24 17:05:51 +01:00
parent 06cbc26688
commit b34365534c
3 changed files with 337 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
#ifndef _FLEXKI_MESSAGES_H
#define _FLEXKI_MESSAGES_H
#include "fki_cluster_info.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) {
@@ -41,6 +43,14 @@ static void send_msg(uint32_t cluster, uint32_t component, uint32_t msg_len, uin
set_mkcontrolclusterstreamcontroller_REG_SEND(msgif, 1);
}
static uint32_t check_response() {
while (true) {
if (get_mkcontrolclusterstreamcontroller_REG_ACK_PENDING_RESPONSE(msgif) != 0) {
return get_mkcontrolclusterstreamcontroller_REG_RECV_ID_RECV_ID(msgif);
}
}
}
static uint32_t wait_response(uint32_t msg_id) {
while (true) {
if (get_mkcontrolclusterstreamcontroller_REG_ACK_PENDING_RESPONSE(msgif) != 0) {
@@ -54,4 +64,14 @@ static uint32_t wait_response(uint32_t msg_id) {
return response_payload;
}
static void fki_dma_transfer(uint32_t cluster, uint32_t msg_id, uint32_t srcAddr, uint32_t destAddr, uint32_t bytes) {
uint32_t values[] = {
0,
srcAddr,
destAddr,
bytes
};
send_msg(cluster, fki_dma(cluster), 4, msg_id, values);
}
#endif /* _FLEXKI_MESSAGES_H */