Exemple #1
0
// Declare Main application
void main(void) {
// Initialize variables
    vos_init_semaphore(&DevicesStarted, 0);
    vos_init_mutex(&dprintLock, VOS_MUTEX_UNLOCKED);
    Delay = 511;
    vos_init_semaphore(&EnumerationComplete, 0);
    vos_init_semaphore(&SendKeyboardReport, 0);

// Initialise RTOS
    vos_init(VOS_QUANTUM, VOS_TICK_INTERVAL, NUMBER_OF_DEVICES);

// Sets the CPU frequency of the connected device.
    vos_set_clock_frequency(VOS_48MHZ_CLOCK_FREQUENCY);

// Initialise devices
    if (InitDevices()) {

// Initialise threads - pass a ThreadID to each thread
        vos_create_thread(28, SIZEOF_tcb, &Blink, 1, 1);
        vos_create_thread(27, SIZEOF_tcb, &EnumerateSlave, 1, 2);
        vos_create_thread(26, SIZEOF_tcb, &FindKeyboard, 1, 4);
        vos_create_thread(25, SIZEOF_tcb, &SendReports, 1, 8);
        vos_create_thread( 1, SIZEOF_tcb, &MyIdleTask, 0);

// Start Scheduler to kick off the created thread(s)
        vos_start_scheduler();
        }

// It is an error to get here, use a breakpoint to catch this
    while (1) {
        CheckStatus(1, ErrorSchedulerDidNotStart);
        }
    }
Exemple #2
0
void fifo_init(FIFO_TYPE *pfifo)
{
	memset(pfifo, 0, sizeof(FIFO_TYPE));
	vos_init_semaphore(&pfifo->semRead, 0);
	vos_init_semaphore(&pfifo->semWrite, SZ_FIFO-1);
	vos_init_mutex(&pfifo->mutex, VOS_MUTEX_UNLOCKED);
}
/////////////////////////////////////////////////////////////////////////////
// INIT
void SMQInit()
{
    head = 0;
    tail = 0;
    vos_init_semaphore(&semAvailable,0);
    vos_init_mutex(&mAccess,0);
}