omap3530/beagle_drivers/wb/api/include/cyashaldoc.h
changeset 27 117faf51deac
equal deleted inserted replaced
26:b7e488c49d0d 27:117faf51deac
       
     1 /* Cypress West Bridge API header file (cyashaldoc.h)
       
     2  ## ===========================
       
     3  ##
       
     4  ##  Copyright Cypress Semiconductor Corporation, 2006-2009,
       
     5  ##  All Rights Reserved
       
     6  ##  UNPUBLISHED, LICENSED SOFTWARE.
       
     7  ##
       
     8  ##  CONFIDENTIAL AND PROPRIETARY INFORMATION
       
     9  ##  WHICH IS THE PROPERTY OF CYPRESS.
       
    10  ##
       
    11  ##  Use of this file is governed
       
    12  ##  by the license agreement included in the file
       
    13  ##
       
    14  ##     <install>/license/license.txt
       
    15  ##
       
    16  ##  where <install> is the Cypress software
       
    17  ##  installation root directory path.
       
    18  ##
       
    19  ## ===========================
       
    20 */
       
    21 
       
    22 #ifndef _INCLUDED_CYASHALDOC_H_
       
    23 #define _INCLUDED_CYASHALDOC_H_
       
    24 
       
    25 #include "cyashaldef.h"
       
    26 
       
    27 /*@@Hardware Abstraction Layer (HAL)
       
    28     Summary
       
    29     This software module is supplied by the user of the West Bridge API.  This module contains the
       
    30     software that is specific to the hardware implementation or operating system of the client
       
    31     system.
       
    32 
       
    33     * Sleep Channels *
       
    34     A sleep channel is a operating system object that provides that capability for one
       
    35     thread or process to sleep while waiting on the completion of some hardware event. The
       
    36     hardware event is usually processed by a hardware interrupt and the interrupt handler
       
    37     then wakes the thread or process that is sleeping.
       
    38 	
       
    39     A sleep channel provides the mechanism for this operation.  A sleep channel is created and 
       
    40     initialized during the API initialization. When the API needs to wait for the hardware, the 
       
    41     API performs a SleepOn() operation on the sleep channel.  When hardware event occurs, an 
       
    42     interrupt handler processes the event and then performs a Wake() operation on the sleep channel 
       
    43     to wake the sleeping process or thread.
       
    44 
       
    45     * DMA Model *
       
    46     When the West Bridge API needs to transfer USB or storage data to/from the West Bridge device, this is 
       
    47     done using a "DMA" operation.  In this context the term DMA is used loosely as the West Bridge 
       
    48     API does not really care if the data is transferred using a burst read or write operation,
       
    49     or if the data is transferred using programmed I/O operations.  When a "DMA" operation is
       
    50     needed, the West Bridge API calls either CyAsHalDmaSetupRead() or CyAsHalDmaSetupWrite() depending
       
    51     on the direction of the data flow.  The West Bridge API expects the "DMA" operation requested in
       
    52     the call to be completed and the registered "DMA complete" callback to be called.
       
    53 
       
    54     The West Bridge API looks at several factors to determine the size of the "DMA" request to
       
    55     pass to the HAL layer.  First the West Bridge API calls CyAsHalDmaMaxRequestSize() to determine
       
    56     the maximum amount of data the HAL layer can accept for a "DMA" operation on the requested
       
    57     endpoint.  The West Bridge API will never exceed this value in a "DMA" request to the HAL
       
    58     layer.  The West Bridge API also sends the maximum amount of data the West Bridge device can
       
    59     accept as part of the "DMA" request.  If the amount of data in the "DMA" request to the HAL
       
    60     layer exceeds the amount of data the West Bridge device can accept, it is expected that the
       
    61     HAL layer has the ability to break the request into multiple operations.
       
    62 
       
    63     If the HAL implementation requires the API to handle the size of the "DMA" requests for
       
    64     one or more endpoints, the value CY_AS_DMA_MAX_SIZE_HW_SIZE can be returned from the
       
    65     CyAsHalDmaMaxRequestSize() call.  In this case, the API assumes that the maximum size of
       
    66     each "DMA" request should be limited to the maximum that can be accepted by the endpoint
       
    67     in question.
       
    68 
       
    69     Notes
       
    70     See the <install>/api/hal/scm_kernel/cyashalscm_kernel.c file for an example of how 
       
    71     the DMA request size can be managed by the HAL implementation.
       
    72 
       
    73     * Interrupt Handling *
       
    74     The HAL implementation is required to handle interrupts arriving from the West Bridge device,
       
    75     and call the appropriate handlers.  If the interrupt arriving is one of PLLLOCKINT,
       
    76     PMINT, MBINT or MCUINT, the CyAsIntrServiceInterrupt API should be called to service the
       
    77     interrupt.  If the interrupt arriving is DRQINT, the HAL should identify the endpoint
       
    78     corresponding to which the DRQ is being generated and perform the read/write transfer
       
    79     from the West Bridge. See the <install>/api/hal/scm_kernel/cyashalscm_kernel.c or
       
    80     <install>/api/hal/fpga/cyashalfpga.c reference HAL implementations for examples.
       
    81 
       
    82     The HAL implementation can choose to poll the West Bridge interrupt status register instead
       
    83     of using interrupts.  In this case, the polling has to be performed from a different
       
    84     thread/task than the one running the APIs.  This is required because there are API calls
       
    85     that block on the reception of data from the West Bridge, which is delivered only through
       
    86     the interrupt handlers.
       
    87 
       
    88     * Required Functions *
       
    89     This section defines the types and functions that must be supplied in order to provide a
       
    90     complete HAL layer for the West Bridge API.
       
    91 
       
    92     Types that must be supplied:
       
    93     * CyAsHalSleepChannel
       
    94 
       
    95     Hardware functions that must be supplied:
       
    96     * CyAsHalWriteRegister
       
    97     * CyAsHalReadRegister
       
    98     * CyAsHalDmaSetupWrite
       
    99     * CyAsHalDmaSetupRead
       
   100     * CyAsHalDmaCancelRequest
       
   101     * CyAsHalDmaRegisterCallback
       
   102     * CyAsHalDmaMaxRequestSize
       
   103     * CyAsHalSetWakeupPin
       
   104     * CyAsHalSyncDeviceClocks
       
   105     * CyAsHalInitDevRegisters
       
   106     * CyAsHalReadRegsBeforeStandby
       
   107     * CyAsHalRestoreRegsAfterStandby
       
   108 
       
   109     Operating system functions that must be supplied:
       
   110     * CyAsHalAlloc
       
   111     * CyAsHalFree
       
   112     * CyAsHalCBAlloc
       
   113     * CyAsHalCBFree
       
   114     * CyAsHalMemSet
       
   115     * CyAsHalCreateSleepChannel
       
   116     * CyAsHalDestroySleepChannel
       
   117     * CyAsHalSleepOn
       
   118     * CyAsHalWake
       
   119     * CyAsHalDisableInterrupts
       
   120     * CyAsHalEnableInterrupts
       
   121     * CyAsHalSleep150
       
   122     * CyAsHalSleep
       
   123     * CyAsHalAssert
       
   124     * CyAsHalPrintMessage
       
   125     * CyAsHalIsPolling
       
   126 */
       
   127 
       
   128 /* Summary
       
   129    This is the type that represents a sleep channel
       
   130 
       
   131    Description
       
   132    A sleep channel is an operating system object that, when a thread of control waits on the
       
   133    sleep channel, the thread sleeps until another thread signals the sleep object.  This object
       
   134    is generally used when a high level API is called and must wait for a response that is 
       
   135    supplied in an interrupt handler.  The thread calling the API is put into a sleep state and
       
   136    when the reply arrives via the interrupt handler, the interrupt handler wakes the sleeping
       
   137    thread to indicate that the expect reply is available.
       
   138 */
       
   139 typedef struct CyAsHalSleepChannel
       
   140 {
       
   141     int					m_channel ;	/* This structure is filled in with OS specific information
       
   142 							   to implementat a sleep channel */
       
   143 } CyAsHalSleepChannel ;
       
   144 
       
   145 /* Summary
       
   146    This function is called to write a register value
       
   147 
       
   148    Description
       
   149    This function is called to write a specific register to a specific value.  The tag identifies the
       
   150    device of interest.  The address is relative to the base address of the West Bridge device. 
       
   151 
       
   152    Returns
       
   153    Nothing
       
   154 
       
   155    See Also
       
   156    * CyAsHalDeviceTag
       
   157    * CyAsHalReadRegister
       
   158 */
       
   159 EXTERN void
       
   160 CyAsHalWriteRegister(
       
   161     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   162     uint16_t				addr,		/* The address we are writing to */
       
   163     uint16_t				value		/* The value to write to the register */
       
   164     ) ;
       
   165 
       
   166 /* Summary
       
   167    This function is called to read a register value
       
   168 
       
   169    Description
       
   170    This function is called to read the contents of a specific register.  The tag identifies the
       
   171    device of interest.  The address is relative to the base address of the West Bridge device.
       
   172 
       
   173    Returns
       
   174    Contents of the register
       
   175 
       
   176    See Also
       
   177    * CyAsHalDeviceTag
       
   178    * CyAsHalWriteRegister
       
   179 */
       
   180 EXTERN uint16_t
       
   181 CyAsHalReadRegister(
       
   182     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   183     uint16_t				addr		/* The address we are writing to */
       
   184     ) ;
       
   185 
       
   186 /* Summary
       
   187    This function initiates a DMA write operation to write to West Bridge
       
   188 
       
   189    Description
       
   190    This function initiates a DMA write operation.  The request size will not exceed the value the HAL
       
   191    layer returned via CyAsHalDmaMaxRequestSize().  This request size may exceed the size of what the
       
   192    West Bridge device will accept as one packet and the HAL layer may need to divide the request into
       
   193    multiple hardware DMA operations.
       
   194 
       
   195    Returns
       
   196    None
       
   197 
       
   198    See Also
       
   199    * CyAsHalDmaSetupRead
       
   200    * CyAsHalDmaMaxRequestSize
       
   201 */
       
   202 EXTERN void
       
   203 CyAsHalDmaSetupWrite(
       
   204     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   205     CyAsEndPointNumber_t		ep,		/* The endpoint we are writing to */
       
   206     void *				buf_p,		/* The data to write via DMA */
       
   207     uint32_t				size,		/* The size of the data at buf_p */
       
   208     uint16_t				maxsize		/* The maximum amount of data that the endpoint can accept as one packet */
       
   209     ) ;
       
   210 
       
   211 /* Summary
       
   212    This function initiates a DMA read operation from West Bridge
       
   213 
       
   214    Description
       
   215    This function initiates a DMA read operation.  The request size will not exceed the value the 
       
   216    HAL layer returned via CyAsHalDmaMaxRequestSize().  This request size may exceed the size of what
       
   217    the Anitoch will accept as one packet and the HAL layer may need to divide the request into multiple
       
   218    hardware DMA operations.
       
   219 
       
   220    Returns
       
   221    None
       
   222 
       
   223    See Also
       
   224    * CyAsHalDmaSetupRead
       
   225    * CyAsHalDmaMaxRequestSize
       
   226 */
       
   227 EXTERN void
       
   228 CyAsHalDmaSetupRead(
       
   229     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   230     CyAsEndPointNumber_t		ep,		/* The endpoint we are reading from */
       
   231     void *				buf_p,		/* The buffer to read data into */
       
   232     uint32_t				size,		/* The amount of data to read */
       
   233     uint16_t				maxsize		/* The maximum amount of data that the endpoint can provide in one DMA operation */
       
   234     ) ;
       
   235 
       
   236 /* Summary
       
   237    This function cancels a pending DMA request
       
   238 
       
   239    Description
       
   240    This function cancels a pending DMA request that has been passed down to the hardware.  The HAL layer
       
   241    can elect to physically cancel the request if possible, or just ignore the results of the request if it
       
   242    is not possible.
       
   243 
       
   244    Returns
       
   245    None
       
   246 */
       
   247 EXTERN void
       
   248 CyAsHalDmaCancelRequest(
       
   249     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   250     CyAsEndPointNumber_t		ep		/* The endpoint we are reading from */
       
   251     ) ;
       
   252 
       
   253 /* Summary
       
   254    This function registers a callback function to be called when a DMA request is completed
       
   255 
       
   256    Description
       
   257    This function registers a callback that is called when a request issued via CyAsHalDmaSetupWrite() or
       
   258    CyAsHalDmaSetupRead() has completed.
       
   259 
       
   260    Returns
       
   261    None
       
   262 
       
   263    See Also
       
   264    * CyAsHalDmaSetupWrite
       
   265    * CyAsHalDmaSetupRead
       
   266 */
       
   267 EXTERN void
       
   268 CyAsHalDmaRegisterCallback(
       
   269     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   270     CyAsHalDmaCompleteCallback		cb		/* The callback to call when a request has completed */
       
   271     ) ;
       
   272 
       
   273 /* Summary
       
   274    This function returns the maximum size of a DMA request that can be handled by the HAL.
       
   275 
       
   276    Description
       
   277    When DMA requests are passed to the HAL layer for processing, the HAL layer may have a limit
       
   278    on the size of the request that can be handled.  This function is called by the DMA manager
       
   279    for an endpoint when DMA is enabled to get the maximum size of data the HAL layer can handle.
       
   280    The DMA manager insures that a request is never sent to the HAL layer that exceeds the size
       
   281    returned by this function.
       
   282 
       
   283    Returns
       
   284    the maximum size of DMA request the HAL layer can handle
       
   285 */
       
   286 EXTERN uint32_t
       
   287 CyAsHalDmaMaxRequestSize(
       
   288     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   289     CyAsEndPointNumber_t		ep		/* The endpoint of interest */
       
   290     ) ;
       
   291 
       
   292 /* Summary
       
   293    This function sets the WAKEUP pin to a specific state on the West Bridge device.
       
   294 
       
   295    Description
       
   296    In order to enter the standby mode, the WAKEUP pin must be de-asserted.  In order to resume from
       
   297    standby mode, the WAKEUP pin must be asserted.  This function provides the mechanism to do
       
   298    this.
       
   299 
       
   300    Returns
       
   301    1 if the pin was changed, 0 if the HAL layer does not support changing this pin
       
   302 */
       
   303 EXTERN uint32_t
       
   304 CyAsHalSetWakeupPin(
       
   305     CyAsHalDeviceTag			tag,		/* The tag to ID a specific West Bridge device */
       
   306     CyBool				state		/* The desired state of the wakeup pin */
       
   307     ) ;
       
   308 
       
   309 /* Summary
       
   310    Synchronise the West Bridge device clocks to re-establish device connectivity.
       
   311 
       
   312    Description
       
   313    When the Astoria bridge device is working in SPI mode, a long period of inactivity
       
   314    can cause a loss of serial synchronisation between the processor and Astoria.  This
       
   315    function is called by the API when it detects such a condition, and is expected to take
       
   316    the action required to re-establish clock synchronisation between the devices.
       
   317 
       
   318    Returns
       
   319    CyTrue if the attempt to re-synchronise is successful, CyFalse if not.
       
   320  */
       
   321 EXTERN CyBool
       
   322 CyAsHalSyncDeviceClocks(
       
   323     CyAsHalDeviceTag                    tag,            /* The tag to ID a specific West Bridge device */
       
   324     ) ;
       
   325 
       
   326 /* Summary
       
   327    Initialize West Bridge device registers that may have been modified while the device
       
   328    was in standby.
       
   329 
       
   330    Description
       
   331    The content of some West Bridge registers may be lost when the device is placed in
       
   332    standby mode.  This function restores these register contents so that the device can
       
   333    continue to function normally after it wakes up from standby mode.
       
   334 
       
   335    This function is required to perform operations only when the API is being used with
       
   336    the Astoria device in one of the PNAND modes or in the PSPI mode.  It can be a
       
   337    no-operation in all other cases.
       
   338 
       
   339    Returns
       
   340    None
       
   341  */
       
   342 EXTERN void
       
   343 CyAsHalInitDevRegisters(
       
   344     CyAsHalDeviceTag                    tag,                    /* The tag to ID a specific West Bridge device */
       
   345     CyBool                              is_standby_wakeup       /* Indicates whether this is a wake-up from standby. */
       
   346     ) ;
       
   347 
       
   348 /* Summary
       
   349    This function reads a set of P-port accessible device registers and stores their value
       
   350    for later use.
       
   351 
       
   352    Description
       
   353    The West Bridge Astoria device silicon has a known problem when operating in SPI mode
       
   354    on the P-port, where some of the device registers lose their value when the device
       
   355    goes in and out of standby mode.  The suggested work-around is to reset the Astoria
       
   356    device as part of the wakeup procedure from standby.
       
   357    
       
   358    This requires that the values of some of the P-port accessible registers be restored to
       
   359    their pre-standby values after it has been reset.  This HAL function can be used to read
       
   360    and store the values of these registers at the point where the device is being placed
       
   361    in standby mode.
       
   362 
       
   363    Returns
       
   364    None
       
   365 
       
   366    See Also
       
   367    * CyAsHalRestoreRegsAfterStandby
       
   368  */
       
   369 EXTERN void
       
   370 CyAsHalReadRegsBeforeStandby(
       
   371     CyAsHalDeviceTag                    tag                     /* The tag to ID a specific West Bridge device */
       
   372     ) ;
       
   373 
       
   374 /* Summary
       
   375    This function restores the old values to a set of P-port accessible device registers.
       
   376 
       
   377    Description
       
   378    This function is part of the work-around to a known West Bridge Astoria device error when
       
   379    operating in SPI mode on the P-port.  This function is used to restore a set of P-port
       
   380    accessible registers to the values they had before the device was placed in standby
       
   381    mode.
       
   382 
       
   383    Returns
       
   384    None
       
   385 
       
   386    See Also
       
   387    * CyAsHalRestoreRegsAfterStandby
       
   388  */
       
   389 EXTERN void
       
   390 CyAsHalRestoreRegsAfterStandby(
       
   391     CyAsHalDeviceTag                    tag                     /* The tag to ID a specific West Bridge device */
       
   392     ) ;
       
   393 
       
   394 /*
       
   395  * The functions below this comment are part of the HAL layer, as the HAL layer consists of the
       
   396  * abstraction to both the hardware platform and the operating system.  However; the functions below
       
   397  * this comment all relate to the operating environment and not specifically to the hardware platform
       
   398  * or specific device.
       
   399  */
       
   400 
       
   401 /* Summary
       
   402    This function allocates a block of memory
       
   403 
       
   404    Description
       
   405    This is the HAL layer equivalent of the malloc() function.
       
   406 
       
   407    Returns
       
   408    a pointer to a block of memory
       
   409 
       
   410    See Also
       
   411    * CyAsHalFree
       
   412 */
       
   413 EXTERN void *
       
   414 CyAsHalAlloc(
       
   415     uint32_t				size		/* The size of the memory block to allocate */
       
   416     ) ;
       
   417 
       
   418 /* Summary
       
   419    This function frees a previously allocated block of memory
       
   420 
       
   421    Description
       
   422    This is the HAL layer equivalent of the free() function.
       
   423 
       
   424    Returns
       
   425    None
       
   426 
       
   427    See Also
       
   428    * CyAsHalAlloc
       
   429 */
       
   430 EXTERN void
       
   431 CyAsHalFree(
       
   432     void *				ptr		/* Pointer to a memory block to free */
       
   433     ) ;
       
   434 
       
   435 /* Summary
       
   436    This function is a malloc equivalent that can be used from an
       
   437    interrupt context.
       
   438 
       
   439    Description
       
   440    This function is a malloc equivalent that will be called from the
       
   441    API in callbacks. This function is required to be able to provide
       
   442    memory in interrupt context.
       
   443 
       
   444    Notes
       
   445    For platforms where it is not possible to allocate memory in interrupt
       
   446    context, we provide a reference allocator that takes memory during
       
   447    initialization and implements malloc/free using this memory.
       
   448    See the <install>/api/hal/fpga/cyashalblkalloc.[ch] files for the
       
   449    implementation, and the <install>/api/hal/fpga/cyashalfpga.c file
       
   450    for an example of the use of this allocator.
       
   451 
       
   452    Returns
       
   453    A pointer to the allocated block of memory
       
   454 
       
   455    See Also
       
   456    * CyAsHalCBFree
       
   457    * CyAsHalAlloc
       
   458 */
       
   459 EXTERN void *
       
   460 CyAsHalCBAlloc(
       
   461     uint32_t                            size            /* The size of the memory block to allocate */
       
   462     ) ;
       
   463 
       
   464 /* Summary
       
   465    This function frees the memory allocated through the CyAsHalCBAlloc
       
   466    call.
       
   467 
       
   468    Description
       
   469    This function frees memory allocated through the CyAsHalCBAlloc
       
   470    call, and is also required to support calls from interrupt
       
   471    context.
       
   472 
       
   473    Returns
       
   474    None
       
   475 
       
   476    See Also
       
   477    * CyAsHalCBAlloc
       
   478    * CyAsHalFree
       
   479 */
       
   480 EXTERN void
       
   481 CyAsHalCBFree(
       
   482     void *                              ptr             /* Pointer to the memory block to be freed */
       
   483     ) ;
       
   484 
       
   485 /* Summary
       
   486    This function sets a block of memory to a specific value
       
   487 
       
   488    Description
       
   489    This function is the HAL layer equivalent of the memset() function.
       
   490 
       
   491    Returns
       
   492    None
       
   493 */
       
   494 EXTERN void
       
   495 CyAsMemSet(
       
   496     void *				ptr,		/* A pointer to a block of memory to set */
       
   497     uint8_t				value,		/* The value to set the memory to */
       
   498     uint32_t				cnt		/* The number of bytes to set */
       
   499     ) ;
       
   500 
       
   501 /* Summary
       
   502    This function creates or initializes a sleep channel
       
   503 
       
   504    Description
       
   505    This function creates or initializes a sleep channel.  The sleep channel defined using
       
   506    the HAL data structure CyAsHalSleepChannel.
       
   507 
       
   508    Returns
       
   509    CyTrue is the initialization was sucessful, and CyFalse otherwise
       
   510 
       
   511    See Also
       
   512    * CyAsHalSleepChannel
       
   513    * CyAsHalDestroySleepChannel
       
   514    * CyAsHalSleepOn
       
   515    * CyAsHalWake
       
   516 */
       
   517 EXTERN CyBool
       
   518 CyAsHalCreateSleepChannel(
       
   519 	CyAsHalSleepChannel		*chan		/* Pointer to the sleep channel to create/initialize */
       
   520 	) ;
       
   521 
       
   522 /* Summary
       
   523    This function destroys an existing sleep channel
       
   524 
       
   525    Description
       
   526    This function destroys an existing sleep channel.  The sleep channel is of type
       
   527    CyAsHalSleepChannel.
       
   528 
       
   529    Returns
       
   530    CyTrue if the channel was destroyed, and CyFalse otherwise
       
   531 
       
   532    See Also
       
   533    * CyAsHalSleepChannel
       
   534    * CyAsHalCreateSleepChannel
       
   535    * CyAsHalSleepOn
       
   536    * CyAsHalWake
       
   537 */
       
   538 EXTERN CyBool
       
   539 CyAsHalDestroySleepChannel(
       
   540 	CyAsHalSleepChannel		chan		/* The sleep channel to destroy */
       
   541 	) ;
       
   542 
       
   543 /* Summary
       
   544    This function causes the calling process or thread to sleep until CyAsHalWake() is called
       
   545 
       
   546    Description
       
   547    This function causes the calling process or threadvto sleep.  When CyAsHalWake() is called 
       
   548    on the same sleep channel, this processes or thread is then wakened and allowed to run
       
   549 
       
   550    Returns
       
   551    CyTrue if the thread or process is asleep, and CyFalse otherwise
       
   552 
       
   553    See Also
       
   554    * CyAsHalSleepChannel
       
   555    * CyAsHalWake
       
   556 */
       
   557 EXTERN CyBool
       
   558 CyAsHalSleepOn(
       
   559 	CyAsHalSleepChannel		chan,		/* The sleep channel to sleep on */
       
   560 	uint32_t				ms			/* The maximum time to sleep in milli-seconds */
       
   561 	) ;
       
   562 
       
   563 /* Summary
       
   564    This function casues the process or thread sleeping on the given sleep channel to wake
       
   565 
       
   566    Description
       
   567    This function causes the process or thread sleeping on the given sleep channel to wake.  The
       
   568    channel
       
   569 
       
   570    Returns
       
   571    CyTrue if the thread or process is awake, and CyFalse otherwise
       
   572 
       
   573    See Also
       
   574    * CyAsHalSleepChannel
       
   575    * CyAsHalSleepOn
       
   576 */
       
   577 EXTERN CyBool
       
   578 CyAsHalWake(
       
   579 	CyAsHalSleepChannel		chan		/* The sleep channel to wake */
       
   580 	) ;
       
   581 
       
   582 /* Summary
       
   583    This function disables interrupts, insuring that short bursts of code can be run without danger of interrupt
       
   584    handlers running.
       
   585 
       
   586    Description
       
   587    There are cases within the API when lists must be manipulated by both the API and the associated
       
   588    interrupt handlers.  In these cases, interrupts must be disabled to insure the integrity of the list during the 
       
   589    modification.  This function is used to disable interrupts during the short intervals where these lists are being
       
   590    changed.
       
   591 
       
   592    The HAL must have the ability to nest calls to CyAsHalDisableInterrupts and CyAsHalEnableInterrupts.
       
   593 
       
   594    Returns
       
   595    Any interrupt related state value which will be passed back into the subsequent CyAsHalEnableInterrupts call.
       
   596 
       
   597    See Also
       
   598    * CyAsHalEnableInterrupts
       
   599 */
       
   600 EXTERN uint32_t
       
   601 CyAsHalDisableInterrupts() ;
       
   602 
       
   603 /* Summary
       
   604    This function re-enables interrupts after a critical section of code in the API has been completed.
       
   605 
       
   606    Description
       
   607    There are cases within the API when lists must be manipulated by both the API and the associated
       
   608    interrupt handlers.  In these cases, interrupts must be disabled to insure the integrity of the list during the 
       
   609    modification.  This function is used to enable interrupts after the short intervals where these lists are being
       
   610    changed.
       
   611 
       
   612    See Also
       
   613    * CyAsHalDisableInterrupts
       
   614 */
       
   615 EXTERN void
       
   616 CyAsHalEnableInterrupts(
       
   617         uint32_t value                          /* Value returned by the previous CyAsHalDisableInterrupts call. */
       
   618         ) ;
       
   619 
       
   620 /* Summary
       
   621    This function sleeps for 150 ns.
       
   622 
       
   623    Description
       
   624    This function sleeps for 150 ns before allowing the calling function to continue.  This function is used for a
       
   625    specific purpose and the sleep required is at least 150 ns.
       
   626 */
       
   627 EXTERN void
       
   628 CyAsHalSleep150(
       
   629         ) ;
       
   630 
       
   631 /* Summary
       
   632    This function sleeps for the given number of milliseconds
       
   633 
       
   634    Description
       
   635    This function sleeps for at least the given number of milliseonds
       
   636 */
       
   637 EXTERN void
       
   638 CyAsHalSleep(
       
   639         uint32_t ms
       
   640         ) ;
       
   641 
       
   642 /* Summary
       
   643    This function asserts when the condition evaluates to zero
       
   644 
       
   645    Description
       
   646    Within the API there are conditions which are checked to insure the integrity of the code.  These conditions are
       
   647    checked only within a DEBUG build.  This function is used to check the condition and if the result evaluates to
       
   648    zero, it should be considered a fatal error that should be reported to Cypress.
       
   649 */
       
   650 EXTERN void
       
   651 CyAsHalAssert(
       
   652 	CyBool					cond		/* The condition to evaluate */
       
   653 	) ;
       
   654 
       
   655 /* Summary
       
   656    This function prints a message from the API to a human readable device
       
   657 
       
   658    Description
       
   659    There are places within the West Bridge API where printing a message is useful to the debug process.  This function
       
   660    provides the mechanism to print a message.
       
   661 
       
   662    Returns
       
   663    NONE
       
   664 */
       
   665 EXTERN void
       
   666 CyAsHalPrintMessage(
       
   667 	const char *			fmt_p,		/* The message to print */
       
   668 	...						/* Variable arguments */
       
   669 	) ;
       
   670 
       
   671 /* Summary
       
   672    This function reports whether the HAL implementation uses polling to service
       
   673    data coming from the West Bridge.
       
   674 
       
   675    Description
       
   676    This function reports whether the HAL implementation uses polling to service
       
   677    data coming from the West Bridge.
       
   678 
       
   679    Returns
       
   680    CyTrue if the HAL polls the West Bridge Interrupt Status registers to complete operations,
       
   681    CyFalse if the HAL is interrupt driven.
       
   682  */
       
   683 EXTERN CyBool
       
   684 CyAsHalIsPolling (
       
   685         void) ;
       
   686 
       
   687 #endif