Hi,
I have read through RTOS get started and user manual several times and import RTOS projects running on LaunchPad, but only have limited experience at RTOS now.
After running uart_dma project from "TivaWare_C_Series-2.1.1.71" and RTOS project mutex with TM4C1294 Launch Pad, I want to insert DMA function to the RTOS proejct. Before modifying .cfg file, I simply rename uart_dma source C main() function to a general function main0(). The needed header file and library paths are added. The new (added uart DMA function) .c file can pass build. I think that DMA and Uart interrupt function do not register in the RTOS project. They should behave like a general function. I want to modify the uart_dma function to its appropriate places (into tasks, initialize before RTOS running) gradually.
To my surprise, the code is stuck at loop:
for(ui16Idx = 0; ui16Idx < UART_TXBUF_SIZE; ui16Idx++)
{
g_ui8TxBuf[ui16Idx] = ui16Idx;
}
UART_TXBUF_SIZE is 256. When I pause the LauchPad out of running (It should not run stuck at some where before a desired breakpoint). It shows
Void Hwi_excDumpRegs(UInt lr)
{
Hwi_ExcContext *excp;
Char *ttype;
UInt coreId = 0;
Char *name;
excp = Hwi_module->excContext[coreId];
Although optimization is turned off, the code may not shows running through line exactly. I suspect that the following line causes the above Hwi dump:
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
I am not clear about how to deal with the above enable code in RTOS for LaunchPad. Could you give me some advice?
Thanks,
Void task1(UArg arg0, UArg arg1);
Void task2(UArg arg0, UArg arg1);
Int resource = 0;
Semaphore_Handle sem;
Task_Handle tsk1;
Task_Handle tsk2;
Int finishCount = 0;
/*
* ======== main ========
*/
extern int main0(void);
Int main()
{
Task_Params taskParams;
/* Call board init functions */
Board_initGeneral();
main0();
void
InitUART1Transfer(void)
{
uint_fast16_t ui16Idx;
//
// Fill the TX buffer with a simple data pattern.
//
for(ui16Idx = 0; ui16Idx < UART_TXBUF_SIZE; ui16Idx++)
{
g_ui8TxBuf[ui16Idx] = ui16Idx;
}
static uint32_t ui32PrevSeconds;
static uint32_t ui32PrevXferCount;
static uint32_t ui32PrevUARTCount = 0;
uint32_t ui32XfersCompleted;
uint32_t ui32BytesTransferred;
//
// Set the clocking to run directly from the crystal at 120MHz.
//
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Enable peripherals to operate when CPU is in sleep.
//
ROM_SysCtlPeripheralClockGating(true);
//
// Enable the GPIO port that is used for the on-board LED.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
//
// Enable the GPIO pins for the LED (PN0).
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
//
// Initialize the UART.
//
ConfigureUART();
UARTprintf("\033[2J\033[H");
UARTprintf("uDMA Example\n");
//
// Show the clock frequency on the display.
//
UARTprintf("Tiva C Series @ %u MHz\n\n", g_ui32SysClock / 1000000);
//
// Show statistics headings.
//
UARTprintf("CPU\tRemaining\tMemory\t\t\t UART\n");
UARTprintf("Usage\tTime\t\tTransfers\t\t Transfers\n");
//
// Configure SysTick to occur 100 times per second, to use as a time
// reference. Enable SysTick to generate interrupts.
//
ROM_SysTickPeriodSet(g_ui32SysClock / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Initialize the CPU usage measurement routine.
//
CPUUsageInit(g_ui32SysClock, SYSTICKS_PER_SECOND, 2);
//
// Enable the uDMA controller at the system level. Enable it to continue
// to run while the processor is in sleep.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA);
//
// Enable the uDMA controller error interrupt. This interrupt will occur
// if there is a bus error during a transfer.
//
ROM_IntEnable(INT_UDMAERR);
//
// Enable the uDMA controller.
//
ROM_uDMAEnable();
//
// Point at the control table to use for channel control structures.
//
ROM_uDMAControlBaseSet(pui8ControlTable);
//
// Initialize the uDMA memory to memory transfers.
//
InitSWTransfer();
//
// Initialize the uDMA UART transfers.
//
InitUART1Transfer();
//
// Remember the current SysTick seconds count.
//
ui32PrevSeconds = g_ui32Seconds;
//
// Remember the current count of memory buffer transfers.
//
ui32PrevXferCount = g_ui32MemXferCount;
//
// Loop until the button is pressed. The processor is put to sleep
// in this loop so that CPU utilization can be measured.
//
while(1)
{