From 3a8d9c27965aa69b38dfaf96dcd84eb1a3d905e8 Mon Sep 17 00:00:00 2001 From: Justin Sobota Date: Wed, 13 Feb 2013 15:15:05 -0500 Subject: [PATCH] Minor updates --- rm.h | 4 ++-- rm_services.h | 6 +++--- rm_transport.h | 6 +++--- src/rm.c | 16 +++++----------- src/rm_services.c | 2 +- src/rm_transport.c | 6 +++--- test/rm_test.c | 10 ++-------- 7 files changed, 19 insertions(+), 31 deletions(-) diff --git a/rm.h b/rm.h index 03cdd3f..4203e0c 100644 --- a/rm.h +++ b/rm.h @@ -390,7 +390,7 @@ typedef struct { * must match an instance name defined in the "valid-instances" lists contained * in the global and static policy DTS files. Resources and privileges to the * resources will be based on the name assigned to the RM instance*/ - char *instName; + const char *instName; /** The type of RM instance that will be created. */ Rm_InstType instType; /** Instance-type specific configurations */ @@ -461,7 +461,7 @@ void Rm_printInstanceStatus(Rm_Handle rmHandle); * @retval * Failure - NULL Rm_Handle and result < #RM_OK */ -Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result); +Rm_Handle Rm_init(const Rm_InitCfg *initCfg, int32_t *result); /** * @b Description diff --git a/rm_services.h b/rm_services.h index 1437be3..142ea9a 100644 --- a/rm_services.h +++ b/rm_services.h @@ -119,7 +119,7 @@ typedef struct { * defined in the GRL and global/static policy. The request will be * denied if the resource name does not match any resource node names * in the policy */ - char *resourceName; + const char *resourceName; /** Informs RM to find the next available resource block of length * resourceLength and alignment resourceAlignment for allocation. This * parameter is only valid for resource allocate service types. */ @@ -147,7 +147,7 @@ typedef struct { * If the service type is #Rm_service_RESOURCE_GET_BY_NAME and the * #resourceBase and #resourceLength fields are not NULL a error will * occur. */ - char *resourceNsName; + const char *resourceNsName; /** Callback function used by RM to provide responses back to application * components after a service request resulted in a blocking operation. */ Rm_ServiceCallback callback; @@ -181,7 +181,7 @@ typedef struct { * @param[out] serviceResponse * Pointer to a service response structure. */ - void (*Rm_serviceHandler)(void *rmHandle, Rm_ServiceReqInfo *serviceRequest, + void (*Rm_serviceHandler)(void *rmHandle, const Rm_ServiceReqInfo *serviceRequest, Rm_ServiceRespInfo *serviceResponse); } Rm_ServiceHandle; diff --git a/rm_transport.h b/rm_transport.h index e97e8f6..a98b999 100644 --- a/rm_transport.h +++ b/rm_transport.h @@ -209,7 +209,7 @@ typedef struct { Rm_InstType remoteInstType; /** Pointer to the remote RM instance name at other end of the * application transport "pipe". */ - char *remoteInstName; + const char *remoteInstName; /** Specifies whether the transport callouts are valid. * TRUE - Transport callouts are valid and can be stored by the RM * instance. @@ -255,7 +255,7 @@ typedef struct { * @retval * Failure - NULL RM_TransportHandle and result = #RM_ERROR_NULL_CALLOUTS_WHEN_VALID */ -Rm_TransportHandle Rm_transportRegister(Rm_TransportCfg *transportCfg, int32_t *result); +Rm_TransportHandle Rm_transportRegister(const Rm_TransportCfg *transportCfg, int32_t *result); /** * @b Description @@ -297,7 +297,7 @@ int32_t Rm_transportUnregister (Rm_TransportHandle transportHandle); * @retval * Failure - < #RM_OK */ -int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, Rm_Packet *pkt); +int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pkt); /** @} diff --git a/src/rm.c b/src/rm.c index c4ffbd8..d66ae06 100644 --- a/src/rm.c +++ b/src/rm.c @@ -99,17 +99,11 @@ static uint32_t transactionInitSequenceNum(void) */ static uint32_t transactionGetSequenceNum(Rm_Inst *rmInst) { - uint32_t sequenceNum = 0; - - if (rmInst->transactionSeqNum + 1 < rmInst->transactionSeqNum) { - /* Rollover */ - sequenceNum = rmInst->transactionSeqNum; - rmInst->transactionSeqNum = transactionInitSequenceNum(); - } - else { - sequenceNum = rmInst->transactionSeqNum++; + rmInst->transactionSeqNum++; + if (!rmInst->transactionSeqNum) { + rmInst->transactionSeqNum++; } - return (sequenceNum); + return (rmInst->transactionSeqNum); } /* FUNCTION PURPOSE: Creates a resource allocator @@ -1987,7 +1981,7 @@ void Rm_printInstanceStatus(Rm_Handle rmHandle) * using the parameters provided via the initCfg * structure. */ -Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result) +Rm_Handle Rm_init(const Rm_InitCfg *initCfg, int32_t *result) { Rm_Inst *rmInst; void *globalResourceDtb = NULL; diff --git a/src/rm_services.c b/src/rm_services.c index e06bd20..31b8f3c 100644 --- a/src/rm_services.c +++ b/src/rm_services.c @@ -66,7 +66,7 @@ * The response will be sent at a later time via the * application supplied callback function. */ -void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest, +void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest, Rm_ServiceRespInfo *serviceResponse) { Rm_Inst *rmInst = (Rm_Inst *)rmHandle; diff --git a/src/rm_transport.c b/src/rm_transport.c index af6746c..48f33be 100644 --- a/src/rm_transport.c +++ b/src/rm_transport.c @@ -64,7 +64,7 @@ * was created, initialized, and added to the * instance transport list. */ -static Rm_Transport *transportAdd(Rm_TransportCfg *transportCfg) +static Rm_Transport *transportAdd(const Rm_TransportCfg *transportCfg) { Rm_Inst *rmInst = (Rm_Inst *) transportCfg->rmHandle; Rm_Transport *transports = rmInst->transports; @@ -364,7 +364,7 @@ Rm_PacketHandle rmTransportCreateNsResponsePkt(Rm_Inst *rmInst, Rm_AppTransportH * is returned for the transport handle if any errors * are encountered. */ -Rm_TransportHandle Rm_transportRegister (Rm_TransportCfg *transportCfg, int32_t *result) +Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, int32_t *result) { Rm_Inst *rmInst = (Rm_Inst *) transportCfg->rmHandle; Rm_Transport *transport = NULL; @@ -445,7 +445,7 @@ int32_t Rm_transportUnregister(Rm_TransportHandle transportHandle) * DESCRIPTION: The application provides RM packets received on the * application transports to RM via this API. Function * can be called from polling or ISR contexts. */ -int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, Rm_Packet *pkt) +int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pkt) { Rm_Transport *transport = (Rm_Transport *)transportHandle; Rm_Inst *rmInst = (Rm_Inst *)transport->rmHandle; diff --git a/test/rm_test.c b/test/rm_test.c index b852246..0837905 100644 --- a/test/rm_test.c +++ b/test/rm_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Texas Instruments Incorporated + * Copyright (c) 2012-2013, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,17 +29,11 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + /* * ======== rm_test.c ======== * RM multicore test example * - * This is an example program that uses MessageQ to pass a message - * from one processor to another. - * - * Each processor creates its own MessageQ first and then will try to open - * a remote processor's MessageQ. - * - * See message_multicore.k file for expected output. */ #include -- 2.39.2