1 // Copyright 2023 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #include "pw_system/trace_service.h" 16 17 #include "pw_trace_tokenized/trace_service_pwpb.h" 18 #include "pw_trace_tokenized/trace_tokenized.h" 19 20 namespace pw::system { 21 namespace { 22 23 // TODO: b/305795949 - place trace_data in a persistent region of memory 24 TracePersistentBuffer trace_data; 25 persistent_ram::PersistentBufferWriter trace_data_writer( 26 trace_data.GetWriter()); 27 28 trace::TraceService trace_service(trace::GetTokenizedTracer(), 29 trace_data_writer); 30 31 } // namespace 32 GetTraceData()33TracePersistentBuffer& GetTraceData() { return trace_data; } 34 RegisterTraceService(rpc::Server & rpc_server,uint32_t transfer_id)35void RegisterTraceService(rpc::Server& rpc_server, uint32_t transfer_id) { 36 rpc_server.RegisterService(trace_service); 37 trace_service.SetTransferId(transfer_id); 38 } 39 40 } // namespace pw::system 41