diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-15 03:12:09 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-15 03:12:09 +0000 |
commit | 13c8a7486f867fa26a6e60a42e1578d29749dad7 (patch) | |
tree | 7d9124ff748344ef0bbe3af9a0f37eebddf32c18 /nuttx/drivers/usbhost/usbhost_registerclass.c | |
parent | 0a03557c61b735a872b4a62604ad0b6d766d945b (diff) | |
download | px4-nuttx-13c8a7486f867fa26a6e60a42e1578d29749dad7.tar.gz px4-nuttx-13c8a7486f867fa26a6e60a42e1578d29749dad7.tar.bz2 px4-nuttx-13c8a7486f867fa26a6e60a42e1578d29749dad7.zip |
A little more USB host logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3178 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_registerclass.c')
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_registerclass.c | 30 |
1 files changed, 28 insertions, 2 deletions
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 <errno.h> #include <nuttx/usb/usbhost.h> +#include <arch/irq.h> + +#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; } |