File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,53 @@ void PRUSSDRVIntcSetHmr(unsigned short channel,
332332 | (((host ) & 0xF ) << (((channel ) & 0x3 ) << 3 ));
333333}
334334
335+ /**
336+ * \brief Set PRU constant table entries
337+ *
338+ * \param pruNum PRU instance number[0 or 1].
339+ * \param ctable_idx Index into constants table
340+ * \param value Value to set
341+ *
342+ * \return 0 in case of success, -1 otherwise.
343+ */
344+ int PRUSSDRVPruSetCTable (unsigned int pruNum ,
345+ unsigned int ctable_idx ,
346+ unsigned int value )
347+ {
348+ unsigned int regAddr ;
349+
350+ if (pruNum == 0 )
351+ regAddr = PRU0CONTROL_PHYS_BASE ;
352+ else if (pruNum == 1 )
353+ regAddr = PRU1CONTROL_PHYS_BASE ;
354+ else
355+ return -1 ;
356+
357+ switch (ctable_idx ) {
358+ case 24 :
359+ HWREG (regAddr + PRU_CONTABBLKIDX0 ) = (HWREG (regAddr + PRU_CONTABBLKIDX0 ) & ~0xf ) | (value & 0xf );
360+ break ;
361+ case 25 :
362+ HWREG (regAddr + PRU_CONTABBLKIDX0 ) = (HWREG (regAddr + PRU_CONTABBLKIDX0 ) & ~0xf0000 ) | ((value & 0xf ) << 16 );
363+ break ;
364+ case 28 :
365+ HWREG (regAddr + PRU_CONTABPROPTR0 ) = (HWREG (regAddr + PRU_CONTABPROPTR0 ) & ~0xffff ) | (value & 0xffff );
366+ break ;
367+ case 29 :
368+ HWREG (regAddr + PRU_CONTABPROPTR0 ) = (HWREG (regAddr + PRU_CONTABPROPTR0 ) & ~0xffff0000 ) | ((value & 0xffff ) << 16 );
369+ break ;
370+ case 30 :
371+ HWREG (regAddr + PRU_CONTABPROPTR1 ) = (HWREG (regAddr + PRU_CONTABPROPTR1 ) & ~0xffff ) | (value & 0xffff );
372+ break ;
373+ case 31 :
374+ HWREG (regAddr + PRU_CONTABPROPTR1 ) = (HWREG (regAddr + PRU_CONTABPROPTR1 ) & ~0xffff0000 ) | ((value & 0xffff ) << 16 );
375+ break ;
376+ default :
377+ return -1 ;
378+ }
379+ return 0 ;
380+ }
381+
335382void ICSS_Init (void )
336383{
337384 /* ICSS PRCM Enable */
Original file line number Diff line number Diff line change @@ -91,6 +91,13 @@ extern "C" {
9191#define PRU1IRAM_PHYS_BASE 0x01C3C000
9292#endif
9393
94+ /*
95+ * PRUSS control and status registers offsets
96+ */
97+ #define PRU_CONTABBLKIDX0 0x20
98+ #define PRU_CONTABPROPTR0 0x28
99+ #define PRU_CONTABPROPTR1 0x2C
100+
94101#define PRU_EVTOUT_0 0
95102#define PRU_EVTOUT_1 1
96103#define PRU_EVTOUT_2 2
@@ -258,6 +265,10 @@ void PRUSSDRVIntcSetCmr(unsigned short sysevt,
258265void PRUSSDRVIntcSetHmr (unsigned short channel ,
259266 unsigned short host );
260267
268+ int PRUSSDRVPruSetCTable (unsigned int pruNum ,
269+ unsigned int ctable_idx ,
270+ unsigned int value );
271+
261272void ICSS_Init (void );
262273
263274// #ifdef AM33XX
You can’t perform that action at this time.
0 commit comments