exi.h File Reference

#include <types.h>
#include <broadway.h>

Go to the source code of this file.

Enumerations

enum  exi_clock_t {
  EXI_CLOCK_1MHz = 0, EXI_CLOCK_2MHz, EXI_CLOCK_4MHz, EXI_CLOCK_8MHz,
  EXI_CLOCK_16MHz, EXI_CLOCK_32MHz
}
enum  exi_transfer_t { EXI_TRANSFER_READ = 0, EXI_TRANSFER_WRITE, EXI_TRANSFER_READ_WRITE }

Functions

void irq_exi_enable (u32 irq)
 Enables a specific EXI IRQ.
void irq_exi_disable (u32 irq)
 Disables a specific EXI IRQ.
int irq_exi_register_handler (u32 irqn, int(*exec)(u32 irq, void *data), void *data)
 Register an EXI IRQ handler.
irq_handler_t irq_exi_get_handler (u32 irqn)
 Gets an EXI IRQ handler.
int exi_initialize (void)
 Initialize the EXI subsystem.
int exi_shutdown (void)
 Shut down the EXI subsystem.
BOOL exi_set_lock (BOOL locked)
 Turn on/off EXI clock lock.
BOOL exi_set_clock (int chan, exi_clock_t clk)
 Set EXI clock frequency.
BOOL exi_device_select (int chan, int dev)
 Select EXI device.
BOOL exi_device_deselect (int chan, int dev)
 Deselect EXI device.
BOOL exi_device_connected (int chan)
 Checks if a device is connected.
BOOL exi_set_dma_address (int chan, u32 addr)
 Sets DMA start address.
BOOL exi_set_dma_length (int chan, u32 len)
 Sets DMA length.
BOOL exi_set_immediate_length (int chan, int len)
 Sets Immediate data length.
BOOL exi_transfer (int chan, exi_transfer_t type, BOOL dma)
 Perform an EXI transfer.
BOOL exi_transfer_ended (int chan)
 Check if an EXI transfer is complete.
u32 exi_immediate_recv (int chan)
 Get data from an Immediate EXI transfer.
BOOL exi_immediate_send (int chan, u32 data)
 Set data for an Immediate EXI transfer.

Detailed Description

An abstraction of the External Interface (EXI). Fairly low-level, so you need to know what you're doing (though if you didn't, why would you be touching this file).


Enumeration Type Documentation

Clock speeds for an EXI channel to run at.

Enumerator:
EXI_CLOCK_1MHz 

1MHz clock

EXI_CLOCK_2MHz 

2MHz clock

EXI_CLOCK_4MHz 

4MHz clock

EXI_CLOCK_8MHz 

8MHz clock

EXI_CLOCK_16MHz 

16MHz clock

EXI_CLOCK_32MHz 

32MHz clock. EXI clock lock must be disabled

Transfer modes for an EXI channel to use.

Enumerator:
EXI_TRANSFER_READ 

Read

EXI_TRANSFER_WRITE 

Write

EXI_TRANSFER_READ_WRITE 

Read and Write (invalid for DMA)


Function Documentation

BOOL exi_device_connected ( int  chan  ) 

Checks if a device is connected.

Parameters:
chan EXI channel to check for a device on. (0 ~ 2)
Returns:
TRUE if there is a device, FALSE if there is not a device
BOOL exi_device_deselect ( int  chan,
int  dev 
)

Deselect EXI device.

Parameters:
chan EXI channel to deselect a device for. (0 ~ 2)
dev device number to deselect. (0 ~ 2)
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_set_clock(), exi_device_select()
BOOL exi_device_select ( int  chan,
int  dev 
)

Select EXI device.

Parameters:
chan EXI channel to select a device for. (0 ~ 2)
dev device number to select. (0 ~ 2)
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_set_clock(), exi_device_deselect()
u32 exi_immediate_recv ( int  chan  ) 

Get data from an Immediate EXI transfer.

Parameters:
chan EXI channel to get data from. (0 ~ 2)
Returns:
The data retrieved from the EXI transfer.
See also:
exi_immediate_send()
BOOL exi_immediate_send ( int  chan,
u32  data 
)

Set data for an Immediate EXI transfer.

Parameters:
chan EXI channel to get data from. (0 ~ 2)
data the data sent during the EXI transfer.
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_immediate_recv()
int exi_initialize ( void   ) 

Initialize the EXI subsystem.

Initializes the EXI subsystem, registers the handler for the EXI interrupt and performs all other required initialization tasks.

Returns:
If initialization was successful, returns 1. Otherwise 0.
See also:
exi_shutdown()
BOOL exi_set_clock ( int  chan,
exi_clock_t  clk 
)

Set EXI clock frequency.

Parameters:
chan EXI channel to set the clock frequency of. (0 ~ 2)
freq exi_clock_t enumeration specifying the clock to operate at.
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_set_lock(), exi_device_select()
BOOL exi_set_dma_address ( int  chan,
u32  addr 
)

Sets DMA start address.

Parameters:
chan EXI channel to set the DMA start address for. (0 ~ 2)
addr address to set as the start address for DMA. (32byte aligned)
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_set_dma_length()
BOOL exi_set_dma_length ( int  chan,
u32  len 
)

Sets DMA length.

Parameters:
chan EXI channel to set the DMA length for. (0 ~ 2)
len length of the DMA. (32byte aligned)
Returns:
TRUE if setting was successful, FALSE otherwise.
See also:
exi_set_dma_address(), exi_set_immediate_length()
BOOL exi_set_immediate_length ( int  chan,
int  len 
)

Sets Immediate data length.

Parameters:
chan EXI channel to set the length of immediate data. (0 ~ 2)
len length of immediate data. (1 ~ 4)
Returns:
TRUE if setting was successful, FALSE otherwise.
BOOL exi_set_lock ( BOOL  locked  ) 

Turn on/off EXI clock lock.

Parameters:
locked TRUE to lock EXI clock, FALSE to unlock it.
Returns:
Returns the old EXI clock lock status.
int exi_shutdown ( void   ) 

Shut down the EXI subsystem.

Shuts down the EXI subsystem, unregisters the handler for the EXI interrupt and performs all other required shut down tasks.

Returns:
If shut down was successful, returns 1. Otherwise 0.
See also:
exi_initialize()
BOOL exi_transfer ( int  chan,
exi_transfer_t  type,
BOOL  dma 
)

Perform an EXI transfer.

Parameters:
chan EXI channel to transfer on. (0 ~ 2)
type exi_transfer_t enumeration specifying the transfer type.
dma TRUE if this is a DMA, FALSE for an immediate transfer.
Returns:
TRUE if transfer was successfully started, FALSE otherwise.
See also:
exi_transfer_ended()
BOOL exi_transfer_ended ( int  chan  ) 

Check if an EXI transfer is complete.

Parameters:
chan EXI channel to check for completion. (0 ~ 2)
Returns:
TRUE if transfer is complete, FALSE if transfer is still in progress.
See also:
exi_transfer()
void irq_exi_disable ( u32  irq  ) 

Disables a specific EXI IRQ.

Parameters:
irq the IRQ to disable
See also:
irq_exi_enable()
void irq_exi_enable ( u32  irq  ) 

Enables a specific EXI IRQ.

Parameters:
irq the IRQ to enable
See also:
irq_exi_disable()
irq_handler_t irq_exi_get_handler ( u32  irqn  ) 

Gets an EXI IRQ handler.

Gets the IRQ handler information for a EXI IRQ.

Parameters:
irqn the IRQ whose handler is to be returned.
Returns:
The irq_handler_t structure containing information about the handler.
See also:
irq_exi_register_handler()
int irq_exi_register_handler ( u32  irqn,
int(*)(u32 irq, void *data)  exec,
void *  data 
)

Register an EXI IRQ handler.

Parameters:
irqn the IRQ whose handle is to be registered.
exec the callback to be called when the IRQ fires. Pass NULL to unregister the IRQ.
data the data to be passed to the IRQ when it fires.
Returns:
Returns 1 on success, 0 on failure.
See also:
irq_exi_get_handler()
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3