CCSDS AOS (Advanced Orbiting Systems) Transfer Frame for satellite downlinks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Port monorepo to latest ocaml-wire (opam pin)

Migrate all consumers to the new wire API:
- wire.c library → wire.3d (Wire_c → Wire_3d)
- Wire.struct_/module_ → Wire.Everparse.struct_/module_
- Wire.Codec: record/|+/seal → Codec.v with Field.v and $
- Wire.bf_uint* → Wire.U8/U16/U16be/U32/U32be
- Wire.UInt32 → Wire.Private.UInt32
- Wire.cases → Wire.lookup, Wire.map now uses labeled args
- Wire.Codec.decode now returns result
- Add wire pin to root.opam.template

+50 -41
+14 -10
c/AosHeader.3d
··· 1 - /*++ CCSDS AOS Transfer Frame Primary Header (732.0-B-4) --*/ 1 + extern typedef struct _WireCtx WireCtx 2 + 3 + extern unit WireSetU16BE(mutable WireCtx *ctx, UINT32 idx, UINT16BE v) 4 + 5 + extern unit WireSetU32BE(mutable WireCtx *ctx, UINT32 idx, UINT32BE v) 2 6 3 7 entrypoint 4 - typedef struct _AosHeader 8 + typedef struct _AosHeader(mutable WireCtx *ctx) 5 9 { 6 - UINT16BE version : 2; 7 - UINT16BE scid : 8; 8 - UINT16BE vcid : 6; 9 - UINT32BE vcfc : 24; 10 - UINT32BE replay_flag : 1; 11 - UINT32BE vc_count_flag : 1; 12 - UINT32BE spare : 2; 13 - UINT32BE vc_count_cycle : 4; 10 + UINT16BE version : 2 {:act WireSetU16BE(ctx, (UINT32) 0, version); }; 11 + UINT16BE scid : 8 {:act WireSetU16BE(ctx, (UINT32) 1, scid); }; 12 + UINT16BE vcid : 6 {:act WireSetU16BE(ctx, (UINT32) 2, vcid); }; 13 + UINT32BE vcfc : 24 {:act WireSetU32BE(ctx, (UINT32) 3, vcfc); }; 14 + UINT32BE replay_flag : 1 {:act WireSetU32BE(ctx, (UINT32) 4, replay_flag); }; 15 + UINT32BE vc_count_flag : 1 {:act WireSetU32BE(ctx, (UINT32) 5, vc_count_flag); }; 16 + UINT32BE spare : 2 {:act WireSetU32BE(ctx, (UINT32) 6, spare); }; 17 + UINT32BE vc_count_cycle : 4 {:act WireSetU32BE(ctx, (UINT32) 7, vc_count_cycle); }; 14 18 } AosHeader; 15 19 16 20
+1 -1
c/dune
··· 6 6 (executable 7 7 (name gen) 8 8 (modules gen) 9 - (libraries aos wire.c)) 9 + (libraries aos wire.3d)) 10 10 11 11 (rule 12 12 (mode promote)
+1 -6
c/gen.ml
··· 1 - let () = 2 - Wire_c.main ~package:"aos" 3 - [ 4 - Wire_c.schema ~name:"AosHeader" ~module_:Aos.module_ 5 - ~wire_size:(Wire.Codec.wire_size Aos.codec); 6 - ] 1 + let () = Wire_3d.main ~package:"aos" [ Wire.Everparse.schema Aos.codec ]
+31 -21
lib/aos.ml
··· 327 327 328 328 (* Wire Codec *) 329 329 let codec = 330 - let open Wire.Codec in 331 - let bits16 n = Wire.bits ~width:n Wire.bf_uint16be in 332 - let bits32 n = Wire.bits ~width:n Wire.bf_uint32be in 330 + let bits16 n = Wire.bits ~width:n Wire.U16be in 331 + let bits32 n = Wire.bits ~width:n Wire.U32be in 333 332 let bool32 = Wire.bool (bits32 1) in 334 - record "AosHeader" (fun ver scid vcid vcfc rf sf spare vfcc -> 333 + let f_version = Wire.Field.v "version" (bits16 2) in 334 + let f_scid = Wire.Field.v "scid" (bits16 8) in 335 + let f_vcid = Wire.Field.v "vcid" (bits16 6) in 336 + let f_vcfc = Wire.Field.v "vcfc" (bits32 24) in 337 + let f_replay_flag = Wire.Field.v "replay_flag" bool32 in 338 + let f_vc_count_flag = Wire.Field.v "vc_count_flag" bool32 in 339 + let f_spare = Wire.Field.v "spare" (bits32 2) in 340 + let f_vc_count_cycle = Wire.Field.v "vc_count_cycle" (bits32 4) in 341 + Wire.Codec.v "AosHeader" 342 + (fun ver scid vcid vcfc rf sf spare vfcc -> 335 343 { 336 344 version = ver; 337 345 scid; ··· 342 350 spare; 343 351 vc_count_cycle = vfcc; 344 352 }) 345 - |+ field "version" (bits16 2) (fun t -> t.version) 346 - |+ field "scid" (bits16 8) (fun t -> t.scid) 347 - |+ field "vcid" (bits16 6) (fun t -> t.vcid) 348 - |+ field "vcfc" (bits32 24) (fun t -> t.vcfc) 349 - |+ field "replay_flag" bool32 (fun t -> t.replay_flag) 350 - |+ field "vc_count_flag" bool32 (fun t -> t.vc_count_flag) 351 - |+ field "spare" (bits32 2) (fun t -> t.spare) 352 - |+ field "vc_count_cycle" (bits32 4) (fun t -> t.vc_count_cycle) 353 - |> seal 353 + Wire.Codec. 354 + [ 355 + (f_version $ fun t -> t.version); 356 + (f_scid $ fun t -> t.scid); 357 + (f_vcid $ fun t -> t.vcid); 358 + (f_vcfc $ fun t -> t.vcfc); 359 + (f_replay_flag $ fun t -> t.replay_flag); 360 + (f_vc_count_flag $ fun t -> t.vc_count_flag); 361 + (f_spare $ fun t -> t.spare); 362 + (f_vc_count_cycle $ fun t -> t.vc_count_cycle); 363 + ] 354 364 355 - let struct_ = Wire.Codec.to_struct codec 365 + let struct_ = Wire.Everparse.struct_of_codec codec 356 366 357 367 let module_ = 358 - Wire.module_ ~doc:"CCSDS AOS Transfer Frame Primary Header (732.0-B-4)" 359 - "AosHeader" 360 - [ Wire.typedef ~entrypoint:true struct_ ] 368 + Wire.Everparse.Raw.module_ 369 + ~doc:"CCSDS AOS Transfer Frame Primary Header (732.0-B-4)" 370 + [ Wire.Everparse.Raw.typedef ~entrypoint:true struct_ ] 361 371 362 372 (* Wire Parse/Encode *) 363 373 let wire_size = Wire.Codec.wire_size codec ··· 365 375 let decode_bytes buf = 366 376 if Bytes.length buf < wire_size then 367 377 Error (Wire.Unexpected_eof { expected = wire_size; got = Bytes.length buf }) 368 - else Ok (Wire.Codec.decode codec buf 0) 378 + else Wire.Codec.decode codec buf 0 369 379 370 380 let decode_string s = 371 381 if String.length s < wire_size then 372 382 Error (Wire.Unexpected_eof { expected = wire_size; got = String.length s }) 373 - else Ok (Wire.Codec.decode codec (Bytes.of_string s) 0) 383 + else Wire.Codec.decode codec (Bytes.of_string s) 0 374 384 375 385 let encode_string t = 376 386 let buf = Bytes.create wire_size in ··· 415 425 }) 416 426 417 427 (* FFI Code Generation *) 418 - let c_stubs () = Wire.to_c_stubs [ struct_ ] 419 - let ml_stubs () = Wire.to_ml_stubs [ struct_ ] 428 + let c_stubs () = Wire_stubs.to_c_stubs [ struct_ ] 429 + let ml_stubs () = Wire_stubs.to_ml_stubs [ struct_ ] 420 430 421 431 (* {1 Constructors} *) 422 432
+2 -2
lib/aos.mli
··· 205 205 206 206 val codec : packed_header Wire.Codec.t 207 207 208 - val struct_ : Wire.struct_ 208 + val struct_ : Wire.Everparse.struct_ 209 209 (** Wire struct definition for an AOS header. *) 210 210 211 - val module_ : Wire.module_ 211 + val module_ : Wire.Everparse.module_ 212 212 (** Wire module definition for AOS. *) 213 213 214 214 (** {1 Wire Parse/Encode} *)
+1 -1
lib/dune
··· 1 1 (library 2 2 (name aos) 3 3 (public_name aos) 4 - (libraries clcw crc wire)) 4 + (libraries clcw crc wire wire.stubs))