123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- /*++
- Copyright (c) 2014 Minoca Corp. All Rights Reserved
- Module Name:
- omapuart.h
- Abstract:
- This header contains library definitions for the serial UART found on
- Texas Instruments OMAP3 and OMAP4 SoCs.
- Author:
- Evan Green 27-Feb-2014
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- /*++
- Structure Description:
- This structure defines the context for an OMAP UART controller. Upon
- initialization, the consumer of the library is responsible for initializing
- some of these values.
- Members:
- UartBase - Stores the base address of the UART. The consumer of the library
- should have initialized this value before calling the library
- initialize function.
- BaudRateRegister - Stores the value to put in the baud rate register. The
- consumer of this library should have initialized this value before
- calling the library initialize function.
- --*/
- typedef struct _OMAP_UART_CONTEXT {
- VOID *UartBase;
- UINT16 BaudRateRegister;
- } OMAP_UART_CONTEXT, *POMAP_UART_CONTEXT;
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // -------------------------------------------------------- Function Prototypes
- //
- EFI_STATUS
- EfipUartOmapComputeDivisor (
- UINTN BaudRate,
- UINT16 *Divisor
- );
- /*++
- Routine Description:
- This routine computes the divisor for the given baud rate.
- Arguments:
- BaudRate - Supplies the desired baud rate.
- Divisor - Supplies a pointer where the divisor will be returned on success.
- Return Value:
- EFI_SUCCESS on success.
- EFI_UNSUPPORTED if the baud rate cannot be achieved.
- --*/
- EFI_STATUS
- EfipUartOmapInitialize (
- POMAP_UART_CONTEXT Context
- );
- /*++
- Routine Description:
- This routine initializes the OMAP UART controller.
- Arguments:
- Context - Supplies the pointer to the port's context. The caller should
- have initialized some of these members.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfipUartOmapTransmit (
- POMAP_UART_CONTEXT Context,
- VOID *Data,
- UINTN Size
- );
- /*++
- Routine Description:
- This routine writes data out the serial port. This routine should busily
- spin if the previously sent byte has not finished transmitting.
- Arguments:
- Context - Supplies the pointer to the port context.
- Data - Supplies a pointer to the data to write.
- Size - Supplies the size to write, in bytes.
- Return Value:
- EFI_SUCCESS on success.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
- EFI_STATUS
- EfipUartOmapReceive (
- POMAP_UART_CONTEXT Context,
- VOID *Data,
- UINTN *Size
- );
- /*++
- Routine Description:
- This routine reads bytes from the serial port.
- Arguments:
- Context - Supplies the pointer to the port context.
- Data - Supplies a pointer where the read data will be returned on success.
- Size - Supplies a pointer that on input contains the size of the receive
- buffer. On output, returns the number of bytes read.
- Return Value:
- EFI_SUCCESS on success.
- EFI_NOT_READY if there was no data to be read at the current time.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
- EFI_STATUS
- EfipUartOmapGetStatus (
- POMAP_UART_CONTEXT Context,
- BOOLEAN *ReceiveDataAvailable
- );
- /*++
- Routine Description:
- This routine returns the current device status.
- Arguments:
- Context - Supplies a pointer to the serial port context.
- ReceiveDataAvailable - Supplies a pointer where a boolean will be returned
- indicating whether or not receive data is available.
- Return Value:
- EFI_SUCCESS on success.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
|