📄 sec2driver.h
字号:
This variable is initialized during startup. It is determined to be a fixed offset from the #IOBaseAddress register. See the SEC2 manual for details.*/SEC2_GLOBAL volatile unsigned long *sec2_MasterControlRegister;/* sec2_FreeChannels A global variable which keeps track of the number of free channels*/SEC2_GLOBAL int sec2_FreeChannels;/*! \var int sec2_FreeRngas \brief A global variable which keeps track of the number of free RNG CHAs*/SEC2_GLOBAL unsigned long sec2_FreeRngas;/*! \var int sec2_FreeAfhas \brief A global variable which keeps track of the number of free ARC4 CHAs*/SEC2_GLOBAL unsigned long sec2_FreeAfhas;/*! \var int sec2_FreeDesas \brief A global variable which keeps track of the number of free DES CHAs*/SEC2_GLOBAL unsigned long sec2_FreeDesas;/*! \var int sec2_FreeMdhas \brief A global variable which keeps track of the number of free MD CHAs*/SEC2_GLOBAL unsigned long sec2_FreeMdhas;/*! \var int sec2_FreePkhas \brief A global variable which keeps track of the number of free PK CHAs*/SEC2_GLOBAL unsigned long sec2_FreePkhas;/*! \var int sec2_FreeAesas \brief A global variable which keeps track of the number of free AESA CHAs*/SEC2_GLOBAL unsigned long sec2_FreeAesas;/*! \var int sec2_FreeKeas \brief A global variable which keeps track of the number of free KEA CHAs*/SEC2_GLOBAL unsigned long sec2_FreeKeas;/*! \var unsigned long sec2_BlockSize \brief A global variable which indicates what the current block size is*/SEC2_GLOBAL unsigned long sec2_BlockSize;/*! \var ProcessQueueTop \brief A global variable which is a pointer to the top of the Pending dynamic request list (list of ::queue_entry"s").*/SEC2_GLOBAL QUEUE_ENTRY *sec2_ProcessQueueTop;/*! \var ProcessQueueBottom \brief A global variable which is a pointer to the bottom of the Pending dynamic request list (list of ::queue_entry"s").*/SEC2_GLOBAL QUEUE_ENTRY *sec2_ProcessQueueBottom;SEC2_GLOBAL SEC2_FWD_QUEUE *gpSec2_FwdQueueTop; SEC2_GLOBAL SEC2_FWD_QUEUE *gpSec2_FwdQueueBottom;/*! \var unsigned long QueueEntryDepth \brief A global variable which keeps track of the number of entries in the Pending dynamic request list pointed to by #ProcessQueueTop*/SEC2_GLOBAL unsigned long sec2_QueueEntryDepth;/*! \var SEM_ID ChannelAssignSemId \brief (VxWorks Only) A global variable which is used as a mutual exclusion semaphore for the #Sec2_ChannelAssignments array. The variable is not used directly. It used by calling #IOLockChannelAssignment() to lock and #IOUnLockChannelAssignment() to unlock.*/#if defined(VXWORKS)SEC2_GLOBAL SEM_ID sec2_ChannelAssignSemId;#else#ifdef __KERNEL__extern spinlock_t ChannelAssignLock;#else#ifdef INIT_CDECLARE_MUTEX(sec2_ChannelAssignSemId);#elseextern struct semaphore sec2_ChannelAssignSemId;#endif#endif#endif/*! \var SEM_ID QueueSemId \brief (VxWorks Only) A global variable which is used as a mutual exclusion semaphore for the Queue The variable is not used directly. It used by calling #IOLockBlockSize() to lock and #IOUnLockBlockSize() to unlock.*/#if defined(VXWORKS)SEC2_GLOBAL SEM_ID sec2_QueueSemId;#else#ifdef INIT_CDECLARE_MUTEX(sec2_QueueSemId);#elseextern struct semaphore sec2_QueueSemId;#endif#endif#ifdef VXWORKS/* The queue identifier is used to queue register values read by the ISR (#sec2_InterruptServiceRoutine()) to the deferred interrupt process routine (#Sec2_ProcessingComplete())*/SEC2_GLOBAL MSG_Q_ID IsrMsgQId;/* OS's identification of the device*/SEC2_GLOBAL int driverNum;#endif#ifdef __KERNEL__/* Device major number registered at device initialization */SEC2_GLOBAL int sec2_devmajor;#endifSEC2_GLOBAL unsigned int sec2_cha_idx[6];/*! \var DEV_HDR vxworksDrvDev \brief (VxWorks Only) Used in driver startup.*/#ifdef VXWORKSSEC2_GLOBAL DEV_HDR vxworksDrvDev;#endif/* coremask holds the core ID register for version/feature control */SEC2_GLOBAL unsigned long sec2_coremask;/* Forward declarations for internal driver functions not meant for "public use" */int sec2_ReleaseChannel(unsigned long, int, BOOLEAN);int MapScatterFragments(unsigned long , unsigned long *);void UnmapScatterFragments(unsigned long *);/* Read/write a block of data from hardware registers (obsolete) */void IORead(unsigned long *, int, volatile unsigned long *);void IOWrite(unsigned long *, int, volatile unsigned long *);/* Register driver and it's handlers with the OS */IO_STATUS IORegisterDriver(void);/* Set up internal driver semaphores */int IOInitChannelSemaphores(void);int InitGlobalQueueSemaphores(void);unsigned int drv_sysGetPeripheralBase(void);/* Initialize drive queues */IO_STATUS IOInitQs(void);/* Enable/Disable the hardware interrupt */IO_STATUS IOConnectInterrupt(void);void IODisconnectInterrupt(void);/* Allocate/free a dynamic queue entry (obsolete) */QUEUE_ENTRY *IOAllocateQEntry(void);void IOFreeQEntry(QUEUE_ENTRY *);/* Initialize/Allocate/Release channel assignment table */IO_STATUS sec2_InitChannelAssignment(int);void FreeChannelAssignment(int);/* Translate CHA index to type */int sec2_ChaNumToType(int);/* Check to see if the CHA type is available */extern int Sec2_CheckChas(unsigned long);/* Open a new connection to this driver */#ifdef __KERNEL__int SEC2Open(struct inode *, struct file *);#elseint SEC2Open(DEV_HDR *, int, int);#endif/* Close a connection to this driver */#ifdef __KERNEL__int SEC2Close(struct inode *, struct file *);#elseint SEC2Close(int);#endif/* Request a driver operation*/#if 0#ifdef __KERNEL__int SEC2_ioctl(struct inode *, struct file *, unsigned int, unsigned long);#elseint SEC2_ioctl(register int, register void *);#endif#endifint SEC2_ioctl(register int ioctlCode, register void *param);/* Driver's top level ISR handler */#ifdef __KERNEL__extern void sec2_InterruptServiceRoutine(int irq, void *dev_id, struct pt_regs *pt_regs);#elseextern void sec2_InterruptServiceRoutine(void);#endif/* ISR's Deferred processing (bottom half) handler */#if defined(VXWORKS) || defined(_MSC_VER)extern void Sec2_ProcessingComplete(SEC2_DEVICE_REGS *regsPtr,UINT8 currentReg);#elseextern void Sec2_ProcessingComplete(unsigned long not_used);#endif/* External function to mark scatter buffers for kernel-state usage */#ifdef __KERNEL__int MarkScatterBuffer(void *, void *);#endif/* Take a user request, build a DPD, and submit it for processing */int Sec2_ProcessRequest(GENERIC_REQ *, int);/* Start any pending requests */void Sec2_ScheduleNext(void);/*! \fn BOOLEAN StartDescriptor(int channel, unsigned long addr) \brief Start a DPD request to the SEC2 Write \a addr to the #ChannelNextDescriptorRegister register for this \a channel Timers are launched if USE_TIMERS are defined \param channel \param addr address to be saved in #ChannelNextDescriptorRegister \retval TRUE if successful*//*extern BOOLEAN StartDescriptor(int channel, unsigned long addr);*//*! \fn int sec2_CompleteRequest(int channel, int status, BOOLEAN bDoNotify) \brief Complete a request Call FinishIoRequest() Cleanup the ::req_list associated with this request by calling CleanupRequestList() Make the #ChannelAssignment entry for the \a channel available If \a bDoNotify is set, call a notify routine \param channel Channel request was issued on \param status Status of the request \param bDoNotify Notify requester? \param pRegs Pointer to register snapshot \retval status*/int sec2_CompleteRequest(int channel, int status);/*! \fn void RemoveQueueEntry(QUEUE_ENTRY *entry) \brief Remove entry from pending dynamic request list \param entry ::queue_entry to be deleted*/void RemoveQueueEntry(QUEUE_ENTRY *entry);/*! \fn int sec2_RequestToDpd(int channel) \brief Transform the current request into a chain of DPDs This routine will traverse a ::req_list populating SEC2_CHANNEL_ASSIGNMENT::Dpds for the given \a channel. The ::req_list will have been built by BuildRequestList(). After successful completion, the caller will be able to get the hardware to process the request by calling StartDescriptor(). StartDescriptor() expects a Hardware specific address, i.e. use SEC2_CHANNEL_ASSIGNMENT::addrHwDpds for the given \a channel. \param channel Channel that DPD(s) will be launched on \retval #SEC2_SUCCESS if successful*/int sec2_RequestToDpd(GENERIC_REQ *pReq, int channel,DPD_DETAILS_ENTRY *pDesc);/*! \fn void CopyRegsToStatus(SEC2_STATUS_REQ *pStatus, SEC2_DEVICE_REGS *pRegs) \brief A helper function to copy a register snapshot into a status request \param pStatus Pointer to status request \param pRegs Pointer to register snapshot*/void sec2_CopyRegsToStatus(SEC2_STATUS_REQ *pStatus, SEC2_DEVICE_REGS *pRegs);/*! \fn int SetBlockSize(unsigned long* newBlockSize) \brief Set the Block Size for DPD requests \param newBlockSize Size to set #BlockSize to. \retval #SEC2_SUCCESS if successful*/int SetBlockSize(unsigned long* newBlockSize);/*! \fn int sec2_GetStatus(SEC2_STATUS_REQ *pStatus, int callingTaskId) \brief Get Current Status of the Driver \param pStatus Pointer to status request. \param callingTaskId Id of Task that is making the request \retval #SEC2_SUCCESS*/int sec2_GetStatus(SEC2_STATUS_REQ *pStatus, int callingTaskId);extern void sec2_complete_callback(int bDoNotify,int status,GENERIC_REQ* req);extern void sec2_complete_handle(void);extern int sec2_addfwdQueue(GENERIC_REQ *req, int callingTaskId);extern int Sec2_ScheduleQueue(int channel);#endif /* SEC2DRIVER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -