From 13c8a7486f867fa26a6e60a42e1578d29749dad7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 15 Dec 2010 03:12:09 +0000 Subject: A little more USB host logic git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3178 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/drivers/usbhost/usbhost_registerclass.c | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'nuttx/drivers/usbhost/usbhost_registerclass.c') diff --git a/nuttx/drivers/usbhost/usbhost_registerclass.c b/nuttx/drivers/usbhost/usbhost_registerclass.c index e81fef9fe..d924de932 100644 --- a/nuttx/drivers/usbhost/usbhost_registerclass.c +++ b/nuttx/drivers/usbhost/usbhost_registerclass.c @@ -42,6 +42,17 @@ #include #include +#include + +#include "usbhost_registry.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ /**************************************************************************** * Private Function Prototypes @@ -81,7 +92,22 @@ int usbhost_registerclass(struct usbhost_registry_s *class) { -#warning "Not Implemented" - return -ENOSYS; + irqstate_t flags; + + /* g_classregistry is a singly-linkedlist of class ID information added by + * calls to usbhost_registerclass(). Since this list is accessed from USB + * host controller interrupt handling logic, accesses to this list must be + * protected by disabling interrupts. + */ + + flags = irqsave(); + + /* Add the new class ID info to the head of the list */ + + class->flink = g_classregistry; + g_classregistry = class; + + irqrestore(flags); + return OK; } -- cgit v1.2.3