Files
m241Neelima/components/ip_net2-6.9/ipfreescale/sec4/sec4_io.c
T
2026-07-30 11:19:44 +05:30

153 lines
4.9 KiB
C

/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name $ $RCSfile $ $Revision $
* $Source $
* $Author $
* $State $ $Locker $
*
* INTERPEAK_COPYRIGHT_STRING
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/****************************************************************************
* sec4_io.c -- bus operations for SEC4 Driver.
* Based on sec2_io.c for SEC2 Driver.
****************************************************************************
* Copyright (c) Certicom Corp. 1996-2002. All rights reserved
* Copyright (c) 2003, 2004 Freescale Semiconductor
* All Rights Reserved. Proprietary and Confidential.
*
* NOTICE: The information contained in this file is proprietary
* to Freescale Semiconductor, and is being made available to
* Freescale's customers under strict license agreements.
* Use or disclosure of this information is permissible only
* under the terms of the existing license agreement.
***************************************************************************/
/* Revision History:
* 1.0 Mar 11,2011 - Based on sec2_io.c v1.2
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <taskLib.h>
#include "Sec4Driver.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
SEM_ID JobEnqueueSemId;
MSG_Q_ID IsrMsgQId;
int driverNum;
DEV_HDR vxworksDrvDev;
/*
****************************************************************************
* 9 LOCAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
IO_STATUS IOInitQs(uint16_t size)
{
/* set up ISR/ProcessingComplete message queue */
IsrMsgQId = msgQCreate(size, sizeof(COMPLETED_JOB), MSG_Q_FIFO);
if (IsrMsgQId == NULL)
return SEC4_VXWORKS_CANNOT_CREATE_QUEUE;
return SEC4_SUCCESS;
}
IO_STATUS IORegisterDriver()
{
/* start ProcessComplete task, with high priority */
if (taskSpawn (SEC4_PC_TASKNAME,
PROCESSING_COMPLETE_PRIORITY,
0,
PROCESSING_COMPLETE_STACKSIZE,
(FUNCPTR)ProcessingComplete,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == TASK_ID_ERROR)
return (SEC4_UNKNOWN_ERROR);
#ifdef SEC4_POLLED_MODE
if (taskSpawn ("tSec4PT",
POLL_COMPLETE_PRIORITY,
0,
POLL_COMPLETE_STACKSIZE,
(FUNCPTR)PollComplete,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == TASK_ID_ERROR)
return (SEC4_UNKNOWN_ERROR);
#endif
/* add the driver to the driver table */
driverNum = iosDrvInstall(SEC4Open, NULL, SEC4Open, SEC4Close, NULL, NULL, SEC4_ioctl);
if (driverNum < 0)
return (SEC4_IO_VXWORKS_DRIVER_TABLE_ADD_ERROR);
(void) iosDevAdd(&vxworksDrvDev, vxworksDrvName, driverNum);
return (SEC4_SUCCESS);
}
void IOInitSemaphores()
{
/* initialize semaphores */
/* JobEnqueueSemId is for enqueueing jobs to the SEC4 Engine */
JobEnqueueSemId = semBCreate(SEM_Q_PRIORITY, SEM_FULL);
}
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/