LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pru_can_emulation_api.c File Reference

Go to the source code of this file.

Functions

short pru_can_enable (void)
 pru_can_enable() Configure and Enable PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_disable (void)
 pru_can_disable() Disable PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_run (u8 u8prunum)
 pru_can_run () Allows the PRU0 or PRU1 of OMAP L138 to execute the code loaded into its Instruction RAM More...
 
short pru_can_psc_enable (void)
 pru_can_psc_enable () Enable state transition of PRU More...
 
short pru_can_psc_disable (void)
 pru_can_psc_disable () Disable state transition of PRU More...
 
short pru_can_ram_write_data (u32 u32offset, u32 *pu32datatowrite, u16 u16wordstowrite)
 pru_can_ram_write_data() Download the data into data RAM of PRU0 or PRU1 of OMAP L138. More...
 
short pru_can_ram_read_data (u32 u32offset, u32 *pu32datatoread, u16 u16wordstoread)
 pru_can_ram_read_data() Download the data into data RAM of PRU0 or PRU1 of OMAP L138. More...
 
short pru_can_download_firmware (pru_can_firmware_structure *pstrfirmwaredata, u8 u8prunum)
 pru_can_download_firmware() Download the firmware into PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_set_brp (u16 u16bitrateprescaler)
 pru_can_set_brp() Updates the BRP register of PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_set_bit_timing (can_bit_timing_consts *pstrcanbittiming)
 pru_can_set_bit_timing() Updates the timing register of PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_calculatetiming (u32 pru_freq, u32 bit_rate)
 pru_can_calculatetiming() Updates the timing values of PRU0 and PRU1 of OMAP L138. More...
 
short pru_can_write_data_to_mailbox (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_write_data_to_mailbox() Updates the transmit mailboxes of PRU1 of OMAP L138. More...
 
short pru_can_get_data_from_mailbox (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_get_data_from_mailbox() Receive data from the receive mailboxes of PRU0 of OMAP L138. More...
 
short pru_can_receive_id_map (u32 u32nodeid, can_mailbox_number ecanmailboxno)
 pru_can_receive_id_map() Receive mailboxes ID Mapping of PRU0 of OMAP L138. More...
 
short pru_can_get_interrupt_status (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_get_interrupt_status() Gets the interrupts status register value More...
 
short pru_can_get_global_status (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_get_global_status() Gets the globalstatus register value More...
 
short pru_can_get_mailbox_status (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_get_mailbox_status() Gets the mailbox status register value More...
 
short pru_can_transfer_mode_set (bool btransfer_flag, can_transfer_direction ecan_trx)
 
short pru_can_configuration_mode_set (bool bconfigmodeenabledisableflag)
 pru_can_configuration_mode_set() Sets the timing value for data transfer More...
 
short pru_can_emulation_init (arm_pru_iomap *pstr_pru_iomap, u32 u32pruclock)
 pru_can_emulation_init() Initializes the Can Emulation Parameters More...
 
short pru_can_emulation_open (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_emulation_open() Opens the can emulation for application to use More...
 
short pru_can_emulation_close (can_emulation_app_hndl *pstrcanemuapphndl)
 pru_can_emulation_close() Closes the can emulation for other applications to use More...
 
short pru_can_emulation_exit (void)
 pru_can_emulation_exit() Diables all the PRUs More...
 
short pru_can_emulation_sreset (void)
 
short pru_can_transfer (u8 u8mailboxnumber, u8 u8prunumber)
 
short pru_can_start_or_abort_transmission (bool bcantransmitabortflag)
 
short pru_can_check_init_status (void)
 
short pru_can_mask_ints (u32 int_mask)
 
int pru_can_get_error_cnt (u8 u8prunumber)
 
int pru_can_intc_status_get (void)
 

Variables

can_emulation_drv_inst gstrcanemulationinst [ecanmaxinst]
 
arm_pru_iomap str_pru_iomap
 
u32 gu32canpruiomapaddress
 
u32 gu32cansyscfgmapaddress
 
u32 gu32canpsc1mapaddress
 
u32 gu32canpsc0mapaddress
 
u32 gu32pruclock
 

Function Documentation

short pru_can_calculatetiming ( u32  pru_freq,
u32  bit_rate 
)

pru_can_calculatetiming() Updates the timing values of PRU0 and PRU1 of OMAP L138.

End of pru_can_set_bit_timing() ******************************************************************************************************** This API will be called by the Application to updtae the timing values of PRU0 and PRU1

Parameters
u32canbittimingBit timing values for can bus
u32bitrateprescalerBit Rate Prescaler for can bus
Returns
SUCCESS or FAILURE

Definition at line 498 of file pru_can_emulation_api.c.

short pru_can_check_init_status ( void  )

Definition at line 1810 of file pru_can_emulation_api.c.

short pru_can_configuration_mode_set ( bool  bconfigmodeenabledisableflag)

pru_can_configuration_mode_set() Sets the timing value for data transfer


This API will be called by the Application to set timing valus for data transfer

Parameters
bconfigmodeenabledisableflagset the timing parameters
Returns
SUCCESS or FAILURE

Definition at line 957 of file pru_can_emulation_api.c.

short pru_can_disable ( void  )

pru_can_disable() Disable PRU0 and PRU1 of OMAP L138.


This API will be called by the Application to disable PRU0 and PRU1

Parameters
None
Returns
SUCCESS or FAILURE

Definition at line 92 of file pru_can_emulation_api.c.

short pru_can_download_firmware ( pru_can_firmware_structure pstrfirmwaredata,
u8  u8prunum 
)

pru_can_download_firmware() Download the firmware into PRU0 and PRU1 of OMAP L138.


This API will be called by the Application to download the code into instruction RAM of PRU0 and PRU1

Parameters
pstrfirmwaredataPointer to structure holding firmware data
u8prunumThe PRU number to download firmware
Returns
SUCCESS or FAILURE

Check for valid input parameter

Choose the PRU to be loaded with instructions

Copy PRU code to its instruction RAM

Definition at line 378 of file pru_can_emulation_api.c.

short pru_can_emulation_close ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_emulation_close() Closes the can emulation for other applications to use

End of pru_can_emulation_open() ******************************************************************************************************** This API will be called by the Application to Close the can emulation for other applications to use

Parameters
pstrcanemuapphndlPointer to application handler structure
Returns
SUCCESS or FAILURE

Definition at line 1505 of file pru_can_emulation_api.c.

short pru_can_emulation_exit ( void  )

pru_can_emulation_exit() Diables all the PRUs

End of pru_can_emulation_close() ******************************************************************************************************** This API will be called by the Application to disable all PRUs

Parameters
None
Returns
SUCCESS or FAILURE

Definition at line 1543 of file pru_can_emulation_api.c.

short pru_can_emulation_init ( arm_pru_iomap pstr_pru_iomap,
u32  u32pruclock 
)

pru_can_emulation_init() Initializes the Can Emulation Parameters

End of pru_can_configuration_mode_set() ******************************************************************************************************** This API will be called by the Application to Initialize the Can Emulation Parameters

Parameters
pstr_pru_iomapPointer to structure holding the io map addresses
u32pruclockPRU Clock value
Returns
SUCCESS or FAILURE

Definition at line 992 of file pru_can_emulation_api.c.

short pru_can_emulation_open ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_emulation_open() Opens the can emulation for application to use

End of pru_can_emulation_init() ******************************************************************************************************** This API will be called by the Application to Open the can emulation for application to use

Parameters
pstrcanemuapphndlPointer to application handler structure
Returns
SUCCESS or FAILURE

Definition at line 1469 of file pru_can_emulation_api.c.

short pru_can_emulation_sreset ( void  )

End of pru_can_emulation_exit()

Definition at line 1557 of file pru_can_emulation_api.c.

short pru_can_enable ( void  )

pru_can_enable() Configure and Enable PRU0 and PRU1 of OMAP L138.


This API will be called by the Application to Configure and Enable PRU0 and PRU1

Parameters
None
Returns
SUCCESS or FAILURE

Definition at line 48 of file pru_can_emulation_api.c.

short pru_can_get_data_from_mailbox ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_get_data_from_mailbox() Receive data from the receive mailboxes of PRU0 of OMAP L138.

End of pru_can_write_data_to_mailbox() ******************************************************************************************************** This API will be called by the Application to get data from the receive mailboxes of PRU0

Parameters
pu16canframedataCan mailbox data buffer
u8mailboxnumMailbox to be updated
Returns
SUCCESS or FAILURE

Definition at line 605 of file pru_can_emulation_api.c.

int pru_can_get_error_cnt ( u8  u8prunumber)

Definition at line 1818 of file pru_can_emulation_api.c.

short pru_can_get_global_status ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_get_global_status() Gets the globalstatus register value

End of pru_can_get_interrupt_status() ******************************************************************************************************** This API will be called by the Application to get the global status register value

Parameters
pu32globalstatusPointer to a var where global status register value has to be written
u8prunumberPRU number for which GlobalStatusReg has to be read
Returns
SUCCESS or FAILURE

Definition at line 734 of file pru_can_emulation_api.c.

short pru_can_get_interrupt_status ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_get_interrupt_status() Gets the interrupts status register value

End of pru_can_receive_id_map() ******************************************************************************************************** This API will be called by the Application to get the interrupts status register value

Parameters
pu32intrstatusPointer to a var where interrupt status register value has to be written
u8prunumberPRU number for which IntStatusReg has to be read
Returns
SUCCESS or FAILURE

Definition at line 690 of file pru_can_emulation_api.c.

short pru_can_get_mailbox_status ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_get_mailbox_status() Gets the mailbox status register value

End of pru_can_get_global_status() ******************************************************************************************************** This API will be called by the Application to get the mailbox status register value

Parameters
pu32globalstatusPointer to a var where global status register value has to be written
u8prunumberPRU number for which GlobalStatusReg has to be read
Returns
SUCCESS or FAILURE

Definition at line 781 of file pru_can_emulation_api.c.

int pru_can_intc_status_get ( void  )

Definition at line 1822 of file pru_can_emulation_api.c.

short pru_can_mask_ints ( u32  int_mask)

Definition at line 1814 of file pru_can_emulation_api.c.

short pru_can_psc_disable ( void  )

pru_can_psc_disable () Disable state transition of PRU


This API will be called by the Application for disabling state transition of PRU

Parameters
None
Returns
SUCCESS or FAILURE

Wait for any outstanding transition to complete

If the process is timed out return failure

If already in that state, just return

Perform transition

Wait for transition to complete

If the process is timed out return failure

Wait and verify the state

If the process is timed out return failure

Definition at line 240 of file pru_can_emulation_api.c.

short pru_can_psc_enable ( void  )

pru_can_psc_enable () Enable state transition of PRU


This API will be called by the Application for state transition of PRU

Parameters
None
Returns
SUCCESS or FAILURE

Wait for any outstanding transition to complete

If the process is timed out return failure

If already in that state, just return

Perform transition

Wait for transition to complete

If the process is timed out return failure

Wait and verify the state

If the process is timed out return failure

Definition at line 164 of file pru_can_emulation_api.c.

short pru_can_ram_read_data ( u32  u32offset,
u32 pu32datatoread,
u16  u16wordstoread 
)

pru_can_ram_read_data() Download the data into data RAM of PRU0 or PRU1 of OMAP L138.


This API will be called by the Application to read the data from data RAM of PRU0 or PRU1

Parameters
u32offsetOffset of the data RAM where the data has to be read
pu32datatoreadPointer to a buffer that would hold the data to be read from the RAM
u16wordstoreadNumber of words to be read from RAM
Returns
SUCCESS or FAILURE

Definition at line 349 of file pru_can_emulation_api.c.

short pru_can_ram_write_data ( u32  u32offset,
u32 pu32datatowrite,
u16  u16wordstowrite 
)

pru_can_ram_write_data() Download the data into data RAM of PRU0 or PRU1 of OMAP L138.


This API will be called by the Application to download the data into data RAM of PRU0 or PRU1

Parameters
u32offsetOffset of the data RAM where the data has to be written
pu32datatowritePointer to a buffer that holds the data to be written into RAM
u16wordstowriteNumber of words to be written into that RAM
Returns
SUCCESS or FAILURE

Definition at line 320 of file pru_can_emulation_api.c.

short pru_can_receive_id_map ( u32  u32nodeid,
can_mailbox_number  ecanmailboxno 
)

pru_can_receive_id_map() Receive mailboxes ID Mapping of PRU0 of OMAP L138.

End of pru_can_get_data_from_mailbox() ******************************************************************************************************** This API will be called by the Application to map the IDs to receive mailboxes of PRU0

Parameters
u32nodeidCan node ID
ecanmailboxnoMailbox to be mapped
Returns
SUCCESS or FAILURE

Definition at line 668 of file pru_can_emulation_api.c.

short pru_can_run ( u8  u8prunum)

pru_can_run () Allows the PRU0 or PRU1 of OMAP L138 to execute the code loaded into its Instruction RAM


This API will be called by the Application to execute the instruction in PRU

Parameters
u8prunumThe PRU number to initiate execution
Returns
SUCCESS or FAILURE

Definition at line 131 of file pru_can_emulation_api.c.

short pru_can_set_bit_timing ( can_bit_timing_consts pstrcanbittiming)

pru_can_set_bit_timing() Updates the timing register of PRU0 and PRU1 of OMAP L138.

End of pru_can_set_brp() ******************************************************************************************************** This API will be called by the Application to updtae the timing register of PRU0 and PRU1

Parameters
pstrcanbittimingPointer to structure holding the bit timing values for can bus
Returns
SUCCESS or FAILURE

Definition at line 455 of file pru_can_emulation_api.c.

short pru_can_set_brp ( u16  u16bitrateprescaler)

pru_can_set_brp() Updates the BRP register of PRU0 and PRU1 of OMAP L138.


This API will be called by the Application to updtae the BRP register of PRU0 and PRU1

Parameters
u16bitrateprescalerThe can bus bitrate prescaler value be set
Returns
SUCCESS or FAILURE

Definition at line 425 of file pru_can_emulation_api.c.

short pru_can_start_or_abort_transmission ( bool  bcantransmitabortflag)

Definition at line 1789 of file pru_can_emulation_api.c.

short pru_can_transfer ( u8  u8mailboxnumber,
u8  u8prunumber 
)

Definition at line 1561 of file pru_can_emulation_api.c.

short pru_can_transfer_mode_set ( bool  btransfer_flag,
can_transfer_direction  ecan_trx 
)

End of pru_can_get_mailbox_status()

Definition at line 905 of file pru_can_emulation_api.c.

short pru_can_write_data_to_mailbox ( can_emulation_app_hndl pstrcanemuapphndl)

pru_can_write_data_to_mailbox() Updates the transmit mailboxes of PRU1 of OMAP L138.

End of pru_can_calculatetiming() ******************************************************************************************************** This API will be called by the Application to updtae the transmit mailboxes of PRU1

Parameters
pu16canframedataCan mailbox data buffer
u8mailboxnumMailbox to be updated
Returns
SUCCESS or FAILURE

Definition at line 545 of file pru_can_emulation_api.c.

Variable Documentation

can_emulation_drv_inst gstrcanemulationinst[ecanmaxinst]

Definition at line 30 of file pru_can_emulation_api.c.

u32 gu32canpruiomapaddress

Definition at line 32 of file pru_can_emulation_api.c.

u32 gu32canpsc0mapaddress

Definition at line 35 of file pru_can_emulation_api.c.

u32 gu32canpsc1mapaddress

Definition at line 34 of file pru_can_emulation_api.c.

u32 gu32cansyscfgmapaddress

Definition at line 33 of file pru_can_emulation_api.c.

u32 gu32pruclock

Definition at line 36 of file pru_can_emulation_api.c.

arm_pru_iomap str_pru_iomap

Definition at line 31 of file pru_can_emulation_api.c.