Open
feat: 新增rmii驱动接口以及bcaldfx调试命令。 #30
byosoft_wujimingAdd on 17 hours ago
feat: 新增rmii驱动接口以及bcaldfx调试命令。 #30
Open
byosoft_wujimingAdd on 17 hours ago
Total: 5 files changed+220-27
@@ -1,4 +1,7 @@
1# Changelog1# Changelog
2+## [0.0.14] - 2026-11-27
3+新增rmii驱动接口以及bcaldfx调试命令。
4+ 
2## [0.0.13] - 2026-11-275## [0.0.13] - 2026-11-27
3 6 
4UartConnect 新增 CMD_GET_UART_ROUTE / CMD_GET_PORT_ROUTE 扩展查询命令,7UartConnect 新增 CMD_GET_UART_ROUTE / CMD_GET_PORT_ROUTE 扩展查询命令,
@@ -11,6 +11,7 @@
11 11 
12#include <algorithm>12#include <algorithm>
13#include <cctype>13#include <cctype>
14+#include <cerrno>
14#include <cstdint>15#include <cstdint>
15#include <cstring>16#include <cstring>
16#include <functional>17#include <functional>
@@ -42,6 +43,7 @@
42#include "bcal/mmc.h"43#include "bcal/mmc.h"
43#include "bcal/peci.h"44#include "bcal/peci.h"
44#include "bcal/pwm.h"45#include "bcal/pwm.h"
46+#include "bcal/rmii.h"
45#include "bcal/sol.h"47#include "bcal/sol.h"
46#include "bcal/spi.h"48#include "bcal/spi.h"
47#include "bcal/trng.h"49#include "bcal/trng.h"
@@ -1055,6 +1057,105 @@ static void exec_kcs(bcal::IDriver* driver, const std::vector<std::string>& args
1055 }1057 }
1056}1058}
1057 1059 
1060+static void exec_rmii(bcal::IDriver* driver, const std::vector<std::string>& args)
1061+{
1062+ auto* rmii = static_cast<BCAL_DRIVER_RMII::Rmii*>(driver);
1063+ if (args.empty()) {
1064+ return;
1065+ }
1066+ const std::string& cmd = args[0];
1067+ 
1068+ try {
1069+ if (cmd == "config") {
1070+ // rmii config [interface_name] [timeout_ms] [retry_count]
1071+ // All args optional. Build RmiiConfig with defaults, override with provided args.
1072+ BCAL_DRIVER_RMII::RmiiConfig cfg{};
1073+ cfg.interface_name = "eth0";
1074+ if (args.size() > 1) {
1075+ if (args[1].empty()) {
1076+ print_err("rmii.config: interface_name must not be empty");
1077+ return;
1078+ }
1079+ cfg.interface_name = args[1];
1080+ }
1081+ if (args.size() > 2) {
1082+ cfg.timeout_ms = parse_uint(args[2]);
1083+ }
1084+ if (args.size() > 3) {
1085+ cfg.retry_count = parse_uint(args[3]);
1086+ }
atomgit-bot
atomgit-botatomgit-bot17 hours ago

🔵 Low Priority

变更行 dfx/src/main.cpp:1083-1088:config 子命令用 parse_uint(args[2]) / parse_uint(args[3]) 解析超时与重试次数,而 parse_uint(107-117)的缺省返回值为 0,非数字、负数(std::stoul("-1") 会解析成大数)、纯字母等都会静默回落为 0。

证据链:

  • exec_rmii 在 1074-1075 显式把默认值写成 5000/3,却在用户给出非法值时把它覆盖成 0。

失败模式:rmii config eth0 5s 3(手误)→ timeout_ms=0;rmii config eth0 5000 3x → retry_count=0。随后程序仍打印 rmii.config called(1090),用户以为配置生效,实际拿到 0 超时 / 0 重试,发送命令会立即失败且难以定位。

修复方向:解析失败时不覆盖默认值(把 def_val 传成 5000 / 3),或对 0 与非法输入做校验并 print_err 后 return。

建议:为 parse_uint 传入默认值(如 parse_uint(args[2], 5000) / parse_uint(args[3], 3)),或校验解析结果合法性,非法时 print_err 并 return,避免静默把超时/重试置 0。

likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
1087+ rmii->init(&cfg, sizeof(cfg));
1088+ print_ok("rmii.config called");
1089+ } else if (cmd == "send") {
1090+ // rmii send <hex_data> [length]
1091+ if (args.size() < 2) {
1092+ print_err("Usage: rmii send <hex_data> [length]");
1093+ return;
1094+ }
1095+ std::string bytes = hex_to_bytes(args[1]);
1096+ int32_t length = -1;
1097+ if (args.size() > 2) {
1098+ length = parse_int(args[2], -1);
1099+ }
1100+ if (length != -1 && (length < 0 || static_cast<size_t>(length) > bytes.size())) {
1101+ print_err("rmii.send: invalid length " + std::to_string(length) + ", payload is " +
1102+ std::to_string(bytes.size()) + " bytes");
1103+ return;
1104+ }
1105+ int32_t ret = rmii->send_ncsi_cmd(string_view_t(bytes.data(), bytes.size()), length);
atomgit-bot
atomgit-botatomgit-bot17 hours ago

🟡 Medium Priority

变更行 dfx/src/main.cpp:1097-1102:bytes = hex_to_bytes(args[1]) 得到实际负载长度,length 由用户参数 args[2] 经 parse_int 得出,随后直接以 send_ncsi_cmd(string_view_t(bytes.data(), bytes.size()), length) 下发给驱动,未校验 length 与 bytes.size() 的关系。\n\n契约(include/bcal/rmii.h:46-49):length 为"数据包长度(字节),-1 表示发送整个 packet",即实现侧可按 length 决定发送/读取长度。\n\n失败模式:执行 bcaldfx rmii send 0102 100 时,view 只有 2 字节而 length=100,若平台实现按 length 作为 send 长度(send(fd, packet.data(), length) 这类写法),会从 string_view 之外的堆内存越界读取;rmii send 0102 -5 同样会被接受(parse_int 允许负号,仅 -1 有定义),被实现当作巨大长度或触发有符号/无符号转换问题。这是调用方违反自身接口契约,属于可触发的越界读与不可预期行为。\n\n修复:调用前校验 length == -1 || (length >= 0 && static_cast<size_t>(length) <= bytes.size()),否则报错返回;parse_int 失败时应回落到 -1 而非 0。

建议:下发给驱动前校验 length 只能是 -1 或 [0, bytes.size()] 范围内的值,越界时 print_err 并 return;parse_int 的第二参数传 -1,避免非法输入被当成 0 长度。

Suggestions
1105
+ std::string bytes = hex_to_bytes(args[1]);
1106
+ int32_t length = -1;
1107
+ if (args.size() > 2) {
1108
+ length = parse_int(args[2], -1);
1109
+ }
1105
- int32_t ret = rmii->send_ncsi_cmd(string_view_t(bytes.data(), bytes.size()), length);
1110
+ if (length != -1 && (length < 0 || static_cast<size_t>(length) > bytes.size())) {
1111
+ print_err("rmii.send: invalid length " + std::to_string(length) + ", payload is " +
1112
+ std::to_string(bytes.size()) + " bytes");
1113
+ return;
1114
+ }
Apply suggestion
likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
1106+ if (ret == 0) {
1107+ print_ok("rmii.send success");
1108+ } else {
1109+ print_err("rmii.send failed: ret=" + std::to_string(ret) +
1110+ (errno != 0 ? std::string(" (") + strerror(errno) + ")" : std::string()));
1111+ }
1112+ } else if (cmd == "recv") {
1113+ // rmii recv [sock]
1114+ int32_t sock = -1;
1115+ if (args.size() > 1) {
1116+ sock = parse_int(args[1], -1);
1117+ }
atomgit-bot
atomgit-botatomgit-bot17 hours ago

🔵 Low Priority

变更行 dfx/src/main.cpp:1110-1113:recv [sock] 用 parse_int(args[1]) 解析套接字,而 parse_int(95-105)的缺省返回值是 0,不是 -1。\n\n契约(include/bcal/rmii.h:54-57):sock 缺省语义为 -1("使用默认套接字")。\n\n失败模式:输入非法 sock(如 bcaldfx rmii recv abc)时 parse_int 抛异常回落到 0,把 fd 0(stdin)当套接字传给平台实现:轻则 recv 失败返回空数据、被 1115-1116 当作 "[INFO] length=0 (no data)" 正常输出,重则实现对 stdin 做 socket 操作产生不可预期行为,且用户无法察觉参数被静默改写。\n\n修复:sock = parse_int(args[1], -1)。

建议:parse_int 第二个参数传 -1,使非法输入回落为"默认套接字"而不是 fd 0。

Suggestions
1117
+ int32_t sock = -1;
1118
+ if (args.size() > 1) {
1119
+ sock = parse_int(args[1], -1);
1117
1120
  }
Apply suggestion
likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
1118+ string_t data = rmii->ncsi_receive_packet(sock);
1119+ if (data.empty()) {
1120+ print_info("rmii.recv: length=0 (no data)");
1121+ } else {
1122+ print_result("rmii.recv", "length=" + std::to_string(data.size()) + ", data=" + hex_dump(data));
1123+ }
1124+ } else if (cmd == "get_interface") {
1125+ print_result("rmii.get_interface", rmii->get_interface_name());
1126+ } else if (cmd == "set_interface") {
1127+ if (args.size() < 2) {
1128+ print_err("Usage: rmii set_interface <name>");
1129+ return;
1130+ }
1131+ rmii->set_interface_name(args[1]);
1132+ print_ok("rmii.set_interface called");
1133+ } else if (cmd == "link_status") {
1134+ bool available = rmii->is_available();
1135+ print_result("rmii.is_available", available ? "true" : "false");
1136+ if (!available) {
1137+ print_info("rmii not ready (freed or not initialized), or interface '" + rmii->get_interface_name() +
1138+ "' is down; run 'rmii config <iface> [timeout_ms] [retry]'");
1139+ }
1140+ } else if (cmd == "free") {
1141+ rmii->free();
1142+ // Keep the instance in the cache: free() only marks it freed, and the next
1143+ // send/recv will report "driver has been freed", while 'rmii config'
1144+ // re-initializes it. Erasing here made every following command silently
1145+ // create a fresh default instance (and print "loaded successfully").
1146+ print_ok("rmii.free called (run 'rmii config' to re-initialize)");
1147+ } else {
1148+ handle_common(driver, args);
1149+ }
1150+ } catch (const std::runtime_error& e) {
1151+ print_err("rmii." + cmd + ": " + e.what());
1152+ } catch (const std::exception& e) {
1153+ print_err("rmii." + cmd + ": " + e.what());
1154+ } catch (...) {
1155+ print_err("rmii." + cmd + ": unknown exception");
1156+ }
1157+}
1158+ 
1058static void exec_canbus(bcal::IDriver* driver, const std::vector<std::string>& args)1159static void exec_canbus(bcal::IDriver* driver, const std::vector<std::string>& args)
1059{1160{
1060 auto* canbus = static_cast<BCAL_DRIVER_CANBUS::Canbus*>(driver);1161 auto* canbus = static_cast<BCAL_DRIVER_CANBUS::Canbus*>(driver);
@@ -2615,32 +2716,15 @@ static void exec_usb_drd(bcal::IDriver* driver, const std::vector<std::string>&
2615 2716 
2616static const std::map<std::string, std::function<void(bcal::IDriver*, const std::vector<std::string>&)>>2717static const std::map<std::string, std::function<void(bcal::IDriver*, const std::vector<std::string>&)>>
2617 g_driver_executors = {2718 g_driver_executors = {
2618- {"wdt", exec_wdt},2719+ {"wdt", exec_wdt}, {"peci", exec_peci}, {"usb_drd", exec_usb_drd},
2619- {"peci", exec_peci},2720+ {"i2c", exec_i2c}, {"jtag", exec_jtag}, {"localbus", exec_localbus},
2620- {"usb_drd", exec_usb_drd},2721+ {"adc", exec_adc}, {"gpio", exec_gpio}, {"canbus", exec_canbus},
2621- {"i2c", exec_i2c},2722+ {"usb", exec_usb}, {"efuse", exec_efuse}, {"mmc", exec_mmc},
2622- {"jtag", exec_jtag},2723+ {"mctp", exec_mctp}, {"uart", exec_uart}, {"uart_connect", exec_uart_connect},
2623- {"localbus", exec_localbus},2724+ {"spi", exec_spi}, {"sol", exec_sol}, {"pwm", exec_pwm},
2624- {"adc", exec_adc},2725+ {"edma", exec_edma}, {"ipmb", exec_ipmb}, {"bt", exec_bt},
2625- {"gpio", exec_gpio},2726+ {"mem", exec_mem}, {"kcs", exec_kcs}, {"mdio", exec_mdio},
2626- {"canbus", exec_canbus},2727+ {"trng", exec_trng}, {"rmii", exec_rmii}, {"lpc_snoop", exec_lpc_snoop},
atomgit-bot
atomgit-botatomgit-bot12 hours ago

🔵 Low Priority

新问题(本轮新增观察): 证据链:

likedislike
Incorrect?
2627- {"usb", exec_usb},
2628- {"efuse", exec_efuse},
2629- {"mmc", exec_mmc},
2630- {"mctp", exec_mctp},
2631- {"uart", exec_uart},
2632- {"uart_connect", exec_uart_connect},
2633- {"spi", exec_spi},
2634- {"sol", exec_sol},
2635- {"pwm", exec_pwm},
2636- {"edma", exec_edma},
2637- {"ipmb", exec_ipmb},
2638- {"bt", exec_bt},
2639- {"mem", exec_mem},
2640- {"kcs", exec_kcs},
2641- {"mdio", exec_mdio},
2642- {"trng", exec_trng},
2643- {"lpc_snoop", exec_lpc_snoop},
2644};2728};
2645 2729 
2646static void cmd_driver_exec(const std::string& driver_name, const std::vector<std::string>& args)2730static void cmd_driver_exec(const std::string& driver_name, const std::vector<std::string>& args)
@@ -2877,6 +2961,14 @@ static void cmd_help(const std::vector<std::string>& /*args*/)
2877 std::cout << " poll\n";2961 std::cout << " poll\n";
2878 std::cout << " read <index> <max_len> <timeout>\n";2962 std::cout << " read <index> <max_len> <timeout>\n";
2879 std::cout << " write <index> <val> <timeout>\n";2963 std::cout << " write <index> <val> <timeout>\n";
2964+ std::cout << " \033[33mrmii\033[0m\n";
2965+ std::cout << " config [interface_name] [timeout_ms] [retry_count]\n";
2966+ std::cout << " send <hex_data> [length]\n";
2967+ std::cout << " recv [sock]\n";
2968+ std::cout << " get_interface\n";
2969+ std::cout << " set_interface <name>\n";
2970+ std::cout << " link_status\n";
2971+ std::cout << " free\n";
2880 std::cout << std::endl;2972 std::cout << std::endl;
2881}2973}
2882 2974 
@@ -0,0 +1,97 @@
1+/* Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
2+ * openUBMC is licensed under Mulan PSL v2.
3+ * You may obtain a copy of Mulan PSL v2 at:
4+ * http://license.coscl.org.cn/MulanPSL2
5+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
6+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
7+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
8+ * See the Mulan PSL v2 for more details.
9+ */
10+ 
11+/**
12+ * @file rmii.h
13+ * @brief RMII (Reduced Media Independent Interface) 驱动接口
14+ * 用于 NC-SI(Network Controller Sideband Interface)协议 over Ethernet,
15+ * 典型用途:BMC 通过 RMII 通道与服务器管理控制器通信
16+ */
17+#ifndef BCAL_RMII_H
18+#define BCAL_RMII_H
19+ 
20+#include "bcal/driver.h"
21+ 
22+namespace BCAL_DRIVER_RMII {
23+using namespace bcal;
24+ 
25+/**
26+ * @struct RmiiConfig
27+ * @brief RMII 驱动初始化配置
28+ */
29+struct RmiiConfig {
30+ string_t interface_name; /**< 网络接口名称,如 "eth0" */
31+ uint32_t timeout_ms = 5000; /**< 超时时间(毫秒),默认 5000 */
32+ uint32_t retry_count = 3; /**< 重试次数,默认 3 */
33+};
atomgit-bot
atomgit-botatomgit-bot17 hours ago

🔵 Low Priority

变更行 include/bcal/rmii.h:29-33 新增的 RmiiConfig 注释声明"默认 5000""默认 3"(31-32 行),但字段没有类内默认初始化。\n\n影响:该头文件是对外发布接口(meson.build:44 已加入 install_headers),平台实现在另一仓 libsoc_adapter_aspeed。使用方写下 RmiiConfig cfg; 后仅设置 interface_name 时,timeout_ms/retry_count 为不确定值。\n\n失败模式:实现侧按注释语义使用 cfg->timeout_ms / retry_count 控制超时与重试时,会读到栈上残留值——超时为 0(立即失败/无超时)或极大随机值(长时间阻塞),重试次数同样不可控,跨仓联调难以定位。当前 exec_rmii 未暴露该问题只是因为它手工赋了默认值(1073-1075)。\n\n修复(可选改进,非必须):为两个字段加类内默认初始化,使注释契约在代码层面成立。

建议:给 timeout_ms / retry_count 增加类内默认初始化(5000 / 3),避免调用方构造后未赋值就读到不确定值。

Suggestions
33
+ struct RmiiConfig {
34
+ string_t interface_name; /**< 网络接口名称,如 "eth0" */
35
+ uint32_t timeout_ms = 5000; /**< 超时时间(毫秒),默认 5000 */
36
+ uint32_t retry_count = 3; /**< 重试次数,默认 3 */
33
37
  };
Apply suggestion
likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
34+ 
35+/**
36+ * @class Rmii
37+ * @brief RMII 驱动接口
38+ * @note 每个 Rmii 实例对应一个网络接口(如 eth0),通过 init() 传入配置
39+ */
40+class Rmii : public IDriver {
41+public:
42+ /**
43+ * @brief 发送 NCSI 命令数据包
44+ *
45+ * @param packet 数据包内容
46+ * @param length 数据包长度(字节)。取值范围 length ∈ {-1} ∪ [0, packet.size()]:
47+ * -1 表示发送整个 packet;
48+ * 0 ≤ length ≤ packet.size() 表示发送 packet 前 length 字节。
49+ * 前置条件:length 不得大于 packet.size(),否则实现不得越界读取,
50+ * 应返回 -1(或抛出 std::invalid_argument)而非按错误长度从 packet 读数据。
51+ * @return int32_t 0: 发送成功, -1: 发送失败(含 length 越界/非法、底层 sendto 失败)
52+ */
53+ virtual int32_t send_ncsi_cmd(const string_view_t& packet, int32_t length) = 0;
atomgit-bot
atomgit-botatomgit-bot15 hours ago

🔵 Low Priority

变更行 include/bcal/rmii.h:49:virtual int32_t send_ncsi_cmd(const string_view_t& packet, int32_t length) = 0; 的注释只写了"数据包长度(字节),-1 表示发送整个 packet",没有声明 length 必须不大于 packet.size()。

证据链:

  • 但头文件是所有平台实现(libsoc_adapter_aspeed drivers/rmii/rmii.cpp)与所有调用方共同遵守的契约,文件中并未把这一前置条件写出来,也没有约束 length 上界。

失败模式:其它调用方(业务进程直接使用该接口)传入大于 packet.size() 的 length(例如误传缓冲区容量而非实际长度)时,实现按该长度从 packet 读取,越界读 1 字节以上数据并发到链路上(信息泄露或崩溃),头文件层面无从发现问题。

建议:在 send_ncsi_cmd 的 Doxygen 注释中补充前置条件 length ∈ {-1} ∪ [0, packet.size()],并说明超出时实现应返回 -1 而非越界读。

likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
54+ 
55+ /**
56+ * @brief 接收 NCSI 响应数据包
57+ *
58+ * @param sock 套接字句柄,-1 表示使用默认套接字
59+ * @return string_t 接收到的数据包内容。返回语义:
60+ * - 成功接收到一个包时返回其内容(长度 > 0);
61+ * - 超时无数据、被信号中断或没有数据时返回空串(长度 == 0,
62+ * 这是「无数据」的正常状态,不是错误);
63+ * - 底层接收真实失败(如 socket 已关闭)时抛出
64+ * std::system_error,调用方须捕获并视为接收失败。
65+ */
66+ virtual string_t ncsi_receive_packet(int32_t sock = -1) = 0;
atomgit-bot
atomgit-botatomgit-bot12 hours ago

🔵 Low Priority

上一轮问题复查:仍存在,未修复。 证据链:

  • 本项为接口契约文档缺失,不构成运行时错误,故维持低优先级。

建议:在 rmii.h 的 Doxygen 注释中明确失败语义:要么约定「失败返回空串并通过 errno 给出原因」,要么改为 int32_t ncsi_receive_packet(int32_t sock, string_t& out) 用返回码区分成功/无数据/失败;随后让 dfx/src/main.cpp:1118-1123 的 recv 分支据此分别输出 INFO(无数据)与 ERROR(接收失败)。

likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
3 hours ago Comments:
likedislike
67+ 
68+ /**
69+ * @brief 获取当前使用的网络接口名称
70+ *
71+ * @return string_t 接口名称,如 "eth0"
72+ */
73+ virtual string_t get_interface_name(void) = 0;
74+ 
75+ /**
76+ * @brief 设置网络接口名称
77+ *
78+ * @param name 新的接口名称
79+ */
80+ virtual void set_interface_name(const string_view_t& name) = 0;
81+ 
82+ /**
83+ * @brief 释放 RMII 驱动资源
84+ */
85+ virtual void free(void) = 0;
atomgit-bot
atomgit-botatomgit-bot17 hours ago

🔵 Low Priority

变更行 include/bcal/rmii.h:76:释放资源的纯虚接口命名为 free(void)。

证据链:

失败模式:同一 HAL 层出现两种释放语义命名(deinit vs free),调用方/实现方容易按 deinit() 习惯调用而漏掉真正的释放接口;实现方误写 free(ptr) 直接编译失败。属于新增接口与既有约定的不一致(P3,可选改进)。

修复方向:重命名为 deinit(),并同步 dfx 的 free 子命令与 cmd_help;因涉及另一仓库的实现同步,此处不给出单点替换代码。

建议:按 bcal 既有释放约定把 free() 改名为 deinit()(参照 h2b.h:103),并同步 dfx/src/main.cpp 的 free 子命令与帮助文本;需与 libsoc_adapter_aspeed 侧实现联动修改。

likedislike
Incorrect?
byosoft_wujiming
byosoft_wujiming
14 hours ago Comments:
likedislike
86+ 
87+ /**
88+ * @brief 检查 RMII 接口是否可用
89+ *
90+ * @return bool 可用返回 true
91+ */
92+ virtual bool is_available(void) = 0;
93+};
94+ 
95+} // namespace BCAL_DRIVER_RMII
96+ 
97+#endif // BCAL_RMII_H
@@ -2,7 +2,7 @@
2 "name": "bcal",2 "name": "bcal",
3 "type": "library",3 "type": "library",
4 "deployConfig": "",4 "deployConfig": "",
5- "version": "0.0.13",5+ "version": "0.0.14",
6 "license": "Mulan PSL v2",6 "license": "Mulan PSL v2",
7 "description": "",7 "description": "",
8 "dependencies": {8 "dependencies": {
@@ -41,6 +41,7 @@ headers = files(
41 'include/bcal/mmc.h',41 'include/bcal/mmc.h',
42 'include/bcal/peci.h',42 'include/bcal/peci.h',
43 'include/bcal/pwm.h',43 'include/bcal/pwm.h',
44+ 'include/bcal/rmii.h',
44 'include/bcal/sol.h',45 'include/bcal/sol.h',
45 'include/bcal/spi.h',46 'include/bcal/spi.h',
46 'include/bcal/trng.h',47 'include/bcal/trng.h',