#ifndef __RPP_TEST_H
#define __RPP_TEST_H
-#define TEST_TASK_PRIORITY 1
-#define TEST_TASK_TASK 512
+#define TEST_TASK_PRIORITY 0
+#define TEST_TASK_STACK 512
void wait_for_quit();
void busy_infinite_loop();
while(TRUE) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
// Update inputs
rpp_ain_update();
rpp_ain_get(11),
rpp_ain_get(12)
);
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
}
{
xTaskHandle test_task_handle;
+ rpp_sci_printf((const char*)"Try to create task.\r\n");
portBASE_TYPE task_created = xTaskCreate(ain_test_task,
(const signed char*)"ain_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
+ rpp_sci_printf((const char*)"After try to create task.\r\n");
if(task_created != pdPASS) {
wait_for_quit();
vTaskDelete(test_task_handle);
+ vTaskDelay(4); // Allow the idle task to free memory
// Reset module
// - Not required
for(i = 0; i < SAMPLE_RATE_HZ; i++, samples++) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
for(pin = 1; pin <= 4; pin++) {
// Calculate sine sample
// Update outputs
rpp_aout_update();
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
rpp_sci_printf((const char*)
portBASE_TYPE task_created = xTaskCreate(aout_test_task,
(const signed char*)"aout_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
void test_can()
{
rpp_sci_printf((const char*)
- "CAN test is unimplemented. Press 'q' to continue...\r\n"
+ "CAN test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
while(TRUE) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
// Update inputs
rpp_din_update();
rpp_din_get(15, FALSE),
rpp_din_get(16, FALSE)
);
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
}
portBASE_TYPE task_created = xTaskCreate(din_test_task,
(const signed char*)"din_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
void test_eth()
{
rpp_sci_printf((const char*)
- "ETH test is unimplemented. Press 'q' to continue...\r\n"
+ "ETH test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
void test_fr()
{
rpp_sci_printf((const char*)
- "FR test is unimplemented. Press 'q' to continue...\r\n"
+ "FR test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
for(i = 0; i < SAMPLE_RATE_HZ; i++, samples++) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
// Update H-Bridge
rpp_hbr_control(sin(i * step));
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
rpp_sci_printf(
portBASE_TYPE task_created = xTaskCreate(hbr_test_task,
(const signed char*)"hbr_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
void test_hout()
{
rpp_sci_printf((const char*)
- "HOUT test is unimplemented. Press 'q' to continue...\r\n"
+ "HOUT test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
void test_lin()
{
rpp_sci_printf((const char*)
- "LIN test is unimplemented. Press 'q' to continue...\r\n"
+ "LIN test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
uint8_t p = 0;
while(TRUE) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
// Output counter
for(p = 1; p <= 8; p++) {
if(is_bit_set(c, p - 1)) {
);
c++;
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
}
portBASE_TYPE task_created = xTaskCreate(lout_test_task,
(const signed char*)"lout_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
*/
void wait_for_quit()
{
- while(TRUE) {
- if(rpp_sci_getc() == 'q') {
- break;
- }
+ while(rpp_sci_getc() < 0) {
vTaskDelay(INPUT_IDLE / portTICK_RATE_MS);
}
}
portBASE_TYPE task_created =
xTaskCreate(test_cmdproc,
(const signed char*)"test_cmdproc",
- 512, NULL, 0, NULL
+ 512, NULL, TEST_TASK_PRIORITY, NULL
);
if(task_created != pdPASS) {
void test_mout()
{
rpp_sci_printf((const char*)
- "MOUT test is unimplemented. Press 'q' to continue...\r\n"
+ "MOUT test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
// the SCI API
rpp_sci_printf((const char*)
"You're using the SCI, reading this and typing this command.\r\n"
- "Press 'q' to continue...\r\n"
+ "Press any key to continue...\r\n"
);
wait_for_quit();
}
void test_sdc()
{
rpp_sci_printf((const char*)
- "SDC test is unimplemented. Press 'q' to continue...\r\n"
+ "SDC test is unimplemented. Press any key to continue...\r\n"
);
wait_for_quit();
}
uint32_t i = 0;
while(TRUE) {
- // Wait until next step
- vTaskDelayUntil(&last_wake_time, freq_ticks);
-
// Put something in the log
rpp_sdr_printf((const char*)
"This is the noise generator at iteration %d "
"putting some noise value %d.", i, rand()
);
i++;
+
+ // Wait until next step
+ vTaskDelayUntil(&last_wake_time, freq_ticks);
}
}
// opened command processor.
portBASE_TYPE task_created = xTaskCreate(sdr_test_task,
(const signed char*)"sdr_test_task",
- TEST_TASK_TASK, NULL, TEST_TASK_PRIORITY,
+ TEST_TASK_STACK, NULL, TEST_TASK_PRIORITY,
&test_task_handle
);
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+ <storageModule moduleId="null.devicePreference"/>
+ <storageModule moduleId="cpuFamily"/>
</cproject>
{
// Create semaphores
vSemaphoreCreateBinary(adcSemaphore_ADC1GRP1);
+ xSemaphoreTake(adcSemaphore_ADC1GRP1, 0);
vSemaphoreCreateBinary(adcSemaphore_ADC2GRP1);
+ xSemaphoreTake(adcSemaphore_ADC2GRP1, 0);
adcMutex_AIN = xSemaphoreCreateMutex();
adcMutex_HOUTIFBK = xSemaphoreCreateMutex();
// Flag to check if SDR module is initialized
static boolean_t initialized = FALSE;
+// Memory for Simulation only
+#if (rppCONFIG_DRV == 0) && defined(FREERTOS_POSIX)
+static uint8_t memory_simulation[1024*1024]; // Allocate 1MB for test
+#endif
+
// Initialize SDR module
int8_t rpp_sdr_init()
{
// Create log show semaphore
vSemaphoreCreateBinary(show_semaphore);
+ xSemaphoreTake(show_semaphore, 0);
// Create semaphore for outer applications to wait cmdproc to exit.
// Non static! The symbol should be exported, so use the full prefix.
vSemaphoreCreateBinary(rpp_sdr_cmdproc_semaphore);
+ xSemaphoreTake(rpp_sdr_cmdproc_semaphore, 0);
// Define memory bounds
#if rppCONFIG_DRV == 1
memory_start = (uint8_t*)RPP_SDR_ADDR_START;
memory_end = (uint8_t*)RPP_SDR_ADDR_END;
#elif defined(FREERTOS_POSIX)
- memory_size = 1024*1024; // Allocate 1MB for test
- memory_start = (uint8_t*)malloc(memory_size);
+ memory_size = sizeof(memory_simulation);
+ memory_start = (uint8_t*)&memory_simulation;
memory_end = (uint8_t*)(memory_start + memory_size - 1);
#endif
memory_current = memory_start;
// Memory available
uint32_t rpp_sdr_available()
{
- if(!log_enabled) {
- return 0;
- }
return (uint32_t)(memory_end - memory_current + 1);
}