📄 ixosal.h
字号:
/** * @file IxOsal.h * * @brief Top include file for OSAL * * * @par * IXP400 SW Release version 2.0 * * -- Copyright Notice -- * * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. * * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @par * -- End of Copyright Notice -- */#ifndef IxOsal_H#define IxOsal_H/* Basic types */#include "IxOsalTypes.h"/* Include assert */#include "IxOsalAssert.h"/* * Config header gives users option to choose IO MEM * and buffer management modules */#include "IxOsalConfig.h"/* * Symbol file needed by some OS. */#include "IxOsalUtilitySymbols.h"/* OS-specific header */#include "IxOsalOs.h"/** * @defgroup IxOsal Operating System Abstraction Layer (IxOsal) API * * @brief This service provides a thin layer of OS dependency services. * * This file contains the API to the functions which are some what OS dependant and would * require porting to a particular OS. * A primary focus of the component development is to make them as OS independent as possible. * All other components should abstract their OS dependency to this module. * Services overview * -# Data types, constants, defines * -# Interrupts * - bind interrupts to handlers * - unbind interrupts from handlers * - disables all interrupts * - enables all interrupts * - selectively disables interrupts * - enables an interrupt level * - disables an interrupt level * -# Memory * - allocates memory * - frees memory * - copies memory zones * - fills a memory zone * - allocates cache-safe memory * - frees cache-safe memory * - physical to virtual address translation * - virtual to physical address translation * - cache to memory flush * - cache line invalidate * -# Threads * - creates a new thread * - starts a newly created thread * - kills an existing thread * - exits a running thread * - sets the priority of an existing thread * - suspends thread execution * - resumes thread execution * -# IPC * - creates a message queue * - deletes a message queue * - sends a message to a message queue * - receives a message from a message queue * -# Thread Synchronisation * - initializes a mutex * - locks a mutex * - unlocks a mutex * - non-blocking attempt to lock a mutex * - destroys a mutex object * - initializes a fast mutex * - non-blocking attempt to lock a fast mutex * - unlocks a fast mutex * - destroys a fast mutex object * - initializes a semaphore * - posts to (increments) a semaphore * - waits on (decrements) a semaphore * - non-blocking wait on semaphore * - gets semaphore value * - destroys a semaphore object * - yields execution of current thread * -# Time functions * - yielding sleep for a number of milliseconds * - busy sleep for a number of microseconds * - value of the timestamp counter * - resolution of the timestamp counter * - system clock rate, in ticks * - current system time * - converts ixOsalTimeVal into ticks * - converts ticks into ixOsalTimeVal * - converts ixOsalTimeVal to milliseconds * - converts milliseconds to IxOsalTimeval * - "equal" comparison for IxOsalTimeval * - "less than" comparison for IxOsalTimeval * - "greater than" comparison for IxOsalTimeval * - "add" operator for IxOsalTimeval * - "subtract" operator for IxOsalTimeval * -# Logging * - sets the current logging verbosity level * - interrupt-safe logging function * -# Timer services * - schedules a repeating timer * - schedules a single-shot timer * - cancels a running timer * - displays all the running timers * -# Optional Modules * - Buffer management module * - I/O memory and endianess support module * * @{ *//* * Prototypes *//* ========================== Interrupts ================================ * *//** * @ingroup IxOsal * * @brief Binds an interrupt handler to an interrupt level * * @param irqLevel (in) - interrupt level * @param irqHandler (in) - interrupt handler * @param parameter (in) - custom parameter to be passed to the * interrupt handler * * Binds an interrupt handler to an interrupt level. The operation will * fail if the wrong level is selected, if the handler is NULL, or if the * interrupt is already bound. This functions binds the specified C * routine to an interrupt level. When called, the "parameter" value will * be passed to the routine. * * Reentrant: no * IRQ safe: no * * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise */PUBLIC IX_STATUS ixOsalIrqBind (UINT32 irqLevel, IxOsalVoidFnVoidPtr irqHandler, void *parameter);/** * @ingroup IxOsal * * @brief Unbinds an interrupt handler from an interrupt level * * @param irqLevel (in) - interrupt level * * Unbinds the selected interrupt level from any previously registered * handler * * @li Reentrant: no * @li IRQ safe: no * * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise */PUBLIC IX_STATUS ixOsalIrqUnbind (UINT32 irqLevel);/** * @ingroup IxOsal * * @brief Disables all interrupts * * @param - none * * Disables all the interrupts and prevents tasks scheduling * * @li Reentrant: no * @li IRQ safe: yes * * @return interrupt enable status prior to locking */PUBLIC UINT32 ixOsalIrqLock (void);/** * @ingroup IxOsal * * @brief Enables all interrupts * * @param irqEnable (in) - interrupt enable status, prior to interrupt * locking * * Enables the interrupts and task scheduling, cancelling the effect * of ixOsalIrqLock() * * @li Reentrant: no * @li IRQ safe: yes * * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise */PUBLIC void ixOsalIrqUnlock (UINT32 irqEnable);/** * @ingroup IxOsal * * @brief Selectively disables interrupts * * @param irqLevel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -