Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/Linux_HAL_Essentials/pru/pwmpru/pru_defs.h
Views: 1800
#pragma once12volatile register unsigned int __R31;3volatile register unsigned int __R30;45__far volatile char C0[0x300] __attribute__((cregister("C0", far)));6__far volatile char C26[0x100] __attribute__((cregister("C26", near))); /* PRUIEP */7__far volatile char C4[0x100] __attribute__((cregister("C4", near))); /* PRUCFG */89#define PRUCFG(_reg) \10(*(volatile u32 *)((char *)C4 + (_reg)))1112/* fast access to the registers using the constants */13#define PRUCFG_REVID PRUCFG(0x0000)1415#define PRUCFG_SYSCFG PRUCFG(0x0004)16#define SYSCFG_IDLE_MODE_S 017#define SYSCFG_IDLE_MODE_W 218#define SYSCFG_IDLE_MODE_M ((SYSCFG_IDLE_MODE_W - 1) << SYSCFG_IDLE_MODE_S)19#define SYSCFG_IDLE_MODE_FORCE (0 << SYSCFG_IDLE_MODE_S)20#define SYSCFG_IDLE_MODE_NO (1 << SYSCFG_IDLE_MODE_S)21#define SYSCFG_IDLE_MODE_SMART (2 << SYSCFG_IDLE_MODE_S)22#define SYSCFG_STANDBY_MODE_S 223#define SYSCFG_STANDBY_MODE_W 224#define SYSCFG_STANDBY_MODE_M ((SYSCFG_STANDBY_MODE_W - 1) << SYSCFG_STANDBY_MODE_S)25#define SYSCFG_STANDBY_MODE_FORCE (0 << SYSCFG_STANDBY_MODE_S)26#define SYSCFG_STANDBY_MODE_NO (1 << SYSCFG_STANDBY_MODE_S)27#define SYSCFG_STANDBY_MODE_SMART (2 << SYSCFG_STANDBY_MODE_S)28#define SYSCFG_STANDBY_INIT (1 << 4)29#define SYSCFG_SUB_MWAIT (1 << 5)30#define PRUCFG_SPP PRUCFG(0x0034)31#define SPP_PRU1_PAD_HP_EN (1 << 0)32#define SPP_XFR_SHIFT_EN (1 << 1)3334#define PRUCFG_GPCFG0 PRUCFG(0x0008)35#define CPCFG0_PRU0_GPI_MODE_S 036#define CPCFG0_PRU0_GPI_MODE_W 237#define CPCFG0_PRU0_GPI_MODE_M ((CPCFG0_PRU0_GPI_MODE_W - 1) << CPCFG0_PRU0_GPI_MODE_S)38#define CPCFG0_PRU0_GPI_MODE_DIRECT (0 << CPCFG0_PRU0_GPI_MODE_S)39#define CPCFG0_PRU0_GPI_MODE_PARALLEL (1 << CPCFG0_PRU0_GPI_MODE_S)40#define CPCFG0_PRU0_GPI_MODE_SHIFT (2 << CPCFG0_PRU0_GPI_MODE_S)41#define CPCFG0_PRU0_GPI_MODE_MII_RT (3 << CPCFG0_PRU0_GPI_MODE_S)42#define CPCFG0_PRU0_GPI_CLK_MODE (1 << 2)43#define CPCFG0_PRU0_GPI_DIV0_S 344#define CPCFG0_PRU0_GPI_DIV0_W 545#define CPCFG0_PRU0_GPI_DIV0_M ((CPCFG0_PRU0_GPI_DIV0_W - 1) << CPCFG0_PRU0_GPI_DIV0_S)46#define CPCFG0_PRU0_GPI_DIV0_1 (0 << CPCFG0_PRU0_GPI_DIV0_S)47#define CPCFG0_PRU0_GPI_DIV0_1_5 (1 << CPCFG0_PRU0_GPI_DIV0_S)48#define CPCFG0_PRU0_GPI_DIV0_2 (2 << CPCFG0_PRU0_GPI_DIV0_S)49#define CPCFG0_PRU0_GPI_DIV0_2_5 (3 << CPCFG0_PRU0_GPI_DIV0_S)50#define CPCFG0_PRU0_GPI_DIV0_3 (4 << CPCFG0_PRU0_GPI_DIV0_S)51#define CPCFG0_PRU0_GPI_DIV0_3_5 (5 << CPCFG0_PRU0_GPI_DIV0_S)52#define CPCFG0_PRU0_GPI_DIV0_4 (6 << CPCFG0_PRU0_GPI_DIV0_S)53#define CPCFG0_PRU0_GPI_DIV0_4_5 (7 << CPCFG0_PRU0_GPI_DIV0_S)54#define CPCFG0_PRU0_GPI_DIV0_5 (8 << CPCFG0_PRU0_GPI_DIV0_S)55#define CPCFG0_PRU0_GPI_DIV0_5_5 (9 << CPCFG0_PRU0_GPI_DIV0_S)56#define CPCFG0_PRU0_GPI_DIV0_6 (10 << CPCFG0_PRU0_GPI_DIV0_S)57#define CPCFG0_PRU0_GPI_DIV0_6_5 (11 << CPCFG0_PRU0_GPI_DIV0_S)58#define CPCFG0_PRU0_GPI_DIV0_7 (12 << CPCFG0_PRU0_GPI_DIV0_S)59#define CPCFG0_PRU0_GPI_DIV0_7_5 (13 << CPCFG0_PRU0_GPI_DIV0_S)60#define CPCFG0_PRU0_GPI_DIV0_8 (14 << CPCFG0_PRU0_GPI_DIV0_S)61#define CPCFG0_PRU0_GPI_DIV0_8_5 (15 << CPCFG0_PRU0_GPI_DIV0_S)62#define CPCFG0_PRU0_GPI_DIV0_9 (16 << CPCFG0_PRU0_GPI_DIV0_S)63#define CPCFG0_PRU0_GPI_DIV0_9_5 (17 << CPCFG0_PRU0_GPI_DIV0_S)64#define CPCFG0_PRU0_GPI_DIV0_10 (18 << CPCFG0_PRU0_GPI_DIV0_S)65#define CPCFG0_PRU0_GPI_DIV0_10_5 (19 << CPCFG0_PRU0_GPI_DIV0_S)66#define CPCFG0_PRU0_GPI_DIV0_11 (20 << CPCFG0_PRU0_GPI_DIV0_S)67#define CPCFG0_PRU0_GPI_DIV0_11_5 (21 << CPCFG0_PRU0_GPI_DIV0_S)68#define CPCFG0_PRU0_GPI_DIV0_12 (22 << CPCFG0_PRU0_GPI_DIV0_S)69#define CPCFG0_PRU0_GPI_DIV0_12_5 (23 << CPCFG0_PRU0_GPI_DIV0_S)70#define CPCFG0_PRU0_GPI_DIV0_13 (24 << CPCFG0_PRU0_GPI_DIV0_S)71#define CPCFG0_PRU0_GPI_DIV0_13_5 (25 << CPCFG0_PRU0_GPI_DIV0_S)72#define CPCFG0_PRU0_GPI_DIV0_14 (26 << CPCFG0_PRU0_GPI_DIV0_S)73#define CPCFG0_PRU0_GPI_DIV0_14_5 (27 << CPCFG0_PRU0_GPI_DIV0_S)74#define CPCFG0_PRU0_GPI_DIV0_15 (28 << CPCFG0_PRU0_GPI_DIV0_S)75#define CPCFG0_PRU0_GPI_DIV0_15_5 (29 << CPCFG0_PRU0_GPI_DIV0_S)76#define CPCFG0_PRU0_GPI_DIV0_16 (30 << CPCFG0_PRU0_GPI_DIV0_S)77#define CPCFG0_PRU0_GPI_DIV1_S 878#define CPCFG0_PRU0_GPI_DIV1_W 579#define CPCFG0_PRU0_GPI_DIV1_M ((CPCFG0_PRU0_GPI_DIV1_W - 1) << CPCFG0_PRU0_GPI_DIV1_S)80#define CPCFG0_PRU0_GPI_DIV1_1 (0 << CPCFG0_PRU0_GPI_DIV1_S)81#define CPCFG0_PRU0_GPI_DIV1_1_5 (1 << CPCFG0_PRU0_GPI_DIV1_S)82#define CPCFG0_PRU0_GPI_DIV1_2 (2 << CPCFG0_PRU0_GPI_DIV1_S)83#define CPCFG0_PRU0_GPI_DIV1_2_5 (3 << CPCFG0_PRU0_GPI_DIV1_S)84#define CPCFG0_PRU0_GPI_DIV1_3 (4 << CPCFG0_PRU0_GPI_DIV1_S)85#define CPCFG0_PRU0_GPI_DIV1_3_5 (5 << CPCFG0_PRU0_GPI_DIV1_S)86#define CPCFG0_PRU0_GPI_DIV1_4 (6 << CPCFG0_PRU0_GPI_DIV1_S)87#define CPCFG0_PRU0_GPI_DIV1_4_5 (7 << CPCFG0_PRU0_GPI_DIV1_S)88#define CPCFG0_PRU0_GPI_DIV1_5 (8 << CPCFG0_PRU0_GPI_DIV1_S)89#define CPCFG0_PRU0_GPI_DIV1_5_5 (9 << CPCFG0_PRU0_GPI_DIV1_S)90#define CPCFG0_PRU0_GPI_DIV1_6 (10 << CPCFG0_PRU0_GPI_DIV1_S)91#define CPCFG0_PRU0_GPI_DIV1_6_5 (11 << CPCFG0_PRU0_GPI_DIV1_S)92#define CPCFG0_PRU0_GPI_DIV1_7 (12 << CPCFG0_PRU0_GPI_DIV1_S)93#define CPCFG0_PRU0_GPI_DIV1_7_5 (13 << CPCFG0_PRU0_GPI_DIV1_S)94#define CPCFG0_PRU0_GPI_DIV1_8 (14 << CPCFG0_PRU0_GPI_DIV1_S)95#define CPCFG0_PRU0_GPI_DIV1_8_5 (15 << CPCFG0_PRU0_GPI_DIV1_S)96#define CPCFG0_PRU0_GPI_DIV1_9 (16 << CPCFG0_PRU0_GPI_DIV1_S)97#define CPCFG0_PRU0_GPI_DIV1_9_5 (17 << CPCFG0_PRU0_GPI_DIV1_S)98#define CPCFG0_PRU0_GPI_DIV1_10 (18 << CPCFG0_PRU0_GPI_DIV1_S)99#define CPCFG0_PRU0_GPI_DIV1_10_5 (19 << CPCFG0_PRU0_GPI_DIV1_S)100#define CPCFG0_PRU0_GPI_DIV1_11 (20 << CPCFG0_PRU0_GPI_DIV1_S)101#define CPCFG0_PRU0_GPI_DIV1_11_5 (21 << CPCFG0_PRU0_GPI_DIV1_S)102#define CPCFG0_PRU0_GPI_DIV1_12 (22 << CPCFG0_PRU0_GPI_DIV1_S)103#define CPCFG0_PRU0_GPI_DIV1_12_5 (23 << CPCFG0_PRU0_GPI_DIV1_S)104#define CPCFG0_PRU0_GPI_DIV1_13 (24 << CPCFG0_PRU0_GPI_DIV1_S)105#define CPCFG0_PRU0_GPI_DIV1_13_5 (25 << CPCFG0_PRU0_GPI_DIV1_S)106#define CPCFG0_PRU0_GPI_DIV1_14 (26 << CPCFG0_PRU0_GPI_DIV1_S)107#define CPCFG0_PRU0_GPI_DIV1_14_5 (27 << CPCFG0_PRU0_GPI_DIV1_S)108#define CPCFG0_PRU0_GPI_DIV1_15 (28 << CPCFG0_PRU0_GPI_DIV1_S)109#define CPCFG0_PRU0_GPI_DIV1_15_5 (29 << CPCFG0_PRU0_GPI_DIV1_S)110#define CPCFG0_PRU0_GPI_DIV1_16 (30 << CPCFG0_PRU0_GPI_DIV1_S)111#define CPCFG0_PRU0_GPI_S8 (1 << 13)112#define CPCFG0_PRU0_GPO_MODE (1 << 14)113#define CPCFG0_PRU0_GPO_DIV0_S 15114#define CPCFG0_PRU0_GPO_DIV0_W 5115#define CPCFG0_PRU0_GPO_DIV0_M ((CPCFG0_PRU0_GPO_DIV0_W - 1) << CPCFG0_PRU0_GPO_DIV0_S)116#define CPCFG0_PRU0_GPO_DIV0_1 (0 << CPCFG0_PRU0_GPO_DIV0_S)117#define CPCFG0_PRU0_GPO_DIV0_1_5 (1 << CPCFG0_PRU0_GPO_DIV0_S)118#define CPCFG0_PRU0_GPO_DIV0_2 (2 << CPCFG0_PRU0_GPO_DIV0_S)119#define CPCFG0_PRU0_GPO_DIV0_2_5 (3 << CPCFG0_PRU0_GPO_DIV0_S)120#define CPCFG0_PRU0_GPO_DIV0_3 (4 << CPCFG0_PRU0_GPO_DIV0_S)121#define CPCFG0_PRU0_GPO_DIV0_3_5 (5 << CPCFG0_PRU0_GPO_DIV0_S)122#define CPCFG0_PRU0_GPO_DIV0_4 (6 << CPCFG0_PRU0_GPO_DIV0_S)123#define CPCFG0_PRU0_GPO_DIV0_4_5 (7 << CPCFG0_PRU0_GPO_DIV0_S)124#define CPCFG0_PRU0_GPO_DIV0_5 (8 << CPCFG0_PRU0_GPO_DIV0_S)125#define CPCFG0_PRU0_GPO_DIV0_5_5 (9 << CPCFG0_PRU0_GPO_DIV0_S)126#define CPCFG0_PRU0_GPO_DIV0_6 (10 << CPCFG0_PRU0_GPO_DIV0_S)127#define CPCFG0_PRU0_GPO_DIV0_6_5 (11 << CPCFG0_PRU0_GPO_DIV0_S)128#define CPCFG0_PRU0_GPO_DIV0_7 (12 << CPCFG0_PRU0_GPO_DIV0_S)129#define CPCFG0_PRU0_GPO_DIV0_7_5 (13 << CPCFG0_PRU0_GPO_DIV0_S)130#define CPCFG0_PRU0_GPO_DIV0_8 (14 << CPCFG0_PRU0_GPO_DIV0_S)131#define CPCFG0_PRU0_GPO_DIV0_8_5 (15 << CPCFG0_PRU0_GPO_DIV0_S)132#define CPCFG0_PRU0_GPO_DIV0_9 (16 << CPCFG0_PRU0_GPO_DIV0_S)133#define CPCFG0_PRU0_GPO_DIV0_9_5 (17 << CPCFG0_PRU0_GPO_DIV0_S)134#define CPCFG0_PRU0_GPO_DIV0_10 (18 << CPCFG0_PRU0_GPO_DIV0_S)135#define CPCFG0_PRU0_GPO_DIV0_10_5 (19 << CPCFG0_PRU0_GPO_DIV0_S)136#define CPCFG0_PRU0_GPO_DIV0_11 (20 << CPCFG0_PRU0_GPO_DIV0_S)137#define CPCFG0_PRU0_GPO_DIV0_11_5 (21 << CPCFG0_PRU0_GPO_DIV0_S)138#define CPCFG0_PRU0_GPO_DIV0_12 (22 << CPCFG0_PRU0_GPO_DIV0_S)139#define CPCFG0_PRU0_GPO_DIV0_12_5 (23 << CPCFG0_PRU0_GPO_DIV0_S)140#define CPCFG0_PRU0_GPO_DIV0_13 (24 << CPCFG0_PRU0_GPO_DIV0_S)141#define CPCFG0_PRU0_GPO_DIV0_13_5 (25 << CPCFG0_PRU0_GPO_DIV0_S)142#define CPCFG0_PRU0_GPO_DIV0_14 (26 << CPCFG0_PRU0_GPO_DIV0_S)143#define CPCFG0_PRU0_GPO_DIV0_14_5 (27 << CPCFG0_PRU0_GPO_DIV0_S)144#define CPCFG0_PRU0_GPO_DIV0_15 (28 << CPCFG0_PRU0_GPO_DIV0_S)145#define CPCFG0_PRU0_GPO_DIV0_15_5 (29 << CPCFG0_PRU0_GPO_DIV0_S)146#define CPCFG0_PRU0_GPO_DIV0_16 (30 << CPCFG0_PRU0_GPO_DIV0_S)147#define CPCFG0_PRU0_GPO_DIV1_S 20148#define CPCFG0_PRU0_GPO_DIV1_W 5149#define CPCFG0_PRU0_GPO_DIV1_M ((CPCFG0_PRU0_GPO_DIV1_W - 1) << CPCFG0_PRU0_GPO_DIV1_S)150#define CPCFG0_PRU0_GPO_DIV1_1 (0 << CPCFG0_PRU0_GPO_DIV1_S)151#define CPCFG0_PRU0_GPO_DIV1_1_5 (1 << CPCFG0_PRU0_GPO_DIV1_S)152#define CPCFG0_PRU0_GPO_DIV1_2 (2 << CPCFG0_PRU0_GPO_DIV1_S)153#define CPCFG0_PRU0_GPO_DIV1_2_5 (3 << CPCFG0_PRU0_GPO_DIV1_S)154#define CPCFG0_PRU0_GPO_DIV1_3 (4 << CPCFG0_PRU0_GPO_DIV1_S)155#define CPCFG0_PRU0_GPO_DIV1_3_5 (5 << CPCFG0_PRU0_GPO_DIV1_S)156#define CPCFG0_PRU0_GPO_DIV1_4 (6 << CPCFG0_PRU0_GPO_DIV1_S)157#define CPCFG0_PRU0_GPO_DIV1_4_5 (7 << CPCFG0_PRU0_GPO_DIV1_S)158#define CPCFG0_PRU0_GPO_DIV1_5 (8 << CPCFG0_PRU0_GPO_DIV1_S)159#define CPCFG0_PRU0_GPO_DIV1_5_5 (9 << CPCFG0_PRU0_GPO_DIV1_S)160#define CPCFG0_PRU0_GPO_DIV1_6 (10 << CPCFG0_PRU0_GPO_DIV1_S)161#define CPCFG0_PRU0_GPO_DIV1_6_5 (11 << CPCFG0_PRU0_GPO_DIV1_S)162#define CPCFG0_PRU0_GPO_DIV1_7 (12 << CPCFG0_PRU0_GPO_DIV1_S)163#define CPCFG0_PRU0_GPO_DIV1_7_5 (13 << CPCFG0_PRU0_GPO_DIV1_S)164#define CPCFG0_PRU0_GPO_DIV1_8 (14 << CPCFG0_PRU0_GPO_DIV1_S)165#define CPCFG0_PRU0_GPO_DIV1_8_5 (15 << CPCFG0_PRU0_GPO_DIV1_S)166#define CPCFG0_PRU0_GPO_DIV1_9 (16 << CPCFG0_PRU0_GPO_DIV1_S)167#define CPCFG0_PRU0_GPO_DIV1_9_5 (17 << CPCFG0_PRU0_GPO_DIV1_S)168#define CPCFG0_PRU0_GPO_DIV1_10 (18 << CPCFG0_PRU0_GPO_DIV1_S)169#define CPCFG0_PRU0_GPO_DIV1_10_5 (19 << CPCFG0_PRU0_GPO_DIV1_S)170#define CPCFG0_PRU0_GPO_DIV1_11 (20 << CPCFG0_PRU0_GPO_DIV1_S)171#define CPCFG0_PRU0_GPO_DIV1_11_5 (21 << CPCFG0_PRU0_GPO_DIV1_S)172#define CPCFG0_PRU0_GPO_DIV1_12 (22 << CPCFG0_PRU0_GPO_DIV1_S)173#define CPCFG0_PRU0_GPO_DIV1_12_5 (23 << CPCFG0_PRU0_GPO_DIV1_S)174#define CPCFG0_PRU0_GPO_DIV1_13 (24 << CPCFG0_PRU0_GPO_DIV1_S)175#define CPCFG0_PRU0_GPO_DIV1_13_5 (25 << CPCFG0_PRU0_GPO_DIV1_S)176#define CPCFG0_PRU0_GPO_DIV1_14 (26 << CPCFG0_PRU0_GPO_DIV1_S)177#define CPCFG0_PRU0_GPO_DIV1_14_5 (27 << CPCFG0_PRU0_GPO_DIV1_S)178#define CPCFG0_PRU0_GPO_DIV1_15 (28 << CPCFG0_PRU0_GPO_DIV1_S)179#define CPCFG0_PRU0_GPO_DIV1_15_5 (29 << CPCFG0_PRU0_GPO_DIV1_S)180#define CPCFG0_PRU0_GPO_DIV1_16 (30 << CPCFG0_PRU0_GPO_DIV1_S)181#define CPCFG0_PRU0_GPO_SH_SE (1 << 25)182183#define PRUCFG_GPCFG1 PRUCFG(0x000C)184#define CPCFG0_PRU1_GPI_MODE_S 0185#define CPCFG0_PRU1_GPI_MODE_W 2186#define CPCFG0_PRU1_GPI_MODE_M ((CPCFG0_PRU1_GPI_MODE_W - 1) << CPCFG0_PRU1_GPI_MODE_S)187#define CPCFG0_PRU1_GPI_MODE_DIRECT (0 << CPCFG0_PRU1_GPI_MODE_S)188#define CPCFG0_PRU1_GPI_MODE_PARALLEL (1 << CPCFG0_PRU1_GPI_MODE_S)189#define CPCFG0_PRU1_GPI_MODE_SHIFT (2 << CPCFG0_PRU1_GPI_MODE_S)190#define CPCFG0_PRU1_GPI_MODE_MII_RT (3 << CPCFG0_PRU1_GPI_MODE_S)191#define CPCFG0_PRU1_GPI_CLK_MODE (1 << 2)192#define CPCFG0_PRU1_GPI_DIV0_S 3193#define CPCFG0_PRU1_GPI_DIV0_W 5194#define CPCFG0_PRU1_GPI_DIV0_M ((CPCFG0_PRU1_GPI_DIV0_W - 1) << CPCFG0_PRU1_GPI_DIV0_S)195#define CPCFG0_PRU1_GPI_DIV0_1 (0 << CPCFG0_PRU1_GPI_DIV0_S)196#define CPCFG0_PRU1_GPI_DIV0_1_5 (1 << CPCFG0_PRU1_GPI_DIV0_S)197#define CPCFG0_PRU1_GPI_DIV0_2 (2 << CPCFG0_PRU1_GPI_DIV0_S)198#define CPCFG0_PRU1_GPI_DIV0_2_5 (3 << CPCFG0_PRU1_GPI_DIV0_S)199#define CPCFG0_PRU1_GPI_DIV0_3 (4 << CPCFG0_PRU1_GPI_DIV0_S)200#define CPCFG0_PRU1_GPI_DIV0_3_5 (5 << CPCFG0_PRU1_GPI_DIV0_S)201#define CPCFG0_PRU1_GPI_DIV0_4 (6 << CPCFG0_PRU1_GPI_DIV0_S)202#define CPCFG0_PRU1_GPI_DIV0_4_5 (7 << CPCFG0_PRU1_GPI_DIV0_S)203#define CPCFG0_PRU1_GPI_DIV0_5 (8 << CPCFG0_PRU1_GPI_DIV0_S)204#define CPCFG0_PRU1_GPI_DIV0_5_5 (9 << CPCFG0_PRU1_GPI_DIV0_S)205#define CPCFG0_PRU1_GPI_DIV0_6 (10 << CPCFG0_PRU1_GPI_DIV0_S)206#define CPCFG0_PRU1_GPI_DIV0_6_5 (11 << CPCFG0_PRU1_GPI_DIV0_S)207#define CPCFG0_PRU1_GPI_DIV0_7 (12 << CPCFG0_PRU1_GPI_DIV0_S)208#define CPCFG0_PRU1_GPI_DIV0_7_5 (13 << CPCFG0_PRU1_GPI_DIV0_S)209#define CPCFG0_PRU1_GPI_DIV0_8 (14 << CPCFG0_PRU1_GPI_DIV0_S)210#define CPCFG0_PRU1_GPI_DIV0_8_5 (15 << CPCFG0_PRU1_GPI_DIV0_S)211#define CPCFG0_PRU1_GPI_DIV0_9 (16 << CPCFG0_PRU1_GPI_DIV0_S)212#define CPCFG0_PRU1_GPI_DIV0_9_5 (17 << CPCFG0_PRU1_GPI_DIV0_S)213#define CPCFG0_PRU1_GPI_DIV0_10 (18 << CPCFG0_PRU1_GPI_DIV0_S)214#define CPCFG0_PRU1_GPI_DIV0_10_5 (19 << CPCFG0_PRU1_GPI_DIV0_S)215#define CPCFG0_PRU1_GPI_DIV0_11 (20 << CPCFG0_PRU1_GPI_DIV0_S)216#define CPCFG0_PRU1_GPI_DIV0_11_5 (21 << CPCFG0_PRU1_GPI_DIV0_S)217#define CPCFG0_PRU1_GPI_DIV0_12 (22 << CPCFG0_PRU1_GPI_DIV0_S)218#define CPCFG0_PRU1_GPI_DIV0_12_5 (23 << CPCFG0_PRU1_GPI_DIV0_S)219#define CPCFG0_PRU1_GPI_DIV0_13 (24 << CPCFG0_PRU1_GPI_DIV0_S)220#define CPCFG0_PRU1_GPI_DIV0_13_5 (25 << CPCFG0_PRU1_GPI_DIV0_S)221#define CPCFG0_PRU1_GPI_DIV0_14 (26 << CPCFG0_PRU1_GPI_DIV0_S)222#define CPCFG0_PRU1_GPI_DIV0_14_5 (27 << CPCFG0_PRU1_GPI_DIV0_S)223#define CPCFG0_PRU1_GPI_DIV0_15 (28 << CPCFG0_PRU1_GPI_DIV0_S)224#define CPCFG0_PRU1_GPI_DIV0_15_5 (29 << CPCFG0_PRU1_GPI_DIV0_S)225#define CPCFG0_PRU1_GPI_DIV0_16 (30 << CPCFG0_PRU1_GPI_DIV0_S)226#define CPCFG0_PRU1_GPI_DIV1_S 8227#define CPCFG0_PRU1_GPI_DIV1_W 5228#define CPCFG0_PRU1_GPI_DIV1_M ((CPCFG0_PRU1_GPI_DIV1_W - 1) << CPCFG0_PRU1_GPI_DIV1_S)229#define CPCFG0_PRU1_GPI_DIV1_1 (0 << CPCFG0_PRU1_GPI_DIV1_S)230#define CPCFG0_PRU1_GPI_DIV1_1_5 (1 << CPCFG0_PRU1_GPI_DIV1_S)231#define CPCFG0_PRU1_GPI_DIV1_2 (2 << CPCFG0_PRU1_GPI_DIV1_S)232#define CPCFG0_PRU1_GPI_DIV1_2_5 (3 << CPCFG0_PRU1_GPI_DIV1_S)233#define CPCFG0_PRU1_GPI_DIV1_3 (4 << CPCFG0_PRU1_GPI_DIV1_S)234#define CPCFG0_PRU1_GPI_DIV1_3_5 (5 << CPCFG0_PRU1_GPI_DIV1_S)235#define CPCFG0_PRU1_GPI_DIV1_4 (6 << CPCFG0_PRU1_GPI_DIV1_S)236#define CPCFG0_PRU1_GPI_DIV1_4_5 (7 << CPCFG0_PRU1_GPI_DIV1_S)237#define CPCFG0_PRU1_GPI_DIV1_5 (8 << CPCFG0_PRU1_GPI_DIV1_S)238#define CPCFG0_PRU1_GPI_DIV1_5_5 (9 << CPCFG0_PRU1_GPI_DIV1_S)239#define CPCFG0_PRU1_GPI_DIV1_6 (10 << CPCFG0_PRU1_GPI_DIV1_S)240#define CPCFG0_PRU1_GPI_DIV1_6_5 (11 << CPCFG0_PRU1_GPI_DIV1_S)241#define CPCFG0_PRU1_GPI_DIV1_7 (12 << CPCFG0_PRU1_GPI_DIV1_S)242#define CPCFG0_PRU1_GPI_DIV1_7_5 (13 << CPCFG0_PRU1_GPI_DIV1_S)243#define CPCFG0_PRU1_GPI_DIV1_8 (14 << CPCFG0_PRU1_GPI_DIV1_S)244#define CPCFG0_PRU1_GPI_DIV1_8_5 (15 << CPCFG0_PRU1_GPI_DIV1_S)245#define CPCFG0_PRU1_GPI_DIV1_9 (16 << CPCFG0_PRU1_GPI_DIV1_S)246#define CPCFG0_PRU1_GPI_DIV1_9_5 (17 << CPCFG0_PRU1_GPI_DIV1_S)247#define CPCFG0_PRU1_GPI_DIV1_10 (18 << CPCFG0_PRU1_GPI_DIV1_S)248#define CPCFG0_PRU1_GPI_DIV1_10_5 (19 << CPCFG0_PRU1_GPI_DIV1_S)249#define CPCFG0_PRU1_GPI_DIV1_11 (20 << CPCFG0_PRU1_GPI_DIV1_S)250#define CPCFG0_PRU1_GPI_DIV1_11_5 (21 << CPCFG0_PRU1_GPI_DIV1_S)251#define CPCFG0_PRU1_GPI_DIV1_12 (22 << CPCFG0_PRU1_GPI_DIV1_S)252#define CPCFG0_PRU1_GPI_DIV1_12_5 (23 << CPCFG0_PRU1_GPI_DIV1_S)253#define CPCFG0_PRU1_GPI_DIV1_13 (24 << CPCFG0_PRU1_GPI_DIV1_S)254#define CPCFG0_PRU1_GPI_DIV1_13_5 (25 << CPCFG0_PRU1_GPI_DIV1_S)255#define CPCFG0_PRU1_GPI_DIV1_14 (26 << CPCFG0_PRU1_GPI_DIV1_S)256#define CPCFG0_PRU1_GPI_DIV1_14_5 (27 << CPCFG0_PRU1_GPI_DIV1_S)257#define CPCFG0_PRU1_GPI_DIV1_15 (28 << CPCFG0_PRU1_GPI_DIV1_S)258#define CPCFG0_PRU1_GPI_DIV1_15_5 (29 << CPCFG0_PRU1_GPI_DIV1_S)259#define CPCFG0_PRU1_GPI_DIV1_16 (30 << CPCFG0_PRU1_GPI_DIV1_S)260#define CPCFG0_PRU1_GPI_S8 (1 << 13)261#define CPCFG0_PRU1_GPO_MODE (1 << 14)262#define CPCFG0_PRU1_GPO_DIV0_S 15263#define CPCFG0_PRU1_GPO_DIV0_W 5264#define CPCFG0_PRU1_GPO_DIV0_M ((CPCFG0_PRU1_GPO_DIV0_W - 1) << CPCFG0_PRU1_GPO_DIV0_S)265#define CPCFG0_PRU1_GPO_DIV0_1 (0 << CPCFG0_PRU1_GPO_DIV0_S)266#define CPCFG0_PRU1_GPO_DIV0_1_5 (1 << CPCFG0_PRU1_GPO_DIV0_S)267#define CPCFG0_PRU1_GPO_DIV0_2 (2 << CPCFG0_PRU1_GPO_DIV0_S)268#define CPCFG0_PRU1_GPO_DIV0_2_5 (3 << CPCFG0_PRU1_GPO_DIV0_S)269#define CPCFG0_PRU1_GPO_DIV0_3 (4 << CPCFG0_PRU1_GPO_DIV0_S)270#define CPCFG0_PRU1_GPO_DIV0_3_5 (5 << CPCFG0_PRU1_GPO_DIV0_S)271#define CPCFG0_PRU1_GPO_DIV0_4 (6 << CPCFG0_PRU1_GPO_DIV0_S)272#define CPCFG0_PRU1_GPO_DIV0_4_5 (7 << CPCFG0_PRU1_GPO_DIV0_S)273#define CPCFG0_PRU1_GPO_DIV0_5 (8 << CPCFG0_PRU1_GPO_DIV0_S)274#define CPCFG0_PRU1_GPO_DIV0_5_5 (9 << CPCFG0_PRU1_GPO_DIV0_S)275#define CPCFG0_PRU1_GPO_DIV0_6 (10 << CPCFG0_PRU1_GPO_DIV0_S)276#define CPCFG0_PRU1_GPO_DIV0_6_5 (11 << CPCFG0_PRU1_GPO_DIV0_S)277#define CPCFG0_PRU1_GPO_DIV0_7 (12 << CPCFG0_PRU1_GPO_DIV0_S)278#define CPCFG0_PRU1_GPO_DIV0_7_5 (13 << CPCFG0_PRU1_GPO_DIV0_S)279#define CPCFG0_PRU1_GPO_DIV0_8 (14 << CPCFG0_PRU1_GPO_DIV0_S)280#define CPCFG0_PRU1_GPO_DIV0_8_5 (15 << CPCFG0_PRU1_GPO_DIV0_S)281#define CPCFG0_PRU1_GPO_DIV0_9 (16 << CPCFG0_PRU1_GPO_DIV0_S)282#define CPCFG0_PRU1_GPO_DIV0_9_5 (17 << CPCFG0_PRU1_GPO_DIV0_S)283#define CPCFG0_PRU1_GPO_DIV0_10 (18 << CPCFG0_PRU1_GPO_DIV0_S)284#define CPCFG0_PRU1_GPO_DIV0_10_5 (19 << CPCFG0_PRU1_GPO_DIV0_S)285#define CPCFG0_PRU1_GPO_DIV0_11 (20 << CPCFG0_PRU1_GPO_DIV0_S)286#define CPCFG0_PRU1_GPO_DIV0_11_5 (21 << CPCFG0_PRU1_GPO_DIV0_S)287#define CPCFG0_PRU1_GPO_DIV0_12 (22 << CPCFG0_PRU1_GPO_DIV0_S)288#define CPCFG0_PRU1_GPO_DIV0_12_5 (23 << CPCFG0_PRU1_GPO_DIV0_S)289#define CPCFG0_PRU1_GPO_DIV0_13 (24 << CPCFG0_PRU1_GPO_DIV0_S)290#define CPCFG0_PRU1_GPO_DIV0_13_5 (25 << CPCFG0_PRU1_GPO_DIV0_S)291#define CPCFG0_PRU1_GPO_DIV0_14 (26 << CPCFG0_PRU1_GPO_DIV0_S)292#define CPCFG0_PRU1_GPO_DIV0_14_5 (27 << CPCFG0_PRU1_GPO_DIV0_S)293#define CPCFG0_PRU1_GPO_DIV0_15 (28 << CPCFG0_PRU1_GPO_DIV0_S)294#define CPCFG0_PRU1_GPO_DIV0_15_5 (29 << CPCFG0_PRU1_GPO_DIV0_S)295#define CPCFG0_PRU1_GPO_DIV0_16 (30 << CPCFG0_PRU1_GPO_DIV0_S)296#define CPCFG0_PRU1_GPO_DIV1_S 20297#define CPCFG0_PRU1_GPO_DIV1_W 5298#define CPCFG0_PRU1_GPO_DIV1_M ((CPCFG0_PRU1_GPO_DIV1_W - 1) << CPCFG0_PRU1_GPO_DIV1_S)299#define CPCFG0_PRU1_GPO_DIV1_1 (0 << CPCFG0_PRU1_GPO_DIV1_S)300#define CPCFG0_PRU1_GPO_DIV1_1_5 (1 << CPCFG0_PRU1_GPO_DIV1_S)301#define CPCFG0_PRU1_GPO_DIV1_2 (2 << CPCFG0_PRU1_GPO_DIV1_S)302#define CPCFG0_PRU1_GPO_DIV1_2_5 (3 << CPCFG0_PRU1_GPO_DIV1_S)303#define CPCFG0_PRU1_GPO_DIV1_3 (4 << CPCFG0_PRU1_GPO_DIV1_S)304#define CPCFG0_PRU1_GPO_DIV1_3_5 (5 << CPCFG0_PRU1_GPO_DIV1_S)305#define CPCFG0_PRU1_GPO_DIV1_4 (6 << CPCFG0_PRU1_GPO_DIV1_S)306#define CPCFG0_PRU1_GPO_DIV1_4_5 (7 << CPCFG0_PRU1_GPO_DIV1_S)307#define CPCFG0_PRU1_GPO_DIV1_5 (8 << CPCFG0_PRU1_GPO_DIV1_S)308#define CPCFG0_PRU1_GPO_DIV1_5_5 (9 << CPCFG0_PRU1_GPO_DIV1_S)309#define CPCFG0_PRU1_GPO_DIV1_6 (10 << CPCFG0_PRU1_GPO_DIV1_S)310#define CPCFG0_PRU1_GPO_DIV1_6_5 (11 << CPCFG0_PRU1_GPO_DIV1_S)311#define CPCFG0_PRU1_GPO_DIV1_7 (12 << CPCFG0_PRU1_GPO_DIV1_S)312#define CPCFG0_PRU1_GPO_DIV1_7_5 (13 << CPCFG0_PRU1_GPO_DIV1_S)313#define CPCFG0_PRU1_GPO_DIV1_8 (14 << CPCFG0_PRU1_GPO_DIV1_S)314#define CPCFG0_PRU1_GPO_DIV1_8_5 (15 << CPCFG0_PRU1_GPO_DIV1_S)315#define CPCFG0_PRU1_GPO_DIV1_9 (16 << CPCFG0_PRU1_GPO_DIV1_S)316#define CPCFG0_PRU1_GPO_DIV1_9_5 (17 << CPCFG0_PRU1_GPO_DIV1_S)317#define CPCFG0_PRU1_GPO_DIV1_10 (18 << CPCFG0_PRU1_GPO_DIV1_S)318#define CPCFG0_PRU1_GPO_DIV1_10_5 (19 << CPCFG0_PRU1_GPO_DIV1_S)319#define CPCFG0_PRU1_GPO_DIV1_11 (20 << CPCFG0_PRU1_GPO_DIV1_S)320#define CPCFG0_PRU1_GPO_DIV1_11_5 (21 << CPCFG0_PRU1_GPO_DIV1_S)321#define CPCFG0_PRU1_GPO_DIV1_12 (22 << CPCFG0_PRU1_GPO_DIV1_S)322#define CPCFG0_PRU1_GPO_DIV1_12_5 (23 << CPCFG0_PRU1_GPO_DIV1_S)323#define CPCFG0_PRU1_GPO_DIV1_13 (24 << CPCFG0_PRU1_GPO_DIV1_S)324#define CPCFG0_PRU1_GPO_DIV1_13_5 (25 << CPCFG0_PRU1_GPO_DIV1_S)325#define CPCFG0_PRU1_GPO_DIV1_14 (26 << CPCFG0_PRU1_GPO_DIV1_S)326#define CPCFG0_PRU1_GPO_DIV1_14_5 (27 << CPCFG0_PRU1_GPO_DIV1_S)327#define CPCFG0_PRU1_GPO_DIV1_15 (28 << CPCFG0_PRU1_GPO_DIV1_S)328#define CPCFG0_PRU1_GPO_DIV1_15_5 (29 << CPCFG0_PRU1_GPO_DIV1_S)329#define CPCFG0_PRU1_GPO_DIV1_16 (30 << CPCFG0_PRU1_GPO_DIV1_S)330#define CPCFG0_PRU1_GPO_SH_SE (1 << 25)331332#define PRUCFG_CGR PRUCFG(0x0010)333334#define PRUCFG_ISRP PRUCFG(0x0014)335336#define PRUCFG_ISP PRUCFG(0x0018)337338#define PRUCFG_IESP PRUCFG(0x001C)339340#define PRUCFG_PMAO PRUCFG(0x0028)341#define PMAO_PMAO_PRU0 (1 << 0)342#define PMAO_PMAO_PRU1 (1 << 1)343344#define PRUCFG_MII_RT PRUCFG(0x002C)345346#define PRUCFG_IEPCLK PRUCFG(0x0030)347348#define PRUCFG_PINMX PRUCFG(0x0040)349350#define PINTC(_reg) \351(*(volatile u32 *)((char *)C0 + (_reg)))352353#define PINTC_REVID PINTC(0x0000)354#define PINTC_CR PINTC(0x0004)355#define PINTC_GER PINTC(0x0010)356#define PINTC_GNLR PINTC(0x001C)357#define PINTC_SISR PINTC(0x0020)358#define PINTC_SICR PINTC(0x0024)359#define PINTC_EISR PINTC(0x0028)360#define PINTC_EICR PINTC(0x002C)361#define PINTC_HIEISR PINTC(0x0034)362#define PINTC_HIDISR PINTC(0x0038)363#define PINTC_GPIR PINTC(0x0080)364#define PINTC_SRSR0 PINTC(0x0200)365#define PINTC_SRSR1 PINTC(0x0204)366#define PINTC_SECR0 PINTC(0x0280)367#define PINTC_SECR1 PINTC(0x0284)368#define PINTC_ESR0 PINTC(0x0300)369#define PINTC_ESR1 PINTC(0x0304)370#define PINTC_ECR0 PINTC(0x0380)371#define PINTC_ECR1 PINTC(0x0384)372#define PINTC_CMR0 PINTC(0x0400)373#define PINTC_CMR1 PINTC(0x0404)374#define PINTC_CMR2 PINTC(0x0408)375#define PINTC_CMR3 PINTC(0x040C)376#define PINTC_CMR4 PINTC(0x0410)377#define PINTC_CMR5 PINTC(0x0414)378#define PINTC_CMR6 PINTC(0x0418)379#define PINTC_CMR7 PINTC(0x041C)380#define PINTC_CMR8 PINTC(0x0420)381#define PINTC_CMR9 PINTC(0x0424)382#define PINTC_CMR10 PINTC(0x0428)383#define PINTC_CMR11 PINTC(0x042C)384#define PINTC_CMR12 PINTC(0x0430)385#define PINTC_CMR13 PINTC(0x0434)386#define PINTC_CMR14 PINTC(0x0438)387#define PINTC_CMR15 PINTC(0x043C)388#define PINTC_HMR0 PINTC(0x0800)389#define PINTC_HMR1 PINTC(0x0804)390#define PINTC_HMR2 PINTC(0x0808)391#define PINTC_HIPIR0 PINTC(0x0900)392#define PINTC_HIPIR1 PINTC(0x0904)393#define PINTC_HIPIR2 PINTC(0x0908)394#define PINTC_HIPIR3 PINTC(0x090C)395#define PINTC_HIPIR4 PINTC(0x0910)396#define PINTC_HIPIR5 PINTC(0x0914)397#define PINTC_HIPIR6 PINTC(0x0918)398#define PINTC_HIPIR7 PINTC(0x091C)399#define PINTC_HIPIR8 PINTC(0x0920)400#define PINTC_HIPIR9 PINTC(0x0924)401#define PINTC_SIPR0 PINTC(0x0D00)402#define PINTC_SIPR1 PINTC(0x0D04)403#define PINTC_SITR0 PINTC(0x0D80)404#define PINTC_SITR1 PINTC(0x0D84)405#define PINTC_HINLR0 PINTC(0x1100)406#define PINTC_HINLR1 PINTC(0x1104)407#define PINTC_HINLR2 PINTC(0x1108)408#define PINTC_HINLR3 PINTC(0x110C)409#define PINTC_HINLR4 PINTC(0x1110)410#define PINTC_HINLR5 PINTC(0x1114)411#define PINTC_HINLR6 PINTC(0x1118)412#define PINTC_HINLR7 PINTC(0x111C)413#define PINTC_HINLR8 PINTC(0x1120)414#define PINTC_HINLR9 PINTC(0x1124)415#define PINTC_HIER PINTC(0x1500)416417/* PRU Industrial Ethernet Peripheral */418#define PIEP(_reg) \419(*(volatile u32 *)((char *)C26 + (_reg)))420421#define PIEP_GLOBAL_CFG PIEP(0x0000)422#define GLOBAL_CFG_CNT_ENABLE (1 << 0)423#define GLOBAL_CFG_DEFAULT_INC_S 4424#define GLOBAL_CFG_DEFAULT_INC_W 4425#define GLOBAL_CFG_DEFAULT_INC_M ((GLOBAL_CFG_DEFAULT_INC_W - 1) << GLOBAL_CFG_DEFAULT_INC_S)426#define GLOBAL_CFG_DEFAULT_INC(x) (((x) << GLOBAL_CFG_DEFAULT_INC_S) & GLOBAL_CFG_DEFAULT_INC_M)427#define GLOBAL_CFG_CMP_INC_S 8428#define GLOBAL_CFG_CMP_INC_W 12429#define GLOBAL_CFG_CMP_INC_M ((GLOBAL_CFG_CMP_INC_W - 1) << GLOBAL_CFG_CMP_INC_S)430#define GLOBAL_CFG_CMP_INC(x) (((x) << GLOBAL_CFG_CMP_INC_S) & GLOBAL_CFG_CMP_INC_M)431432#define PIEP_GLOBAL_STATUS PIEP(0x0004)433#define GLOBAL_STATUS_CNT_OVF (1 << 0)434435#define PIEP_COMPEN PIEP(0x0008)436#define PIEP_COUNT PIEP(0x000C)437#define PIEP_CMP_CFG PIEP(0x0040)438#define CMP_CFG_CMP0_RST_CNT_EN (1 << 0)439#define CMP_CFG_CMP_EN_S 1440#define CMP_CFG_CMP_EN_W 8441#define CMP_CFG_CMP_EN_M ((CMP_CFG_CMP_EN_W - 1) << CMP_CFG_CMP_EN_S)442#define CMP_CFG_CMP_EN(x) ((1 << ((x) + CMP_CFG_CMP_EN_S)) & CMP_CFG_CMP_EN_M)443444#define PIEP_CMP_STATUS PIEP(0x0044)445#define CMD_STATUS_CMP_HIT_S 0446#define CMD_STATUS_CMP_HIT_W 8447#define CMD_STATUS_CMP_HIT_M ((CMD_STATUS_CMP_HIT_W - 1) << CMD_STATUS_CMP_HIT_S)448#define CMD_STATUS_CMP_HIT(x) ((1 << ((x) + CMD_STATUS_CMP_HIT_S)) & CMD_STATUS_CMP_HIT_M)449450#define PIEP_CMP_CMP0 PIEP(0x0048)451#define PIEP_CMP_CMP1 PIEP(0x004C)452#define PIEP_CMP_CMP2 PIEP(0x0050)453#define PIEP_CMP_CMP3 PIEP(0x0054)454#define PIEP_CMP_CMP4 PIEP(0x0058)455#define PIEP_CMP_CMP5 PIEP(0x005C)456#define PIEP_CMP_CMP6 PIEP(0x0060)457#define PIEP_CMP_CMP7 PIEP(0x0064)458#define PIEP_CMP_CMP(x) PIEP(0x0048 + ((x) << 2))459460#if defined(PRU0) || defined(PRU1)461462#ifdef PRU0463#define PCTRL(_reg) \464(*(volatile u32 *)((char *)0x22000 + (_reg)))465#define PCTRL_OTHER(_reg) \466(*(volatile u32 *)((char *)0x24000 + (_reg)))467#else468#define PCTRL(_reg) \469(*(volatile u32 *)((char *)0x24000 + (_reg)))470#define PCTRL_OTHER(_reg) \471(*(volatile u32 *)((char *)0x22000 + (_reg)))472#endif473474#define PCTRL_CONTROL PCTRL(0x0000)475#define CONTROL_SOFT_RST_N (1 << 0)476#define CONTROL_ENABLE (1 << 1)477#define CONTROL_SLEEPING (1 << 2)478#define CONTROL_COUNTER_ENABLE (1 << 3)479#define CONTROL_SINGLE_STEP (1 << 8)480#define CONTROL_RUNSTATE (1 << 15)481#define PCTRL_STATUS PCTRL(0x0004)482#define PCTRL_WAKEUP_EN PCTRL(0x0008)483#define PCTRL_CYCLE PCTRL(0x000C)484#define PCTRL_STALL PCTRL(0x0010)485#define PCTRL_CTBIR0 PCTRL(0x0020)486#define PCTRL_CTBIR1 PCTRL(0x0024)487#define PCTRL_CTPPR0 PCTRL(0x0028)488#define PCTRL_CTPPR1 PCTRL(0x002C)489490/* we can't access our debug registers (since we have to be stopped) */491#ifdef PRU0492#define PDBG_OTHER(_reg) \493(*(volatile u32 *)((char *)0x24400 + (_reg)))494#else495#define PDBG_OTHER(_reg) \496(*(volatile u32 *)((char *)0x22400 + (_reg)))497#endif498499#endif500501/* secondary access by C28 (which must point to 0x20200 */502#define PINTC_0200(_reg) \503(*(volatile u32 *)((char *)C28 + ((_reg) - 0x200)))504505#define SIGNAL_EVENT(x) \506do { \507__R31 = (1 << 5) | ((x) - 16); \508} while(0)509510511#ifndef PRU_CLK512/* default PRU clock (200MHz) */513#define PRU_CLK 200000000514#endif515516/* NOTE: Do no use it for larger than 5 secs */517#define PRU_200MHz_sec(x) ((u32)(((x) * 200000000)))518#define PRU_200MHz_ms(x) ((u32)(((x) * 200000)))519#define PRU_200MHz_ms_err(x) 0520#define PRU_200MHz_us(x) ((u32)(((x) * 200)))521#define PRU_200MHz_us_err(x) 0522#define PRU_200MHz_ns(x) ((u32)(((x) * 2) / 10))523#define PRU_200MHz_ns_err(x) ((u32)(((x) * 2) % 10))524525#if PRU_CLK != 200000000526/* NOTE: Do no use it for larger than 5 secs */527#define PRU_sec(x) ((u32)(((u64)(x) * PRU_CLK)))528#define PRU_ms(x) ((u32)(((u64)(x) * PRU_CLK) / 1000))529#define PRU_ms_err(x) ((u32)(((u64)(x) * PRU_CLK) % 1000))530#define PRU_us(x) ((u32)(((u64)(x) * PRU_CLK) / 1000000))531#define PRU_us_err(x) ((u32)(((u64)(x) * PRU_CLK) % 1000000))532#define PRU_ns(x) ((u32)(((u64)(x) * PRU_CLK) / 1000000000))533#define PRU_ns_err(x) ((u32)(((u64)(x) * PRU_CLK) % 1000000000))534#else535/* NOTE: Do no use it for larger than 5 secs */536#define PRU_sec(x) PRU_200MHz_sec(x)537#define PRU_ms(x) PRU_200MHz_ms(x)538#define PRU_ms_err(x) PRU_200MHz_ms_err(x)539#define PRU_us(x) PRU_200MHz_us(x)540#define PRU_us_err(x) PRU_200MHz_us_err(x)541#define PRU_ns(x) PRU_200MHz_ns(x)542#define PRU_ns_err(x) PRU_200MHz_ns_err(x)543#endif544545#define DPRAM_SHARED 0x00010000546547/* event definitions */548#define SYSEV_ARM_TO_PRU0 21549#define SYSEV_ARM_TO_PRU1 22550#define SYSEV_PRU0_TO_ARM 19551#define SYSEV_PRU0_TO_PRU1 17552#define SYSEV_PRU1_TO_ARM 20553#define SYSEV_PRU1_TO_PRU0 19554555/* for communication with the host we have another set of events */556#define SYSEV_VR_ARM_TO_PRU0 24557#define SYSEV_VR_PRU0_TO_ARM 25558#define SYSEV_VR_ARM_TO_PRU1 26559#define SYSEV_VR_PRU1_TO_ARM 27560561#define pru0_signal() (__R31 & (1U << 30))562#define pru1_signal() (__R31 & (1U << 31))563564#ifdef PRU0565#define pru_signal() pru0_signal()566#define SYSEV_OTHER_PRU_TO_THIS_PRU SYSEV_PRU1_TO_PRU0567#define SYSEV_ARM_TO_THIS_PRU SYSEV_ARM_TO_PRU0568#define SYSEV_THIS_PRU_TO_OTHER_PRU SYSEV_PRU0_TO_PRU1569#define SYSEV_THIS_PRU_TO_ARM SYSEV_PRU0_TO_ARM570#define SYSEV_VR_ARM_TO_THIS_PRU SYSEV_VR_ARM_TO_PRU0571#define SYSEV_VR_THIS_PRU_TO_ARM SYSEV_VR_PRU0_TO_ARM572#endif573574#ifdef PRU1575#define pru_signal() pru1_signal()576#define SYSEV_OTHER_PRU_TO_THIS_PRU SYSEV_PRU0_TO_PRU1577#define SYSEV_ARM_TO_THIS_PRU SYSEV_ARM_TO_PRU1578#define SYSEV_THIS_PRU_TO_OTHER_PRU SYSEV_PRU1_TO_PRU0579#define SYSEV_THIS_PRU_TO_ARM SYSEV_PRU1_TO_ARM580#define SYSEV_VR_ARM_TO_THIS_PRU SYSEV_VR_ARM_TO_PRU1581#define SYSEV_VR_THIS_PRU_TO_ARM SYSEV_VR_PRU1_TO_ARM582#endif583584/* all events < 32 */585#define SYSEV_THIS_PRU_INCOMING_MASK \586(BIT(SYSEV_ARM_TO_THIS_PRU) | \587BIT(SYSEV_OTHER_PRU_TO_THIS_PRU) | \588BIT(SYSEV_VR_ARM_TO_THIS_PRU))589590#define DELAY_CYCLES(x) \591do { \592unsigned int t = (x) >> 1; \593do { \594__asm(" "); \595} while (--t); \596} while(0)597598#ifndef BIT599#define BIT(x) (1U << (x))600#endif601602/* access to the resources of the other PRU (halt it and have your way) */603#if defined(PRU0) || defined(PRU1)604605static inline void pru_other_halt(void)606{607PCTRL_OTHER(0x0000) &= ~CONTROL_ENABLE; /* clear enable */608/* loop until RUNSTATE clears */609while ((PCTRL_OTHER(0x0000) & CONTROL_RUNSTATE) != 0)610;611}612613static inline void pru_other_resume(void)614{615PCTRL_OTHER(0x0000) |= CONTROL_ENABLE; /* set enable */616}617618static inline u32 pru_other_read_reg(u16 reg)619{620u32 val;621622reg <<= 2; /* multiply by 4 */623pru_other_halt();624val = PDBG_OTHER(reg);625pru_other_resume();626return val;627}628629static inline void pru_other_write_reg(u16 reg, u32 val)630{631reg <<= 2; /* multiply by 4 */632pru_other_halt();633PDBG_OTHER(reg) = val;634pru_other_resume();635}636637static inline void pru_other_and_or_reg(u16 reg, u32 andmsk, u32 ormsk)638{639reg <<= 2; /* multiply by 4 */640pru_other_halt();641PDBG_OTHER(reg) = (PDBG_OTHER(reg) & andmsk) | ormsk;642pru_other_resume();643}644645#endif646647648