Hello Stephen Langstaff
You don't need to modify the API functions, you can configure two different CTARs with DSPI_RTOS_Init() and DSPI_MasterInit().
The struct dspi_master_config_t has one space called whichCtar that allows you to select which CTAR configure.
You can call first DSPI_RTOS_Init() with the first CTAR configuration, this will create the mutex, semaphore and handle, Then call DSPI_MasterInit() to avoid the re-creation of the mutex, semaphore and handle. Before calling DSPI_MasterInit() make sure to change the whichCtar field.
Example.
dspi_master_config_t masterConfig;
/*Master config*/
masterConfig.whichCtar = kDSPI_Ctar0;
masterConfig.ctarConfig.baudRate = TRANSFER_BAUDRATE;
masterConfig.ctarConfig.bitsPerFrame = 8;
masterConfig.ctarConfig.cpol = kDSPI_ClockPolarityActiveHigh;
masterConfig.ctarConfig.cpha = kDSPI_ClockPhaseFirstEdge;
.
.
.
status = DSPI_RTOS_Init(&master_rtos_handle, EXAMPLE_DSPI_MASTER_BASEADDR, &masterConfig, sourceClock);
/**Configure the second ctar*/
masterConfig.whichCtar = kDSPI_Ctar1;/***/
masterConfig.ctarConfig.baudRate = TRANSFER_BAUDRATE;
masterConfig.ctarConfig.bitsPerFrame = 8;
masterConfig.ctarConfig.cpol = kDSPI_ClockPolarityActiveLow
masterConfig.ctarConfig.cpha = kDSPI_ClockPhaseSecondEdge;
DSPI_MasterInit(EXAMPLE_DSPI_MASTER_BASEADDR,&masterConfig,sourceClock)
To change the ctar when you start a transfer you change the value configFlags of the dspi_transfer_t struct and use the same handle to avoid clashing.
Example.
dspi_transfer_t masterXfer;
/*Start master transfer*/
masterXfer.txData = masterSendBuffer;
masterXfer.rxData = masterReceiveBuffer;
masterXfer.dataSize = TRANSFER_SIZE;
masterXfer.configFlags = kDSPI_MasterCtar0 | kDSPI_MasterPcs0 | kDSPI_MasterPcsContinuous;
status = DSPI_RTOS_Transfer(&master_rtos_handle, &masterXfer);
Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar