PMSIS BSP
|
Content | |
Hyperram | |
Data Structures | |
struct | pi_ram_conf |
RAM configuration structure. More... | |
Typedefs | |
typedef struct pi_cl_ram_req_s | pi_cl_ram_req_t |
RAM cluster copy request structure. More... | |
typedef struct pi_cl_ram_alloc_req_s | pi_cl_ram_alloc_req_t |
RAM cluster alloc request structure. More... | |
typedef struct pi_cl_ram_free_req_s | pi_cl_ram_free_req_t |
RAM cluster free request structure. More... | |
Functions | |
int32_t | pi_ram_open (struct pi_device *device) |
Open a RAM device. More... | |
static void | pi_ram_close (struct pi_device *device) |
Close an opened RAM device. More... | |
static int | pi_ram_alloc (struct pi_device *device, uint32_t *addr, uint32_t size) |
Allocate RAM memory. More... | |
static int | pi_ram_free (struct pi_device *device, uint32_t addr, uint32_t size) |
Free RAM memory. More... | |
static void | pi_ram_read (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size) |
Enqueue a read copy to the RAM (from RAM to processor). More... | |
static void | pi_ram_write (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size) |
Enqueue a write copy to the RAM (from processor to RAM). More... | |
static void | pi_ram_copy (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, int ext2loc) |
Enqueue a copy with the RAM. More... | |
static void | pi_ram_read_2d (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length) |
Enqueue a 2D read copy (rectangle area) to the RAM (from RAM to processor). More... | |
static void | pi_ram_write_2d (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length) |
Enqueue a 2D write copy (rectangle area) to the RAM (from processor to RAM). More... | |
static void | pi_ram_copy_2d (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length, int ext2loc) |
Enqueue a 2D copy (rectangle area) with the RAM. More... | |
static void | pi_ram_read_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, pi_task_t *task) |
Enqueue an asynchronous read copy to the RAM (from RAM to processor). More... | |
static void | pi_ram_write_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, pi_task_t *task) |
Enqueue an asynchronous write copy to the RAM (from processor to RAM). More... | |
static void | pi_ram_copy_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, int ext2loc, pi_task_t *task) |
Enqueue an asynchronous copy with the RAM. More... | |
static void | pi_ram_read_2d_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length, pi_task_t *task) |
Enqueue an asynchronous 2D read copy (rectangle area) to the RAM (from RAM to processor). More... | |
static void | pi_ram_write_2d_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length, pi_task_t *task) |
Enqueue an asynchronous 2D write copy (rectangle area) to the RAM (from processor to RAM). More... | |
static void | pi_ram_copy_2d_async (struct pi_device *device, uint32_t pi_ram_addr, void *data, uint32_t size, uint32_t stride, uint32_t length, int ext2loc, pi_task_t *task) |
Enqueue an asynchronous 2D copy (rectangle area) with the RAM. More... | |
void | pi_cl_ram_alloc (struct pi_device *device, uint32_t size, pi_cl_ram_alloc_req_t *req) |
Allocate RAM memory from cluster side. More... | |
void | pi_cl_ram_free (struct pi_device *device, uint32_t chunk, uint32_t size, pi_cl_ram_free_req_t *req) |
Free RAM memory from cluster side. More... | |
static int32_t | pi_cl_ram_alloc_wait (pi_cl_ram_alloc_req_t *req, uint32_t *addr) |
Wait until the specified RAM alloc request has finished. More... | |
static int32_t | pi_cl_ram_free_wait (pi_cl_ram_free_req_t *req) |
Wait until the specified RAM free request has finished. More... | |
static void | pi_cl_ram_read (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, pi_cl_ram_req_t *req) |
Enqueue a read copy to the RAM from cluster side (from RAM to processor). More... | |
static void | pi_cl_ram_write (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, pi_cl_ram_req_t *req) |
Enqueue a write copy to the RAM from cluster side (from RAM to processor). More... | |
void | pi_cl_ram_copy (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, int ext2loc, pi_cl_ram_req_t *req) |
Enqueue a copy with the RAM from cluster side. More... | |
static void | pi_cl_ram_read_2d (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, uint32_t stride, uint32_t length, pi_cl_ram_req_t *req) |
Enqueue a 2D read copy (rectangle area) to the RAM from cluste side (from RAM to processor). More... | |
static void | pi_cl_ram_write_2d (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, uint32_t stride, uint32_t length, pi_cl_ram_req_t *req) |
Enqueue a 2D write copy (rectangle area) to the RAM from cluster side (from RAM to processor). More... | |
void | pi_cl_ram_copy_2d (struct pi_device *device, uint32_t pi_ram_addr, void *addr, uint32_t size, uint32_t stride, uint32_t length, int ext2loc, pi_cl_ram_req_t *req) |
Enqueue a 2D copy (rectangle area) with the RAM from cluster side. More... | |
static void | pi_cl_ram_read_wait (pi_cl_ram_req_t *req) |
Wait until the specified RAM request has finished. More... | |
static void | pi_cl_ram_write_wait (pi_cl_ram_req_t *req) |
Wait until the specified RAM request has finished. More... | |
static void | pi_cl_ram_copy_wait (pi_cl_ram_req_t *req) |
Wait until the specified RAM request has finished. More... | |
The RAM driver provides support for transferring data between an external RAM chip (e.g. Hyperram or SPI ram) and the processor running this driver.
typedef struct pi_cl_ram_alloc_req_s pi_cl_ram_alloc_req_t |
This structure is used by the runtime to manage a cluster remote allocation in the RAM. It must be instantiated once for each allocation and must be kept alive until the allocation is done. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through a memory allocator.
typedef struct pi_cl_ram_free_req_s pi_cl_ram_free_req_t |
This structure is used by the runtime to manage a cluster remote free in the RAM. It must be instantiated once for each free and must be kept alive until the free is done. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through a memory allocator.
typedef struct pi_cl_ram_req_s pi_cl_ram_req_t |
This structure is used by the runtime to manage a cluster remote copy with the RAM. It must be instantiated once for each copy and must be kept alive until the copy is finished. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through a memory allocator.
void pi_cl_ram_alloc | ( | struct pi_device * | device, |
uint32_t | size, | ||
pi_cl_ram_alloc_req_t * | req | ||
) |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM allocation. The allocated memory is 4-bytes aligned. The allocator uses some meta-data stored in the fabric controller memory for every allocation so it is advisable to do as few allocations as possible to lower the memory overhead.
device | The device descriptor of the RAM chip for which the memory must be allocated. |
size | The size in bytes of the memory to allocate. |
req | The request structure used for termination. |
|
inlinestatic |
This blocks the calling core until the specified cluster RAM allocation is finished.
req | The request structure used for termination. |
addr | A pointer to the variable where the allocated address must be returned. |
void pi_cl_ram_copy | ( | struct pi_device * | device, |
uint32_t | pi_ram_addr, | ||
void * | addr, | ||
uint32_t | size, | ||
int | ext2loc, | ||
pi_cl_ram_req_t * | req | ||
) |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
void pi_cl_ram_copy_2d | ( | struct pi_device * | device, |
uint32_t | pi_ram_addr, | ||
void * | addr, | ||
uint32_t | size, | ||
uint32_t | stride, | ||
uint32_t | length, | ||
int | ext2loc, | ||
pi_cl_ram_req_t * | req | ||
) |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
|
inlinestatic |
This blocks the calling core until the specified cluster remote copy is finished.
req | The request structure used for termination. |
void pi_cl_ram_free | ( | struct pi_device * | device, |
uint32_t | chunk, | ||
uint32_t | size, | ||
pi_cl_ram_free_req_t * | req | ||
) |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM allocation. The allocator does not store any information about the allocated chunks, thus the size of the allocated chunk to to be freed must be provided by the caller.
device | The device descriptor of the RAM chip for which the memory must be freed. |
chunk | The allocated chunk to free. |
size | The size in bytes of the memory chunk which was allocated. |
req | The request structure used for termination. |
|
inlinestatic |
This blocks the calling core until the specified cluster RAM free is finished.
req | The request structure used for termination. |
|
inlinestatic |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM read copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
|
inlinestatic |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM read copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy. |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
|
inlinestatic |
This blocks the calling core until the specified cluster remote copy is finished.
req | The request structure used for termination. |
|
inlinestatic |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM write copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
|
inlinestatic |
This function is a remote call that the cluster can do to the fabric-controller in order to ask for a RAM write copy. The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A pointer to a request structure must be provided so that the runtime can properly do the remote call. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
addr | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
req | A pointer to the RAM request structure. It must be allocated by the caller and kept alive until the copy is finished. |
|
inlinestatic |
This blocks the calling core until the specified cluster remote copy is finished.
req | The request structure used for termination. |
|
inlinestatic |
The allocated memory is 4-bytes aligned. The allocator uses some meta-data stored in the chip memory for every allocation so it is advisable to do as few allocations as possible to lower the memory overhead.
device | The device structure of the device where to allocate the memory. |
addr | A pointer to the variable where the allocated address must be returned. |
size | The size in bytes of the memory to allocate |
|
inlinestatic |
This function can be called to close an opened RAM device once it is not needed anymore, in order to free all allocated resources. Once this function is called, the device is not accessible anymore and must be opened again before being used.
device | The device structure of the device to close. |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The calller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The calller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
ext2loc | 1 if the copy is from RAM to the chip or 0 for the contrary. |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |
|
inlinestatic |
The allocator does not store any information about the allocated chunks, thus the size of the allocated chunk to to be freed must be provided by the caller.
device | The device structure of the device where to free the memory. |
addr | The allocated chunk to free |
size | The size in bytes of the memory chunk which was allocated |
int32_t pi_ram_open | ( | struct pi_device * | device | ) |
This function must be called before the RAM device can be used. It will do all the needed configuration to make it usable and initialize the handle used to refer to this opened device when calling other functions. The configuration associated to the device must specify the exact model of RAM which must be opened.
device | A pointer to the device structure of the device to open. This structure is allocated by the called and must be kept alive until the device is closed. |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The caller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The calller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The calller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
|
inlinestatic |
The copy will make a transfer between the RAM and one of the processor memory areas. The calller is blocked until the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the driver will switch to the next line. |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |
|
inlinestatic |
The copy will make an asynchronous transfer between the RAM and one of the processor memory areas. A task must be specified in order to specify how the caller should be notified when the transfer is finished. Depending on the chip, there may be some restrictions on the memory which can be used. Check the chip-specific documentation for more details.
device | The device descriptor of the RAM chip on which to do the copy. |
pi_ram_addr | The address of the copy in the RAM. |
data | The address of the copy in the processor. |
size | The size in bytes of the copy |
task | The task used to notify the end of transfer. See the documentation of pi_task_t for more details. |