Optimizations, documentation reformatting.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14223 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
dc9b229679
commit
8e0f307e75
|
@ -178,10 +178,6 @@ CH_IRQ_HANDLER(Vector80) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void port_init(os_instance_t *oip) {
|
void port_init(os_instance_t *oip) {
|
||||||
uint32_t core_id = port_get_core_id();
|
|
||||||
|
|
||||||
/* Port-related info for each OS instance.*/
|
|
||||||
oip->core_id = core_id;
|
|
||||||
|
|
||||||
/* Activating timer for this instance.*/
|
/* Activating timer for this instance.*/
|
||||||
port_timer_enable(oip);
|
port_timer_enable(oip);
|
||||||
|
@ -189,11 +185,11 @@ void port_init(os_instance_t *oip) {
|
||||||
#if CH_CFG_SMP_MODE== TRUE
|
#if CH_CFG_SMP_MODE== TRUE
|
||||||
/* FIFO handlers for each core.*/
|
/* FIFO handlers for each core.*/
|
||||||
SIO->FIFO_ST = SIO_FIFO_ST_ROE | SIO_FIFO_ST_WOF;
|
SIO->FIFO_ST = SIO_FIFO_ST_ROE | SIO_FIFO_ST_WOF;
|
||||||
if (core_id == 0U) {
|
if (oip->core_id == 0U) {
|
||||||
NVIC_SetPriority(15, CORTEX_MINIMUM_PRIORITY);
|
NVIC_SetPriority(15, CORTEX_MINIMUM_PRIORITY);
|
||||||
NVIC_EnableIRQ(15);
|
NVIC_EnableIRQ(15);
|
||||||
}
|
}
|
||||||
else if (core_id == 1U) {
|
else if (oip->core_id == 1U) {
|
||||||
NVIC_SetPriority(16, CORTEX_MINIMUM_PRIORITY);
|
NVIC_SetPriority(16, CORTEX_MINIMUM_PRIORITY);
|
||||||
NVIC_EnableIRQ(16);
|
NVIC_EnableIRQ(16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,20 +68,36 @@ typedef struct ch_delta_list delta_list_t;
|
||||||
* @brief Virtual Timer delta list element and header structure.
|
* @brief Virtual Timer delta list element and header structure.
|
||||||
*/
|
*/
|
||||||
struct ch_delta_list {
|
struct ch_delta_list {
|
||||||
delta_list_t *next; /**< @brief Next timer in the list. */
|
/**
|
||||||
delta_list_t *prev; /**< @brief Previous timer in the list. */
|
* @brief Next timer in the list.
|
||||||
sysinterval_t delta; /**< @brief Time delta before timeout. */
|
*/
|
||||||
|
delta_list_t *next;
|
||||||
|
/**
|
||||||
|
* @brief Previous timer in the list.
|
||||||
|
*/
|
||||||
|
delta_list_t *prev;
|
||||||
|
/**
|
||||||
|
* @brief Time delta before timeout.
|
||||||
|
*/
|
||||||
|
sysinterval_t delta;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Type of a Virtual Timer.
|
* @brief Type of a Virtual Timer.
|
||||||
*/
|
*/
|
||||||
typedef struct ch_virtual_timer {
|
typedef struct ch_virtual_timer {
|
||||||
delta_list_t dlist; /**< @brief Delta list element. */
|
/**
|
||||||
vtfunc_t func; /**< @brief Timer callback function
|
* @brief Delta list element.
|
||||||
pointer. */
|
*/
|
||||||
void *par; /**< @brief Timer callback function
|
delta_list_t dlist;
|
||||||
parameter. */
|
/**
|
||||||
|
* @brief Timer callback function pointer.
|
||||||
|
*/
|
||||||
|
vtfunc_t func;
|
||||||
|
/**
|
||||||
|
* @brief Timer callback function parameter.
|
||||||
|
*/
|
||||||
|
void *par;
|
||||||
} virtual_timer_t;
|
} virtual_timer_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,19 +107,27 @@ typedef struct ch_virtual_timer {
|
||||||
* timer is often used in the code.
|
* timer is often used in the code.
|
||||||
*/
|
*/
|
||||||
typedef struct ch_virtual_timers_list {
|
typedef struct ch_virtual_timers_list {
|
||||||
delta_list_t dlist; /**< @brief Delta list header. */
|
/**
|
||||||
|
* @brief Delta list header.
|
||||||
|
*/
|
||||||
|
delta_list_t dlist;
|
||||||
#if (CH_CFG_ST_TIMEDELTA == 0) || defined(__DOXYGEN__)
|
#if (CH_CFG_ST_TIMEDELTA == 0) || defined(__DOXYGEN__)
|
||||||
volatile systime_t systime; /**< @brief System Time counter. */
|
/**
|
||||||
|
* @brief System Time counter.
|
||||||
|
*/
|
||||||
|
volatile systime_t systime;
|
||||||
#endif
|
#endif
|
||||||
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
|
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief System time of the last tick event.
|
* @brief System time of the last tick event.
|
||||||
*/
|
*/
|
||||||
systime_t lasttime; /**< @brief System time of the last
|
systime_t lasttime;
|
||||||
tick event. */
|
|
||||||
#endif
|
#endif
|
||||||
#if (CH_CFG_USE_TIMESTAMP == TRUE) || defined(__DOXYGEN__)
|
#if (CH_CFG_USE_TIMESTAMP == TRUE) || defined(__DOXYGEN__)
|
||||||
volatile uint64_t laststamp; /**< @brief Last generated time stamp. */
|
/**
|
||||||
|
* @brief Last generated time stamp.
|
||||||
|
*/
|
||||||
|
volatile uint64_t laststamp;
|
||||||
#endif
|
#endif
|
||||||
} virtual_timers_list_t;
|
} virtual_timers_list_t;
|
||||||
|
|
||||||
|
@ -116,7 +140,10 @@ typedef thread_t * thread_reference_t;
|
||||||
* @brief Type of a threads queue.
|
* @brief Type of a threads queue.
|
||||||
*/
|
*/
|
||||||
typedef struct ch_threads_queue {
|
typedef struct ch_threads_queue {
|
||||||
ch_queue_t queue; /**< @brief Threads queue header. */
|
/**
|
||||||
|
* @brief Threads queue header.
|
||||||
|
*/
|
||||||
|
ch_queue_t queue;
|
||||||
} threads_queue_t;
|
} threads_queue_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,18 +153,32 @@ typedef struct ch_threads_queue {
|
||||||
* by shrinking this structure.
|
* by shrinking this structure.
|
||||||
*/
|
*/
|
||||||
struct ch_thread {
|
struct ch_thread {
|
||||||
|
/**
|
||||||
|
* @brief Shared list headers.
|
||||||
|
*/
|
||||||
union {
|
union {
|
||||||
ch_list_t list; /**< @brief Threads lists element. */
|
/**
|
||||||
ch_queue_t queue; /**< @brief Threads queues element. */
|
* @brief Threads lists element.
|
||||||
ch_priority_queue_t pqueue; /**< @brief Threads ordered queues
|
*/
|
||||||
element. */
|
ch_list_t list;
|
||||||
|
/**
|
||||||
|
* @brief Threads queues element.
|
||||||
|
*/
|
||||||
|
ch_queue_t queue;
|
||||||
|
/**
|
||||||
|
* @brief Threads ordered queues element.
|
||||||
|
*/
|
||||||
|
ch_priority_queue_t pqueue;
|
||||||
} hdr;
|
} hdr;
|
||||||
/**
|
/**
|
||||||
* @brief Processor context.
|
* @brief Processor context.
|
||||||
*/
|
*/
|
||||||
struct port_context ctx;
|
struct port_context ctx;
|
||||||
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
|
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
|
||||||
ch_queue_t rqueue; /**< @brief Registry queue element. */
|
/**
|
||||||
|
* @brief Registry queue element.
|
||||||
|
*/
|
||||||
|
ch_queue_t rqueue;
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief OS instance owner of this thread.
|
* @brief OS instance owner of this thread.
|
||||||
|
@ -370,6 +411,10 @@ struct ch_os_instance {
|
||||||
* @brief Core associated to this instance.
|
* @brief Core associated to this instance.
|
||||||
*/
|
*/
|
||||||
core_id_t core_id;
|
core_id_t core_id;
|
||||||
|
/**
|
||||||
|
* @brief Pointer to the instance configuration data.
|
||||||
|
*/
|
||||||
|
const os_instance_config_t *config;
|
||||||
/**
|
/**
|
||||||
* @brief Main thread descriptor.
|
* @brief Main thread descriptor.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -305,8 +305,13 @@ void chSchObjectInit(os_instance_t *oip,
|
||||||
#endif
|
#endif
|
||||||
chDbgAssert(ch_system.instances[core_id] == NULL, "instance already registered");
|
chDbgAssert(ch_system.instances[core_id] == NULL, "instance already registered");
|
||||||
ch_system.instances[core_id] = oip;
|
ch_system.instances[core_id] = oip;
|
||||||
|
|
||||||
|
/* Core associated to this instance.*/
|
||||||
oip->core_id = core_id;
|
oip->core_id = core_id;
|
||||||
|
|
||||||
|
/* Keeping a reference to the configuration data.*/
|
||||||
|
oip->config = oicp;
|
||||||
|
|
||||||
/* Port initialization for the current instance.*/
|
/* Port initialization for the current instance.*/
|
||||||
port_init(oip);
|
port_init(oip);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue