Merge pull request #7672 from mikeller/make_fully_configurable
Made DMA options configurable.
This commit is contained in:
commit
657e858ea6
|
@ -4701,7 +4701,7 @@ dmaoptEntry_t dmaoptEntryTable[] = {
|
||||||
|
|
||||||
static void dmaoptToString(int optval, char *buf)
|
static void dmaoptToString(int optval, char *buf)
|
||||||
{
|
{
|
||||||
if (optval == -1) {
|
if (optval == DMA_OPT_UNUSED) {
|
||||||
memcpy(buf, "NONE", DMA_OPT_STRING_BUFSIZE);
|
memcpy(buf, "NONE", DMA_OPT_STRING_BUFSIZE);
|
||||||
} else {
|
} else {
|
||||||
tfp_sprintf(buf, "%d", optval);
|
tfp_sprintf(buf, "%d", optval);
|
||||||
|
@ -4741,8 +4741,11 @@ static void printPeripheralDmaopt(dmaoptEntry_t *entry, int index, uint8_t dumpM
|
||||||
dmaCode = dmaChannelSpec->code;
|
dmaCode = dmaChannelSpec->code;
|
||||||
}
|
}
|
||||||
cliDefaultPrintLinef(dumpMask, equalsDefault,
|
cliDefaultPrintLinef(dumpMask, equalsDefault,
|
||||||
"dmaopt %s %d %d # DMA%d Stream %d Channel %d",
|
"dmaopt %s %d %d",
|
||||||
entry->device, DMA_OPT_UI_INDEX(index), defaultOpt, DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
|
entry->device, DMA_OPT_UI_INDEX(index), defaultOpt);
|
||||||
|
cliDefaultPrintLinef(dumpMask, equalsDefault,
|
||||||
|
"# %s %d: DMA%d Stream %d Channel %d",
|
||||||
|
entry->device, DMA_OPT_UI_INDEX(index), DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
|
||||||
} else {
|
} else {
|
||||||
cliDefaultPrintLinef(dumpMask, equalsDefault,
|
cliDefaultPrintLinef(dumpMask, equalsDefault,
|
||||||
"dmaopt %s %d NONE",
|
"dmaopt %s %d NONE",
|
||||||
|
@ -4751,14 +4754,18 @@ static void printPeripheralDmaopt(dmaoptEntry_t *entry, int index, uint8_t dumpM
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentOpt != DMA_OPT_UNUSED) {
|
if (currentOpt != DMA_OPT_UNUSED) {
|
||||||
|
cliDumpPrintLinef(dumpMask, equalsDefault,
|
||||||
|
"dmaopt %s %d %d",
|
||||||
|
entry->device, DMA_OPT_UI_INDEX(index), currentOpt);
|
||||||
|
|
||||||
const dmaChannelSpec_t *dmaChannelSpec = dmaGetChannelSpecByPeripheral(entry->peripheral, index, currentOpt);
|
const dmaChannelSpec_t *dmaChannelSpec = dmaGetChannelSpecByPeripheral(entry->peripheral, index, currentOpt);
|
||||||
dmaCode_t dmaCode = 0;
|
dmaCode_t dmaCode = 0;
|
||||||
if (dmaChannelSpec) {
|
if (dmaChannelSpec) {
|
||||||
dmaCode = dmaChannelSpec->code;
|
dmaCode = dmaChannelSpec->code;
|
||||||
}
|
}
|
||||||
cliDumpPrintLinef(dumpMask, equalsDefault,
|
cliDumpPrintLinef(dumpMask, equalsDefault,
|
||||||
"dmaopt %s %d %d # DMA%d Stream %d Channel %d",
|
"# %s %d: DMA%d Stream %d Channel %d",
|
||||||
entry->device, DMA_OPT_UI_INDEX(index), currentOpt, DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
|
entry->device, DMA_OPT_UI_INDEX(index), DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
|
||||||
} else {
|
} else {
|
||||||
if (!(dumpMask & HIDE_UNUSED)) {
|
if (!(dumpMask & HIDE_UNUSED)) {
|
||||||
cliDumpPrintLinef(dumpMask, equalsDefault,
|
cliDumpPrintLinef(dumpMask, equalsDefault,
|
||||||
|
@ -4771,7 +4778,7 @@ static void printPeripheralDmaopt(dmaoptEntry_t *entry, int index, uint8_t dumpM
|
||||||
#if defined(USE_TIMER_MGMT)
|
#if defined(USE_TIMER_MGMT)
|
||||||
static void printTimerDmaopt(const timerIOConfig_t *timerIoConfig, uint8_t dumpMask)
|
static void printTimerDmaopt(const timerIOConfig_t *timerIoConfig, uint8_t dumpMask)
|
||||||
{
|
{
|
||||||
const char *format = "dmaopt %c%02d %d";
|
const char *format = "dmaopt pin %c%02d %d";
|
||||||
|
|
||||||
const ioTag_t ioTag = timerIoConfig->ioTag;
|
const ioTag_t ioTag = timerIoConfig->ioTag;
|
||||||
|
|
||||||
|
@ -4793,14 +4800,14 @@ static void printTimerDmaopt(const timerIOConfig_t *timerIoConfig, uint8_t dumpM
|
||||||
dmaCode = dmaChannelSpec->code;
|
dmaCode = dmaChannelSpec->code;
|
||||||
}
|
}
|
||||||
cliDumpPrintLinef(dumpMask, false,
|
cliDumpPrintLinef(dumpMask, false,
|
||||||
"# %c%02d: DMA%d Stream %d Channel %d",
|
"# pin %c%02d: DMA%d Stream %d Channel %d",
|
||||||
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag),
|
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag),
|
||||||
DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode)
|
DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!(dumpMask & HIDE_UNUSED)) {
|
if (!(dumpMask & HIDE_UNUSED)) {
|
||||||
cliDumpPrintLinef(dumpMask, false,
|
cliDumpPrintLinef(dumpMask, false,
|
||||||
"dmaopt %c%02d NONE",
|
"dmaopt pin %c%02d NONE",
|
||||||
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag)
|
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4848,71 +4855,123 @@ static void cliDmaopt(char *cmdline)
|
||||||
entry = &dmaoptEntryTable[i];
|
entry = &dmaoptEntryTable[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!entry) {
|
if (!entry && strcasecmp(pch, "pin") != 0) {
|
||||||
cliPrintLinef("bad device %s", pch);
|
cliPrintLinef("bad device %s", pch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index
|
// Index
|
||||||
pch = strtok_r(NULL, " ", &saveptr);
|
dmaoptValue_t orgval = DMA_OPT_UNUSED;
|
||||||
int index = atoi(pch) - 1;
|
|
||||||
if (index < 0 || index >= entry->maxIndex) {
|
|
||||||
cliPrintLinef("bad index %s", pch);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pgRegistry_t* pg = pgFind(entry->pgn);
|
int index = 0;
|
||||||
const void *currentConfig;
|
dmaoptValue_t *optaddr = NULL;
|
||||||
if (configIsInCopy) {
|
|
||||||
currentConfig = pg->copy;
|
ioTag_t ioTag = IO_TAG_NONE;
|
||||||
|
#if defined(USE_TIMER_MGMT)
|
||||||
|
timerIOConfig_t *timerIoConfig = NULL;
|
||||||
|
#endif
|
||||||
|
const timerHardware_t *timer = NULL;
|
||||||
|
pch = strtok_r(NULL, " ", &saveptr);
|
||||||
|
if (entry) {
|
||||||
|
index = atoi(pch) - 1;
|
||||||
|
if (index < 0 || index >= entry->maxIndex) {
|
||||||
|
cliPrintLinef("bad index %s", pch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pgRegistry_t* pg = pgFind(entry->pgn);
|
||||||
|
const void *currentConfig;
|
||||||
|
if (configIsInCopy) {
|
||||||
|
currentConfig = pg->copy;
|
||||||
|
} else {
|
||||||
|
currentConfig = pg->address;
|
||||||
|
}
|
||||||
|
optaddr = (dmaoptValue_t *)((uint8_t *)currentConfig + entry->stride * index + entry->offset);
|
||||||
|
orgval = *optaddr;
|
||||||
} else {
|
} else {
|
||||||
currentConfig = pg->address;
|
// It's a pin
|
||||||
|
if (!pch || !(strToPin(pch, &ioTag) && IOGetByTag(ioTag))) {
|
||||||
|
cliPrintErrorLinef("INVALID PIN: '%s'", pch);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
orgval = dmaoptByTag(ioTag);
|
||||||
|
#if defined(USE_TIMER_MGMT)
|
||||||
|
timerIoConfig = timerIoConfigByTag(ioTag);
|
||||||
|
#endif
|
||||||
|
timer = timerGetByTag(ioTag);
|
||||||
}
|
}
|
||||||
dmaoptValue_t *optaddr = (dmaoptValue_t *)((uint8_t *)currentConfig + entry->stride * index + entry->offset);
|
|
||||||
|
|
||||||
// opt or list
|
// opt or list
|
||||||
pch = strtok_r(NULL, " ", &saveptr);
|
pch = strtok_r(NULL, " ", &saveptr);
|
||||||
|
|
||||||
if (!pch) {
|
if (!pch) {
|
||||||
if (*optaddr == -1) {
|
if (entry) {
|
||||||
cliPrintLinef("%s %d NONE", entry->device, index + 1);
|
if (orgval == DMA_OPT_UNUSED) {
|
||||||
|
cliPrintLinef("%s %d NONE", entry->device, index + 1);
|
||||||
|
} else {
|
||||||
|
cliPrintLinef("%s %d %d", entry->device, index + 1, *optaddr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cliPrintLinef("%s %d %d", entry->device, index + 1, *optaddr);
|
if (orgval == DMA_OPT_UNUSED) {
|
||||||
|
cliPrintLinef("pin %c%02d NONE", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag));
|
||||||
|
} else {
|
||||||
|
cliPrintLinef("pin %c%02d %d", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), orgval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (strcasecmp(pch, "list") == 0) {
|
} else if (strcasecmp(pch, "list") == 0) {
|
||||||
// Show possible opts
|
// Show possible opts
|
||||||
const dmaChannelSpec_t *dmaChannelSpec;
|
const dmaChannelSpec_t *dmaChannelSpec;
|
||||||
for (int opt = 0; (dmaChannelSpec = dmaGetChannelSpecByPeripheral(entry->peripheral, index, opt)); opt++) {
|
if (entry) {
|
||||||
cliPrintLinef("# %d: DMA%d Stream %d channel %d", opt, DMA_CODE_CONTROLLER(dmaChannelSpec->code), DMA_CODE_STREAM(dmaChannelSpec->code), DMA_CODE_CHANNEL(dmaChannelSpec->code));
|
for (int opt = 0; (dmaChannelSpec = dmaGetChannelSpecByPeripheral(entry->peripheral, index, opt)); opt++) {
|
||||||
|
cliPrintLinef("# %d: DMA%d Stream %d channel %d", opt, DMA_CODE_CONTROLLER(dmaChannelSpec->code), DMA_CODE_STREAM(dmaChannelSpec->code), DMA_CODE_CHANNEL(dmaChannelSpec->code));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int opt = 0; (dmaChannelSpec = dmaGetChannelSpecByTimerValue(timer->tim, timer->channel, opt)); opt++) {
|
||||||
|
cliPrintLinef("# %d: DMA%d Stream %d channel %d", opt, DMA_CODE_CONTROLLER(dmaChannelSpec->code), DMA_CODE_STREAM(dmaChannelSpec->code), DMA_CODE_CHANNEL(dmaChannelSpec->code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (pch) {
|
} else if (pch) {
|
||||||
int optval;
|
int optval;
|
||||||
|
|
||||||
if (strcasecmp(pch, "none") == 0) {
|
if (strcasecmp(pch, "none") == 0) {
|
||||||
optval = -1;
|
optval = DMA_OPT_UNUSED;
|
||||||
} else {
|
} else {
|
||||||
optval = atoi(pch);
|
optval = atoi(pch);
|
||||||
if (optval < 0) { // XXX Check against opt max? How?
|
if (optval < 0 || (entry && optval >= MAX_PERIPHERAL_DMA_OPTIONS) || (!entry && optval >= MAX_TIMER_DMA_OPTIONS)) {
|
||||||
cliPrintLinef("bad optnum %s", pch);
|
cliPrintErrorLinef("BAD DMA OPTION NUMBER '%s'", pch);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dmaoptValue_t orgval = *optaddr;
|
|
||||||
|
|
||||||
char optvalString[5];
|
char optvalString[5];
|
||||||
char orgvalString[5];
|
char orgvalString[5];
|
||||||
dmaoptToString(optval, optvalString);
|
dmaoptToString(optval, optvalString);
|
||||||
dmaoptToString(orgval, orgvalString);
|
dmaoptToString(orgval, orgvalString);
|
||||||
|
|
||||||
if (optval != orgval) {
|
if (optval != orgval) {
|
||||||
*optaddr = optval;
|
if (entry) {
|
||||||
|
*optaddr = optval;
|
||||||
|
|
||||||
cliPrintLinef("dmaopt %s %d: changed from %s to %s", entry->device, DMA_OPT_UI_INDEX(index), orgvalString, optvalString);
|
cliPrintLinef("dmaopt %s %d: changed from %s to %s", entry->device, DMA_OPT_UI_INDEX(index), orgvalString, optvalString);
|
||||||
|
} else {
|
||||||
|
#if defined(USE_TIMER_MGMT)
|
||||||
|
timerIoConfig->dmaopt = optval;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cliPrintLinef("dmaopt pin %c%02d: changed from %s to %s", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), orgvalString, optvalString);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cliPrintLinef("dmaopt %s %d: no change", entry->device, DMA_OPT_UI_INDEX(index), orgvalString);
|
if (entry) {
|
||||||
|
cliPrintLinef("dmaopt %s %d: no change: %s", entry->device, DMA_OPT_UI_INDEX(index), orgvalString);
|
||||||
|
} else {
|
||||||
|
cliPrintLinef("dmaopt %c%02d: no change: %s", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag),orgvalString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cliPrintLinef("bad option %s", pch);
|
cliPrintLinef("bad option %s", pch);
|
||||||
|
@ -4925,13 +4984,7 @@ static void cliDmaopt(char *cmdline)
|
||||||
|
|
||||||
static void printTimer(uint8_t dumpMask)
|
static void printTimer(uint8_t dumpMask)
|
||||||
{
|
{
|
||||||
cliPrintLine("# examples: ");
|
|
||||||
const char *format = "timer %c%02d %d";
|
const char *format = "timer %c%02d %d";
|
||||||
cliPrint("#");
|
|
||||||
cliPrintLinef(format, 'A', 1, 1);
|
|
||||||
|
|
||||||
cliPrint("#");
|
|
||||||
cliPrintLinef(format, 'A', 1, 0);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
for (unsigned int i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
||||||
|
|
||||||
|
@ -5021,6 +5074,7 @@ static void cliTimer(char *cmdline)
|
||||||
success:
|
success:
|
||||||
timerIOConfigMutable(timerIOIndex)->ioTag = timerIndex == 0 ? IO_TAG_NONE : ioTag;
|
timerIOConfigMutable(timerIOIndex)->ioTag = timerIndex == 0 ? IO_TAG_NONE : ioTag;
|
||||||
timerIOConfigMutable(timerIOIndex)->index = timerIndex;
|
timerIOConfigMutable(timerIOIndex)->index = timerIndex;
|
||||||
|
timerIOConfigMutable(timerIOIndex)->dmaopt = DMA_OPT_UNUSED;
|
||||||
|
|
||||||
cliPrintLine("Success");
|
cliPrintLine("Success");
|
||||||
return;
|
return;
|
||||||
|
@ -5084,6 +5138,10 @@ static void printConfig(char *cmdline, bool doDiff)
|
||||||
#ifdef USE_RESOURCE_MGMT
|
#ifdef USE_RESOURCE_MGMT
|
||||||
cliPrintHashLine("resources");
|
cliPrintHashLine("resources");
|
||||||
printResource(dumpMask);
|
printResource(dumpMask);
|
||||||
|
#if defined(USE_TIMER_MGMT)
|
||||||
|
cliPrintHashLine("timer");
|
||||||
|
printTimer(dumpMask);
|
||||||
|
#endif
|
||||||
#ifdef USE_DMA_SPEC
|
#ifdef USE_DMA_SPEC
|
||||||
cliPrintHashLine("dmaopt");
|
cliPrintHashLine("dmaopt");
|
||||||
printDmaopt(dumpMask);
|
printDmaopt(dumpMask);
|
||||||
|
|
|
@ -34,16 +34,12 @@
|
||||||
|
|
||||||
#include "dma_reqmap.h"
|
#include "dma_reqmap.h"
|
||||||
|
|
||||||
#define MAX_PERIPHERAL_DMA_OPTIONS 2
|
|
||||||
|
|
||||||
typedef struct dmaPeripheralMapping_s {
|
typedef struct dmaPeripheralMapping_s {
|
||||||
dmaPeripheral_e device;
|
dmaPeripheral_e device;
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
dmaChannelSpec_t channelSpec[MAX_PERIPHERAL_DMA_OPTIONS];
|
dmaChannelSpec_t channelSpec[MAX_PERIPHERAL_DMA_OPTIONS];
|
||||||
} dmaPeripheralMapping_t;
|
} dmaPeripheralMapping_t;
|
||||||
|
|
||||||
#define MAX_TIMER_DMA_OPTIONS 3
|
|
||||||
|
|
||||||
typedef struct dmaTimerMapping_s {
|
typedef struct dmaTimerMapping_s {
|
||||||
TIM_TypeDef *tim;
|
TIM_TypeDef *tim;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
|
@ -245,7 +241,7 @@ const dmaChannelSpec_t *dmaGetChannelSpecByPeripheral(dmaPeripheral_e device, ui
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int8_t dmaoptByTag(ioTag_t ioTag)
|
dmaoptValue_t dmaoptByTag(ioTag_t ioTag)
|
||||||
{
|
{
|
||||||
#ifdef USE_TIMER_MGMT
|
#ifdef USE_TIMER_MGMT
|
||||||
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
||||||
|
@ -259,20 +255,15 @@ static int8_t dmaoptByTag(ioTag_t ioTag)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer)
|
const dmaChannelSpec_t *dmaGetChannelSpecByTimerValue(TIM_TypeDef *tim, uint8_t channel, dmaoptValue_t dmaopt)
|
||||||
{
|
{
|
||||||
if (!timer) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int8_t dmaopt = dmaoptByTag(timer->tag);
|
|
||||||
if (dmaopt < 0 || dmaopt >= MAX_TIMER_DMA_OPTIONS) {
|
if (dmaopt < 0 || dmaopt >= MAX_TIMER_DMA_OPTIONS) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0 ; i < ARRAYLEN(dmaTimerMapping) ; i++) {
|
for (unsigned i = 0 ; i < ARRAYLEN(dmaTimerMapping) ; i++) {
|
||||||
const dmaTimerMapping_t *timerMapping = &dmaTimerMapping[i];
|
const dmaTimerMapping_t *timerMapping = &dmaTimerMapping[i];
|
||||||
if (timerMapping->tim == timer->tim && timerMapping->channel == timer->channel && timerMapping->channelSpec[dmaopt].ref) {
|
if (timerMapping->tim == tim && timerMapping->channel == channel && timerMapping->channelSpec[dmaopt].ref) {
|
||||||
return &timerMapping->channelSpec[dmaopt];
|
return &timerMapping->channelSpec[dmaopt];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +271,17 @@ const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t dmaGetOptionByTimer(const timerHardware_t *timer)
|
const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer)
|
||||||
|
{
|
||||||
|
if (!timer) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dmaoptValue_t dmaopt = dmaoptByTag(timer->tag);
|
||||||
|
return dmaGetChannelSpecByTimerValue(timer->tim, timer->channel, dmaopt);
|
||||||
|
}
|
||||||
|
|
||||||
|
dmaoptValue_t dmaGetOptionByTimer(const timerHardware_t *timer)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0 ; i < ARRAYLEN(dmaTimerMapping); i++) {
|
for (unsigned i = 0 ; i < ARRAYLEN(dmaTimerMapping); i++) {
|
||||||
const dmaTimerMapping_t *timerMapping = &dmaTimerMapping[i];
|
const dmaTimerMapping_t *timerMapping = &dmaTimerMapping[i];
|
||||||
|
|
|
@ -52,8 +52,14 @@ typedef enum {
|
||||||
} dmaPeripheral_e;
|
} dmaPeripheral_e;
|
||||||
|
|
||||||
typedef int8_t dmaoptValue_t;
|
typedef int8_t dmaoptValue_t;
|
||||||
|
|
||||||
#define DMA_OPT_UNUSED (-1)
|
#define DMA_OPT_UNUSED (-1)
|
||||||
|
|
||||||
|
#define MAX_PERIPHERAL_DMA_OPTIONS 2
|
||||||
|
#define MAX_TIMER_DMA_OPTIONS 3
|
||||||
|
|
||||||
|
dmaoptValue_t dmaoptByTag(ioTag_t ioTag);
|
||||||
const dmaChannelSpec_t *dmaGetChannelSpecByPeripheral(dmaPeripheral_e device, uint8_t index, int8_t opt);
|
const dmaChannelSpec_t *dmaGetChannelSpecByPeripheral(dmaPeripheral_e device, uint8_t index, int8_t opt);
|
||||||
|
const dmaChannelSpec_t *dmaGetChannelSpecByTimerValue(TIM_TypeDef *tim, uint8_t channel, dmaoptValue_t dmaopt);
|
||||||
const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer);
|
const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer);
|
||||||
int8_t dmaGetOptionByTimer(const timerHardware_t *timer);
|
dmaoptValue_t dmaGetOptionByTimer(const timerHardware_t *timer);
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "drivers/io_types.h"
|
#include "drivers/io_types.h"
|
||||||
#include "rcc_types.h"
|
#include "drivers/rcc_types.h"
|
||||||
#include "drivers/timer_def.h"
|
#include "drivers/timer_def.h"
|
||||||
|
|
||||||
|
#include "pg/timerio.h"
|
||||||
|
|
||||||
#define CC_CHANNELS_PER_TIMER 4 // TIM_Channel_1..4
|
#define CC_CHANNELS_PER_TIMER 4 // TIM_Channel_1..4
|
||||||
#define CC_INDEX_FROM_CHANNEL(x) ((uint8_t)((x) >> 2))
|
#define CC_INDEX_FROM_CHANNEL(x) ((uint8_t)((x) >> 2))
|
||||||
#define CC_CHANNEL_FROM_INDEX(x) ((uint16_t)(x) << 2)
|
#define CC_CHANNEL_FROM_INDEX(x) ((uint16_t)(x) << 2)
|
||||||
|
@ -255,6 +257,9 @@ void configTimeBase(TIM_TypeDef *tim, uint16_t period, uint32_t hz); // TODO -
|
||||||
rccPeriphTag_t timerRCC(TIM_TypeDef *tim);
|
rccPeriphTag_t timerRCC(TIM_TypeDef *tim);
|
||||||
uint8_t timerInputIrq(TIM_TypeDef *tim);
|
uint8_t timerInputIrq(TIM_TypeDef *tim);
|
||||||
|
|
||||||
|
#if defined(USE_TIMER_MGMT)
|
||||||
|
timerIOConfig_t *timerIoConfigByTag(ioTag_t ioTag);
|
||||||
|
#endif
|
||||||
const timerHardware_t *timerGetByTag(ioTag_t ioTag);
|
const timerHardware_t *timerGetByTag(ioTag_t ioTag);
|
||||||
ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index);
|
ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,19 @@
|
||||||
#include "pg/timerio.h"
|
#include "pg/timerio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_TIMER_MGMT
|
||||||
|
timerIOConfig_t *timerIoConfigByTag(ioTag_t ioTag)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
||||||
|
if (timerIOConfig(i)->ioTag == ioTag) {
|
||||||
|
return timerIOConfigMutable(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UNUSED(ioTag);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t timerIndexByTag(ioTag_t ioTag)
|
static uint8_t timerIndexByTag(ioTag_t ioTag)
|
||||||
{
|
{
|
||||||
#ifdef USE_TIMER_MGMT
|
#ifdef USE_TIMER_MGMT
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
# Betaflight / DYSF4PRO (DYS4) 4.0.0 Feb 26 2019 / 02:31:38 (cf41bcea1) MSP API: 1.41
|
||||||
|
|
||||||
|
board_name DYSF4PRO
|
||||||
|
manufacturer_id DYST
|
||||||
|
|
||||||
|
# resources
|
||||||
|
resource BEEPER 1 B04
|
||||||
|
resource MOTOR 1 B00
|
||||||
|
resource MOTOR 2 B01
|
||||||
|
resource MOTOR 3 A03
|
||||||
|
resource MOTOR 4 A02
|
||||||
|
resource MOTOR 5 A01
|
||||||
|
resource MOTOR 6 A08
|
||||||
|
resource PPM 1 B14
|
||||||
|
resource PWM 1 B14
|
||||||
|
resource PWM 2 B15
|
||||||
|
resource PWM 3 C06
|
||||||
|
resource PWM 4 C07
|
||||||
|
resource PWM 5 C08
|
||||||
|
resource PWM 6 C09
|
||||||
|
resource SONAR_TRIGGER 1 A01
|
||||||
|
resource SONAR_ECHO 1 A08
|
||||||
|
resource LED_STRIP 1 A01
|
||||||
|
resource SERIAL_TX 1 A09
|
||||||
|
resource SERIAL_TX 3 B10
|
||||||
|
resource SERIAL_TX 6 C06
|
||||||
|
resource SERIAL_RX 1 A10
|
||||||
|
resource SERIAL_RX 3 B11
|
||||||
|
resource SERIAL_RX 6 C07
|
||||||
|
resource INVERTER 1 C00
|
||||||
|
resource LED 1 B05
|
||||||
|
resource SPI_SCK 1 A05
|
||||||
|
resource SPI_SCK 3 C10
|
||||||
|
resource SPI_MISO 1 A06
|
||||||
|
resource SPI_MISO 3 C11
|
||||||
|
resource SPI_MOSI 1 A07
|
||||||
|
resource SPI_MOSI 3 C12
|
||||||
|
resource ESCSERIAL 1 B14
|
||||||
|
resource ADC_BATT 1 C02
|
||||||
|
resource ADC_RSSI 1 C03
|
||||||
|
resource ADC_CURR 1 C01
|
||||||
|
resource FLASH_CS 1 B03
|
||||||
|
resource OSD_CS 1 A15
|
||||||
|
resource GYRO_EXTI 1 C04
|
||||||
|
resource GYRO_CS 1 A04
|
||||||
|
resource USB_DETECT 1 C05
|
||||||
|
|
||||||
|
# timer list
|
||||||
|
timer B14 2
|
||||||
|
timer B15 2
|
||||||
|
timer C06 1
|
||||||
|
timer C07 1
|
||||||
|
timer C08 1
|
||||||
|
timer C09 1
|
||||||
|
timer B00 1
|
||||||
|
timer B01 1
|
||||||
|
timer A01 1
|
||||||
|
timer A08 0
|
||||||
|
timer A03 0
|
||||||
|
timer A02 0
|
||||||
|
timer A09 0
|
||||||
|
timer A10 0
|
||||||
|
|
||||||
|
# dmaopt
|
||||||
|
dmaopt ADC 2 1
|
||||||
|
dmaopt pin C06 0
|
||||||
|
# pin C06: DMA2 Stream 2 Channel 0
|
||||||
|
dmaopt pin C07 0
|
||||||
|
# pin C07: DMA2 Stream 2 Channel 0
|
||||||
|
dmaopt pin C08 0
|
||||||
|
# pin C08: DMA2 Stream 2 Channel 0
|
||||||
|
dmaopt pin C09 0
|
||||||
|
# pin C09: DMA2 Stream 7 Channel 7
|
||||||
|
dmaopt pin B00 0
|
||||||
|
# pin B00: DMA1 Stream 7 Channel 5
|
||||||
|
dmaopt pin B01 0
|
||||||
|
# pin B01: DMA1 Stream 2 Channel 5
|
||||||
|
dmaopt pin A03 1
|
||||||
|
# pin A03: DMA1 Stream 6 Channel 3
|
||||||
|
dmaopt pin A02 0
|
||||||
|
# pin A02: DMA1 Stream 1 Channel 3
|
||||||
|
dmaopt pin A01 0
|
||||||
|
# pin A01: DMA1 Stream 4 Channel 6
|
||||||
|
dmaopt pin A08 0
|
||||||
|
# pin A08: DMA2 Stream 6 Channel 0
|
||||||
|
dmaopt pin A09 0
|
||||||
|
# pin A09: DMA2 Stream 6 Channel 0
|
||||||
|
dmaopt pin A10 0
|
||||||
|
# pin A10: DMA2 Stream 6 Channel 0
|
||||||
|
|
||||||
|
# feature
|
||||||
|
feature -RX_PARALLEL_PWM
|
||||||
|
feature RX_SERIAL
|
||||||
|
feature OSD
|
||||||
|
|
||||||
|
# serial
|
||||||
|
serial 0 64 115200 57600 0 115200
|
||||||
|
|
||||||
|
# master
|
||||||
|
set serialrx_provider = SBUS
|
||||||
|
set adc_device = 2
|
||||||
|
set dshot_burst = ON
|
||||||
|
set motor_pwm_protocol = ONESHOT125
|
||||||
|
set current_meter = ADC
|
||||||
|
set battery_meter = ADC
|
||||||
|
set beeper_inversion = ON
|
||||||
|
set beeper_od = OFF
|
||||||
|
set system_hse_mhz = 8
|
||||||
|
set max7456_spi_bus = 3
|
||||||
|
set flash_spi_bus = 3
|
||||||
|
set gyro_1_bustype = SPI
|
||||||
|
set gyro_1_spibus = 1
|
||||||
|
set gyro_1_sensor_align = CW180
|
||||||
|
set gyro_2_bustype = SPI
|
|
@ -6,6 +6,7 @@ Last updated: 17/02/2019
|
||||||
|AFNG|AlienFlight NG|https://www.alienflightng.com/|
|
|AFNG|AlienFlight NG|https://www.alienflightng.com/|
|
||||||
|BKMN|Jason Blackman|https://github.com/blckmn|
|
|BKMN|Jason Blackman|https://github.com/blckmn|
|
||||||
|DRCL|dronercland|https://www.instagram.com/dronercland/|
|
|DRCL|dronercland|https://www.instagram.com/dronercland/|
|
||||||
|
|DYST|DongYang Smart Technology Co.,Ltd (dys)|http://www.dys.hk/|
|
||||||
|FFPV|Furious FPV|https://furiousfpv.com/|
|
|FFPV|Furious FPV|https://furiousfpv.com/|
|
||||||
|
|
||||||
This is the official list of manufacturer ids (`manufacturer_id` in the target config) that will be supported for loading onto unified targets by Betaflight configurator.
|
This is the official list of manufacturer ids (`manufacturer_id` in the target config) that will be supported for loading onto unified targets by Betaflight configurator.
|
||||||
|
|
Loading…
Reference in New Issue