Generic Packet Router (GPR) APIs

Public APIs

This file contains GPR APIs.

Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Defines

GPR_HEAP_INDEX_DEFAULT
GPR_HEAP_INDEX_1

Typedefs

typedef uint8_t gpr_heap_index_t
typedef uint32_t (*gpr_callback_fn_t)(gpr_packet_t *packet, void *callback_data)

Prototype of a packet callback function.

Associated data types

#gpr_packet_t

Otherwise, an error (see) — The packet ownership is returned to the caller.

Param packet:

[in] Pointer to the incoming packet. The packet is guaranteed to have a non-NULL value.

Param callback_data:

[in] Client-supplied data pointer that the service provided at registration time.

Return:

#AR_EOK — When successful, indicates that the callee has taken ownership of the packet.

typedef struct gpr_packet_pool_info_v2_t gpr_packet_pool_info_v2_t
typedef struct gpr_cmd_gpr_packet_pool_info_t gpr_cmd_gpr_packet_pool_info_t
typedef struct gpr_cmd_alloc_ext_v2_t gpr_cmd_alloc_ext_v2_t

Functions

GPR_EXTERNAL uint32_t gpr_init (void)

Performs external initialization of the GPR infrastructure.

Each supported domain calls this function once during system bring-up or during runtime to initialize the GPR infrastructure for that domain. The GPR infrastructure must be initialized before any other GPR APIs can be called.

#include “gpr_api.h”

Dependencies

None.

int32_t rc = gpr_init(); if ( rc ) { printf( “Could not initialize the GPR infrastructure” ); }

Returns:

#AR_EOK — When successful.

GPR_EXTERNAL uint32_t gpr_init_domain (uint32_t domain_id)

To initialize GPR with particular domain.

Dependencies

None.

Returns:

#AR_EOK — When successful.

GPR_EXTERNAL uint32_t gpr_deinit (void)

Performs external deinitialization of the GPR infrastructure.

Each supported domain calls this function once during system shutdown or during runtime to deinitialize the GPR infrastructure for that domain. No functions except for gpr_init() can be called after the GPR infrastructure is deinitialized.

#include “gpr_api.h”

Dependencies

None.

int32_t rc = gpr_deinit(); if ( rc ) { printf( “Could not deinitialize the GPR infrastructure” ); }

Returns:

#AR_EOK — When successful.

struct gpr_packet_pool_info_v2_t
#include <gpr_api.h>

Public Members

gpr_heap_index_t heap_index
uint8_t is_dynamic
uint16_t reserved
uint32_t num_packets
uint32_t packet_size
struct gpr_cmd_gpr_packet_pool_info_t
#include <gpr_api.h>

Contains the packet pool information for __gpr_cmd_get_gpr_packet_info().

Public Members

uint32_t bytes_per_min_size_packet

Minimum size (in bytes) of a GPR packet.

uint32_t num_min_size_packets

Number of packets of the minimum size allocated at initialization.

uint32_t bytes_per_max_size_packet

Maximum size (in bytes) of a GPR packet.

uint32_t num_max_size_packets

Number of packets of the maximum size allocated at initialization.

struct gpr_cmd_alloc_ext_t
#include <gpr_api.h>

Contains the allocated packet information for __gpr_cmd_alloc_ext().

Public Members

uint8_t src_domain_id

Domain ID of the sender service.

uint32_t src_port

Registered unique ID of the sender service.

uint8_t dst_domain_id

Domain ID of the receiver service.

uint32_t dst_port

Registered unique ID of the receiver service.

uint8_t client_data

Reserved for use by client.

uint32_t token

Value attached by the sender to determine when command messages are processed by the receiver after they receive response messages.

uint32_t opcode

Defines both the action and the payload structure to the receiver.

uint32_t payload_size

Actual number of bytes required for the payload.

gpr_packet_t **ret_packet

Double pointer to the formatted packet returned by the function.

struct gpr_cmd_alloc_ext_v2_t
#include <gpr_api.h>

Contains the allocated packet information for __gpr_cmd_alloc_ext_v2().

Public Members

uint8_t src_domain_id

Domain ID of the sender service.

uint32_t src_port

Registered unique ID of the sender service.

uint8_t dst_domain_id

Domain ID of the receiver service.

uint32_t dst_port

Registered unique ID of the receiver service.

uint8_t client_data

Reserved for use by client.

uint32_t token

Value attached by the sender to determine when command messages are processed by the receiver after they receive response messages.

gpr_heap_index_t heap_index

heap index of the packet pool. ‘0’ is default value. Must be set to 0 if not applicable.

uint32_t opcode

Defines both the action and the payload structure to the receiver.

uint32_t payload_size

Actual number of bytes required for the payload.

gpr_packet_t **ret_packet

Double pointer to the formatted packet returned by the function.

struct gpr_cmd_alloc_send_t
#include <gpr_api.h>

Contains the allocated packet information for __gpr_cmd_alloc_send().

Public Members

uint8_t src_domain_id

Domain ID of the sender service.

uint32_t src_port

Registered unique ID of the sender service.

uint8_t dst_domain_id

Domain ID of the receiver service.

uint32_t dst_port

Registered unique ID of the receiver service.

uint8_t client_data

Reserved for use by the client.

uint32_t token

Value attached by the sender to determine when command messages have been processed by the receiver after having received response messages.

uint32_t opcode

Operation code defines both the action and the payload structure to the receiver.

uint32_t payload_size

Actual number of bytes needed for the payload.

void *payload

Pointer to the payload to send.