fsw_init.c
938 lines
| 32.1 KiB
| text/x-c
|
CLexer
/ src / fsw_init.c
|
r45 | /** This is the RTEMS initialization module. | ||
* | ||||
* @file | ||||
* @author P. LEROY | ||||
* | ||||
* This module contains two very different information: | ||||
* - specific instructions to configure the compilation of the RTEMS executive | ||||
* - functions related to the fligth softwre initialization, especially the INIT RTEMS task | ||||
* | ||||
*/ | ||||
|
r5 | //************************* | ||
// GPL reminder to be added | ||||
//************************* | ||||
|
r18 | #include <rtems.h> | ||
/* configuration information */ | ||||
#define CONFIGURE_INIT | ||||
|
r5 | |||
#include <bsp.h> /* for device driver prototypes */ | ||||
|
r18 | |||
/* configuration information */ | ||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | ||||
|
r5 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | ||
|
r18 | |||
|
r33 | #define CONFIGURE_MAXIMUM_TASKS 20 | ||
|
r18 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | ||
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | ||||
|
r5 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | ||
|
r34 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 | ||
#define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | ||||
|
r139 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) | ||
|
r5 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | ||
|
r18 | #define CONFIGURE_MAXIMUM_PERIODS 5 | ||
|
r254 | #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link] | ||
|
r124 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 | ||
|
r34 | #ifdef PRINT_STACK_REPORT | ||
#define CONFIGURE_STACK_CHECKER_ENABLED | ||||
#endif | ||||
|
r18 | |||
#include <rtems/confdefs.h> | ||||
/* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | ||||
|
r5 | #ifdef RTEMS_DRVMGR_STARTUP | ||
|
r295 | #ifdef LEON3 | ||
/* Add Timer and UART Driver */ | ||||
#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | ||||
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | ||||
#endif | ||||
#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | ||||
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | ||||
#endif | ||||
#endif | ||||
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | ||||
#include <drvmgr/drvmgr_confdefs.h> | ||||
|
r5 | #endif | ||
|
r18 | |||
|
r40 | #include "fsw_init.h" | ||
#include "fsw_config.c" | ||||
|
r197 | #include "GscMemoryLPP.hpp" | ||
|
r5 | |||
|
r181 | void initCache() | ||
{ | ||||
|
r251 | // ASI 2 contains a few control registers that have not been assigned as ancillary state registers. | ||
// These should only be read and written using 32-bit LDA/STA instructions. | ||||
// All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2. | ||||
// The table below shows the register addresses: | ||||
// 0x00 Cache control register | ||||
// 0x04 Reserved | ||||
// 0x08 Instruction cache configuration register | ||||
// 0x0C Data cache configuration register | ||||
// Cache Control Register Leon3 / Leon3FT | ||||
// 31..30 29 28 27..24 23 22 21 20..19 18 17 16 | ||||
// RFT PS TB DS FD FI FT ST IB | ||||
// 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0 | ||||
// IP DP ITE IDE DTE DDE DF IF DCS ICS | ||||
|
r196 | unsigned int cacheControlRegister; | ||
|
r181 | |||
|
r259 | CCR_resetCacheControlRegister(); | ||
ASR16_resetRegisterProtectionControlRegister(); | ||||
|
r251 | cacheControlRegister = CCR_getValue(); | ||
|
r259 | PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister); | ||
PRINTF1("(0) ASR16 = %x\n", *asr16Ptr); | ||||
|
r181 | |||
|
r251 | CCR_enableInstructionCache(); // ICS bits | ||
CCR_enableDataCache(); // DCS bits | ||||
CCR_enableInstructionBurstFetch(); // IB bit | ||||
|
r181 | |||
|
r259 | faultTolerantScheme(); | ||
|
r251 | cacheControlRegister = CCR_getValue(); | ||
|
r259 | PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister); | ||
PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr); | ||||
|
r251 | |||
|
r253 | PRINTF("\n"); | ||
|
r181 | } | ||
|
r18 | rtems_task Init( rtems_task_argument ignored ) | ||
|
r5 | { | ||
|
r196 | /** This is the RTEMS INIT taks, it is the first task launched by the system. | ||
|
r45 | * | ||
* @param unused is the starting argument of the RTEMS task | ||||
* | ||||
* The INIT task create and run all other RTEMS tasks. | ||||
* | ||||
*/ | ||||
|
r181 | //*********** | ||
// INIT CACHE | ||||
|
r144 | unsigned char *vhdlVersion; | ||
|
r171 | reset_lfr(); | ||
|
r104 | reset_local_time(); | ||
|
r45 | |||
|
r134 | rtems_cpu_usage_reset(); | ||
|
r18 | rtems_status_code status; | ||
|
r46 | rtems_status_code status_spw; | ||
|
r31 | rtems_isr_entry old_isr_handler; | ||
|
r18 | |||
|
r92 | // UART settings | ||
|
r253 | enable_apbuart_transmitter(); | ||
|
r94 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | ||
|
r181 | |||
|
r98 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | ||
|
r92 | |||
|
r181 | |||
|
r98 | PRINTF("\n\n\n\n\n") | ||
|
r181 | |||
initCache(); | ||||
|
r98 | PRINTF("*************************\n") | ||
PRINTF("** LFR Flight Software **\n") | ||||
|
r306 | |||
|
r298 | PRINTF1("** %d-", SW_VERSION_N1) | ||
PRINTF1("%d-" , SW_VERSION_N2) | ||||
PRINTF1("%d-" , SW_VERSION_N3) | ||||
PRINTF1("%d **\n", SW_VERSION_N4) | ||||
|
r144 | |||
vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | ||||
PRINTF("** VHDL **\n") | ||||
PRINTF1("** %d.", vhdlVersion[1]) | ||||
PRINTF1("%d." , vhdlVersion[2]) | ||||
PRINTF1("%d **\n", vhdlVersion[3]) | ||||
|
r98 | PRINTF("*************************\n") | ||
PRINTF("\n\n") | ||||
|
r18 | |||
|
r28 | init_parameter_dump(); | ||
|
r194 | init_kcoefficients_dump(); | ||
|
r28 | init_local_mode_parameters(); | ||
|
r21 | init_housekeeping_parameters(); | ||
|
r214 | init_k_coefficients_prc0(); | ||
init_k_coefficients_prc1(); | ||||
init_k_coefficients_prc2(); | ||||
|
r318 | pa_bia_status_info = INIT_CHAR; | ||
cp_rpw_sc_rw_f_flags = INIT_CHAR; | ||||
cp_rpw_sc_rw1_f1 = INIT_FLOAT; | ||||
cp_rpw_sc_rw1_f2 = INIT_FLOAT; | ||||
cp_rpw_sc_rw2_f1 = INIT_FLOAT; | ||||
cp_rpw_sc_rw2_f2 = INIT_FLOAT; | ||||
cp_rpw_sc_rw3_f1 = INIT_FLOAT; | ||||
cp_rpw_sc_rw3_f2 = INIT_FLOAT; | ||||
cp_rpw_sc_rw4_f1 = INIT_FLOAT; | ||||
cp_rpw_sc_rw4_f2 = INIT_FLOAT; | ||||
|
r293 | // initialize filtering parameters | ||
filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED; | ||||
filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS; | ||||
filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD; | ||||
filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET; | ||||
filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT; | ||||
filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F; | ||||
|
r240 | update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); | ||
|
r34 | |||
|
r139 | // waveform picker initialization | ||
|
r284 | WFP_init_rings(); | ||
LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings | ||||
|
r139 | WFP_reset_current_ring_nodes(); | ||
reset_waveform_picker_regs(); | ||||
|
r110 | |||
|
r139 | // spectral matrices initialization | ||
SM_init_rings(); // initialize spectral matrices rings | ||||
SM_reset_current_ring_nodes(); | ||||
reset_spectral_matrix_regs(); | ||||
|
r110 | |||
|
r187 | // configure calibration | ||
configureCalibration( false ); // true means interleaved mode, false is for normal mode | ||||
|
r254 | updateLFRCurrentMode( LFR_MODE_STANDBY ); | ||
|
r47 | |||
BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | ||||
|
r46 | create_names(); // create all names | ||
|
r47 | |||
|
r248 | status = create_timecode_timer(); // create the timer used by timecode_irq_handler | ||
if (status != RTEMS_SUCCESSFUL) | ||||
{ | ||||
PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status) | ||||
} | ||||
|
r46 | status = create_message_queues(); // create message queues | ||
if (status != RTEMS_SUCCESSFUL) | ||||
{ | ||||
PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | ||||
} | ||||
|
r34 | |||
|
r46 | status = create_all_tasks(); // create all tasks | ||
|
r40 | if (status != RTEMS_SUCCESSFUL) | ||
{ | ||||
|
r124 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) | ||
|
r40 | } | ||
|
r33 | |||
|
r46 | // ************************** | ||
// <SPACEWIRE INITIALIZATION> | ||||
status_spw = spacewire_open_link(); // (1) open the link | ||||
if ( status_spw != RTEMS_SUCCESSFUL ) | ||||
{ | ||||
PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | ||||
} | ||||
if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | ||||
{ | ||||
status_spw = spacewire_configure_link( fdSPW ); | ||||
if ( status_spw != RTEMS_SUCCESSFUL ) | ||||
{ | ||||
PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | ||||
} | ||||
} | ||||
if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | ||||
{ | ||||
status_spw = spacewire_start_link( fdSPW ); | ||||
if ( status_spw != RTEMS_SUCCESSFUL ) | ||||
{ | ||||
PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | ||||
} | ||||
} | ||||
// </SPACEWIRE INITIALIZATION> | ||||
// *************************** | ||||
|
r40 | status = start_all_tasks(); // start all tasks | ||
if (status != RTEMS_SUCCESSFUL) | ||||
{ | ||||
PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | ||||
} | ||||
|
r34 | |||
|
r47 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | ||
|
r46 | status = start_recv_send_tasks(); | ||
if ( status != RTEMS_SUCCESSFUL ) | ||||
{ | ||||
PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | ||||
} | ||||
|
r110 | // suspend science tasks, they will be restarted later depending on the mode | ||
|
r47 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | ||
if (status != RTEMS_SUCCESSFUL) | ||||
{ | ||||
PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | ||||
} | ||||
|
r32 | // configure IRQ handling for the waveform picker unit | ||
|
r18 | status = rtems_interrupt_catch( waveforms_isr, | ||
IRQ_SPARC_WAVEFORM_PICKER, | ||||
&old_isr_handler) ; | ||||
|
r103 | // configure IRQ handling for the spectral matrices unit | ||
status = rtems_interrupt_catch( spectral_matrices_isr, | ||||
IRQ_SPARC_SPECTRAL_MATRIX, | ||||
&old_isr_handler) ; | ||||
|
r18 | |||
|
r47 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | ||
|
r46 | if ( status_spw != RTEMS_SUCCESSFUL ) | ||
{ | ||||
status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | ||||
if ( status != RTEMS_SUCCESSFUL ) { | ||||
PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | ||||
} | ||||
} | ||||
|
r35 | BOOT_PRINTF("delete INIT\n") | ||
|
r34 | |||
|
r224 | set_hk_lfr_sc_potential_flag( true ); | ||
|
r259 | // start the timer to detect a missing spacewire timecode | ||
// the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout | ||||
// if a tickout is generated, the timer is restarted | ||||
status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL ); | ||||
|
r267 | |||
|
r259 | grspw_timecode_callback = &timecode_irq_handler; | ||
|
r257 | |||
|
r5 | status = rtems_task_delete(RTEMS_SELF); | ||
|
r18 | |||
|
r5 | } | ||
|
r34 | void init_local_mode_parameters( void ) | ||
|
r28 | { | ||
|
r45 | /** This function initialize the param_local global variable with default values. | ||
* | ||||
*/ | ||||
|
r46 | unsigned int i; | ||
|
r23 | // LOCAL PARAMETERS | ||
|
r35 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | ||
BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | ||||
|
r23 | |||
|
r21 | // init sequence counters | ||
|
r56 | |||
for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | ||||
|
r21 | { | ||
|
r318 | sequenceCounters_TC_EXE[i] = INIT_CHAR; | ||
sequenceCounters_TM_DUMP[i] = INIT_CHAR; | ||||
|
r21 | } | ||
|
r318 | sequenceCounters_SCIENCE_NORMAL_BURST = INIT_CHAR; | ||
sequenceCounters_SCIENCE_SBM1_SBM2 = INIT_CHAR; | ||||
sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << TM_PACKET_SEQ_SHIFT; | ||||
|
r21 | } | ||
|
r104 | void reset_local_time( void ) | ||
{ | ||||
|
r318 | time_management_regs->ctrl = time_management_regs->ctrl | VAL_SOFTWARE_RESET; // [0010] software reset, coarse time = 0x80000000 | ||
|
r104 | } | ||
|
r46 | void create_names( void ) // create all names for tasks and queues | ||
|
r18 | { | ||
|
r40 | /** This function creates all RTEMS names used in the software for tasks and queues. | ||
* | ||||
* @return RTEMS directive status codes: | ||||
|
r45 | * - RTEMS_SUCCESSFUL - successful completion | ||
|
r40 | * | ||
*/ | ||||
|
r18 | // task names | ||
Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | ||||
|
r16 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | ||
|
r18 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | ||
|
r239 | Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' ); | ||
|
r16 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | ||
|
r105 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); | ||
|
r18 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | ||
Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | ||||
Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | ||||
|
r119 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); | ||
|
r32 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | ||
|
r33 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | ||
Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | ||||
Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | ||||
|
r254 | Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' ); | ||
|
r121 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); | ||
Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); | ||||
|
r124 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); | ||
Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); | ||||
|
r18 | |||
|
r46 | // rate monotonic period names | ||
name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | ||||
|
r34 | |||
|
r46 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | ||
misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | ||||
|
r119 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); | ||
misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); | ||||
|
r124 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); | ||
|
r248 | |||
timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' ); | ||||
|
r18 | } | ||
|
r40 | int create_all_tasks( void ) // create all tasks which run in the software | ||
|
r18 | { | ||
|
r40 | /** This function creates all RTEMS tasks used in the software. | ||
* | ||||
* @return RTEMS directive status codes: | ||||
* - RTEMS_SUCCESSFUL - task created successfully | ||||
* - RTEMS_INVALID_ADDRESS - id is NULL | ||||
* - RTEMS_INVALID_NAME - invalid task name | ||||
* - RTEMS_INVALID_PRIORITY - invalid task priority | ||||
* - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | ||||
* - RTEMS_TOO_MANY - too many tasks created | ||||
* - RTEMS_UNSATISFIED - not enough memory for stack/FP context | ||||
* - RTEMS_TOO_MANY - too many global objects | ||||
* | ||||
*/ | ||||
|
r18 | rtems_status_code status; | ||
|
r5 | |||
|
r105 | //********** | ||
// SPACEWIRE | ||||
|
r5 | // RECV | ||
status = rtems_task_create( | ||||
|
r34 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | ||
|
r5 | RTEMS_DEFAULT_MODES, | ||
|
r16 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | ||
|
r18 | ); | ||
|
r105 | if (status == RTEMS_SUCCESSFUL) // SEND | ||
{ | ||||
status = rtems_task_create( | ||||
|
r318 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT, | ||
|
r181 | RTEMS_DEFAULT_MODES, | ||
|
r172 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] | ||
|
r105 | ); | ||
} | ||||
|
r254 | if (status == RTEMS_SUCCESSFUL) // LINK | ||
|
r105 | { | ||
status = rtems_task_create( | ||||
|
r254 | Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE, | ||
|
r105 | RTEMS_DEFAULT_MODES, | ||
|
r254 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK] | ||
|
r105 | ); | ||
} | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // ACTN | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | ||||
|
r129 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | ||
|
r40 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | ||
); | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // SPIQ | ||||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | ||||
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | ||||
); | ||||
} | ||||
|
r105 | |||
//****************** | ||||
// SPECTRAL MATRICES | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // AVF0 | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | ||||
|
r181 | RTEMS_DEFAULT_MODES, | ||
|
r40 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | ||
); | ||||
} | ||||
|
r121 | if (status == RTEMS_SUCCESSFUL) // PRC0 | ||
|
r105 | { | ||
status = rtems_task_create( | ||||
|
r318 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT, | ||
|
r182 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | ||
|
r119 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] | ||
|
r105 | ); | ||
} | ||||
|
r121 | if (status == RTEMS_SUCCESSFUL) // AVF1 | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, | ||||
|
r181 | RTEMS_DEFAULT_MODES, | ||
|
r121 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] | ||
); | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // PRC1 | ||||
{ | ||||
status = rtems_task_create( | ||||
|
r318 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT, | ||
|
r182 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | ||
|
r121 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] | ||
); | ||||
} | ||||
|
r124 | if (status == RTEMS_SUCCESSFUL) // AVF2 | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, | ||||
|
r181 | RTEMS_DEFAULT_MODES, | ||
|
r124 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] | ||
); | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // PRC2 | ||||
{ | ||||
status = rtems_task_create( | ||||
|
r318 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT, | ||
|
r182 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | ||
|
r124 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] | ||
); | ||||
} | ||||
|
r105 | |||
//**************** | ||||
// WAVEFORM PICKER | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // WFRM | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES, | ||||
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | ||||
); | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // CWF3 | ||||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES, | ||||
|
r98 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] | ||
|
r40 | ); | ||
} | ||||
if (status == RTEMS_SUCCESSFUL) // CWF2 | ||||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES, | ||||
|
r98 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] | ||
|
r40 | ); | ||
} | ||||
if (status == RTEMS_SUCCESSFUL) // CWF1 | ||||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES, | ||||
|
r98 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] | ||
|
r40 | ); | ||
} | ||||
|
r105 | if (status == RTEMS_SUCCESSFUL) // SWBD | ||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, | ||||
RTEMS_DEFAULT_MODES, | ||||
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] | ||||
); | ||||
} | ||||
//***** | ||||
// MISC | ||||
|
r239 | if (status == RTEMS_SUCCESSFUL) // LOAD | ||
|
r40 | { | ||
status = rtems_task_create( | ||||
|
r239 | Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE, | ||
|
r105 | RTEMS_DEFAULT_MODES, | ||
|
r239 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD] | ||
|
r40 | ); | ||
} | ||||
|
r105 | if (status == RTEMS_SUCCESSFUL) // DUMB | ||
|
r46 | { | ||
status = rtems_task_create( | ||||
|
r105 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | ||
|
r46 | RTEMS_DEFAULT_MODES, | ||
|
r105 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | ||
); | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // HOUS | ||||
{ | ||||
status = rtems_task_create( | ||||
Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | ||||
|
r181 | RTEMS_DEFAULT_MODES, | ||
|
r171 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] | ||
|
r46 | ); | ||
} | ||||
|
r40 | |||
return status; | ||||
|
r18 | } | ||
|
r5 | |||
|
r46 | int start_recv_send_tasks( void ) | ||
{ | ||||
rtems_status_code status; | ||||
status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // SEND | ||||
{ | ||||
status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | ||||
} | ||||
} | ||||
return status; | ||||
} | ||||
int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | ||||
|
r5 | { | ||
|
r40 | /** This function starts all RTEMS tasks used in the software. | ||
* | ||||
* @return RTEMS directive status codes: | ||||
* - RTEMS_SUCCESSFUL - ask started successfully | ||||
* - RTEMS_INVALID_ADDRESS - invalid task entry point | ||||
* - RTEMS_INVALID_ID - invalid task id | ||||
* - RTEMS_INCORRECT_STATE - task not in the dormant state | ||||
* - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | ||||
* | ||||
*/ | ||||
// starts all the tasks fot eh flight software | ||||
|
r5 | rtems_status_code status; | ||
|
r105 | //********** | ||
// SPACEWIRE | ||||
|
r18 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | ||
if (status!=RTEMS_SUCCESSFUL) { | ||||
|
r35 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | ||
|
r18 | } | ||
|
r254 | if (status == RTEMS_SUCCESSFUL) // LINK | ||
|
r46 | { | ||
|
r254 | status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 ); | ||
|
r46 | if (status!=RTEMS_SUCCESSFUL) { | ||
|
r254 | BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n") | ||
|
r46 | } | ||
} | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // ACTN | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | ||||
} | ||||
|
r18 | } | ||
|
r105 | //****************** | ||
// SPECTRAL MATRICES | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // AVF0 | ||
{ | ||||
|
r121 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); | ||
|
r40 | if (status!=RTEMS_SUCCESSFUL) { | ||
BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | ||||
} | ||||
|
r18 | } | ||
|
r119 | if (status == RTEMS_SUCCESSFUL) // PRC0 | ||
|
r105 | { | ||
|
r121 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); | ||
|
r105 | if (status!=RTEMS_SUCCESSFUL) { | ||
|
r119 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") | ||
|
r105 | } | ||
} | ||||
|
r121 | if (status == RTEMS_SUCCESSFUL) // AVF1 | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") | ||||
} | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // PRC1 | ||||
{ | ||||
status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") | ||||
} | ||||
} | ||||
|
r126 | if (status == RTEMS_SUCCESSFUL) // AVF2 | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") | ||||
} | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // PRC2 | ||||
{ | ||||
status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") | ||||
} | ||||
} | ||||
|
r105 | |||
//**************** | ||||
// WAVEFORM PICKER | ||||
|
r40 | if (status == RTEMS_SUCCESSFUL) // WFRM | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | ||||
} | ||||
|
r18 | } | ||
|
r40 | if (status == RTEMS_SUCCESSFUL) // CWF3 | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | ||||
} | ||||
|
r33 | } | ||
|
r40 | if (status == RTEMS_SUCCESSFUL) // CWF2 | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | ||||
} | ||||
|
r33 | } | ||
|
r40 | if (status == RTEMS_SUCCESSFUL) // CWF1 | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | ||||
} | ||||
} | ||||
|
r105 | if (status == RTEMS_SUCCESSFUL) // SWBD | ||
{ | ||||
status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") | ||||
} | ||||
} | ||||
//***** | ||||
// MISC | ||||
if (status == RTEMS_SUCCESSFUL) // HOUS | ||||
{ | ||||
status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | ||||
} | ||||
} | ||||
if (status == RTEMS_SUCCESSFUL) // DUMB | ||||
{ | ||||
status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | ||||
if (status!=RTEMS_SUCCESSFUL) { | ||||
BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | ||||
} | ||||
} | ||||
|
r239 | if (status == RTEMS_SUCCESSFUL) // LOAD | ||
|
r105 | { | ||
|
r239 | status = rtems_task_start( Task_id[TASKID_LOAD], load_task, 1 ); | ||
|
r105 | if (status!=RTEMS_SUCCESSFUL) { | ||
|
r239 | BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n") | ||
|
r105 | } | ||
} | ||||
|
r40 | return status; | ||
|
r18 | } | ||
|
r40 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | ||
|
r18 | { | ||
|
r46 | rtems_status_code status_recv; | ||
rtems_status_code status_send; | ||||
|
r121 | rtems_status_code status_q_p0; | ||
rtems_status_code status_q_p1; | ||||
|
r124 | rtems_status_code status_q_p2; | ||
|
r35 | rtems_status_code ret; | ||
rtems_id queue_id; | ||||
|
r118 | //**************************************** | ||
|
r42 | // create the queue for handling valid TCs | ||
|
r46 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | ||
|
r118 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, | ||
|
r42 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | ||
|
r46 | if ( status_recv != RTEMS_SUCCESSFUL ) { | ||
PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | ||||
|
r42 | } | ||
|
r118 | //************************************************ | ||
|
r40 | // create the queue for handling TM packet sending | ||
|
r46 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | ||
|
r118 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, | ||
|
r37 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | ||
|
r46 | if ( status_send != RTEMS_SUCCESSFUL ) { | ||
PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | ||||
} | ||||
|
r119 | //***************************************************************************** | ||
// create the queue for handling averaged spectral matrices for processing @ f0 | ||||
|
r121 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], | ||
|
r119 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, | ||
|
r118 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | ||
|
r121 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { | ||
PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) | ||||
|
r118 | } | ||
|
r119 | //***************************************************************************** | ||
// create the queue for handling averaged spectral matrices for processing @ f1 | ||||
|
r121 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], | ||
MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, | ||||
RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | ||||
if ( status_q_p1 != RTEMS_SUCCESSFUL ) { | ||||
PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) | ||||
} | ||||
|
r119 | |||
|
r124 | //***************************************************************************** | ||
// create the queue for handling averaged spectral matrices for processing @ f2 | ||||
status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], | ||||
MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, | ||||
RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | ||||
if ( status_q_p2 != RTEMS_SUCCESSFUL ) { | ||||
PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) | ||||
} | ||||
|
r46 | if ( status_recv != RTEMS_SUCCESSFUL ) | ||
{ | ||||
ret = status_recv; | ||||
} | ||||
|
r118 | else if( status_send != RTEMS_SUCCESSFUL ) | ||
{ | ||||
ret = status_send; | ||||
} | ||||
|
r121 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) | ||
{ | ||||
ret = status_q_p0; | ||||
} | ||||
|
r124 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) | ||
{ | ||||
ret = status_q_p1; | ||||
} | ||||
|
r46 | else | ||
{ | ||||
|
r124 | ret = status_q_p2; | ||
|
r35 | } | ||
|
r18 | |||
|
r42 | return ret; | ||
|
r23 | } | ||
|
r82 | |||
|
r248 | rtems_status_code create_timecode_timer( void ) | ||
{ | ||||
rtems_status_code status; | ||||
status = rtems_timer_create( timecode_timer_name, &timecode_timer_id ); | ||||
if ( status != RTEMS_SUCCESSFUL ) | ||||
{ | ||||
PRINTF1("in create_timer_timecode *** ERR creating SPTC timer, %d\n", status) | ||||
} | ||||
else | ||||
{ | ||||
PRINTF("in create_timer_timecode *** OK creating SPTC timer\n") | ||||
} | ||||
return status; | ||||
} | ||||
|
r82 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | ||
{ | ||||
rtems_status_code status; | ||||
rtems_name queue_name; | ||||
queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | ||||
status = rtems_message_queue_ident( queue_name, 0, queue_id ); | ||||
return status; | ||||
} | ||||
rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | ||||
{ | ||||
rtems_status_code status; | ||||
rtems_name queue_name; | ||||
queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | ||||
status = rtems_message_queue_ident( queue_name, 0, queue_id ); | ||||
return status; | ||||
} | ||||
|
r118 | |||
|
r119 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) | ||
|
r118 | { | ||
rtems_status_code status; | ||||
rtems_name queue_name; | ||||
|
r119 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); | ||
|
r118 | |||
status = rtems_message_queue_ident( queue_name, 0, queue_id ); | ||||
return status; | ||||
} | ||||
|
r119 | |||
rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) | ||||
{ | ||||
rtems_status_code status; | ||||
rtems_name queue_name; | ||||
queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); | ||||
status = rtems_message_queue_ident( queue_name, 0, queue_id ); | ||||
return status; | ||||
} | ||||
|
r124 | |||
rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) | ||||
{ | ||||
rtems_status_code status; | ||||
rtems_name queue_name; | ||||
queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); | ||||
status = rtems_message_queue_ident( queue_name, 0, queue_id ); | ||||
return status; | ||||
} | ||||
|
r197 | |||
void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max ) | ||||
{ | ||||
u_int32_t count; | ||||
rtems_status_code status; | ||||
status = rtems_message_queue_get_number_pending( queue_id, &count ); | ||||
count = count + 1; | ||||
if (status != RTEMS_SUCCESSFUL) | ||||
{ | ||||
PRINTF1("in update_queue_max_count *** ERR = %d\n", status) | ||||
} | ||||
else | ||||
{ | ||||
if (count > *fifo_size_max) | ||||
{ | ||||
*fifo_size_max = count; | ||||
} | ||||
} | ||||
} | ||||
void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ) | ||||
{ | ||||
unsigned char i; | ||||
//*************** | ||||
// BUFFER ADDRESS | ||||
for(i=0; i<nbNodes; i++) | ||||
{ | ||||
|
r318 | ring[i].coarseTime = INT32_ALL_F; | ||
ring[i].fineTime = INT32_ALL_F; | ||||
ring[i].sid = INIT_CHAR; | ||||
ring[i].status = INIT_CHAR; | ||||
|
r197 | ring[i].buffer_address = (int) &buffer[ i * bufferSize ]; | ||
} | ||||
//***** | ||||
// NEXT | ||||
ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ]; | ||||
for(i=0; i<nbNodes-1; i++) | ||||
{ | ||||
ring[i].next = (ring_node*) &ring[ i + 1 ]; | ||||
} | ||||
//********* | ||||
// PREVIOUS | ||||
ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ]; | ||||
for(i=1; i<nbNodes; i++) | ||||
{ | ||||
ring[i].previous = (ring_node*) &ring[ i - 1 ]; | ||||
} | ||||
} | ||||