diff options
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | vag-bap-dump.c (renamed from vw-bap-dump.c) | 10 | ||||
-rw-r--r-- | vag-bap-frame.c (renamed from vw-bap-frame.c) | 16 | ||||
-rw-r--r-- | vag-bap-rx.c (renamed from vw-bap-rx.c) | 12 | ||||
-rw-r--r-- | vag-bap-send.c (renamed from vw-bap-send.c) | 12 | ||||
-rw-r--r-- | vag-bap-sniffer.c (renamed from vw-bap-sniffer.c) | 10 | ||||
-rw-r--r-- | vag-bap-tx.c (renamed from vw-bap-tx.c) | 20 | ||||
-rw-r--r-- | vag-bap.c (renamed from vw-bap.c) | 2 | ||||
-rw-r--r-- | vag-bap.h (renamed from vw-bap.h) | 26 |
9 files changed, 67 insertions, 59 deletions
@@ -1,13 +1,21 @@ CFLAGS += -Wall -g -BAPLIB = vw-bap.c vw-bap-frame.c vw-bap-rx.c vw-bap-tx.c +BAPLIB = vag-bap.c vag-bap-frame.c vag-bap-rx.c vag-bap-tx.c -all: vw-bap-dump vw-bap-sniffer vw-bap-send +EXES = vag-bap-dump vag-bap-sniffer vag-bap-send -vw-bap-dump: vw-bap-dump.c $(BAPLIB) +all: $(EXES) -vw-bap-sniffer: vw-bap-sniffer.c $(BAPLIB) + +vag-bap-dump: vag-bap-dump.c $(BAPLIB) + +vag-bap-sniffer: vag-bap-sniffer.c $(BAPLIB) gcc -o $@ $^ -lncurses -vw-bap-send: vw-bap-send.c $(BAPLIB) +vag-bap-send: vag-bap-send.c $(BAPLIB) + + +.PHONY: clean +clean: + rm -f $(EXES) diff --git a/vw-bap-dump.c b/vag-bap-dump.c index 62916f1..e9fb9bc 100644 --- a/vw-bap-dump.c +++ b/vag-bap-dump.c @@ -18,7 +18,7 @@ #include <net/if.h> #include <sys/ioctl.h> -#include "vw-bap.h" +#include "vag-bap.h" @@ -89,7 +89,7 @@ int main(int argc, char **argv) for (i = 0; i < can_id_count; i++) { can_ids[i] = strtoul(argv[2 + i], NULL, 0); - baps[i] = vw_bap_rxer_alloc(); + baps[i] = vag_bap_rxer_alloc(); if (!baps[i]) { printf("Out of memory allocating BAP struct.\n"); return 1; @@ -130,11 +130,11 @@ int main(int argc, char **argv) struct BAP_Frame *bap_frame; struct BAP_RXer *bap = baps[i]; - bap_frame = vw_bap_handle_can_frame(bap, &frame); + bap_frame = vag_bap_handle_can_frame(bap, &frame); if (bap_frame) { printf("%03x: ", frame.can_id); - vw_bap_frame_dump(bap_frame); - vw_bap_frame_free(bap_frame); + vag_bap_frame_dump(bap_frame); + vag_bap_frame_free(bap_frame); } break; diff --git a/vw-bap-frame.c b/vag-bap-frame.c index 1fa353f..4117d84 100644 --- a/vw-bap-frame.c +++ b/vag-bap-frame.c @@ -3,11 +3,11 @@ #include <stdlib.h> #include <string.h> -#include "vw-bap.h" +#include "vag-bap.h" -struct BAP_Frame* vw_bap_frame_alloc(void) +struct BAP_Frame* vag_bap_frame_alloc(void) { struct BAP_Frame* bap_frame; @@ -17,13 +17,13 @@ struct BAP_Frame* vw_bap_frame_alloc(void) } -void vw_bap_frame_free(struct BAP_Frame *bap_frame) +void vag_bap_frame_free(struct BAP_Frame *bap_frame) { free(bap_frame); } -int vw_bap_frame_is_valid(struct BAP_Frame *bap_frame) +int vag_bap_frame_is_valid(struct BAP_Frame *bap_frame) { if ( 0 || (bap_frame->opcode > 7) @@ -39,15 +39,15 @@ int vw_bap_frame_is_valid(struct BAP_Frame *bap_frame) } -struct BAP_Frame* vw_bap_frame_clone(struct BAP_Frame *bap_frame) +struct BAP_Frame* vag_bap_frame_clone(struct BAP_Frame *bap_frame) { struct BAP_Frame *new_frame; - if (!vw_bap_frame_is_valid(bap_frame)) { + if (!vag_bap_frame_is_valid(bap_frame)) { return NULL; } - new_frame = vw_bap_frame_alloc(); + new_frame = vag_bap_frame_alloc(); if (!new_frame) { return NULL; } @@ -59,7 +59,7 @@ struct BAP_Frame* vw_bap_frame_clone(struct BAP_Frame *bap_frame) -void vw_bap_frame_dump(struct BAP_Frame *bap_frame) +void vag_bap_frame_dump(struct BAP_Frame *bap_frame) { unsigned i; diff --git a/vw-bap-rx.c b/vag-bap-rx.c index e17dee3..2e6c0cd 100644 --- a/vw-bap-rx.c +++ b/vag-bap-rx.c @@ -5,10 +5,10 @@ #include <linux/can.h> -#include "vw-bap.h" +#include "vag-bap.h" -struct BAP_Frame* vw_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame *frame) +struct BAP_Frame* vag_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame *frame) { struct BAP_Frame *bap_frame = NULL; unsigned short header; @@ -39,7 +39,7 @@ struct BAP_Frame* vw_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame } bap->mfchannel[mfchannel] = NULL; - bap_frame = vw_bap_frame_alloc(); + bap_frame = vag_bap_frame_alloc(); if (!bap_frame) { printf("bap_handle_can_frame: Failed to allocate new frame\n"); return NULL; @@ -142,7 +142,7 @@ struct BAP_Frame* vw_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame -struct BAP_RXer* vw_bap_rxer_alloc() +struct BAP_RXer* vag_bap_rxer_alloc() { struct BAP_RXer *bap; @@ -157,13 +157,13 @@ struct BAP_RXer* vw_bap_rxer_alloc() -void vw_bap_rxer_free(struct BAP_RXer *bap) +void vag_bap_rxer_free(struct BAP_RXer *bap) { int i; for (i = 0; i < 8; i++) { if (bap->mfchannel[i]) { - vw_bap_frame_free(bap->mfchannel[i]); + vag_bap_frame_free(bap->mfchannel[i]); } } diff --git a/vw-bap-send.c b/vag-bap-send.c index 55cd222..3a0f2d1 100644 --- a/vw-bap-send.c +++ b/vag-bap-send.c @@ -18,7 +18,7 @@ #include <net/if.h> #include <sys/ioctl.h> -#include "vw-bap.h" +#include "vag-bap.h" static unsigned hex2bin(char c) { @@ -115,13 +115,13 @@ int main(int argc, char **argv) /* bap_data */ - bap = vw_bap_txer_alloc(); + bap = vag_bap_txer_alloc(); if (!bap) { printf("Out of memory allocating BAP TXer struct.\n"); return 1; } - bap_frame = vw_bap_frame_alloc(); + bap_frame = vag_bap_frame_alloc(); if (!bap_frame) { printf("Out of memory allocating BAP frame.\n"); return 1; @@ -166,9 +166,9 @@ int main(int argc, char **argv) /* Fill TXer */ printf("Will send frame:\n"); - vw_bap_frame_dump(bap_frame); + vag_bap_frame_dump(bap_frame); - ret = vw_bap_txer_queue(bap, bap_frame, &frame); + ret = vag_bap_txer_queue(bap, bap_frame, &frame); frame.can_id = can_id; can_tx(s, &frame); @@ -198,7 +198,7 @@ int main(int argc, char **argv) - vw_bap_txer_free(bap); + vag_bap_txer_free(bap); close(s); diff --git a/vw-bap-sniffer.c b/vag-bap-sniffer.c index f7f493c..1c17a25 100644 --- a/vw-bap-sniffer.c +++ b/vag-bap-sniffer.c @@ -20,7 +20,7 @@ #include <ncurses.h> -#include "vw-bap.h" +#include "vag-bap.h" @@ -82,7 +82,7 @@ int main(int argc, char **argv) can_id = strtoul(argv[2], NULL, 0); node_id = strtoul(argv[3], NULL, 0); - bap = vw_bap_rxer_alloc(); + bap = vag_bap_rxer_alloc(); if (!bap) { printf("Out of memory allocating BAP struct.\n"); return 1; @@ -126,7 +126,7 @@ int main(int argc, char **argv) struct BAP_Frame *bap_frame; unsigned i; - bap_frame = vw_bap_handle_can_frame(bap, &frame); + bap_frame = vag_bap_handle_can_frame(bap, &frame); if (bap_frame && bap_frame->node == node_id) { mvprintw(bap_frame->port, 0, ""); @@ -166,7 +166,7 @@ int main(int argc, char **argv) refresh(); - vw_bap_frame_free(bap_frame); + vag_bap_frame_free(bap_frame); } } @@ -176,7 +176,7 @@ int main(int argc, char **argv) endwin(); - vw_bap_rxer_free(bap); + vag_bap_rxer_free(bap); close(s); diff --git a/vw-bap-tx.c b/vag-bap-tx.c index a2f5f02..5beee30 100644 --- a/vw-bap-tx.c +++ b/vag-bap-tx.c @@ -7,11 +7,11 @@ #include <linux/can.h> -#include "vw-bap.h" +#include "vag-bap.h" -static void vw_bap_txer_build_only_can_frame(struct BAP_Frame *bap_frame, struct can_frame *frame) +static void vag_bap_txer_build_only_can_frame(struct BAP_Frame *bap_frame, struct can_frame *frame) { assert(!bap_frame->is_multiframe); @@ -25,7 +25,7 @@ static void vw_bap_txer_build_only_can_frame(struct BAP_Frame *bap_frame, struct } -static void vw_bap_txer_build_first_can_frame(struct BAP_TXer* bap, unsigned slotnum, struct can_frame *frame) +static void vag_bap_txer_build_first_can_frame(struct BAP_TXer* bap, unsigned slotnum, struct can_frame *frame) { struct BAP_Frame *bap_frame = bap->slot[slotnum]; @@ -59,14 +59,14 @@ static void vw_bap_txer_build_first_can_frame(struct BAP_TXer* bap, unsigned slo -int vw_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct can_frame *frame) +int vag_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct can_frame *frame) { - if (!vw_bap_frame_is_valid(bap_frame)) { + if (!vag_bap_frame_is_valid(bap_frame)) { return -EINVAL; } if (!bap_frame->is_multiframe) { - vw_bap_txer_build_only_can_frame(bap_frame, frame); + vag_bap_txer_build_only_can_frame(bap_frame, frame); return 0; } else { /* bap->frame->is_multiframe */ unsigned i; @@ -82,12 +82,12 @@ int vw_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct } /* Found empty slot */ - bap->slot[i] = vw_bap_frame_clone(bap_frame); + bap->slot[i] = vag_bap_frame_clone(bap_frame); if (!bap->slot[i]) { return -ENOMEM; } - vw_bap_txer_build_first_can_frame(bap, i, frame); + vag_bap_txer_build_first_can_frame(bap, i, frame); if (bap->slot[i]) { return 1; @@ -99,7 +99,7 @@ int vw_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct -struct BAP_TXer* vw_bap_txer_alloc() +struct BAP_TXer* vag_bap_txer_alloc() { struct BAP_TXer *bap; @@ -114,7 +114,7 @@ struct BAP_TXer* vw_bap_txer_alloc() -void vw_bap_txer_free(struct BAP_TXer *bap) +void vag_bap_txer_free(struct BAP_TXer *bap) { free(bap); } @@ -5,4 +5,4 @@ #include <linux/can.h> -#include "vw-bap.h" +#include "vag-bap.h" @@ -1,5 +1,5 @@ -#ifndef __VW_BAP_H__ -#define __VW_BAP_H__ +#ifndef __VAG_BAP_H__ +#define __VAG_BAP_H__ #include <linux/can.h> @@ -68,26 +68,26 @@ struct BAP_TXer { /* BAP frame struct handling */ -struct BAP_Frame* vw_bap_frame_alloc(void); - void vw_bap_frame_free(struct BAP_Frame *bap_frame); +struct BAP_Frame* vag_bap_frame_alloc(void); + void vag_bap_frame_free(struct BAP_Frame *bap_frame); -int vw_bap_frame_is_valid(struct BAP_Frame *bap_frame); +int vag_bap_frame_is_valid(struct BAP_Frame *bap_frame); -struct BAP_Frame* vw_bap_frame_clone(struct BAP_Frame *bap_frame); +struct BAP_Frame* vag_bap_frame_clone(struct BAP_Frame *bap_frame); -void vw_bap_frame_dump(struct BAP_Frame *bap_frame); +void vag_bap_frame_dump(struct BAP_Frame *bap_frame); /* BAP reception */ -struct BAP_Frame* vw_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame *frame); -struct BAP_RXer* vw_bap_rxer_alloc(); -void vw_bap_rxer_free(struct BAP_RXer *bap); +struct BAP_Frame* vag_bap_handle_can_frame(struct BAP_RXer *bap, struct can_frame *frame); +struct BAP_RXer* vag_bap_rxer_alloc(); +void vag_bap_rxer_free(struct BAP_RXer *bap); /* BAP transmission */ -int vw_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct can_frame *frame); -struct BAP_TXer* vw_bap_txer_alloc(); -void vw_bap_txer_free(struct BAP_TXer *bap); +int vag_bap_txer_queue(struct BAP_TXer* bap, struct BAP_Frame *bap_frame, struct can_frame *frame); +struct BAP_TXer* vag_bap_txer_alloc(); +void vag_bap_txer_free(struct BAP_TXer *bap); #endif |