Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imxrt117x: CM4 MU optimizations #401

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions multi/imxrt-multi/cm4.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@
#include <sys/interrupt.h>
#include <sys/threads.h>
#include <phoenix/arch/imxrt1170.h>
#include <board_config.h>

#include "common.h"

#ifndef CM4_MU_FIFO_SIZE
#define CM4_MU_FIFO_SIZE 256
#endif

#define CM4_MEMORY_START ((void *)0x20200000)
#define CM4_MEMORY_SIZE (256 * 1024)

Expand All @@ -47,7 +52,7 @@ typedef union {


typedef struct {
unsigned char buff[256];
unsigned char buff[CM4_MU_FIFO_SIZE];
volatile int wptr;
volatile int rptr;
} fifo_t;
Expand Down Expand Up @@ -151,15 +156,18 @@ static inline int fifo_pushPacket(packet_t *packet, fifo_t *fifo)

static int mu_irqHandler(unsigned int n, void *arg)
{
uint32_t sr;
int chan;
packet_t packet;

(void)n;
(void)arg;

sr = *(m4_common.mu + asr);

/* TX */
for (chan = 0; chan < chanLen; ++chan) {
if ((*(m4_common.mu + asr) & (1 << (23 - chan))) != 0) {
if ((sr & (1 << (23 - chan))) != 0) {
if (fifo_popPacket(&packet, &m4_common.channel[chan].tx) == 0) {
setTXirq(chan, 0);
}
Expand All @@ -171,7 +179,7 @@ static int mu_irqHandler(unsigned int n, void *arg)

/* RX */
for (chan = 0; chan < chanLen; ++chan) {
if ((*(m4_common.mu + asr) & (1 << (27 - chan))) != 0) {
if ((sr & (1 << (27 - chan))) != 0) {
packet.word = *(m4_common.mu + arr0 + chan);
fifo_pushPacket(&packet, &m4_common.channel[chan].rx);
}
Expand Down
Loading