Go to the documentation of this file.00001
00009 #ifndef SOCKET_H_
00010 #define SOCKET_H_
00011
00012 #include "config.h"
00013 #include "types.h"
00014
00015 struct can_msg{
00016 u16 id : 11;
00017 u8 len : 4;
00018 u8 rtr : 1;
00019 union{
00020 u8 data[8];
00021 struct{
00022 u8 function_code;
00023 u8 function_specific[7];
00024 };
00025 };
00026 };
00027
00028 struct socket;
00029 typedef void (*sock_recv_hook)(struct socket*);
00030
00034 struct canel{
00035 struct canel *next;
00036 struct can_msg msg;
00037 };
00038
00044 struct socket{
00045 volatile struct canel *rd, *wr;
00046 sock_recv_hook recv_hook;
00047 volatile _Bool recv_hook_running;
00048 };
00049
00050 void sock_init(struct socket*);
00051 void sock_register_recv_hook(struct socket*, sock_recv_hook);
00052 void sock_push(struct socket*, struct can_msg*);
00053 struct can_msg *sock_pull(struct socket*);
00054
00055 #endif