⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zl5011xos.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
📖 第 1 页 / 共 2 页
字号:
       int     arg         - argument with which to call routine
      );
*/

#define OS_AUX_TIMER_ENABLE()             sysAuxClkEnable()
/*
   void    sysAuxClkEnable (void);
*/

#define OS_AUX_TIMER_DISABLE()            sysAuxClkDisable()
/*
   void    sysAuxClkDisable (void);
*/

#define OS_AUX_TIMER_SET(rate)            sysAuxClkRateSet(rate)
/*
   STATUS  sysAuxClkRateSet (
      int ticksPerSecond  - number of clock interrupts per second
      );

   Notes
      Sets the interrupt rate of the auxiliary clock, but does not enable the auxiliary clock interrupt.

      Returns OK, or ERROR if the tick rate is invalid or the timer cannot be set.
*/

#define OS_AUX_TIMER_GET()                sysAuxClkRateGet()
/*
   int     sysAuxClkRateGet (void);
*/

/*****************   Interrupts   *********************************************/
/* Connect a C routine to a hardware interrupt */
#define OS_INTERRUPT_CONNECT intConnect
/*
   STATUS intConnect
       (
       VOIDFUNCPTR * vector,   - interrupt vector to attach to
       VOIDFUNCPTR   routine,  - routine to be called
       int           parameter - parameter to be passed to routine
       )

   Notes
      Returns OK or ERROR.
*/

/* disable the interrupt on the host */
#define OS_INTERRUPT_LOCK intLock
/*
   int   intLock (void);

   Notes
      Disables interrupts and returns a lock-out key representing the interrupt level prior to the call;
      this key can be passed to intUnlock( ) to re-enable interrupts.
*/

/* enable the interrupt on the host */
#define OS_INTERRUPT_UNLOCK intUnlock
/*
   void intUnlock
       (
       int lockKey - lock-out key returned by preceding intLock()
       )
*/


/* Enable the 'interrupLevel' interrupt to the processor */
#define OS_INTERRUPT_ENABLE(interruptLevel)    intEnable(interruptLevel)
/*
   int intEnable
       (
       int level     - new interrupt bits (0x00 - 0xff00)
       )

   Notes
      Enables the input interrupt bits on the present status register of the processor.
      Returns OK or ERROR.
*/

/* Disable the 'interrupLevel' interrupt to the processor */
#define OS_INTERRUPT_DISABLE(interruptLevel)   intDisable(interruptLevel)
/*
   int intDisable
       (
       int level     - new interrupt bits (0x0 - 0xff00)
       )

   Notes
      Returns OK or ERROR.
*/

/*****************   Semaphores   *********************************************/
/* Create and initialise a counting semaphore */
#define OS_SEMA4_CREATE(options,initialCount) semCCreate(options,initialCount)
/*
   SEM_ID semCCreate
       (
       int options,        - semaphore option modes
       int initialCount    - initial count
       )

   Notes
      Create and initialize a counting semaphore
      The options are SEM_Q_PRIORITY (0x1) and SEM_Q_FIFO (0x0) and specify the
      queuing style for blocked tasks. Tasks may be queued on a priority basis
      or a first-in-first-out basis.
      Returns a semaphore ID or NULL on failure.
*/

/* Give a semaphore */
#define OS_SEMA4_GIVE(semId) semGive(semId)
/*
   STATUS semGive
       (
       SEM_ID semId        - semaphore ID to give
       )

   Notes
      Returns OK, or ERROR if the semaphore ID is invalid.
*/

/* Take a semaphore */
#define OS_SEMA4_TAKE(semId,timeout) semTake(semId,timeout)
/*
   STATUS semTake
       (
       SEM_ID semId,       - semaphore ID to take
       int    timeout      - timeout in ticks or 0 = no wait, -1 = wait forever
       )

   Notes
      Returns OK, or ERROR if the semaphore ID is invalid or timed out.
*/

/* Delete a semaphore */
#define OS_SEMA4_DELETE(semId) semDelete(semId)
/*
   STATUS semDelete
       (
       SEM_ID semId        - semaphore ID to delete
       )

   Notes
      Returns OK, or ERROR if the semaphore ID is invalid.
*/

/*****************   Mutex Semaphores   ***************************************/
/* Create and initialise a mutex (binary) semaphore */
#define OS_MUTEX_CREATE(initialState) semBCreate(OS_SEM_Q_PRIORITY,initialState)
/*
   SEM_ID semBCreate
       (
       int         options,         - semaphore options
       SEM_B_STATE initialState     - initial semaphore state full=1 or empty=0.

       )

   Notes
      Create and initialize a binary semaphore
      The options are SEM_Q_PRIORITY (0x1) and SEM_Q_FIFO (0x0) and specify the
      queuing style for blocked tasks. Tasks may be queued on a priority basis
      or a first-in-first-out basis.
      The initialState is SEM_FULL (0x1) or SEM_EMPTY (0x0).
      Returns a semaphore ID or NULL on failure.
*/

/* Take a mutex semaphore - see OS_SEMA4_TAKE*/
#define OS_MUTEX_TAKE(mutex) semTake(mutex,OS_WAIT_FOREVER)

/* Take a mutex semaphore, and define a timeout value  - see OS_SEMA4_TAKE*/
#define OS_MUTEX_TAKE_T(mutex,timeout) semTake(mutex,OS_TICKS(timeout))

/* Give a mutex semaphore  - see OS_SEMA4_GIVE*/
#define OS_MUTEX_GIVE(mutex) semGive(mutex)

/* Delete a mutex semaphore  - see OS_SEMA4_DELETE*/
#define OS_MUTEX_DELETE(mutex) semDelete(mutex)

/*****************   Message Queues   *****************************************/
/* Create and initialise a message queue */
#define OS_MSG_Q_CREATE msgQCreate
/*
   MSG_Q_ID msgQCreate
       (
       int maxMsgs,           - max messages that can be queued
       int maxMsgLength,      - max bytes in a message
       int options            - message queue options
       )

   Notes
      Create and initialize a message queue. The options are MSG_Q_PRIORITY (0x1)
      and MSG_Q_FIFO (0x0) and specify the queuing style for blocked tasks. Tasks
      may be queued on a priority basis or a first-in-first-out basis.
      Returns a message queue ID or NULL on failure.

*/

/* Send a message to a message queue */
#define OS_MSG_Q_SEND msgQSend
/*
   STATUS msgQSend
       (
       MSG_Q_ID msgQId,       - message queue on which to send
       char *   buffer,       - message to send
       UINT     nBytes,       - length of message
       int      timeout,      - timeout in ticks or 0 = no wait, -1 = wait forever
       int      priority      - MSG_PRI_NORMAL or MSG_PRI_URGENT (add at head of queue)
       )

   Notes
      Send a message to a message queue. Returns OK or ERROR.
*/

/* Receive a message from a message queue */
#define OS_MSG_Q_RECEIVE msgQReceive
/*
   int msgQReceive
       (
       MSG_Q_ID msgQId,       - message queue from which to receive
       char *   buffer,       - buffer to receive message
       UINT     maxNBytes,    - length of buffer
       int      timeout       - timeout in ticks or 0 = no wait, -1 = wait forever
       )

   Notes
      Receive a message from a message queue.
      Returns the number of bytes copied to buffer, or ERROR.
*/

/* Delete a message queue */
#define OS_MSG_Q_DELETE msgQDelete
/*
   STATUS msgQDelete
       (
       MSG_Q_ID msgQId        - message queue to delete
       )

   Notes
      Delete a message queue - any blocked tasks will be unblocked with an error
      return code. Returns OK or ERROR.
*/

/* Determine the number of messages in a queue */
#define OS_MSG_Q_NUM_MSGS msgQNumMsgs
/*
   int msgQNumMsgs
       (
       MSG_Q_ID msgQId /         - message queue to examine
       )

   Notes
      Returns the number of messages queued, or ERROR.
*/

/*****************   logging functions   **************************************/

/* Set the file descriptor to which logging will be sent */
#define OS_LOG_INIT(x) logFdSet(x)
/*
   void logFdSet
       (
       int fd                    - file descriptor to use as logging device
       )

   Notes
      Changes the file descriptor where messages from logMsg( ) are written.
*/

/* Output a log message */
#define OS_LOG_MSG   logMsg
/*
      int logMsg
          (
          char * fmt,            - format string for print
          int    arg1,           - first of six required args for fmt
          int    arg2,
          int    arg3,
          int    arg4,
          int    arg5,
          int    arg6
          )

   Notes
      logMsg is a fixed number of argument version of printf. It uses a seperate logging task to
      actually perform the logging and hence can safely be called from time sensitive code such as
      interrupt service routines etc.
*/

/*****************   Memory allocation   **************************************/
/* Note: It is EXTREMELY important that these defines are mapped to the
appropriate RTOS calls if the processor has an internal cache. Failing to do
this will result in the DMA operating in an unpredictable manner              */
#define OS_CACHE_DMA_MALLOC(numOfBytes) cacheDmaMalloc(numOfBytes)
/*
   void * cacheDmaMalloc
       (
       size_t bytes              - number of bytes to allocate
       )

   Notes
      Allocate a cache-safe buffer for DMA devices and drivers.
      Returns a pointer to a section of memory that will not experience cache
      coherency problems or NULL.
*/

#define OS_CACHE_DMA_FREE(memoryP) cacheDmaFree(memoryP)
/*
   STATUS cacheDmaFree
       (
       void * pBuf               - pointer to malloc/free buffer
       )

   Notes
      Free the buffer acquired with cacheDmaMalloc( ). Returns OK or ERROR.
*/

#define OS_MALLOC(numOfBytes) malloc(numOfBytes)
#define OS_CALLOC(numEntries, numOfBytes) calloc(numEntries, numOfBytes)
#define OS_FREE(memoryP) free(memoryP)

/****************   Functions for locating base addresses   *******************/

#define OS_IMMR_GET vxImmrGet
/*
   UINT32  vxImmrGet    (void)

   Notes
      Returns the IMMR base address.
*/

/****************   Functions for handling DMA endian conversions  ************/

#ifdef _ZL5011X_DMA_CONVERT_LITTLE_ENDIAN

   #define ZL5011X_DMA_DATA_BYTE_ORDER(x)   (((x) << 24) | (((x) << 8) & 0x00FF0000) | \
                                          (((x) >> 8) & 0x0000FF00) | ((x) >> 24))

   #define ZL5011X_DMA_HEADER_BYTE_ORDER(x) (x)

#else
   /* standard endian format for PowerPc */

   #define ZL5011X_DMA_DATA_BYTE_ORDER(x)   (x)

   #define ZL5011X_DMA_HEADER_BYTE_ORDER(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | \
                                          (((x) >> 8) & 0x0000FF00) | ((x) >> 24))

#endif

/*****************   STATIC FUNCTION DECLARATIONS   ***************************/

#ifdef __cplusplus
}
#endif

#endif



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -