Skip to content

Commit

Permalink
Fixed print mbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Oct 3, 2020
1 parent 346db7d commit f56ef87
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
16 changes: 13 additions & 3 deletions apps/my_sensor_app/src/ble_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ static int bleprph_gap_event(struct ble_gap_event *event, void *arg);

static void blecent_read(const struct blepeer *peer);
static int blecent_on_read(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg);
static void print_mbuf(const struct os_mbuf *om);

// Called when GATT Service Discovery of the BLE Peer has completed
/// Called when GATT Service Discovery of the BLE Peer has completed
static void blecent_on_disc_complete(const struct blepeer *peer, int status, void *arg) {
if (status != 0) {
// Service discovery failed
Expand All @@ -90,7 +91,7 @@ static void blecent_on_disc_complete(const struct blepeer *peer, int status, voi
return;
}

// Read the GATT Characteristic for Current Time Service from the BLE Peer
/// Read the GATT Characteristic for Current Time Service from the BLE Peer
static void blecent_read(const struct blepeer *peer) {
// Find the GATT Characteristic for Current Time Service from the discovered GATT Characteristics
const struct blepeer_chr *chr = blepeer_chr_find_uuid(
Expand Down Expand Up @@ -122,7 +123,7 @@ static void blecent_read(const struct blepeer *peer) {
return;
}

// Called when Current Time Service GATT Characteristic has been read
/// Called when Current Time Service GATT Characteristic has been read
static int blecent_on_read(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) {
// Read the current time from the Current Time Service
MODLOG_DFLT_INFO("Read complete; status=%d conn_handle=%d", error->status, conn_handle);
Expand All @@ -138,6 +139,15 @@ static int blecent_on_read(uint16_t conn_handle, const struct ble_gatt_error *er
return 0;
}

/// Print the mbuf
static void print_mbuf(const struct os_mbuf *om) {
while (om != NULL) {
console_dump(om->om_data, om->om_len);
console_printf("\n");
om = SLIST_NEXT(om, om_next);
}
}

// End of Time Sync
///////////////////////////////////////////////////////////////////////////////

Expand Down
9 changes: 0 additions & 9 deletions apps/my_sensor_app/src/ble_peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ struct ble_hs_cfg;
union ble_store_value;
union ble_store_key;

/** Misc. */
void print_bytes(const uint8_t *bytes, int len);
void print_mbuf(const struct os_mbuf *om);
char *addr_str(const void *addr);
void print_uuid(const ble_uuid_t *uuid);
void print_conn_desc(const struct ble_gap_conn_desc *desc);
void print_adv_fields(const struct ble_hs_adv_fields *fields);

/** Peer. */
struct blepeer_dsc {
SLIST_ENTRY(blepeer_dsc) next;
struct ble_gatt_dsc dsc;
Expand Down
20 changes: 10 additions & 10 deletions logs/rustlib-demangle.S
Original file line number Diff line number Diff line change
Expand Up @@ -4176,15 +4176,15 @@ __rust_i128_subo():
a: e9d7 e604 ldrd lr, r6, [r7, #16]
e: 2100 movs r1, #0
10: e9d7 8c06 ldrd r8, ip, [r7, #24]
_ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_add17h4d60e949e302cf5bE():
_ZN17compiler_builtins3int6addsub7UAddSub8uadd_one17h31c39dd29144a579E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/uint_macros.rs:1209
14: f1de 0e00 rsbs lr, lr, #0
18: f8d7 9008 ldr.w r9, [r7, #8]
1c: eb71 0a06 sbcs.w sl, r1, r6
_ZN44_$LT$u128$u20$as$u20$core..ops..bit..Not$GT$3not17he45b7b3fddc19b70E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/ops/bit.rs:60
20: ea6f 060c mvn.w r6, ip
_ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_add17h4d60e949e302cf5bE():
_ZN17compiler_builtins3int6addsub7UAddSub8uadd_one17h31c39dd29144a579E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/uint_macros.rs:1209
24: f141 0500 adc.w r5, r1, #0
_ZN44_$LT$u128$u20$as$u20$core..ops..bit..Not$GT$3not17he45b7b3fddc19b70E():
Expand Down Expand Up @@ -6350,7 +6350,7 @@ _ZN4core3num22_$LT$impl$u20$u128$GT$11checked_rem17ha3da3663f9d27aaaE():
36: ea45 0406 orr.w r4, r5, r6
3a: ea54 0408 orrs.w r4, r4, r8
3e: d01e beq.n 7e <__modti3+0x7e>
_ZN17compiler_builtins3int4sdiv8__modti317h4746257be72974acE():
_ZN17compiler_builtins3int4sdiv3Mod4mod_17h438c6bcc94b62f75E():
40: 17dc asrs r4, r3, #31
_ZN47_$LT$i128$u20$as$u20$core..ops..bit..BitXor$GT$6bitxor17h36896e9a94a15d19E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/ops/bit.rs:351
Expand Down Expand Up @@ -6402,7 +6402,7 @@ __modti3():
76: b004 add sp, #16
78: f85d 8b04 ldr.w r8, [sp], #4
7c: bdf0 pop {r4, r5, r6, r7, pc}
_ZN17compiler_builtins3int4sdiv8__modti317h4746257be72974acE():
_ZN17compiler_builtins5abort17h7205a50b89493a10E():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/lib.rs:35
7e: defe udf #254 ; 0xfe
80: defe udf #254 ; 0xfe
Expand Down Expand Up @@ -7025,14 +7025,14 @@ _ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt1
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
5e: e9c0 4100 strd r4, r1, [r0]
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
62: eb73 0101 sbcs.w r1, r3, r1
66: eb78 0105 sbcs.w r1, r8, r5
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
6a: e9c0 5e02 strd r5, lr, [r0, #8]
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
6e: eb7c 010e sbcs.w r1, ip, lr
72: bf38 it cc
Expand Down Expand Up @@ -14878,7 +14878,7 @@ _ZN17compiler_builtins3int4sdiv3Div3div17h9b145e34fb16bf32E():
_ZN46_$LT$i64$u20$as$u20$core..ops..bit..BitXor$GT$6bitxor17h9f5f5cce5bb4775cE():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/ops/bit.rs:351
28: 4061 eors r1, r4
_ZN4core3num21_$LT$impl$u20$i64$GT$12wrapping_sub17hc1ea7ebcd259f0b8E():
_ZN51_$LT$i64$u20$as$u20$compiler_builtins..int..Int$GT$12wrapping_sub17h07923e108ccced18E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/int_macros.rs:1032
2a: 1b00 subs r0, r0, r4
2c: 41a1 sbcs r1, r4
Expand Down Expand Up @@ -17959,7 +17959,7 @@ _ZN17compiler_builtins5float3div8__divdf317h0f427d9698a77203E():
2f4: b007 add sp, #28
2f6: e8bd 0f00 ldmia.w sp!, {r8, r9, sl, fp}
2fa: bdf0 pop {r4, r5, r6, r7, pc}
_ZN45_$LT$u64$u20$as$u20$core..ops..bit..BitOr$GT$5bitor17h640bf6d9ba3e8ef2E():
_ZN17compiler_builtins5float3div5div6417h2df9c43f595e47b3E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/ops/bit.rs:253
2fc: 9804 ldr r0, [sp, #16]
2fe: 4310 orrs r0, r2
Expand Down Expand Up @@ -21231,14 +21231,14 @@ _ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt1
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
5e: e9c0 4100 strd r4, r1, [r0]
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
62: eb73 0101 sbcs.w r1, r3, r1
66: eb78 0105 sbcs.w r1, r8, r5
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
6a: e9c0 5e02 strd r5, lr, [r0, #8]
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
6e: eb7c 010e sbcs.w r1, ip, lr
72: bf38 it cc
Expand Down
12 changes: 6 additions & 6 deletions logs/rustlib.S
Original file line number Diff line number Diff line change
Expand Up @@ -15275,7 +15275,7 @@ _ZN4core3num21_$LT$impl$u20$i64$GT$12wrapping_sub17hc1ea7ebcd259f0b8E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/int_macros.rs:1032
e: ebb2 72ec subs.w r2, r2, ip, asr #31
12: eb63 73ec sbc.w r3, r3, ip, asr #31
_ZN51_$LT$u64$u20$as$u20$compiler_builtins..int..Int$GT$12aborting_div17h96d6354f11099909E():
_ZN4core3num21_$LT$impl$u20$u64$GT$11checked_div17h2acb6b449001fd49E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/uint_macros.rs:577
16: ea52 0e03 orrs.w lr, r2, r3
1a: d00f beq.n 3c <_ZN17compiler_builtins3int4sdiv8__divdi317hf638ee34a5813680E+0x3c>
Expand All @@ -15294,7 +15294,7 @@ _ZN4core3num21_$LT$impl$u20$i64$GT$12wrapping_sub17hc1ea7ebcd259f0b8E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/int_macros.rs:1032
2a: 1b00 subs r0, r0, r4
2c: 41a1 sbcs r1, r4
_ZN51_$LT$u64$u20$as$u20$compiler_builtins..int..Int$GT$12aborting_div17h96d6354f11099909E():
_ZN4core3num21_$LT$impl$u20$u64$GT$11checked_div17h2acb6b449001fd49E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/uint_macros.rs:582
2e: f7ff fffe bl 0 <__aeabi_uldivmod>
_ZN46_$LT$i64$u20$as$u20$core..ops..bit..BitXor$GT$6bitxor17h9f5f5cce5bb4775cE():
Expand All @@ -15308,7 +15308,7 @@ _ZN45_$LT$i64$u20$as$u20$core..ops..arith..Sub$GT$3sub17h2bb6c4d9fa9b556eE():
_ZN17compiler_builtins3int4sdiv8__divdi317hf638ee34a5813680E():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/macros.rs:264
3a: bdb0 pop {r4, r5, r7, pc}
_ZN51_$LT$u64$u20$as$u20$compiler_builtins..int..Int$GT$12aborting_div17h96d6354f11099909E():
_ZN17compiler_builtins5abort17h7205a50b89493a10E():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/lib.rs:35
3c: defe udf #254 ; 0xfe
3e: defe udf #254 ; 0xfe
Expand Down Expand Up @@ -18779,7 +18779,7 @@ Disassembly of section .text._ZN17compiler_builtins5float6extend13__extendsfdf21
_ZN46_$LT$u32$u20$as$u20$core..ops..bit..BitAnd$GT$6bitand17h0d21bf3c3314d30dE():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/ops/bit.rs:158
0: f020 4200 bic.w r2, r0, #2147483648 ; 0x80000000
_ZN51_$LT$u32$u20$as$u20$compiler_builtins..int..Int$GT$12wrapping_sub17h1e049eca522a20b5E():
_ZN4core3num21_$LT$impl$u20$u32$GT$12wrapping_sub17h57a4102f47cf3239E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/num/uint_macros.rs:920
4: f5a2 0100 sub.w r1, r2, #8388608 ; 0x800000
_ZN17compiler_builtins5float6extend6extend17h8485c584851c0b04E():
Expand Down Expand Up @@ -21233,14 +21233,14 @@ _ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt1
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
5e: e9c0 4100 strd r4, r1, [r0]
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
62: eb73 0101 sbcs.w r1, r3, r1
66: eb78 0105 sbcs.w r1, r8, r5
_ZN17compiler_builtins3int6addsub16__rust_u128_subo17h1e3d2c3ff22ecb5aE():
/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/addsub.rs:132
6a: e9c0 5e02 strd r5, lr, [r0, #8]
_ZN17compiler_builtins3int6addsub4Subo4subo17h7b048631b3396470E():
_ZN4core3cmp5impls56_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u128$GT$2gt17hdf751ff6fbf5edf4E():
/rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/cmp.rs:1138
6e: eb7c 010e sbcs.w r1, ip, lr
72: bf38 it cc
Expand Down

0 comments on commit f56ef87

Please sign in to comment.