Beispiel #1
0
static void prvQueueSetSendingTask( void *pvParameters )
{
unsigned long ulTaskTxValue = 0, ulQueueToWriteTo;
xQueueHandle xQueueInUse;

	/* Remove compiler warning about the unused parameter. */
	( void ) pvParameters;

	/* Seed mini pseudo random number generator. */
	prvSRand( ( unsigned long ) &ulTaskTxValue );

	for( ;; )
	{
		/* Generate the index for the queue to which a value is to be sent. */
		ulQueueToWriteTo = prvRand() % queuesetNUM_QUEUES_IN_SET;
		xQueueInUse = xQueues[ ulQueueToWriteTo ];

		/* Note which index is being written to to ensure all the queues are
		used. */
		( ulQueueUsedCounter[ ulQueueToWriteTo ] )++;

		/* Send to the queue to unblock the task that is waiting for data to
		arrive on a queue within the queue set to which this queue belongs. */
		if( xQueueSendToBack( xQueueInUse, &ulTaskTxValue, portMAX_DELAY ) != pdPASS )
		{
			/* The send should always pass as an infinite block time was
			used. */
			xQueueSetTasksStatus = pdFAIL;
		}

		#if( configUSE_PREEMPTION == 0 )
			taskYIELD();
		#endif

		ulTaskTxValue++;

		/* If the Tx value has reached the range used by the ISR then set it
		back to 0. */
		if( ulTaskTxValue == queuesetINITIAL_ISR_TX_VALUE )
		{
			ulTaskTxValue = 0;
		}

		/* Increase test coverage by occasionally change the priorities of the
		two tasks relative to each other. */
		prvChangeRelativePriorities();
	}
}
Beispiel #2
0
int main( void )
{
	BaseType_t	res = pdPASS;
	rtc_t	rtc;
	TickType_t xTimeNow;
	/* Seed the random number generator. */
	xTimeNow = 0;//xTaskGetTickCount();
	prvSRand( 0);

#if configUSE_TRACE_FACILITY == 1
	vTraceInitTraceData();
	vTraceSetISRProperties(TIID_EthRx, "i_EthRx", IPRI_EthRx);
	vTraceSetISRProperties(TIID_EthTx, "i_EthTx", IPRI_EthTx);
	vTraceSetISRProperties(TIID_EthSys, "i_EthSys", IPRI_EthSys);
	vTraceSetISRProperties(TIID_Tmr0, "i_Tmr0", IPRI_Tmr0);
	vTraceSetISRProperties(TIID_Tmr1, "i_Tmr1", IPRI_Tmr1);
	vTraceSetISRProperties(TIID_Tmr2, "i_Tmr2", IPRI_Tmr2);
	vTraceSetISRProperties(TIID_rtc, "i_rtc", IPRI_rtc);
	vTraceSetISRProperties(TIID_uart0, "i_uart0", IPRI_uart0);
	vTraceSetISRProperties(TIID_uart1, "i_uart1", IPRI_uart1);
	vTraceSetISRProperties(TIID_button0, "i_swb0", IPRI_button0);
	vTraceSetISRProperties(TIID_button1, "i_swb1", IPRI_button1);
	vTraceSetISRProperties(TIID_button2, "i_swb2", IPRI_button2);
	// uiTraceStart(); 
	// vTraceStop()
#endif
		
#if INCLUDE_CONSOLE == 1 || INCLUDE_MODEM == 1  		// Include serial port 0 or serial port 1
	initSerial();
#endif

#if INCLUDE_RTC	== 1		// Include Realtime Clock
	initRTC();
#endif

#if INCLUDE_BUTTONS == 1
	initButtons();
#endif

#if INCLUDE_NETWORK
	/* Initialise the RTOS's TCP/IP stack.  The tasks that use the network
    are created in the vApplicationIPNetworkEventHook() hook function
    below.  The hook function is called when the network connects. */
	res = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
    //vRegisterSampleCLICommands();
	vRegisterTCPCLICommands();
	vRegisterMonitorCLICommands();
	
	// Commandline interface (Telnet port 5010)
	vStartTCPCommandInterpreterTask( 2048, 5010, tskIDLE_PRIORITY + 1);
#endif 

#ifdef INCLUDE_MONITOR
	// Demo Sysinfo 
	// Connect putty 115200,8,1,n (ansi terminal) to get the status informations
	res = xTaskCreate( sysinfo, "SysInfo", configMINIMAL_STACK_SIZE*2, (void *)portMAX_DELAY, PRIO_SYSINFO, NULL);
#endif


#if INCLUDE_LED5x7	== 1
	initLED5x7();
	res = xTaskCreate( TaskLED, "TaskLED", configMINIMAL_STACK_SIZE, (void *)portMAX_DELAY, PRIO_LED, NULL);
#endif

#ifdef CPM22 
	memset(cpmmem,0,sizeof(cpmmem));
	res = xTaskCreate( prvTCPCpmIOTask, "CPMIO", configMINIMAL_STACK_SIZE*2, (void*)cpmmem, PRIO_CPMIO, NULL);
#endif

	vTaskStartScheduler();

    return res;
}