00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __ORE_TYPES_H
00009 #define __ORE_TYPES_H
00010
00011 #include <l4/sys/types.h>
00012 #include <l4/dm_generic/types.h>
00013 #include <l4/ore/ore-dsi.h>
00014
00015
00016
00017 typedef l4_threadid_t l4ore_handle_t;
00018
00019
00020
00021
00022
00023
00024
00025 typedef struct ore_connection_configuration
00026 {
00027 int rw_debug;
00028 int rw_broadcast;
00029 int rw_active;
00030
00031 int ro_keep_device_mac;
00032
00033 int ro_irq;
00034 int ro_mtu;
00035 l4dm_dataspace_t ro_send_ds;
00036 l4dm_dataspace_t ro_send_ctl_ds;
00037 dsi_socket_ref_t ro_send_client_socketref;
00038 dsi_socket_ref_t ro_send_ore_socketref;
00039 l4dm_dataspace_t ro_recv_ds;
00040 l4dm_dataspace_t ro_recv_ctl_ds;
00041 dsi_socket_ref_t ro_recv_client_socketref;
00042 dsi_socket_ref_t ro_recv_ore_socketref;
00043 char ro_orename[16];
00044 } l4ore_config;
00045
00046 #define LOG_CONFIG(conf) { \
00047 LOG("conf->debug = %d", (conf).rw_debug); \
00048 LOG("conf->broadcast = %d", (conf).rw_broadcast); \
00049 LOG("conf->active = %d", (conf).rw_active); \
00050 LOG("conf->keep_mac = %d", (conf).ro_keep_device_mac); \
00051 LOG("conf->irq = %d", (conf).ro_irq); \
00052 LOG("conf->mtu = %d", (conf).ro_mtu); \
00053 LOG("conf->send_ds = DS %d", (conf).ro_send_ds.id); \
00054 LOG("conf->send_ctl = DS %d", (conf).ro_send_ctl_ds.id); \
00055 LOG("conf->recv_ds = DS %d", (conf).ro_recv_ds.id); \
00056 LOG("conf->recv_ctl = DS %d", (conf).ro_recv_ctl_ds.id); \
00057 LOG("conf->send_client_socket = %d", (conf).ro_send_client_socketref.socket); \
00058 LOG("conf->send_ore_socket = %d", (conf).ro_send_ore_socketref.socket); \
00059 LOG("conf->recv_client_socket = %d", (conf).ro_recv_client_socketref.socket); \
00060 LOG("conf->recv_ore_socket = %d", (conf).ro_recv_ore_socketref.socket); \
00061 LOG("conf->orename = %s", (conf).ro_orename); \
00062 }
00063
00064 #define LOG_SOCKETREF(s) \
00065 LOG("socketid = %d", (s)->socket); \
00066 LOG("worker = "l4util_idfmt, l4util_idstr((s)->work_th)); \
00067 LOG("sync = "l4util_idfmt, l4util_idstr((s)->sync_th)); \
00068 LOG("eventh = "l4util_idfmt, l4util_idstr((s)->event_th));
00069
00070 #define LOG_SOCKET(s) \
00071 LOG("socket id = %d", (s)->socket_id); \
00072 LOG("data ds = DS %d", (s)->data_ds.id); \
00073 LOG("data is at %p", (s)->data_area);
00074
00075 #define LOG_PACKET(p) \
00076 LOG("packet number = %d", (p)->no);
00077
00078 #define mac_fmt "%02X:%02X:%02X:%02X:%02X:%02X"
00079 #define mac_str(mac) (unsigned char)((mac)[0]), (unsigned char)((mac)[1]), \
00080 (unsigned char)((mac)[2]), (unsigned char)((mac)[3]), \
00081 (unsigned char)((mac)[4]), (unsigned char)((mac)[5])
00082
00083 #define LOG_MAC_s(cond, str, mac) LOGd(cond, "%s " mac_fmt, (str), mac_str(mac))
00084
00085 #define LOG_MAC(cond, mac) LOG_MAC_s(cond, "MAC = ", (mac))
00086
00087 #define L4ORE_DEFAULT_INITIALIZER { 0, 0, 1, 0, 0, 0, \
00088 L4DM_INVALID_DATASPACE, L4DM_INVALID_DATASPACE, \
00089 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00090 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00091 L4DM_INVALID_DATASPACE, L4DM_INVALID_DATASPACE, \
00092 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00093 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00094 {'O', 'R', 'e', 0, 0, 0, 0, 0, 0, 0}, \
00095 }
00096
00097 #define L4ORE_INVALID_INITIALIZER { -1,-1,-1,-1,-1,-1, \
00098 L4DM_INVALID_DATASPACE, L4DM_INVALID_DATASPACE, \
00099 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00100 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00101 L4DM_INVALID_DATASPACE, L4DM_INVALID_DATASPACE, \
00102 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00103 {-1, L4_INVALID_ID, L4_INVALID_ID, L4_INVALID_ID}, \
00104 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \
00105 }
00106
00107 #define L4ORE_DEFAULT_CONFIG ((l4ore_config)L4ORE_DEFAULT_INITIALIZER)
00108 #define L4ORE_INVALID_CONFIG ((l4ore_config)L4ORE_INVALID_INITIALIZER)
00109
00110
00111
00112
00113 L4_INLINE int l4ore_is_invalid_config(l4ore_config);
00114 L4_INLINE int l4ore_is_invalid_config(l4ore_config c)
00115 {
00116 return (c.rw_debug == -1);
00117 }
00118
00119 #endif