hll_arbitrator.h
Go to the documentation of this file.
00001 /***********************************************************************/
00014 #if CONFIG_BUS_MODE == BUS_ARBITRATOR
00015 
00016 void post_office(struct socket *so);
00017 void hll_arbdev_init(void);
00018 
00019 struct nodeinfo{
00020         struct request_bind personality;
00021 };
00022 
00023 #ifdef CONFIG_USE_MALLOC
00024 #       include "trie.h"
00025 extern struct trienode nodeinfo_byId;
00026 typedef struct trie_iterator nodeinfo_iterator;
00027 #else
00028 extern struct nodeinfo nodeinfo_byId[254];
00029 typedef struct{u8 index;} nodeinfo_iterator;
00030 #endif
00031 
00032 #ifdef CONFIG_USE_MALLOC
00033 
00034 inline struct nodeinfo *
00035 nodeinfo_lookup(u8 index){
00036         return trie_lookup(&nodeinfo_byId, index);
00037 }
00038 
00039 inline struct nodeinfo *
00040 nodeinfo_iterate(nodeinfo_iterator *it){
00041         return trie_iterate(it);
00042 }
00043 
00044 inline struct nodeinfo *
00045 nodeinfo_iterator_begin(nodeinfo_iterator *it, index_t index){
00046         return trie_iterator_begin(it, &nodeinfo_byId, index);
00047 }
00048 
00049 #else
00050 
00051 inline struct nodeinfo *
00052 nodeinfo_lookup(u8 index){
00053         struct nodeinfo *node = &nodeinfo_byId[index-1];
00054         return (
00055                 node->personality.vendor_id == ~0 &&
00056                 node->personality.product_id == ~0 &&
00057                 node->personality.serial_number == ~0
00058         ) ? NULL : node;
00059 }
00060 
00061 inline struct nodeinfo *
00062 nodeinfo_iterate(nodeinfo_iterator *it){
00063         while(it->index--){
00064                 struct nodeinfo *ret = nodeinfo_lookup(it->index);
00065                 if(ret) return ret;
00066         }
00067         return NULL;
00068 }
00069 
00070 inline struct nodeinfo *
00071 nodeinfo_iterator_begin(nodeinfo_iterator *it, u8 index){
00072         it->index = index+1;
00073         return nodeinfo_iterate(it);
00074 }
00075 
00076 inline void
00077 nodeinfo_setUnused(struct nodeinfo *node){
00078         node->personality.vendor_id = ~0;
00079         node->personality.product_id = ~0;
00080         node->personality.serial_number = ~0;
00081 }
00082 
00083 #endif
00084 
00085 
00086 #endif
 All Classes Files Functions Enumerations Enumerator Defines