本文整理汇总了C++中GT_setFailureReason函数的典型用法代码示例。如果您正苦于以下问题:C++ GT_setFailureReason函数的具体用法?C++ GT_setFailureReason怎么用?C++ GT_setFailureReason使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GT_setFailureReason函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _SysLinkMemUtils_init
/*!
* @brief Setup SysLinkMemUtils module.
*
* @sa _SysLinkMemUtils_exit
*/
static Void
_SysLinkMemUtils_init (Void)
{
List_Params listParams;
GT_0trace (curTrace, GT_ENTER, "_SysLinkMemUtils_init");
List_Params_init (&listParams);
SysLinkMemUtils_module->addrTable = List_create (&listParams);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (!SysLinkMemUtils_module->addrTable) {
GT_setFailureReason (curTrace,
GT_4CLASS,
(Char *)__func__,
PROCMGR_E_MEMORY,
"Translation list could not be created!");
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
SysLinkMemUtils_module->semList = OsalSemaphore_create (
OsalSemaphore_Type_Counting, 1);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (!SysLinkMemUtils_module->semList) {
GT_setFailureReason (curTrace,
GT_4CLASS,
(Char *)__func__,
PROCMGR_E_MEMORY,
"List semaphore could not be created!");
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_0trace (curTrace, GT_LEAVE, "_SysLinkMemUtils_init");
}
开发者ID:ZIViTi,项目名称:android_hardware_ti_omap4,代码行数:38,代码来源:SysLinkMemUtils.c
示例2: DM8168DUCATIPWR_Params_init
/*!
* @brief Function to initialize the parameters for this PwrMgr instance.
*
* @param params Configuration parameters.
*
* @sa DM8168DUCATIPWR_create
*/
Void
DM8168DUCATIPWR_Params_init (DM8168DUCATIPWR_Params * params)
{
GT_1trace (curTrace, GT_ENTER, "DM8168DUCATIPWR_Params_init", params);
GT_assert (curTrace, (params != NULL));
GT_assert (curTrace, (DM8168DUCATIPWR_state.refCount != 0));
#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
if (DM8168DUCATIPWR_state.refCount == 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"DM8168DUCATIPWR_Params_initv",
DM8168DUCATIPWR_E_INVALIDSTATE,
"Module was not initialized!");
}
else if (params == NULL) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"DM8168DUCATIPWR_Params_init",
PWRMGR_E_INVALIDARG,
"Argument of type (DM8168DUCATIPWR_Params *) "
"passed is null!");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
params->reserved = 0;
#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
GT_0trace (curTrace, GT_LEAVE, "DM8168DUCATIPWR_Params_init");
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:40,代码来源:Dm8168DucatiPwr.c
示例3: Memory_valloc
/* Function to allocate the specified number of bytes and memory is set to
* the specified value.
*/
Ptr
Memory_valloc (IHeap_Handle heap, SizeT size, SizeT align, Char value, Ptr eb)
{
Ptr buffer = NULL;
GT_4trace (curTrace, GT_ENTER, "Memory_valloc", heap, size, align, eb);
/* Check whether the right paramaters are passed or not.*/
GT_assert (curTrace, (size > 0));
(Void) eb; /* Not used. */
if (heap == NULL) {
buffer = MemoryOS_alloc (size, align, 0);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (buffer == NULL) {
/*! @retval NULL Failed to allocate memory */
GT_setFailureReason (curTrace,
GT_4CLASS,
"Memory_valloc",
Memory_E_MEMORY,
"Failed to allocate memory!");
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
}
else {
buffer = IHeap_alloc (heap, size, align);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (buffer == NULL) {
/*! @retval NULL Heap_alloc failed */
GT_setFailureReason (curTrace,
GT_4CLASS,
"Memory_valloc",
Memory_E_MEMORY,
"IHeap_alloc failed!");
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
}
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (buffer != NULL) {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
buffer = Memory_set (buffer, value, size);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (buffer == NULL) {
/*! @retval NULL Memory_set to 0 failed */
GT_setFailureReason (curTrace,
GT_4CLASS,
"Memory_valloc",
Memory_E_MEMORY,
"Memory_set to 0 failed!");
}
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_0trace (curTrace, GT_LEAVE, "Memory_valloc");
/*! @retval Pointer Success: Pointer to allocated buffer */
return buffer;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:62,代码来源:Memory.c
示例4: NameServerDrv_open
/*!
* @brief Function to open the NameServer driver.
*
* @sa NameServerDrv_close
*/
Int NameServerDrv_open(Void)
{
Int status = NameServer_S_SUCCESS;
GT_0trace(curTrace, GT_ENTER, "NameServerDrv_open");
/* TBD: Protection for refCount. */
if (NameServerDrv_refCount == 0) {
/* open the drive */
NameServerDrv_handle = Dev_pollOpen(NAMESERVER_DRVIER_NAME,
O_SYNC | O_RDWR);
if (NameServerDrv_handle < 0) {
status = NameServer_E_OSFAILURE;
GT_setFailureReason(curTrace, GT_4CLASS, "NameServerDrv_open",
status, "Failed to open NameServer driver with OS");
}
/* set flag to close file descriptor on exec */
if (status == NameServer_S_SUCCESS) {
status = fcntl(NameServerDrv_handle, F_SETFD, FD_CLOEXEC);
if (status != 0) {
status = NameServer_E_OSFAILURE;
GT_setFailureReason(curTrace, GT_4CLASS, "NameServerDrv_open",
status, "Failed to set file descriptor flags");
}
}
/* set pid on file descriptor for resource tracking */
if (status == NameServer_S_SUCCESS) {
status = fcntl(NameServerDrv_handle, F_SETOWN, getpid());
if (status != 0) {
status = NameServer_E_OSFAILURE;
GT_setFailureReason(curTrace, GT_4CLASS, "NameServerDrv_open",
status, "Failed to set process id");
}
}
}
if (status == NameServer_S_SUCCESS) {
NameServerDrv_refCount++;
}
/* failure case */
if (status < 0) {
if (NameServerDrv_handle > 0) {
close(NameServerDrv_handle);
NameServerDrv_handle = 0;
}
}
GT_1trace(curTrace, GT_LEAVE, "NameServerDrv_open", status);
return(status);
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:63,代码来源:NameServerDrv.c
示例5: HeapMultiBufDrv_open
/*!
* @brief Function to open the HeapMultiBuf driver.
*
* @sa HeapMultiBufDrv_close
*/
Int
HeapMultiBufDrv_open (Void)
{
//Int status = HEAPMULTIBUF_SUCCESS;
Int status = 0;
int osStatus = 0;
GT_0trace (curTrace, GT_ENTER, "HeapMultiBufDrv_open");
#if 0
if (HeapMultiBufDrv_refCount == 0) {
HeapMultiBufDrv_handle = open (HEAPMULTIBUF_DRIVER_NAME,
O_SYNC | O_RDWR);
if (HeapMultiBufDrv_handle < 0) {
perror (HEAPMULTIBUF_DRIVER_NAME);
/*! @retval HEAPMULTIBUF_E_OSFAILURE Failed to open
* HeapMultiBuf driver with OS
*/
status = HEAPMULTIBUF_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"HeapMultiBufDrv_open",
status,
"Failed to open HeapMultiBuf driver with OS!");
}
else {
osStatus = fcntl (HeapMultiBufDrv_handle, F_SETFD, FD_CLOEXEC);
if (osStatus != 0) {
/*! @retval HEAPMULTIBUF_E_OSFAILURE
* Failed to set file descriptor flags
*/
status = HEAPMULTIBUF_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"HeapMultiBufDrv_open",
status,
"Failed to set file descriptor flags!");
}
else {
/* TBD: Protection for refCount. */
HeapMultiBufDrv_refCount++;
}
}
}
else {
HeapMultiBufDrv_refCount++;
}
#endif
GT_1trace (curTrace, GT_LEAVE, "HeapMultiBufDrv_open", status);
/*! @retval HEAPMULTIBUF_SUCCESS Operation successfully completed. */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:60,代码来源:HeapMultiBufDrv.c
示例6: ListMPDrv_open
/*!
* @brief Function to open the ListMP driver.
*
* @sa ListMPDrv_close
*/
Int
ListMPDrv_open (Void)
{
Int status = ListMP_S_SUCCESS;
int osStatus = 0;
GT_0trace (curTrace, GT_ENTER, "ListMPDrv_open");
if (ListMPDrv_refCount == 0) {
ListMPDrv_handle = open (LISTMP_DRIVER_NAME,
O_SYNC | O_RDWR);
if (ListMPDrv_handle < 0) {
perror (LISTMP_DRIVER_NAME);
/*! @retval ListMP_E_OSFAILURE
* Failed to open ListMP driver with OS
*/
status = ListMP_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"ListMPDrv_open",
status,
"Failed to open ListMP driver"
" with OS!");
}
else {
osStatus = fcntl (ListMPDrv_handle,
F_SETFD,
FD_CLOEXEC);
if (osStatus != 0) {
/*! @retval ListMP_E_OSFAILURE
* Failed to set file descriptor flags
*/
status = ListMP_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"ListMPDrv_open",
status,
"Failed to set file descriptor flags!");
}
else{
/* TBD: Protection for refCount. */
ListMPDrv_refCount++;
}
}
}
else {
ListMPDrv_refCount++;
}
GT_1trace (curTrace, GT_LEAVE, "ListMPDrv_open", status);
/*! @retval ListMP_S_SUCCESS Operation successfully completed. */
return status;
}
开发者ID:zaporozhets,项目名称:ti_ezsdk_tools,代码行数:59,代码来源:ListMPDrv.c
示例7: NotifyDrvUsr_open
/*!
* @brief Function to open the Notify driver.
*
* @param createThread Flag to indicate whether to create thread or not.
*
* @sa NotifyDrvUsr_close
*/
Int
NotifyDrvUsr_open (Bool createThread)
{
Int status = Notify_S_SUCCESS;
GT_1trace (curTrace, GT_ENTER, "NotifyDrvUsr_open", createThread);
if (NotifyDrvUsr_refCount == 0) {
/* TBD: Protection for refCount. */
NotifyDrvUsr_refCount++;
if (createThread == TRUE) {
Notify_CmdArgsThreadAttach attachParams;
attachParams.pid = getpid ();
status = NotifyDrvUsr_ioctl (CMD_NOTIFY_THREADATTACH, &attachParams);
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"NotifyDrvUsr_close",
status,
"Notify attach failed on kernel "
"side!");
}
else {
/* Create the pthread */
pthread_create (&NotifyDrv_workerThread,
NULL,
(Ptr) _NotifyDrvUsr_eventWorker,
NULL);
if (NotifyDrv_workerThread == (UInt32) NULL) {
/*! @retval Notify_E_OSFAILURE Failed to create
Notify thread */
status = Notify_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"NotifyDrvUsr_open",
status,
"Failed to create Notify "
"thread!");
}
}
}
}
else {
/* TBD: Protection for refCount. */
NotifyDrvUsr_refCount++;
}
GT_1trace (curTrace, GT_LEAVE, "NotifyDrvUsr_open", status);
/*! @retval Notify_S_SUCCESS Operation successfully completed. */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:60,代码来源:NotifyDrvUsr.c
示例8: NotifyDrvUsr_close
/*!
* @brief Function to close the Notify driver.
*
* @param deleteThread Flag to indicate whether to delete thread or not.
*
* @sa NotifyDrvUsr_open
*/
Int
NotifyDrvUsr_close (Bool deleteThread)
{
Int status = Notify_S_SUCCESS;
int osStatus = 0;
UInt32 pid;
Notify_CmdArgsThreadDetach cmdArgs;
GT_1trace (curTrace, GT_ENTER, "NotifyDrvUsr_close", deleteThread);
/* TBD: Protection for refCount. */
if (NotifyDrvUsr_refCount == 1) {
if (deleteThread == TRUE) {
pid = getpid ();
cmdArgs.pid = pid;
status = NotifyDrvUsr_ioctl (CMD_NOTIFY_THREADDETACH, &cmdArgs);
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"NotifyDrvUsr_close",
status,
"Notify detach failed on kernel side!");
}
#ifndef LINUX_THREAD
pthread_join (NotifyDrv_workerThread, NULL);
#endif
}
NotifyDrvUsr_refCount--;
osStatus = close (NotifyDrvUsr_handle);
if (osStatus != 0) {
perror ("Notify driver close: " NOTIFY_DRIVER_NAME);
/*! @retval Notify_E_OSFAILURE Failed to open Notify driver with
OS */
status = Notify_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"NotifyDrvUsr_close",
status,
"Failed to close Notify driver with OS!");
}
else {
NotifyDrvUsr_handle = -1;
}
}
else {
NotifyDrvUsr_refCount--;
}
GT_1trace (curTrace, GT_LEAVE, "NotifyDrvUsr_close", status);
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:60,代码来源:NotifyDrvUsr.c
示例9: DM8168DUCATIPWR_close
/*!
* @brief Function to close a handle to an instance of this PwrMgr.
*
* @param handlePtr Pointer to Handle to the PwrMgr instance
*
* @sa DM8168DUCATIPWR_open
*/
Int
DM8168DUCATIPWR_close (DM8168DUCATIPWR_Handle * handlePtr)
{
Int status = PWRMGR_SUCCESS;
GT_1trace (curTrace, GT_ENTER, "DM8168DUCATIPWR_close", handlePtr);
GT_assert (curTrace, (handlePtr != NULL));
GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL)));
GT_assert (curTrace, (DM8168DUCATIPWR_state.refCount != 0));
#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
if (DM8168DUCATIPWR_state.refCount == 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"DM8168DUCATIPWR_close",
DM8168DUCATIPWR_E_INVALIDSTATE,
"Module was not initialized!");
}
else if (handlePtr == NULL) {
/*! @retval PWRMGR_E_INVALIDARG Invalid NULL handlePtr pointer
specified*/
status = PWRMGR_E_INVALIDARG;
GT_setFailureReason (curTrace,
GT_4CLASS,
"DM8168DUCATIPWR_close",
status,
"Invalid NULL handlePtr pointer specified");
}
else if (*handlePtr == NULL) {
/*! @retval PWRMGR_E_HANDLE Invalid NULL *handlePtr specified */
status = PWRMGR_E_HANDLE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"DM8168DUCATIPWR_close",
status,
"Invalid NULL *handlePtr specified");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined(SYSLINK_BUILD_HLOS) */
/* Nothing to be done for close. */
*handlePtr = NULL;
#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined(SYSLINK_BUILD_HLOS) */
GT_1trace (curTrace, GT_LEAVE, "DM8168DUCATIPWR_close", status);
/*! @retval PWRMGR_SUCCESS Operation successful */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:58,代码来源:Dm8168DucatiPwr.c
示例10: OsalKfile_close
/*
* ======== OsalKfile_close ========
*/
Int
OsalKfile_close (OsalKfile_Handle * fileHandle)
{
Int status = OSALKFILE_SUCCESS;
OsalKfile_Object * fileObject = NULL;
mm_segment_t fs;
GT_1trace (curTrace, GT_ENTER, "OsalKfile_close", fileHandle);
GT_assert (curTrace, (fileHandle != NULL));
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (fileHandle == NULL) {
/*! @retval OSALKFILE_E_INVALIDARG NULL provided for argument
fileHandle. */
status = OSALKFILE_E_INVALIDARG;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalKfile_close",
status,
"NULL provided for argument fileHandle");
}
else if (*fileHandle == NULL) {
/*! @retval OSALKFILE_E_HANDLE NULL file handle provided. */
status = OSALKFILE_E_HANDLE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalKfile_close",
status,
"NULL file handle provided.");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
fileObject = (OsalKfile_Object *) *fileHandle;
fs = get_fs();
set_fs (KERNEL_DS);
filp_close (fileObject->fileDesc, NULL);
set_fs (fs);
Memory_free (NULL, fileObject, sizeof(OsalKfile_Object));
/* Reset user's file handle pointer. */
*fileHandle = NULL;
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_1trace (curTrace, GT_LEAVE, "OsalKfile_close", status);
/*! @retval OSALKFILE_SUCCESS Operation successfully completed. */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:54,代码来源:OsalKfile.c
示例11: ClientNotifyMgrDrv_open
/*!
* @brief Function to open the ClientNotifyMgr driver.
*
* @sa GatePetersonDrv_close
*/
Int
ClientNotifyMgrDrv_open (Void)
{
Int status = ClientNotifyMgr_S_SUCCESS;
int osStatus = 0;
GT_0trace (curTrace, GT_ENTER, "ClientNotifyMgrDrv_open");
if (ClientNotifyMgrDrv_refCount == 0) {
/* TBD: Protection for refCount. */
ClientNotifyMgrDrv_refCount++;
ClientNotifyMgrDrv_handle = Dev_pollOpen (CLIENTNOTIFYMGR_DRVIER_NAME,
O_SYNC | O_RDWR);
if (ClientNotifyMgrDrv_handle < 0) {
perror (CLIENTNOTIFYMGR_DRVIER_NAME);
/*! @retval ClientNotifyMgr_E_OSFAILURE Failed to open ClientNotifyMgr driver with OS
*/
status = ClientNotifyMgr_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"ClientNotifyMgrDrv_open",
status,
"Failed to open ClientNotifyMgr driver with OS!");
}
else {
osStatus = fcntl (ClientNotifyMgrDrv_handle, F_SETFD, FD_CLOEXEC);
if (osStatus != 0) {
/*! @retval ClientNotifyMgr_E_OSFAILURE Failed to set file
* descriptor flags
*/
status = ClientNotifyMgr_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"ClientNotifyMgrDrv_open",
status,
"Failed to set file descriptor flags!");
}
}
}
else {
ClientNotifyMgrDrv_refCount++;
}
GT_1trace (curTrace, GT_LEAVE, "ClientNotifyMgrDrv_open", status);
/*! @retval ClientNotifyMgr_SUCCESS Operation successfully completed. */
return (status);
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:56,代码来源:ClientNotifyMgrDrv.c
示例12: OsalSemaphore_delete
/*!
* @brief Deletes an instance of Semaphore object.
*
* @param mutexHandle Semaphore object handle which needs to be deleted.
*
* @sa OsalSemaphore_create
*/
Int
OsalSemaphore_delete(OsalSemaphore_Handle *semHandle)
{
Int status = OSALSEMAPHORE_SUCCESS;
OsalSemaphore_Object **semObj = (OsalSemaphore_Object **)semHandle;
int osStatus = 0;
GT_1trace (curTrace, GT_ENTER, "OsalSemaphore_delete", semHandle);
GT_assert (curTrace, (semHandle != NULL));
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (semHandle == NULL) {
status = OSALSEMAPHORE_E_INVALIDARG;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalSemaphore_delete",
status,
"NULL provided for argument semHandle");
}
else if (*semHandle == NULL) {
status = OSALSEMAPHORE_E_HANDLE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalSemaphore_delete",
status,
"NULL Semaphore handle provided.");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
osStatus = sem_destroy(&((*semObj)->lock));
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (osStatus < 0) {
status = OSALSEMAPHORE_E_HANDLE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalSemaphore_delete",
status,
"Failed to destroy semaphore");
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
Memory_free(NULL, *semHandle, sizeof (OsalSemaphore_Object));
*semHandle = NULL;
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_1trace (curTrace, GT_LEAVE, "OsalSemaphore_delete", status);
return status;
}
开发者ID:ZIViTi,项目名称:android_hardware_ti_omap4,代码行数:58,代码来源:OsalSemaphore.c
示例13: IpcDrv_open
/*!
* @brief Function to open the Ipc driver.
*
* @sa IpcDrv_close
*/
Int
IpcDrv_open (Void)
{
Int status = Ipc_S_SUCCESS;
int osStatus = 0;
GT_0trace (curTrace, GT_ENTER, "IpcDrv_open");
if (IpcDrv_refCount == 0) {
IpcDrv_handle = open (IPC_DRIVER_NAME,
O_SYNC | O_RDWR);
if (IpcDrv_handle < 0) {
perror (IPC_DRIVER_NAME);
/*! @retval Ipc_E_OSFAILURE Failed to open Ipc driver with OS
*/
status = Ipc_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"IpcDrv_open",
status,
"Failed to open Ipc driver with OS!");
}
else {
osStatus = fcntl (IpcDrv_handle, F_SETFD, FD_CLOEXEC);
if (osStatus != 0) {
/*! @retval Ipc_E_OSFAILURE Failed to set file descriptor flags
*/
status = Ipc_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"IpcDrv_open",
status,
"Failed to set file descriptor flags!");
}
else {
/* TBD: Protection for refCount. */
IpcDrv_refCount++;
}
}
}
else {
IpcDrv_refCount++;
}
GT_1trace (curTrace, GT_LEAVE, "IpcDrv_open", status);
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:54,代码来源:IpcDrv.c
示例14: OMAPL1XX_halInit
/*!
* @brief Function to initialize the HAL object
*
* @param halObj Return parameter: Pointer to the HAL object
* @param initParams Optional initialization parameters
*
* @sa OMAPL1XX_halExit
* OMAPL1XX_phyShmemInit
*/
Int
OMAPL1XX_halInit (Ptr * halObj, Ptr params)
{
Int status = PROCESSOR_SUCCESS;
OMAPL1XX_HalObject * halObject = NULL;
GT_2trace (curTrace, GT_ENTER, "OMAPL1XX_halInit", halObj, params);
GT_assert (curTrace, (halObj != NULL));
(Void) params ; /* Not used. */
*halObj = Memory_calloc (NULL, sizeof (OMAPL1XX_HalObject), 0, NULL);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (*halObj == NULL) {
/*! @retval PROCESSOR_E_MEMORY Memory allocation failed */
status = PROCESSOR_E_MEMORY;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OMAPL1XX_halInit",
status,
"Memory allocation failed for HAL object!");
}
else {
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
halObject = (OMAPL1XX_HalObject *) *halObj;
halObject->offsetPsc0 = OFFSET_PSC0;
halObject->offsetSysModule = OFFSET_SYSTEM_MODULE;
status = OMAPL1XX_phyShmemInit (*halObj);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"OMAPL1XX_halInit",
status,
"OMAPL1XX_phyShmemInit failed!");
Memory_free (NULL, *halObj, sizeof (OMAPL1XX_HalObject));
*halObj = NULL;
}
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_1trace (curTrace, GT_LEAVE, "OMAPL1XX_halInit", status);
/*! @retval PROCESSOR_SUCCESS Operation successful */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:57,代码来源:omapl1xx_hal.c
示例15: OsalMutex_leave
/*!
* @brief Leave/unlock the Mutex object.
*
* This function releases the critical section identified by this
* mutex handle. The completion of this function shall make the
* critical section available to any other threads that may be
* waiting to acquire it.
*
* @param mutexHandle Mutex object handle to be released.
* @param key Key received from the corresponding enter call.
*
* @sa OsalMutex_enter
*/
Void
OsalMutex_leave(OsalMutex_Handle mutexHandle, IArg key)
{
OsalMutex_Object * mutexObj = (OsalMutex_Object*) mutexHandle;
Int ret = 0;
GT_2trace (curTrace, GT_ENTER, "OsalMutex_leave", mutexHandle, key);
GT_assert (curTrace, (mutexHandle != NULL));
/* key can be 0, so not checked. */
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (mutexHandle == NULL) {
/* Void function, so not setting status. */
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalMutex_leave",
OSALMUTEX_E_HANDLE,
"NULL Mutex handle provided.");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
ret = pthread_mutex_unlock (&(mutexObj->lock));
GT_assert (curTrace, (ret == 0));
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_0trace (curTrace, GT_LEAVE, "OsalMutex_leave");
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:43,代码来源:OsalMutex.c
示例16: OsalEvent_create
/*!
* @brief Creates and initializes an event object for thread
* synchronization. The event is initialized to a
* non-signaled state..
*
* @param Un-allocated event object.
* @sa EventClose
*/
OsalEvent_Handle
OsalEvent_create (Void)
{
#if (!defined(SYSLINK_BUILD_OPTIMIZE)|| defined(SYSLINK_TRACE_ENABLE))
Int status = OSALEVENT_SUCCESS ;
#endif /*(!defined(SYSLINK_BUILD_OPTIMIZE)|| defined(SYSLINK_TRACE_ENABLE)) */
OsalEvent_Object* event = NULL;
GT_0trace (curTrace, GT_ENTER, "OsalEvent_create");
event = Memory_alloc (NULL, sizeof (OsalEvent_Object), 0, NULL);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
if (event == NULL) {
status = OSALEVENT_E_MEMORY;
GT_setFailureReason (curTrace,
GT_4CLASS,
"OsalEvent_create",
OSALEVENT_E_MEMORY,
"Memory allocation failed");
}
else {
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
event->value = 0;
event->lock = OsalSpinlock_create (OsalSpinlock_Type_Normal);
init_waitqueue_head (&event->list) ;
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_1trace (curTrace, GT_LEAVE, "OsalEvent_create", status);
/*[email protected] The object created */
return (OsalEvent_Handle) event;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:43,代码来源:OsalEvent.c
示例17: OsalEvent_delete
/*!
* @brief Closes the handle corresponding to an event. It also frees the
* resources allocated, if any, during call to OpenEvent ()
*
* @param allocated event object handle.
* @sa OsalEvent_delete
*/
Int OsalEvent_delete (OsalEvent_Handle handle)
{
Int status = OSALEVENT_SUCCESS ;
OsalEvent_Object* event = (OsalEvent_Object*) handle;
GT_1trace (curTrace, GT_ENTER,"OsalEvent_close",event );
GT_assert (curTrace, (NULL != event) );
status = OsalSpinlock_delete (&(event->lock));
if (status >= 0)
{
event->signature = 0;
}
#if !defined(SYSLINK_BUILD_OPTIMIZE)
else {
status = OSALEVENT_E_SPINLOCK;
GT_setFailureReason(curTrace, GT_4CLASS,
"OsalEvent_close",OSALEVENT_E_SPINLOCK,
"SpinLock Delete failed");
}
#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
GT_1trace (curTrace, GT_LEAVE,"Event_Close",status );
/*[email protected] OSALEVENT_SUCCESS if call succeeded.*/
/*[email protected] OSALEVENT_E_SPINLOCK when SpinLock operation fails.*/
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:35,代码来源:OsalEvent.c
示例18: NotifyDrvUsr_close
/*!
* @brief Function to close the Notify driver.
*
* @param deleteThread Flag to indicate whether to delete thread or not.
*
* @sa NotifyDrvUsr_open
*/
Int
NotifyDrvUsr_close (Bool deleteThread)
{
Int status = Notify_S_SUCCESS;
GT_1trace (curTrace, GT_ENTER, "NotifyDrvUsr_close", deleteThread);
/* TBD: Protection for refCount. */
if (NotifyDrvUsr_refCount == 1) {
if (deleteThread == TRUE) {
Notify_CmdArgsThreadDetach detachParams;
detachParams.pid = getpid ();
status = NotifyDrvUsr_ioctl (CMD_NOTIFY_THREADDETACH, &detachParams);
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"NotifyDrvUsr_close",
status,
"Notify detach failed on kernel side!");
}
pthread_join (NotifyDrv_workerThread, NULL);
}
NotifyDrvUsr_refCount--;
}
else {
NotifyDrvUsr_refCount--;
}
GT_1trace (curTrace, GT_LEAVE, "NotifyDrvUsr_close", status);
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:40,代码来源:NotifyDrvUsr.c
示例19: ClientNotifyMgrDrv_close
/*!
* @brief Function to close the ClientNotifyMgr driver.
*
* @sa ClientNotifyMgrDrv_open
*/
Int
ClientNotifyMgrDrv_close (Void)
{
Int status = ClientNotifyMgr_S_SUCCESS;
int osStatus = 0;
GT_0trace (curTrace, GT_ENTER, "ClientNotifyMgrDrv_close");
/* TBD: Protection for refCount. */
ClientNotifyMgrDrv_refCount--;
if (ClientNotifyMgrDrv_refCount == 0) {
osStatus = close (ClientNotifyMgrDrv_handle);
if (osStatus != 0) {
perror ("ClientNotifyMgr driver close: ");
/*! @retval ClientNotifyMgr_E_OSFAILURE Failed to open ClientNotifyMgr
* driver with OS
*/
status = ClientNotifyMgr_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"ClientNotifyMgrDrv_close",
status,
"Failed to close ClientNotifyMgr driver with OS!");
}
else {
ClientNotifyMgrDrv_handle = 0;
}
}
GT_1trace (curTrace, GT_LEAVE, "ClientNotifyMgrDrv_close", status);
/*! @retval ClientNotifyMgr_S_SUCCESS Operation successfully completed. */
return (status);
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:39,代码来源:ClientNotifyMgrDrv.c
示例20: SyslinkMemMgrDrv_ioctl
/*!
* @brief Function to invoke the APIs through ioctl.
*
* @param cmd Command for driver ioctl
* @param args Arguments for the ioctl command
*
* @sa
*/
Int
SyslinkMemMgrDrv_ioctl (UInt32 cmd, Ptr args)
{
Int status = MEMMGR_SUCCESS;
int osStatus = 0;
GT_2trace (curTrace, GT_ENTER, "SyslinkMemMgrDrv_ioctl", cmd, args);
GT_assert (curTrace, (SyslinkMemMgrDrv_refCount > 0));
osStatus = ioctl (SyslinkMemMgrDrv_handle, cmd, args);
if (osStatus < 0) {
/*! @retval MEMMGR_E_OSFAILURE Driver ioctl failed */
status = MEMMGR_E_OSFAILURE;
GT_setFailureReason (curTrace,
GT_4CLASS,
"SyslinkMemMgrDrv_ioctl",
status,
"Driver ioctl failed!");
}
else {
/* First field in the structure is the API status. */
status = ((SyslinkMemMgrDrv_CmdArgs *) args)->apiStatus;
}
GT_1trace (curTrace, GT_LEAVE, "SyslinkMemMgrDrv_ioctl", status);
/*! @retval MEMMGR_SUCCESS Operation successfully completed. */
return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:38,代码来源:SyslinkMemMgrDrv.c
注:本文中的GT_setFailureReason函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论