genregs.awk 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/awk -f
  2. BEGIN{
  3. }
  4. /^\/\/ Secure APB3 Slot 0 Registers/{
  5. sec_bus="SECBUS_REG_ADDR"
  6. }
  7. /^\/\/ Secure APB3 Slot 2 Registers/{
  8. sec_bus="SECBUS2_REG_ADDR"
  9. }
  10. /^#define/ && $2 ~/^P_AO_RTC_/{
  11. # print $1,$2,"\t\tSECBUS_REG_ADDR(" $8,$9,$10,"\t///" FILENAME
  12. # ignore RTC
  13. next
  14. }
  15. /^#define/ && NF==3{
  16. BASE="CBUS_REG_ADDR";
  17. if(index(FILENAME,"secure_apb")!=0){
  18. BASE=sec_bus;
  19. }else
  20. if(index(FILENAME,"pctl")!=0 || index(FILENAME,"hdmi")!=0){
  21. BASE="APB_REG_ADDR";
  22. }else if( $3 ~ /^0x0?[39ceCE][[:xdigit:]][[:xdigit:]]$|^0x3[fF][[:xdigit:]][[:xdigit:]]$/ )
  23. {
  24. BASE="DOS_REG_ADDR";
  25. }else if( $2 ~ /^VDEC_ASSIST_/)
  26. {
  27. BASE="DOS_REG_ADDR";
  28. }
  29. if(index(FILENAME,"hdmi")!=0 && $2 ~ /^STIMULUS_/)
  30. next;
  31. print $1,$2,$3,"\t///" FILENAME
  32. print $1,"P_" $2 , "\t\t" BASE "(" $2 ")" ,"\t///" FILENAME
  33. }
  34. /^#define/ && NF==14 && $2 ~ /^P_/{
  35. print $1,$2,"\t\tAOBUS_REG_ADDR(" $8,$9,$10,$11,$12,$13,$14,"\t///" FILENAME
  36. }
  37. END{
  38. }