clock_time_arch.svg 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <svg xmlns="http://www.w3.org/2000/svg" width="900" height="620" viewBox="0 0 900 620">
  2. <defs>
  3. <style>
  4. .box { fill: #ffffff; stroke: #3b5998; stroke-width: 1.5; }
  5. .box-upper { fill: #e8f4fd; stroke: #3b5998; stroke-width: 1.5; }
  6. .box-core { fill: #fff8e6; stroke: #d9a300; stroke-width: 1.5; }
  7. .box-source { fill: #e6f7e6; stroke: #2e8b57; stroke-width: 1.5; }
  8. .box-event { fill: #ffe6e6; stroke: #c44536; stroke-width: 1.5; }
  9. .box-helper { fill: #f0e6ff; stroke: #7b4bb7; stroke-width: 1.5; }
  10. .box-bsp { fill: #e6f0f0; stroke: #4a7c7c; stroke-width: 1.5; }
  11. .box-hw { fill: #f5f5f5; stroke: #666666; stroke-width: 1.5; }
  12. .title { font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; font-weight: 600; fill: #1a1a2e; }
  13. .text { font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; fill: #4a4a4a; }
  14. .label { font-family: 'Segoe UI', Arial, sans-serif; font-size: 10px; fill: #666666; font-style: italic; }
  15. .layer { fill: #f8fafc; stroke: #3b5998; stroke-width: 2; stroke-dasharray: none; }
  16. .layer-title { font-family: 'Segoe UI', Arial, sans-serif; font-size: 16px; font-weight: 700; fill: #3b5998; }
  17. .arrow { stroke: #5c6b7a; stroke-width: 1.5; fill: none; }
  18. </style>
  19. <marker id="arrowhead" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
  20. <polygon points="0 0, 8 3, 0 6" fill="#5c6b7a" />
  21. </marker>
  22. </defs>
  23. <!-- ========== 上层应用层 ========== -->
  24. <rect class="box-upper" x="50" y="20" width="240" height="65" rx="8" ry="8" />
  25. <text class="title" x="170" y="45" text-anchor="middle">POSIX / libc</text>
  26. <text class="text" x="170" y="62" text-anchor="middle">clock_gettime, nanosleep</text>
  27. <rect class="box-upper" x="330" y="20" width="240" height="65" rx="8" ry="8" />
  28. <text class="title" x="450" y="45" text-anchor="middle">Soft RTC</text>
  29. <text class="text" x="450" y="62" text-anchor="middle">timekeeping baseline</text>
  30. <rect class="box-upper" x="610" y="20" width="240" height="65" rx="8" ry="8" />
  31. <text class="title" x="730" y="45" text-anchor="middle">Device Drivers</text>
  32. <text class="text" x="730" y="62" text-anchor="middle">input timestamp, vDSO, PIC</text>
  33. <!-- ========== Clock Time 子系统层 ========== -->
  34. <rect class="layer" x="40" y="115" width="820" height="300" rx="12" ry="12" />
  35. <text class="layer-title" x="60" y="142">Clock Time Subsystem</text>
  36. <!-- 第一行:Core API, Clock Source, Clock Event -->
  37. <rect class="box-core" x="80" y="165" width="200" height="80" rx="6" ry="6" />
  38. <text class="title" x="180" y="195" text-anchor="middle">Core API</text>
  39. <text class="text" x="180" y="212" text-anchor="middle">register, default source/event</text>
  40. <text class="text" x="180" y="227" text-anchor="middle">counter ↔ ns conversion</text>
  41. <rect class="box-source" x="350" y="165" width="200" height="80" rx="6" ry="6" />
  42. <text class="title" x="450" y="195" text-anchor="middle">Clock Source Device</text>
  43. <text class="text" x="450" y="212" text-anchor="middle">get_freq / get_counter</text>
  44. <text class="text" x="450" y="227" text-anchor="middle">monotonic time base</text>
  45. <rect class="box-event" x="620" y="165" width="200" height="80" rx="6" ry="6" />
  46. <text class="title" x="720" y="195" text-anchor="middle">Clock Event Device</text>
  47. <text class="text" x="720" y="212" text-anchor="middle">set_timeout / event ISR</text>
  48. <text class="text" x="720" y="227" text-anchor="middle">timeout programming</text>
  49. <!-- 第二行:HRTimer, Boottime, Clock Timer Adapter -->
  50. <rect class="box-helper" x="80" y="275" width="200" height="80" rx="6" ry="6" />
  51. <text class="title" x="180" y="305" text-anchor="middle">Clock HRTimer</text>
  52. <text class="text" x="180" y="322" text-anchor="middle">priority queue of timeouts</text>
  53. <text class="text" x="180" y="337" text-anchor="middle">callback dispatch</text>
  54. <rect class="box-helper" x="350" y="275" width="200" height="80" rx="6" ry="6" />
  55. <text class="title" x="450" y="305" text-anchor="middle">Boottime Helpers</text>
  56. <text class="text" x="450" y="322" text-anchor="middle">get_us / get_ns / get_s</text>
  57. <text class="text" x="450" y="337" text-anchor="middle">timeval / timespec</text>
  58. <rect class="box-helper" x="620" y="275" width="200" height="80" rx="6" ry="6" />
  59. <text class="title" x="720" y="305" text-anchor="middle">Clock Timer Adapter</text>
  60. <text class="text" x="720" y="322" text-anchor="middle">rt_clock_timer device API</text>
  61. <text class="text" x="720" y="337" text-anchor="middle">unified timer interface</text>
  62. <!-- ========== BSP 驱动层 ========== -->
  63. <rect class="box-bsp" x="40" y="445" width="820" height="65" rx="12" ry="12" />
  64. <text class="title" x="450" y="472" text-anchor="middle">BSP Drivers</text>
  65. <text class="text" x="450" y="490" text-anchor="middle">arch counters, clock_timer drivers, DM/OFW integration</text>
  66. <!-- ========== 硬件层 ========== -->
  67. <rect class="box-hw" x="40" y="540" width="820" height="55" rx="12" ry="12" />
  68. <text class="title" x="450" y="565" text-anchor="middle">Hardware Counter / Timer</text>
  69. <text class="text" x="450" y="582" text-anchor="middle">CPU timer, SoC timer peripherals</text>
  70. <!-- ========== 箭头连接(使用圆弧路径) ========== -->
  71. <!-- 上层到子系统的连接 -->
  72. <path class="arrow" d="M 170 85 Q 170 100, 180 115" marker-end="url(#arrowhead)" />
  73. <path class="arrow" d="M 450 85 Q 450 100, 450 115" marker-end="url(#arrowhead)" />
  74. <path class="arrow" d="M 730 85 Q 730 100, 720 115" marker-end="url(#arrowhead)" />
  75. <!-- 子系统到 BSP 层的连接 -->
  76. <path class="arrow" d="M 450 415 Q 450 430, 450 445" marker-end="url(#arrowhead)" />
  77. <!-- BSP 到硬件层的连接 -->
  78. <path class="arrow" d="M 450 510 Q 450 525, 450 540" marker-end="url(#arrowhead)" />
  79. </svg>