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