Commit cf0ae61b authored by yoogx's avatar yoogx

* Introduction of Python bindings for generated code

parent 105eb2a5
......@@ -194,6 +194,7 @@ AC_OUTPUT([
src/drivers/configuration/Makefile
src/monitoring/Makefile
src/monitoring/cheddar_scheduling/Makefile
src/python/Makefile
src/simulator/Makefile
include/Makefile
include/drivers/Makefile
......
......@@ -63,8 +63,10 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
* last argument is the request to store in the queue.
*/
/*
int __po_hi_gqueue_send_output (__po_hi_task_id id,
__po_hi_port_t port);
*/
/*
* Send a value for an out port.
*
......
......@@ -13,7 +13,7 @@
int __po_hi_initialize (void);
/*
* Invoke all functions to initialize tasks
* Invoke all functions to initialize tasks
* and network. Return __PO_HI_SUCCESS if there
* is no error. Else, it can return the value
* __PO_HI_ERROR_PTHREAD_BARRIER.
......@@ -37,12 +37,11 @@ int __po_hi_wait_initialization (void);
#ifdef __PO_HI_USE_GPROF
void __po_hi_wait_end_of_instrumentation (void);
/*
* Wait a certain amount of time to finish the
* Wait a certain amount of time to finish the
* execution of the system.
*/
#endif
int __po_hi_initialize_early (void);
/*
* __po_hi_initialize_earlier() is used to perform
......
......@@ -15,14 +15,19 @@
* Define some values that are dependant of the
* underlying executive.
*/
#if defined(POSIX) || defined (XENO_POSIX) || defined (SIMULATOR)
#if defined (POSIX) || defined (XENO_POSIX) || defined (SIMULATOR)
#include <stdlib.h>
#include <stdio.h>
#if defined (DLL)
#define __PO_HI_MAIN_NAME aadl_start
#else
#define __PO_HI_MAIN_NAME main
#endif
#define __PO_HI_MAIN_TYPE int
#define __PO_HI_MAIN_ARGS int argc , char *argv[] , char **arge
#define __PO_HI_MAIN_RETURN EXIT_SUCCESS
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#elif defined(_WIN32)
#include <tchar.h>
#include <windows.h>
......@@ -33,6 +38,7 @@
#define __PO_HI_MAIN_ARGS
#define __PO_HI_MAIN_RETURN EXIT_SUCCESS
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#elif defined (XENO_NATIVE)
#include <native/task.h>
#include <native/timer.h>
......@@ -41,12 +47,14 @@
#define __PO_HI_MAIN_ARGS int argc , char *argv[] , char **arge
#define __PO_HI_MAIN_RETURN 0
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#elif defined(RTEMS_PURE)
#define __PO_HI_MAIN_NAME Init
#define __PO_HI_MAIN_TYPE rtems_task
#define __PO_HI_MAIN_ARGS rtems_task_argument argument
#define __PO_HI_MAIN_RETURN 0
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#elif defined(RTEMS_POSIX)
#define __PO_HI_MAIN_NAME POSIX_Init
#define __PO_HI_MAIN_TYPE int
......@@ -55,8 +63,6 @@
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#endif
#if defined(POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
#include <semaphore.h>
#include <po_hi_time.h>
......
......@@ -87,7 +87,6 @@ int __po_hi_transport_send (__po_hi_task_id id, __po_hi_port_t por
#define __po_hi_transport_send_default __po_hi_transport_send
#define __po_hi_send_output __po_hi_transport_send
/*
* \fn __po_hi_get_port_name
* \brief Return the name of the port similar to the name within the AADL model.
......@@ -227,7 +226,7 @@ __po_hi_protocol_t __po_hi_transport_get_protocol (const __po_hi_port_t
/*
* \fn __po_hi_transport_get_protocol_configuration
* \brief Retrieve the configuration of the given protocol identifier. Returns a pointer on the conf or NULL.
*
*
*
* Protocol identifier can be retrieve in the generated deployment.h file
* under the type __po_hi_protocol_t. Invalid protocol identifier
......@@ -273,7 +272,7 @@ int __po_hi_transport_call_sending_func_by_device (const __po_hi_device_id, __po
* First argument is the task that is sending the data. The second
* is the port associated with the task and the device. The device
* to call is deduced from the port.
*
*
* The function returns __PO_HI_UNAVAILABLE is no sending function
* has been set for this device or if the device identifier is invalid.
* Otherwise, it returns the value returned by the sending function
......
......@@ -389,3 +389,13 @@ gprof:
./$(BINARY)
gprof ./$(BINARY) > gprof.out
endif
################################################################################
# Generate Python wrapper for generated code, suppose the generated
# code uses the DLL target, and assumes a Linux OS for ld
python_wrapper:
swig -python -I$(RUNTIME_PATH)/include -outdir . -o po_hi_c_python_wrap.c $(RUNTIME_PATH)/src/po_hi_c_python.i
$(CC) -fPIC -c po_hi_c_python_wrap.c $(INCLUDE) $(CFLAGS) `python-config --includes`
ld -dylib po_hi_c_python_wrap.o $(EXTERNAL_OBJECTS) $(PO_HI_OBJS) $(PO_HI_CPPOBJS) $(GENERATED_OBJS) $(USER_OBJS) $(LDFLAGS) `python-config --libs` -o _po_hi_c_python.so
AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS=drivers monitoring simulator
SUBDIRS=drivers monitoring simulator python
C_FILES = $(srcdir)/po_hi_task.c $(srcdir)/po_hi_main.c \
$(srcdir)/po_hi_marshallers.c $(srcdir)/po_hi_messages.c \
......
AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS=
C_FILES = $(srcdir)/po_hi_c_python.i
csrc = ${shell $(CYGPATH_U) '$(OCARINA_RUNTIME)/polyorb-hi-c/src'}
install-data-local:
$(INSTALL) -d $(DESTDIR)$(csrc)
for f in $(C_FILES); do $(INSTALL) -m 444 $$f $(DESTDIR)$(csrc) ; done
uninstall-local:
rm -rf $(DESTDIR)$(csrc)
EXTRA_DIST = $(C_FILES)
CLEANFILES = *~
%module po_hi_c_python
%{
#include <deployment.h>
#include <request.h>
#include <activity.h>
#include <po_hi_time.h>
#include <po_hi_task.h>
#include <po_hi_main.h>
#include <po_hi_time.h>
#include <po_hi_types.h>
#include <po_hi_config.h>
#include <po_hi_gqueue.h>
#include <po_hi_transport.h>
%}
%include <types.h>
%include <deployment.h>
%include <po_hi_gqueue.h>
%include <request.h>
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