AM57x ICSS Switch Driver API Guide

Introduction
ICSS Switch Driver API provides the interface to Stacks to use the cut-through switch based on ICSS in AM57x. These APIs are used for configuring and communicating with Switch firmware.

ICSSSwitchInit
Function

Int8 ICSSSwitchInit(void);

Parameters


 * void
 * Return value: 0 on Success, -1 on Failure

Description Initializes the ICSS based Switch

PRUSSDRVSetPRUBuffer
Function

Int8 PRUSSDRVSetPRUBuffer(unsigned int pruinst, unsigned int * firmware_load,unsigned int firmware_length);

Parameters


 * firmware_load: start address of firmware to be loaded
 * firmware_length: size of firmware in number of instructions
 * pruinst: the pru to which firmware is to be loaded. Valid values: 0,1
 * Return value: 0 on Success,-1 on Failure

Description Loads firmware to PRU instruction memory

PRUSSDRVPruExecProgram
Function

Int8 PRUSSDRVPruExecProgram(unsigned int pruinst);

Parameters


 * pruinst: the pru to from which firmware is to be executed. Valid values: 0,1
 * Return value: 0 on Success,-1 on Failure

Description Starts firmware execution from PRU instruction memory

LoadStaticTable
Function

Int32 LoadStaticTable(const unsigned int * staticTable, Uint8 staticTableLength, Uint8 staticTableType);

Parameters


 * static_table: start address of the static table
 * static_table_length: length of the static table
 * static_table_type: type of static table (forward table (0) or receive table (1))
 * Return value: 0 on Success;-1 on Failure

Description Loads multicast static table to ICSS memory

PRUSSDRVPruEnable
Function

Int8 PRUSSDRVPruEnable(int pruinst);

Parameters


 * pruinst: the pru to from which firmware is to be executed. Valid values: 0,1
 * Return value: 0 on Success,-1 on Failure

Description Starts firmware execution from PRU instruction memory

StartSwitch
Function

Int8 StartSwitch(void);

Parameters


 * void
 * Return value:0 on Success, -1 on Failure

Description Starts the switch by enabling both the PRUs

StopSwitch
Function

Int8 StopSwitch(void);

Parameters


 * void
 * Return value:0 on success, -1 on Failure

Description Stops the switch by disabling both the PRUs

GetLinkStatus
Function

Uint8 GetLinkStatus(Uint32 port);

Parameters


 * port: Port number whose status is to be checked.Valid values:
 * PORT1 (1)
 * PORT2 (2)
 * 0 - Checks for atleast one port is up
 * Return value:1 if link up,0 if link is down

Description Finds the link status of a port

TxPacket
Function

Int32 TxPacket(const Uint8* srcAddress, Int32 portNumber, Int32 queuePriority, Int32 lengthOfPacket);

Parameters


 * src_address: Base address of the buffer where the frame to be transmitted resides
 * port_number: Port on which frame has to be transmitted. Valid values:
 * PORT1 (1)- Sends packet to port1
 * PORT2 (2)- Sends packet to port2
 * 0 - Driver uses Learning module to determine portnumber
 * queue_priority: Queue number in which frame will be queued for transmission. Valid values are:
 * QUEPRIO1(0)
 * QUEPRIO2(1)
 * QUEPRIO3(2)
 * QUEPRIO4(3)
 * length_of_packet: length of the frame in bytes
 * Return value:0 on Success, (&lt;0) on Failure

Description Queues a frame which has to be transmitted in the right port queue

RxPktGet
Function

Int32 RxPktGet(Uint32 dest_address, Int32 queue_number, Int32* port, Int32* more);

Parameters


 * dest_address: Base address of data buffer where received frame has to be stored
 * queue_number: Receive queue from which frame has to be copied. Valid values are:
 * QUEPRIO1(0)
 * QUEPRIO2(1)
 * QUEPRIO3(2)
 * QUEPRIO4(3)
 * port: Returns port number on which frame was received
 * more: Returns more which is set to 1 if there are more frames in the queue
 * Return value: Length of the frame received in number of bytes or -1 on Failure

Description Retrieves a frame from a host queue and copies it in the allocated stack buffer

RxPktInfo
Function

Int32 RxPktInfo(Int32* port_number, Int32* queue_number);

Parameters


 * port_number: Return pointer of port number where frame was received
 * queue_number: Return pointer of host queue where the received frame is queued
 * Return value:length of the received frame in bytes

Description Retrieves the information about the received frame which is then used to dequeue the frame from the host queues

GetMaxQueueFillLevel
Function

Int32 GetMaxQueueFillLevel(Int32 portNumber, Int32 queuePriority, Int32* queueOverflowCount);

Parameters


 * port_number: Port on which queue resides. Valid values are:
 * PORT0(0)
 * PORT1(1)
 * PORT2(2)
 * queue_priority: Priority of the queue or queue number whose fill level has to be found
 * queue_overflow_count: Return pointer to number of times queue has overflown
 * Return value: maximum fill level of the queue or <0 if there was error in the input parameters

Description Finds the maximum fill level of the queue in terms of 32 byte blocks. For example, if there was only one 64 byte packet received when this API is called then it would return value of 2. It also returns number of times queue has overflown.

SwitchLinkStatus
Function

void SwitchLinkStatus( Uint32 port, Uint32 phy ,Uint32 linkStatus );

Parameters


 * port: port on which the status is changed .Valid values are:
 * PORT1(1)
 * PORT2(2)
 * phy : phynumber of the port
 * linkStatus: status of the link (Valid range 0-5)
 * Return value:null

Description This is a callback from the Ethernet driver.This function updates the link status whenever there is a change

ICSSIoctl
Function

Int8 ICSSIoctl(enum t_portNum port, enum t_portCmd command);

Parameters


 * port: port number . Valid values are:
 * PORT1(1)
 * PORT2(2)
 * command: command whether to disable or enable(0 -Enable,1 -disable)
 * Return value:0 on success

Description Enables or disables the Ethernet port

consolidateStats
Function

void consolidateStats;

Parameters


 * none
 * Return value: none

Description Returns some of the ethernet statistics like number of RX frames, TX frame octets etc in the global structure Stats.

ICSSALEInit
Function

void ICSSALEInit;

Parameters


 * none
 * Return value: none

Description Initializes Learning module and clears ALE table

Note: Not used currently

ICSSALEAgeOutNow
Function

void ICSSALEAgeOutNow;

Parameters


 * none
 * Return value: none

Description Removes (free up) any aged table entry

Note: Not used currently

ICSSALEClearTable
Function

void ICSSALEClearTable;

Parameters


 * none
 * Return value: none

Description Clears ALE table entries

Note: Not used currently

ICSSALECounter
Function

void ICSSALECounter;

Parameters


 * none
 * Return value: none

Description Increments time counters in both the port tables.It is called periodically to implement Ageing.

Note: Not used currently