Commit fe23e85e authored by julien.delange's avatar julien.delange
Browse files

basecode for device driver integration, hardware interfacing

 now works



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@568 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent dffbd238
......@@ -48,13 +48,15 @@
#if defined(RTEMS_POSIX)
#include <rtems.h>
#include <inttypes.h>
#include <bsp.h>
#define CONFIGURE_INIT
#include <bsp.h>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
int POSIX_Init ();
#define CONFIGURE_MAXIMUM_POSIX_THREADS __PO_HI_NB_TASKS + 2
#define CONFIGURE_MAXIMUM_POSIX_THREADS __PO_HI_NB_TASKS + 4
#define CONFIGURE_MAXIMUM_TASKS 16
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES __PO_HI_NB_TASKS + 1
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES __PO_HI_NB_TASKS + 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
......
......@@ -6,7 +6,14 @@
* For more informations, please visit http://ocarina.enst.fr
*
* Copyright (C) 2008-2009, GET-Telecom Paris.
* Copyright (C) 2010, European Space Agency.
*/
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#include <deployment.h>
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
#ifdef __PO_HI_NEED_DRIVER_SERIAL_RASTA
#define CONFIGURE_MAXIMUM_DRIVERS 16
#endif
......@@ -13,7 +13,6 @@
#define __PO_HI_DRIVER_SERIAL_LINUX_DEVICE "/dev/ttyS0"
#define __PO_HI_DRIVER_SERIAL_LINUX_BAUDRATE B19200
#include <po_hi_debug.h>
/* po-hi-c related files */
......@@ -29,7 +28,17 @@ int po_hi_c_driver_serial_fd;
void __po_hi_c_driver_serial_linux_poller (void)
{
char buf[1024];
int n;
__DEBUGMSG ("Hello, i'm the serial linux poller !\n");
n = read (po_hi_c_driver_serial_fd, &buf, 6);
__DEBUGMSG ("[LINUX SERIAL] read() returns %d\n", n);
if (n > 0)
{
buf[n] = '\0';
printf ("[LINUX SERIAL] Received: %s\n", buf);
}
}
......
......@@ -19,33 +19,33 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
/* POSIX-style files */
#include <pci.h>
#include <rasta.h>
#include <apbuart_rasta.h>
/* Rasta includes from GAISLER drivers */
#define __PO_HI_DRIVER_SERIAL_LINUX_DEVICE "/dev/apburasta0"
#define __PO_HI_DRIVER_SERIAL_LINUX_BAUDRATE 19200
#define __PO_HI_DRIVER_SERIAL_RASTA_DEVICE "/dev/apburasta0"
#define __PO_HI_DRIVER_SERIAL_RASTA_BAUDRATE 19200
int po_hi_c_driver_rasta_serial_fd;
void __po_hi_c_driver_serial_rasta_poller (void)
{
/*
char buf[1024];
int n;
while(1)
__DEBUGMSG ("Hello, i'm the serial RASTA poller !\n");
n = read (po_hi_c_driver_rasta_serial_fd, &buf, 6);
__DEBUGMSG ("[RASTA SERIAL] read() returns %d\n", n);
if (n > 0)
{
n = read (po_hi_c_driver_rasta_serial_fd, &buf, 1024);
__DEBUGMSG ("[RASTA SERIAL] read() returns %d\n", n);
if (n > 0)
{
buf[n] = '\0';
printf ("[RASTA SERIAL] Received: %s\n", buf);
}
sleep(2);
buf[n] = '\0';
printf ("[RASTA SERIAL] Received: %s\n", buf);
}
*/
}
void __po_hi_c_driver_serial_rasta_init (void)
......@@ -55,17 +55,18 @@ void __po_hi_c_driver_serial_rasta_init (void)
__DEBUGMSG ("[RASTA SERIAL] Initializing RASTA ...\n");
if ( rasta_register() ){
__DEBUGMSG(" ERROR !\n");
return;
}
__DEBUGMSG(" OK !\n");
po_hi_c_driver_rasta_serial_fd = open ("/dev/apburasta0", O_RDWR);
po_hi_c_driver_rasta_serial_fd = open (__PO_HI_DRIVER_SERIAL_RASTA_DEVICE, O_RDWR);
if (po_hi_c_driver_rasta_serial_fd < 0)
{
__DEBUGMSG ("[RASTA SERIAL] Error while opening device %s\n", __PO_HI_DRIVER_SERIAL_LINUX_DEVICE);
__DEBUGMSG ("[RASTA SERIAL] Error while opening device %s\n", __PO_HI_DRIVER_SERIAL_RASTA_DEVICE);
}
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_BAUDRATE, 19200); /* stream mode */
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_BAUDRATE, __PO_HI_DRIVER_SERIAL_RASTA_BAUDRATE); /* stream mode */
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_BLOCKING, APBUART_BLK_RX | APBUART_BLK_TX | APBUART_BLK_FLUSH);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_TXFIFO_LEN, 64); /* Transmitt buffer 64 chars */
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_RXFIFO_LEN, 256); /* Receive buffer 256 chars */
......@@ -77,7 +78,7 @@ void __po_hi_c_driver_serial_rasta_init (void)
int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const __po_hi_port_t port)
{
int n;
n = write (po_hi_c_driver_rasta_serial_fd, "blabla", 6);
n = write (po_hi_c_driver_rasta_serial_fd, "blabl\n", 6);
__DEBUGMSG ("RASTA write returns %d\n", n);
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment