Skip to content

e_pythonLibrary Documentation

elliottpaulrees edited this page Oct 13, 2014 · 3 revisions

Library Include Tag

#include e_pythonLibrary

e_init()

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_init("hardware definition file location as string")

Description:

Initiates the connection to the epiphany chip and must be done before any other epiphany commands are called.

The parameter should contain the file location of the Parallella boards hardware definition file as a string. The default file location for the hardware definition file is "/opt/adapteva/esdk/bsps/current/platform.hdf" but will differ if you have set a custom save location for the eSDK.

Returns:

returns 0 if successful and -1 if unsuccessful.

e_reset_system()

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_reset_system()

Description:

Carries out a full hardware reset of the epiphany platform.

Returns:

returns 0 if successful and -1 if unsuccessful.

e_reset_group()

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_reset_group(e_epiphany_t_pointer)

Description:

Use this function to perform a soft reset of an e_epiphany_t workgroup.

Returns:

returns 0 if successful and -1 if unsuccessful.

e_epiphany_create()

Synopsis:

#include e_pythonLibrary

dev = e_pythonLibrary.e_epiphany_create()

Description:

creates a new e_epiphany_t object which is what is used to define and access an eCore workgroup.

Returns:

returns a pointer to the e_epiphany_t object

e_mem_create()

Synopsis:

#include e_pythonLibrary

mem = e_pythonLibrary.e_mem_create()

Description:

creates a new e_mem_t object which is used to define memory on the epiphany board

Returns:

returns a pointer to the created e_mem_t object

e_get_platform_info()

Synopsis:

#include e_pythonLibrary

platform = e_pythonLibrary.e_get_platform_info()

Description:

creates a new e_platform_t struct object which is populated with the platform information. Treat as a struct with the following fields:

char *version - platform version string unsigned row, col - coordinates of effective chip area unsigned rows, cols - size of effective chip area int num_chips - number of Epiphany chips in platform int num_emems - number of external memory segments

Returns:

returns a pointer to the created e_platform_t object

e_open():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_open(e_epiphany_t_pointer, row, col, rows, cols)

Description:

This function defines an eCore workgroup. The workgroup is defined in terms of the coordinates relative to the platform’s effective chip area. The arguments row and col define the place of the group’s origin eCore. The origin is set relative to the Epiphany platform’s origin, defined in the e_init() call. The arguments rows and cols give the group’s size, defining the work rectangle. A work group can be as small as a single core or as large as the whole available effective chip area. The core group data is saved in the provided e_epiphany_t type object which is defined with the e_epiphany_create() function call

Subsequent accesses to the core group (e.g., for read and write of data) are done using a reference to the e_epiphany_t object.

Returns:

Returns a 0 if successful and -1 if unsuccessful.

e_load():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_load("file.srec", e_epiphany_t_pointer, row, col)

Description:

Loads a file onto a single work group core.The string specifies the path to the program’s image. The target core workgroup is specified by the e_epiphany_t_pointer argument. The target core is specified by the row and col coordinates, relative to the e_epiphany_t_pointer workgroup.

Returns:

Returns a 0 if successful and -1 if unsuccessful.

e_load_group():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_load("file.srec", e_epiphany_t_pointer, row, col, rows, cols)

Description:

This function loads an Epiphany program onto a subgroup of a workgroup. The "file.srec" string specifies the path to the program’s image to be loaded onto the cores. The target workgroup is specified by the e_epiphany_t_pointer argument. The target cores subgroup for loading the image is specified by the row and col coordinates, relative to the workgroup origin. The rows and cols parameters specify the size of the subgroups. All cores in the subgroup are loaded with the same program image.

Returns:

Returns a 0 if successful and -1 if unsuccessful.

e_alloc():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_alloc(e_mem_t_pointer, base, size)

Description:

This function defines a buffer in external memory. The buffer is defined in terms of the relative from the beginning of the external memory segment, defined in the e_init() call. The argument base defines the offset, starting at 0. The argument and size gives the buffer’s size. The external memory buffer data is saved in the provided e_mem_t type object mbuf.

e_mem_t_pointer is created within the e_mem_create() function

Returns:

Returns a 0 if successful and -1 if unsuccessful.

e_free():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_free(e_mem_t_pointer)

Description:

Releases the resources allocated by the e_alloc() function.

e_mem_t_pointer is created within the e_mem_create() function

Returns:

Returns a 0 if successful and -1 if unsuccessful.

e_read():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_read(e_mem_t_OR_e_epiphany_t, row, col, memStart, buffSize)

Description:

NOTE: I am willing to edit this to return all data types but this not required for my test and therefore, currently only returns data as an integer

This function reads data of length size from a workgroup core or an external memory buffer to the local byte buffer buf. The argument e_mem_t_OR_e_pepiphany_t specifies the target from which to read the data. It can be of either types e_epiphany_t or e_mem_t.

If an object of type e_epiphany_t is given, then the row and col arguments specify the relative target eCore coordinates in the workgroup.

If an object of type e_mem_t is given, then the row and col arguments are ignored.

In both cases, the from_addr parameter specifies the write offset relative to the buffer’s start, or to the eCore’s internal space.

Returns:

Returns the read data as an integer.

e_write():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_write(e_mem_t_OR_e_epiphany_t, row, col, memStart, buffer, buffSize)

Description:

This function writes data of length size from the local byte buffer to a workgroup core or an external memory buffer. The argument e_mem_t_OR_e_pepiphany_t specifies the target on which to write the data. It can be of either types e_epiphany_t (see e_epiphany_create()) or e_mem_t (see e_mem_create()).

If an object of type e_epiphany_t is given, then the row and col arguments specify the relative target eCore coordinates in the workgroup.

If an object of type e_mem_t is given, then the row and col arguments are ignored.

In both cases, the memStart parameter specifies the write offset relative to the buffer’s start, or to the eCore’s internal space.

Returns:

Returns the size of the written data

e_close():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_close(e_epiphany_t_pointer)

Description:

The function closes the eCore workgroup. The resources allocated by the e_open() call are released here. Use this function before re-allocating an eCore to a new workgroup.

Returns:

Returns 0 if successful. Returns -1 if unsuccessful

e_finalize():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.e_finalize()

Description:

Use this function to finalize the connection with the Epiphany system. Some resources that were allocated in the e_init() call are released here.

Returns:

Returns 0 if successful. Returns -1 if unsuccessful

get_offset():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.get_offset(struct_name, item_name)

Description:

Calculates and returns the memory offset of an item within a struct.

Returns:

Returns the item offset

get_sizeof():

Synopsis:

#include e_pythonLibrary

e_pythonLibrary.get_sizeof(item)

Description:

Calculates and returns the size of an item provided in bytes

Returns:

Returns the size of the item