51 short s16returncapture;
57 sysCfg0->KICK0R = 0x83E70B13;
58 sysCfg0->KICK1R = 0x95A4F1E0;
60 sysCfg0->KICK0R = 0x0;
61 sysCfg0->KICK1R = 0x0;
65 if (s16returncapture == -1) {
94 short s16returncapture;
99 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_COUNTENABLE, DISABLE);
100 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_ENABLE, DISABLE);
107 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_COUNTENABLE, DISABLE);
108 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_ENABLE, DISABLE);
114 if (s16returncapture == -1) {
148 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_COUNTENABLE, ENABLE);
149 CSL_FINST(hPru->CONTROL, PRUCORE_CONTROL_ENABLE, ENABLE);
166 bool btransitioncomplete;
170 btransitioncomplete =
false;
173 while (btransitioncomplete ==
false) {
174 if (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
176 btransitioncomplete =
true;
196 btransitioncomplete =
false;
199 while (btransitioncomplete ==
false) {
200 if (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
202 btransitioncomplete =
true;
212 btransitioncomplete =
false;
215 while (btransitioncomplete ==
false) {
218 btransitioncomplete =
true;
243 bool btransitioncomplete;
247 btransitioncomplete =
false;
250 while (btransitioncomplete ==
false) {
251 if (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
253 btransitioncomplete =
true;
273 btransitioncomplete =
false;
276 while (btransitioncomplete ==
false) {
277 if (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
279 btransitioncomplete =
true;
289 btransitioncomplete =
false;
292 while (btransitioncomplete ==
false) {
295 btransitioncomplete =
true;
320 (
u32 u32offset,
u32 * pu32datatowrite,
u16 u16wordstowrite) {
322 u32 *pu32addresstowrite;
325 pu32addresstowrite = (
u32 *) (u32offset);
327 for (u16loop = 0; u16loop < u16wordstowrite; u16loop++) {
328 *pu32addresstowrite = *pu32datatowrite;
330 pu32addresstowrite++;
349 (
u32 u32offset,
u32 * pu32datatoread,
u16 u16wordstoread) {
351 u32 *pu32addresstoread;
354 pu32addresstoread = (
u32 *) (u32offset);
356 for (u16loop = 0; u16loop < u16wordstoread; u16loop++) {
357 *pu32datatoread = *pu32addresstoread;
380 u32 *pu32pruinstructionram;
381 u32 u32codesizeinwords;
385 pu32pruinstructionram =
NULL;
386 u32codesizeinwords = 0;
389 if (pstrfirmwaredata ==
NULL) {
394 pu32pruinstructionram =
399 pu32pruinstructionram =
408 for (u32counter = 0; u32counter < u32codesizeinwords; u32counter++) {
409 pu32pruinstructionram[u32counter] = pu32prucode[u32counter];
429 if (u16bitrateprescaler > 255) {
462 if (pstrcanbittiming ==
NULL) {
472 u32serregister = u32serregister |
516 u16phaseseg1 = (
u16) (u32TimingValue / 2);
517 u16phaseseg2 = u32TimingValue - u16phaseseg1;
520 u32SetupValue = (u16phaseseg1 << 16) | u16phaseseg2;
546 short s16subrtnretval;
549 if (pstrcanemuapphndl ==
NULL) {
585 if (s16subrtnretval == -1) {
607 short s16subrtnretval;
610 if (pstrcanemuapphndl ==
NULL) {
649 if (s16subrtnretval == -1) {
672 (
u32 *) & u32nodeid, 1);
692 short s16subrtnretval = -1;
694 if (pstrcanemuapphndl ==
NULL) {
714 if (s16subrtnretval == -1) {
736 int s16subrtnretval = -1;
738 if (pstrcanemuapphndl ==
NULL) {
761 if (s16subrtnretval == -1) {
783 short s16subrtnretval = -1;
785 if (pstrcanemuapphndl ==
NULL) {
895 if (s16subrtnretval == -1) {
914 if (btransfer_flag ==
true) {
930 if (btransfer_flag ==
true) {
959 u32 u32bitrateprescaler;
964 (
u32 *) & u32bitrateprescaler, 1);
966 (
u32 *) & u32canbittiming, 1);
968 if (bconfigmodeenabledisableflag == 1) {
996 short s16subrtnretval = -1;
1017 u32value = 0x00000000;
1019 if (s16subrtnretval == -1) {
1026 u32value = 0x00000040;
1028 if (s16subrtnretval == -1) {
1034 u32value = 0x00000040;
1036 if (s16subrtnretval == -1) {
1043 u32value = 0x00004000;
1045 if (s16subrtnretval == -1) {
1052 u32value = 0x00000000;
1054 if (s16subrtnretval == -1) {
1061 u32value = 0x00000001;
1063 if (s16subrtnretval == -1) {
1070 u32value = 0x00000001;
1072 if (s16subrtnretval == -1) {
1079 u32value = 0x00000001;
1081 if (s16subrtnretval == -1) {
1088 u32value = 0x00000001;
1090 if (s16subrtnretval == -1) {
1097 u32value = 0x00000001;
1099 if (s16subrtnretval == -1) {
1106 u32value = 0x00000001;
1108 if (s16subrtnretval == -1) {
1115 u32value = 0x00000001;
1117 if (s16subrtnretval == -1) {
1124 u32value = 0x00000001;
1126 if (s16subrtnretval == -1) {
1133 u32value = 0x00000000;
1135 if (s16subrtnretval == -1) {
1141 u32value = 0x00000000;
1143 if (s16subrtnretval == -1) {
1149 u32value = 0x00000000;
1151 if (s16subrtnretval == -1) {
1158 u32value = 0x00000000;
1160 if (s16subrtnretval == -1) {
1167 u32value = 0xFFFFFFFF;
1169 if (s16subrtnretval == -1) {
1175 u32value = 0xFFFFFFFF;
1177 if (s16subrtnretval == -1) {
1183 u32value = 0x1C000000;
1185 if (s16subrtnretval == -1) {
1191 u32value = 0x00000000;
1193 if (s16subrtnretval == -1) {
1201 if (s16subrtnretval == -1) {
1209 if (s16subrtnretval == -1) {
1216 if (s16subrtnretval == -1) {
1221 u32value = 0x03020100;
1223 if (s16subrtnretval == -1) {
1228 u32value = 0x07060504;
1230 if (s16subrtnretval == -1) {
1235 u32value = 0x0000908;
1237 if (s16subrtnretval == -1) {
1244 if (s16subrtnretval == -1) {
1249 u32value = 0x00020200;
1251 if (s16subrtnretval == -1) {
1258 if (s16subrtnretval == -1) {
1265 if (s16subrtnretval == -1) {
1272 if (s16subrtnretval == -1) {
1278 if (s16subrtnretval == -1) {
1285 if (s16subrtnretval == -1) {
1292 if (s16subrtnretval == -1) {
1299 if (s16subrtnretval == -1) {
1308 if (s16subrtnretval == -1) {
1316 if (s16subrtnretval == -1) {
1325 u32value = 0x00000000;
1327 if (s16subrtnretval == -1) {
1334 u32value = 0x00000040;
1336 if (s16subrtnretval == -1) {
1343 u32value = 0x00004000;
1345 if (s16subrtnretval == -1) {
1352 u32value = 0x00000000;
1354 if (s16subrtnretval == -1) {
1361 u32value = 0x00000000;
1363 if (s16subrtnretval == -1) {
1370 u32value = 0x0000000;
1372 if (s16subrtnretval == -1) {
1379 u32value = 0x00000000;
1381 if (s16subrtnretval == -1) {
1388 u32value = 0x00000000;
1390 if (s16subrtnretval == -1) {
1397 u32value = 0x00000000;
1399 if (s16subrtnretval == -1) {
1406 u32value = 0x00000000;
1408 if (s16subrtnretval == -1) {
1415 u32value = 0x00000000;
1417 if (s16subrtnretval == -1) {
1424 u32value = 0x00000000;
1426 if (s16subrtnretval == -1) {
1433 u32value = 0x00000000;
1435 if (s16subrtnretval == -1) {
1441 u32value = 0x0000000;
1443 if (s16subrtnretval == -1) {
1449 u32value = 0x00000000;
1451 if (s16subrtnretval == -1) {
1472 if (pstrcanemuapphndl ==
NULL) {
1476 if (gstrcanemulationinst[pstrcanemuapphndl->
ecaninstance].
1477 bcaninststate == 1) {
1484 ecantransferdirection =
1486 ecantransferdirection;
1488 u32apphandlerptr = (
u32) pstrcanemuapphndl;
1508 if (pstrcanemuapphndl ==
NULL) {
1511 if (gstrcanemulationinst[pstrcanemuapphndl->
ecaninstance].
1512 bcaninststate == 0) {
1515 if ((
u32) pstrcanemuapphndl !=
1526 u32apphandlerptr = 0;
1545 short s16subrtnretval;
1548 if (s16subrtnretval == -1) {
1564 short s16subrtnretval = -1;
1567 switch (u8mailboxnumber) {
1572 u32value = 0x00000080;
1576 if (s16subrtnretval == -1) {
1584 u32value = 0x00000080;
1588 if (s16subrtnretval == -1) {
1596 u32value = 0x00000080;
1600 if (s16subrtnretval == -1) {
1608 u32value = 0x00000080;
1612 if (s16subrtnretval == -1) {
1620 u32value = 0x00000080;
1624 if (s16subrtnretval == -1) {
1632 u32value = 0x00000080;
1636 if (s16subrtnretval == -1) {
1644 u32value = 0x00000080;
1648 if (s16subrtnretval == -1) {
1656 u32value = 0x00000080;
1660 if (s16subrtnretval == -1) {
1672 u32value = 0x00000000;
1675 if (s16subrtnretval == -1) {
1678 u32value = u32value & ~(1 << u8mailboxnumber);
1681 if (s16subrtnretval == -1) {
1685 switch (u8mailboxnumber) {
1690 u32value = 0x00000000;
1694 if (s16subrtnretval == -1) {
1702 u32value = 0x00000000;
1706 if (s16subrtnretval == -1) {
1714 u32value = 0x00000000;
1718 if (s16subrtnretval == -1) {
1726 u32value = 0x00000000;
1730 if (s16subrtnretval == -1) {
1738 u32value = 0x00000000;
1742 if (s16subrtnretval == -1) {
1750 u32value = 0x00000000;
1754 if (s16subrtnretval == -1) {
1762 u32value = 0x00000000;
1766 if (s16subrtnretval == -1) {
1774 u32value = 0x00000000;
1778 if (s16subrtnretval == -1) {
1792 short s16subrtnretval;
1804 if (s16subrtnretval == -1) {
1825 u32 u32getvalue = 0;
1826 u32 u32clrvalue = 0;
1831 if (u32getvalue & 4)
1834 if (u32getvalue & 2)
short pru_can_emulation_exit(void)
pru_can_emulation_exit() Diables all the PRUs
#define PRU_CAN_RX_TIMING_REGISTER
#define PRU0_PROG_RAM_START_OFFSET
short pru_can_enable(void)
pru_can_enable() Configure and Enable PRU0 and PRU1 of OMAP L138.
#define PRU_CAN_TX_MAILBOX2
#define PRU_INTC_STATCLRINT1
#define CSL_FEXT(reg, PER_REG_FIELD)
#define PRU_INTC_STATIDXCLR
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.
#define CSL_SYSCFG_CFGCHIP3_PRUEVTSEL_ALTERNATE
#define PRU_INTC_HOSTMAP2
#define CSL_PRUCORE_CONTROL_RESETVAL
can_transfer_direction ecantransferdirection
#define PRU_CAN_TX_CLOCK_BRP_REGISTER
short pru_can_emulation_open(can_emulation_app_hndl *pstrcanemuapphndl)
pru_can_emulation_open() Opens the can emulation for application to use
#define PRU_INTC_HOSTINTEN
#define PRU_INTC_HSTINTENIDXSET
short pru_can_get_mailbox_status(can_emulation_app_hndl *pstrcanemuapphndl)
pru_can_get_mailbox_status() Gets the mailbox status register value
short pru_can_disable(void)
pru_can_disable() Disable PRU0 and PRU1 of OMAP L138.
#define PRU_INTC_POLARITY0
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.
#define PRU_CAN_TX_MAILBOX7
#define PRU_CAN_TX_MAILBOX5
short pru_can_transfer_mode_set(bool btransfer_flag, can_transfer_direction ecan_trx)
#define CSL_PRUCANCORE_0_REGS
#define PRU_CAN_TX_MAILBOX1
#define PRU_CAN_RX_CLOCK_BRP_REGISTER
#define CSL_PSC_MDSTAT_STATE_SYNCRST
#define PRU_CAN_RX_INTERRUPT_MASK_REGISTER
#define PRU_CAN_RX_MAILBOX3
#define PRU_CAN_RX_MAILBOX2
#define PRU_CAN_RX_MAILBOX1
#define PRU1_PROG_RAM_START_OFFSET
#define PRU_CAN_RX_MAILBOX3_STATUS_REGISTER
#define PRU_CAN_TX_MAILBOX1_STATUS_REGISTER
#define PRU_CAN_RX_MAILBOX6
short pru_can_psc_disable(void)
pru_can_psc_disable () Disable state transition of PRU
short pru_can_set_brp(u16 u16bitrateprescaler)
pru_can_set_brp() Updates the BRP register of PRU0 and PRU1 of OMAP L138.
short pru_can_emulation_close(can_emulation_app_hndl *pstrcanemuapphndl)
pru_can_emulation_close() Closes the can emulation for other applications to use
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.
u32 gu32canpsc0mapaddress
can_instance_enum ecaninstance
#define PRU_CAN_RX_GLOBAL_CONTROL_REGISTER
#define PRU_CAN_TX_MAILBOX3
#define PRU_CAN_RX_MAILBOX7
can_mailbox_number ecanmailboxnumber
#define TIMER_SETUP_DELAY
#define PRU_CAN_RX_MAILBOX7_STATUS_REGISTER
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.
#define PRU_CAN_RX_MAILBOX5_STATUS_REGISTER
#define CSL_PSC_PTSTAT_GOSTAT0_IN_TRANSITION
short pru_can_start_or_abort_transmission(bool bcantransmitabortflag)
#define PRU_CAN_MAX_PHSEG2
short pru_ram_read_data_4byte(unsigned int u32offset, unsigned int *pu32datatoread, short u16wordstoread)
pru_ram_read_data_4byte() Download the data into data RAM of PRU0 or PRU1 of OMAP L138...
volatile CSL_SyscfgRegs * CSL_SyscfgRegsOvly
#define PRU_CAN_TX_GLOBAL_STATUS_REGISTER
short pru_can_get_interrupt_status(can_emulation_app_hndl *pstrcanemuapphndl)
pru_can_get_interrupt_status() Gets the interrupts status register value
short pru_can_calculatetiming(u32 pru_freq, u32 bit_rate)
pru_can_calculatetiming() Updates the timing values of PRU0 and PRU1 of OMAP L138.
#define PRU_CAN_TX_INTERRUPT_MASK_REGISTER
#define PRU_INTC_STATIDXSET
#define PRU_CAN_RX_MAILBOX5
#define PRU_INTC_CHANMAP0
short pru_can_psc_enable(void)
pru_can_psc_enable () Enable state transition of PRU
#define PRU_CAN_TX_MAILBOX4_STATUS_REGISTER
#define PRU_CAN_RX_MAILBOX4_STATUS_REGISTER
#define PRU_CAN_TIMING_VAL_TX_SJW
short pru_can_mask_ints(u32 int_mask)
#define PRU_CAN_RX_MAILBOX0_STATUS_REGISTER
#define PRU_CAN_RX_MAILBOX2_STATUS_REGISTER
#define PRU_CAN_TX_INTERRUPT_STATUS_REGISTER
short pru_can_check_init_status(void)
#define PRU_INTC_HOSTMAP0
#define PRU_CAN_TX_MAILBOX6_STATUS_REGISTER
#define PRU_CAN_MAX_PHSEG1
#define CSL_SYSCFG_CFGCHIP3_PRUEVTSEL_SHIFT
#define PRU_CAN_RX_MAILBOX6_STATUS_REGISTER
#define CSL_PRUCORE_0
Peripheral Instance of PRU CORE instances.
#define PRU_CAN_TX_MAILBOX6
#define DELAY_LOOP_LENGTH
#define PRU_CAN_INIT_MAX_TIMEOUT
#define PRU_CAN_TX_MAILBOX7_STATUS_REGISTER
#define PRU_CAN_TX_MAILBOX0_STATUS_REGISTER
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.
u32 gu32canpsc1mapaddress
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 R...
#define PRU_INTC_POLARITY1
volatile CSL_PscRegs * CSL_PscRegsOvly
#define PRU_CAN_TIMING_VAL_TX
#define PRU_CAN_RX_MAILBOX4
int pru_can_get_error_cnt(u8 u8prunumber)
#define PRU_CAN_RX_MAILBOX0
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...
#define PRU_INTC_HOSTMAP1
short pru_can_emulation_sreset(void)
int pru_can_intc_status_get(void)
short pru_can_transfer(u8 u8mailboxnumber, u8 u8prunumber)
#define PRU_CAN_TX_TIMING_REGISTER
#define PRU_CAN_RX_GLOBAL_STATUS_REGISTER
#define PRU_CAN_RX_MAILBOX8
#define CSL_FINST(reg, PER_REG_FIELD, TOKEN)
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.
short pru_can_get_global_status(can_emulation_app_hndl *pstrcanemuapphndl)
pru_can_get_global_status() Gets the globalstatus register value
#define PRU_INTC_HSTINTENIDXCLR
#define PRU_CAN_RX_MAILBOX8_STATUS_REGISTER
#define PRU_INTC_ENIDXSET
#define PRU_CAN_TX_MAILBOX0
can_mail_box_structure strcanmailbox
#define PRU_CAN_TX_MAILBOX2_STATUS_REGISTER
#define PRU_CAN_TX_MAILBOX3_STATUS_REGISTER
arm_pru_iomap str_pru_iomap
#define PRU_CAN_RX_ERROR_COUNTER_REGISTER
#define PRU_CAN_RX_MAILBOX1_STATUS_REGISTER
short pru_ram_write_data_4byte(unsigned int u32offset, unsigned int *pu32datatoread, short u16wordstoread)
pru_ram_write_data_4byte() Download the data into data RAM of PRU0 or PRU1 of OMAP L138...
can_emulation_drv_inst gstrcanemulationinst[ecanmaxinst]
#define PRU_CAN_TX_MAILBOX4
short pru_can_configuration_mode_set(bool bconfigmodeenabledisableflag)
pru_can_configuration_mode_set() Sets the timing value for data transfer
#define PRU_CAN_TX_MAILBOX5_STATUS_REGISTER
#define PRU_CAN_TX_ERROR_COUNTER_REGISTER
#define PRU_CAN_TX_GLOBAL_CONTROL_REGISTER
volatile CSL_PrucoreRegs * CSL_PrucoreRegsOvly
#define CSL_PSC_MDSTAT_STATE_ENABLE
#define CSL_PRUCANCORE_1_REGS
short pru_can_emulation_init(arm_pru_iomap *pstr_pru_iomap, u32 u32pruclock)
pru_can_emulation_init() Initializes the Can Emulation Parameters
#define PRU_INTC_CHANMAP8
#define PRU_CAN_TIMING_VAL_RX
#define PRU_CAN_RX_INTERRUPT_STATUS_REGISTER
u32 gu32cansyscfgmapaddress
u32 gu32canpruiomapaddress