Exemple #1
0
void UsbSerial_begin( void )
{
  USBD_Disconnect(); // tell the host we're not attached
  CDCDSerialDriver_Initialize();
  USBD_Connect();
  usbSerial.readSemaphore = SemaphoreCreate();
  SemaphoreTake( usbSerial.readSemaphore, -1 );
  usbSerial.writeSemaphore = SemaphoreCreate();
  SemaphoreTake( usbSerial.writeSemaphore, -1 );
}
void* ConditionCreate()
{
	condition_t *cond = (condition_t *)malloc(sizeof(condition_t));
	cond->waiters = 0;
	cond->semaphore = SemaphoreCreate(0);
	return (void *)cond;
}
Exemple #3
0
ThreadQueue *NewThreadQueue()
{
	ThreadQueue *q = (ThreadQueue *)malloc(sizeof(ThreadQueue));
	if (q == NULL) {
		error("malloc failed");
		return NULL;
	}

	SemaphoreCreate(&q->sem, 0);

	q->queue = NewQueue();

	return q;
}
Exemple #4
0
/* Starts the DeviceManager request thread */
void DmStart(void)
{
	/* Debug */
	LogInformation("DRVM", "Starting Request Handler");

	/* Create the signal & Request queue */
	GlbDmEventLock = SemaphoreCreate(0);
	GlbDmEventQueue = list_create(LIST_SAFE);

	/* Spawn the thread */
	ThreadingCreateThread("Device Event Thread", DmRequestHandler, NULL, 0);

	/* Is there a boot video? */
	if (GlbDmBootVideo != NULL)
		DmCreateDevice("Boot-Video", GlbDmBootVideo);
}