add more/better documentation to pico/multicore.h #620

Merged
kilograham merged 6 commits from multicore_doc into develop 2021-10-25 12:23:41 -05:00
kilograham commented 2021-10-19 13:15:44 -05:00 (Migrated from github.com)
No description provided.
Wren6991 (Migrated from github.com) reviewed 2021-10-19 13:15:44 -05:00
lurch (Migrated from github.com) reviewed 2021-10-19 16:46:25 -05:00
@ -44,3 +47,3 @@
*
* Reset core1 and enter the given function on core 1 using the default core 1 stack (below core 0 stack)
* Wake up (a previously reset) core 1 and enter the given function on core 1 using the default core 1 stack (below core 0 stack).
*
lurch (Migrated from github.com) commented 2021-10-19 16:46:24 -05:00

Presumably this always needs to run on core 0? What would happen if you accidentally ran it on core 1?

Presumably this always needs to run on core 0? What would happen if you accidentally ran it on core 1?
lurch (Migrated from github.com) reviewed 2021-10-19 16:51:32 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 16:51:32 -05:00

vector_Table -> vector_table

`vector_Table` -> `vector_table`
lurch (Migrated from github.com) reviewed 2021-10-19 16:51:43 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 16:51:42 -05:00

functions -> function

functions -> function
lurch (Migrated from github.com) reviewed 2021-10-19 16:52:27 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 16:52:26 -05:00

Probably don't need to explicitly mention sp here, now that you've added \param sp ?

Probably don't need to explicitly mention `sp` here, now that you've added `\param sp` ?
lurch (Migrated from github.com) reviewed 2021-10-19 17:12:46 -05:00
@ -75,0 +102,4 @@
* core 1 launch or by the \ref multicore_lockout functions). Additionally they are often required for the exclusive use
* of an RTOS (e.g. FreeRTOS SMP). For these reasons it is suggested that you do not use the FIFO for your own purposes
* unless none of the above concerns apply; the majority of cases for transferring data between cores can be eqaully
* well handled by using a \ref queue
lurch (Migrated from github.com) commented 2021-10-19 17:12:46 -05:00

This seems to be the only "launch" function that allows a vector table to be passed? I know nothing about low-level multicore programming, but would e.g. a multicore_launch_core1_with_stack_and_vector_table be useful? 🤷‍♂️

This seems to be the only "launch" function that allows a vector table to be passed? I know nothing about low-level multicore programming, but would e.g. a `multicore_launch_core1_with_stack_and_vector_table` be useful? :man_shrugging:
lurch (Migrated from github.com) reviewed 2021-10-19 17:14:08 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:14:08 -05:00

"exclusive used" -> "exclusive use"

"exclusive used" -> "exclusive use"
lurch (Migrated from github.com) reviewed 2021-10-19 17:18:43 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:18:43 -05:00

The "waiting sent" doesn't sound quite right IMHO. What about:
"Check the read FIFO to see if it contains data sent by the other core"
?

The "waiting sent" doesn't sound quite right IMHO. What about: "Check the read FIFO to see if it contains data sent by the other core" ?
lurch (Migrated from github.com) reviewed 2021-10-19 17:23:03 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:23:02 -05:00

wash -> was 😉 🧼

wash -> was :wink: :soap:
lurch (Migrated from github.com) reviewed 2021-10-19 17:26:42 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:26:41 -05:00

Not sure if the "unsigned" is needed here, as multicore_fifo_push_blocking just says "A 32 bit value" ?

Not sure if the "unsigned" is needed here, as `multicore_fifo_push_blocking` just says "A 32 bit value" ?
lurch (Migrated from github.com) reviewed 2021-10-19 17:27:40 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:27:40 -05:00

"data to" -> "data from" ?

"data to" -> "data from" ?
lurch (Migrated from github.com) reviewed 2021-10-19 17:28:54 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:28:53 -05:00

"there timeout" -> "the timeout"

"there timeout" -> "the timeout"
lurch (Migrated from github.com) reviewed 2021-10-19 17:30:18 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:30:18 -05:00

wash -> was
pushed -> popped

wash -> was pushed -> popped
lurch (Migrated from github.com) reviewed 2021-10-19 17:33:37 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 17:33:37 -05:00

Perhaps change "incoming FIFO" to "read FIFO" for consistency with the other function-descriptions?

Perhaps change "incoming FIFO" to "read FIFO" for consistency with the other function-descriptions?
lurch (Migrated from github.com) reviewed 2021-10-19 17:36:01 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:36:00 -05:00

Should this mention the ROE and WOF labels, to match up with the doxygen for the multicore_fifo_clear_irq function?

Should this mention the ROE and WOF labels, to match up with the doxygen for the `multicore_fifo_clear_irq` function?
lurch (Migrated from github.com) reviewed 2021-10-19 17:40:13 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:40:13 -05:00

This "Sometimes it is useful to enter a critical section on both cores at once. On a single core system, this can easily be done..." seems like a bit of a logical tautology? 😉 I think I get the intention though.

This "Sometimes it is useful to enter a critical section on both cores at once. On a single core system, this can easily be done..." seems like a bit of a logical tautology? :wink: I think I get the intention though.
lurch (Migrated from github.com) reviewed 2021-10-19 17:40:37 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:40:37 -05:00

cna -> can

cna -> can
lurch (Migrated from github.com) reviewed 2021-10-19 17:41:38 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:41:38 -05:00

Should the /ref be \ref ? (or does Doxygen allow both?)

Should the `/ref` be `\ref` ? (or does Doxygen allow both?)
lurch (Migrated from github.com) reviewed 2021-10-19 17:43:57 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:43:56 -05:00

paused -> pause?

paused -> pause?
lurch (Migrated from github.com) reviewed 2021-10-19 17:44:38 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:44:38 -05:00

paused -> pause?

paused -> pause?
lurch (Migrated from github.com) reviewed 2021-10-19 17:46:17 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:46:17 -05:00

timout -> timeout
these -> this?

timout -> timeout these -> this?
lurch (Migrated from github.com) reviewed 2021-10-19 17:48:47 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:48:47 -05:00

I'm not sure how the "the victim core is executing code from RAM" stuff here meshes with the other parts which talk about the victim core being paused? 😕

I'm not sure how the "the victim core is executing code from RAM" stuff here meshes with the other parts which talk about the victim core being paused? :confused:
lurch (Migrated from github.com) reviewed 2021-10-19 17:53:16 -05:00
lurch (Migrated from github.com) commented 2021-10-19 17:53:16 -05:00

After reading this a couple of times, perhaps "This makes the lockout functions suitable for code that wants to write to flash..." makes more sense than "This allows the lockout functions to be used by code that wants to write to flash..." ? 🤷‍♂️ (I was confused by the "allows")

After reading this a couple of times, perhaps "This makes the lockout functions suitable for code that wants to write to flash..." makes more sense than "This allows the lockout functions to be used by code that wants to write to flash..." ? :man_shrugging: (I was confused by the "allows")
lurch (Migrated from github.com) reviewed 2021-10-19 18:00:42 -05:00
lurch (Migrated from github.com) commented 2021-10-19 18:00:42 -05:00

"force to" -> "forced to" ?

"force to" -> "forced to" ?
lurch (Migrated from github.com) reviewed 2021-10-19 18:04:53 -05:00
lurch (Migrated from github.com) commented 2021-10-19 18:04:53 -05:00

Given that you can only call multicore_lockout_end_ after multicore_lockout_start_, what's the use-case for ever needing/wanting to use multicore_lockout_end_timeout_us ? "if you have already waited for the victim core to enter the lockout state" - there doesn't seem to be any way to not wait for the victim core to enter the lockout state? 🤔
EDIT: Oh, or will the victim core "eventually" enter the lockout state, if you called multicore_lockout_start_timeout_us with a small timeout value and it returned false? (If so, perhaps that's worth clarifying in the multicore_lockout_start_timeout_us doxygen comments?)

Given that you can only call `multicore_lockout_end_` after `multicore_lockout_start_`, what's the use-case for ever needing/wanting to use `multicore_lockout_end_timeout_us` ? "if you have already waited for the victim core to enter the lockout state" - there doesn't seem to be any way to **not** wait for the victim core to enter the lockout state? :thinking: EDIT: Oh, or will the victim core "eventually" enter the lockout state, if you called `multicore_lockout_start_timeout_us` with a small timeout value and it returned false? (If so, perhaps that's worth clarifying in the `multicore_lockout_start_timeout_us` doxygen comments?)
kilograham (Migrated from github.com) reviewed 2021-10-19 18:10:50 -05:00
@ -44,3 +47,3 @@
*
* Reset core1 and enter the given function on core 1 using the default core 1 stack (below core 0 stack)
* Wake up (a previously reset) core 1 and enter the given function on core 1 using the default core 1 stack (below core 0 stack).
*
kilograham (Migrated from github.com) commented 2021-10-19 18:10:50 -05:00

good point, it doesn't work right on core 1 added a note

good point, it doesn't work right on core 1 added a note
lurch (Migrated from github.com) reviewed 2021-10-19 18:11:10 -05:00
lurch (Migrated from github.com) commented 2021-10-19 18:11:10 -05:00

Having read through the doxygen again, perhaps it makes sense to replace references to "pause" with "lockout state", with a brief description of what "lockout state" means? (I'm going to guess that it's just sitting in a busy loop, waiting to be told to exit the lockout state?)

Having read through the doxygen again, perhaps it makes sense to replace references to "pause" with "lockout state", with a brief description of what "lockout state" means? (I'm going to guess that it's just sitting in a busy loop, waiting to be told to exit the lockout state?)
kilograham (Migrated from github.com) reviewed 2021-10-19 18:14:33 -05:00
@ -75,0 +102,4 @@
* core 1 launch or by the \ref multicore_lockout functions). Additionally they are often required for the exclusive use
* of an RTOS (e.g. FreeRTOS SMP). For these reasons it is suggested that you do not use the FIFO for your own purposes
* unless none of the above concerns apply; the majority of cases for transferring data between cores can be eqaully
* well handled by using a \ref queue
kilograham (Migrated from github.com) commented 2021-10-19 18:14:33 -05:00

i think it is fine, i doubt anyone has ever called it

i think it is fine, i doubt anyone has ever called it
lurch (Migrated from github.com) reviewed 2021-10-19 18:14:55 -05:00
lurch (Migrated from github.com) commented 2021-10-19 18:14:55 -05:00

Does this need to describe what happens if you try to "lockout" a core that's already in the lockout state? Is it a NOP?

Does this need to describe what happens if you try to "lockout" a core that's _already_ in the lockout state? Is it a NOP?
kilograham (Migrated from github.com) reviewed 2021-10-19 18:15:52 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
kilograham (Migrated from github.com) commented 2021-10-19 18:15:52 -05:00

not sure how the emojis are better than 'h" :-)

not sure how the emojis are better than 'h" :-)
kilograham (Migrated from github.com) reviewed 2021-10-19 18:18:05 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:18:05 -05:00

added ROE/WOF

added ROE/WOF
kilograham (Migrated from github.com) reviewed 2021-10-19 18:20:48 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:20:48 -05:00

made it slightly - but not much - better, perhaps

made it slightly - but not much - better, perhaps
kilograham (Migrated from github.com) reviewed 2021-10-19 18:21:53 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:21:52 -05:00

the

the
kilograham (Migrated from github.com) reviewed 2021-10-19 18:23:23 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:23:23 -05:00

improved

improved
kilograham (Migrated from github.com) reviewed 2021-10-19 18:24:09 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:24:09 -05:00

ok

ok
kilograham (Migrated from github.com) reviewed 2021-10-19 18:26:31 -05:00
kilograham (Migrated from github.com) commented 2021-10-19 18:26:31 -05:00

yeah multicore_lockout_end_timeout_us is largely pointless, but since i can't remove it i thought id improve the docs.

most of the complication arises from the possibility of both cores trying to lock each other out the same time or so (which probably people are not actually doing)

yeah `multicore_lockout_end_timeout_us` is largely pointless, but since i can't remove it i thought id improve the docs. most of the complication arises from the possibility of both cores trying to lock each other out the same time or so (which probably people are not actually doing)
lurch (Migrated from github.com) reviewed 2021-10-19 18:49:40 -05:00
@ -33,95 +33,155 @@ extern "C" {
#endif
lurch (Migrated from github.com) commented 2021-10-19 18:49:40 -05:00

Missed this one? To clarify:
"(data to the other core)" -> "(data from the other core)" ?

Missed this one? To clarify: "(data to the other core)" -> "(data from the other core)" ?
lurch (Migrated from github.com) reviewed 2021-10-19 18:50:12 -05:00
@ -112,4 +158,4 @@
* This function will block until there is data ready to be read
* Use multicore_fifo_rvalid() to check if data is ready to be read if you don't
* want to block.
*
lurch (Migrated from github.com) commented 2021-10-19 18:50:12 -05:00

"the timeout occurred before data could be pushed" -> "the timeout occurred before data could be popped"

"the timeout occurred before data could be pushed" -> "the timeout occurred before data could be popped"
lurch (Migrated from github.com) reviewed 2021-10-19 18:57:47 -05:00
lurch (Migrated from github.com) commented 2021-10-19 18:57:47 -05:00

Just out of curiosity, would this only return false if multicore_lockout_victim_init hadn't been called on the other core?

Just out of curiosity, would this only return false if `multicore_lockout_victim_init` hadn't been called on the other core?
lurch (Migrated from github.com) reviewed 2021-10-19 19:05:10 -05:00
@ -133,38 +193,117 @@ static inline void multicore_fifo_drain(void) {
*
lurch (Migrated from github.com) commented 2021-10-19 19:05:09 -05:00

nitpick: "inter process FIFOs" -> "inter-core FIFOs" ?

nitnitpick: This PR uses "inter-core FIFO", "intercore FIFO" and "multicore FIFO"

nitpick: "inter process FIFOs" -> "inter-core FIFOs" ? nitnitpick: This PR uses "inter-core FIFO", "intercore FIFO" and "multicore FIFO"
kilograham (Migrated from github.com) reviewed 2021-10-20 18:20:47 -05:00
kilograham (Migrated from github.com) commented 2021-10-20 18:20:47 -05:00

it will hang or timeout depending on which you call

it will hang or timeout depending on which you call
lurch (Migrated from github.com) reviewed 2021-10-21 06:11:57 -05:00
lurch (Migrated from github.com) commented 2021-10-21 06:11:56 -05:00

I guess I didn't ask the question very clearly: I was trying to ask "In which conditions would this function return false?"

I guess I didn't ask the question very clearly: I was trying to ask "In which conditions would this function return false?"
lurch (Migrated from github.com) reviewed 2021-10-21 06:15:17 -05:00
@ -97,9 +97,11 @@ bool watchdog_caused_reboot(void);
* This would not be present if a watchdog reset is initiated by \ref watchdog_reboot or by the RP2040 bootrom
lurch (Migrated from github.com) commented 2021-10-21 06:15:17 -05:00

watchdog_enabled -> watchdog_enable ?

watchdog_enabled -> watchdog_enable ?
liamfraser (Migrated from github.com) reviewed 2021-10-25 10:04:31 -05:00
@ -97,9 +97,11 @@ bool watchdog_caused_reboot(void);
* This would not be present if a watchdog reset is initiated by \ref watchdog_reboot or by the RP2040 bootrom
liamfraser (Migrated from github.com) commented 2021-10-25 10:04:30 -05:00

This does indeed look like a typo

This does indeed look like a typo
liamfraser (Migrated from github.com) reviewed 2021-10-25 10:04:49 -05:00
liamfraser (Migrated from github.com) left a comment
No description provided.
Approved apart from tiny typo `watchdog_enabled` needs correcting to `watchdog_enable`
kilograham commented 2021-10-25 12:24:00 -05:00 (Migrated from github.com)

approved + tiny typo => force merge

approved + tiny typo => force merge
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!620
No description provided.