diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2016-07-28 14:15:55 +0200 |
---|---|---|
committer | Christian Gromm <christian.gromm@microchip.com> | 2016-07-28 14:15:55 +0200 |
commit | 5f0d290de700ddffa6750e95344fdc9fb49301db (patch) | |
tree | 4ec75b4a20074e8aaa11d2c923f822244c4d0eac /Usb-Driver/test-mocca.c | |
parent | 13b0ae6f160b0551edaee913d791607fd0cc3e4e (diff) |
src: can-lin: Usb-Driver: prepare directory for yocto build
This patch cleans the Usb-Driver directory. It removes files not
needed for the build process and fixes the Makefile. The patch is
needed for bitbake to fetch the source and compile the kernel
module.
Change-Id: I7748629d5c5b9a2cfcc3c6db63e64a10270fd77d
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Diffstat (limited to 'Usb-Driver/test-mocca.c')
-rw-r--r-- | Usb-Driver/test-mocca.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/Usb-Driver/test-mocca.c b/Usb-Driver/test-mocca.c deleted file mode 100644 index 70c4760..0000000 --- a/Usb-Driver/test-mocca.c +++ /dev/null @@ -1,68 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> -#include <stdint.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <pthread.h> - -uint8_t relayOn[] = { - 0x04, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x13, - 0x02, 0x0b, 0x70, 0x07, 0x00, 0x00, 0x01, 0x00 -}; - -uint8_t relayOff[] = { - 0x04, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x13, - 0x02, 0x0b, 0x70, 0x07, 0x00, 0x00, 0x00, 0x00 -}; - -uint8_t readBuffer[1024]; - -static int32_t repeat = 10; -static pthread_t readingThread; -static bool allowRun = true; -static int fd = -1; - -void* executeReading ( void* arg ) -{ - uint32_t bytesRead; - uint32_t i; - - while ( allowRun ) { - bytesRead = read ( fd, readBuffer, sizeof ( readBuffer ) ); - if ( bytesRead > 0 ) { - printf ( "Received bytes (hex): " ); - for ( i = 0; i < bytesRead; i++ ) { - printf ( "%02X ", readBuffer[i] ); - } - printf ( "\n" ); - } - } - pthread_exit ( 0 ); -} - -int main ( int argc, char* argv[] ) -{ - int ret; - if ( ( fd = open ( "/dev/mocca0", O_RDWR|O_SYNC ) ) < 0 ) { - printf ( "Failed to open mocca0 device\n" ); - exit ( -4 ); - } - ret = pthread_create ( &readingThread, NULL, executeReading, NULL ); - if ( ret ) { - printf ( "Failed to start reader thread\n" ); - } else { - while ( --repeat >= 0 ) { - write ( fd, relayOn, sizeof ( relayOn ) ); - usleep ( 1000000 ); - write ( fd, relayOff, sizeof ( relayOff ) ); - usleep ( 1000000 ); - } - } - allowRun = false; - - close ( fd ); - return 0; -} |