This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc bug?
- To: toy at rtp dot ericsson dot se
- Subject: gcc bug?
- From: Randy Yates <qusraya at rtp dot ericsson dot se>
- Date: Mon, 05 Jun 2000 11:01:01 -0400
- CC: bug-gcc at gnu dot org
- Organization: Ericsson
Hi,
I'm using the gcc compiler,
[qusraya@edgedsp1] ~ $ gcc -v
Reading specs from /apps/gnu/solaris2.7/lib/gcc-lib/sparc-sun-solaris2.7/2.7.2.2/specs
gcc version 2.7.2.2
under the Sun OS,
[qusraya@edgedsp1] ~ $ uname -a
SunOS edgedsp1 5.7 Generic sun4u sparc SUNW,Ultra-5_10
I have noticed that my structures are not packed as tightly
as they could be. When I try to tighten them up by specifying
fpack-struct, I get the following messages:
[qusraya@edgedsp1] /vobs/edgedsp_sw/src/EDGE/hostif $ gcc -c -Wall -fpack-struct -I. -I../../include hostif.c
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 8: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 10: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 12: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 14: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 16: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 18: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 20: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 22: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 24: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 26: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 28: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 30: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 32: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 34: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 36: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 38: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 40: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 42: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 44: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 46: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 48: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 50: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 52: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 54: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 56: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 58: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 60: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 62: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 64: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 66: error: location counter not on word boundary
/usr/ccs/bin/as: "/home/unix/qusraya/tmp/cc4oa4Pq.s", line 72: error: location counter not on word boundary
This appears to be a bug, or rather is it that I'm doing something wrong? I also
tried using the __attribute__((packed)) but it made no difference on the size
of the structure. Here's the structure:
typedef struct {
UINT16_T application_address_high; /* DSP application address (high word) */
UINT16_T application_address_low; /* DSP application address (low word) */
unsigned reserved : 15; /* DSP ready */
unsigned dr : 1;
unsigned reservedb: 15; /* DSP PLL clock mode */
unsigned pcm : 1;
UINT16_T dsp_version; /* DSP version */
UINT16_T low_softbit_cache_threshold; /* low softbit cache threshold */
UINT16_T adequate_softbit_cache_threshold; /* adequate softbit cache threshold */
} INITIALIZATION_TABLE_T __attribute__((packed));
This structure can be packed to 7 16-bit words but instead the compiler always
generates it in 8 16-bit words. The special type UINT16_T:
typedef unsigned short UINT16_T;
is defined is dsptypes.h.
I have attached hostif.c, hostif.h, and dsptypes.h in order to help
you reproduce this error.
Any help, pointers, acknowledgements of guilt, etc. would be appreciated.
--
Randy Yates
DSP Engineer
Ericsson / Research Triangle Park, NC, USA
qusraya@rtp.ericsson.se, 919-472-1124
/******************************************************************************
--- E R I C S S O N --
Copyright 1999 by Ericsson Inc. All rights reserved. No part of
this publication, or any software included with it, may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any other means, including photocopying, electronic or
mechanical recording, or otherwise, without prior written permission
of the copyright holder.
Ericsson Confidential and Proprietary information.
******************************************************************************/
/*-- Module Definitions --*/
/*-- Include Files --*/
#include <stdio.h>
#include <string.h>
#include "hostif.h"
/*-- public variables --*/
/*-- private variables --*/
/* host interface memory area */
#if defined(__TMS320C5XX__)
#pragma DATA_SECTION(hostif, "HOSTIF_SECTION") /* put the hostif in its own section */
#endif
HOST_INTERFACE_T hostif;
/* The command message array is in order of the commands
as defined in the command registers, going from least-significant
bit to most-significant, and counting control registers 1 and 2
as one 32-bit control register (control register 1 is the least-significant
word). The message pointers here point inside of the EHPI. */
const COMMAND_MESSAGE_T command_messages[] = {
{
0, /* the semaphore flag is not really a command */
NULL,
0,
NULL},
{
DSP_OPERATING_MODE_COMMAND_MESSAGE_ID ,
&hostif.command_interface.dsp_operating_mode_command,
sizeof(DSP_OPERATING_MODE_COMMAND_T),
Command_Processor_DSP_Operating_Mode},
{
TFI_ASSIGNMENT_COMMAND_MESSAGE_ID ,
&hostif.command_interface.tfi_assignment_command,
sizeof(TFI_ASSIGNMENT_COMMAND_T),
Command_Processor_TFI_Assignment},
{
TX_BUFFER_READY_COMMAND_MESSAGE_ID ,
&hostif.command_interface.tx_buffer_ready_command,
sizeof(TX_BUFFER_READY_COMMAND_T),
Command_Processor_TX_Buffer_Ready},
{
RX_BUFFER_AVAILABLE_COMMAND_MESSAGE_ID ,
NULL,
0,
Command_Processor_RX_Buffer_Available},
{
DSP_DETECTION_MODE_COMMAND_MESSAGE_ID ,
&hostif.command_interface.dsp_detection_mode_command,
sizeof(DSP_DETECTION_MODE_COMMAND_T ),
Command_Processor_DSP_Detection_Mode},
{
ACCESS_BURST_COMMAND_MESSAGE_ID ,
&hostif.command_interface.access_burst_command,
sizeof(ACCESS_BURST_COMMAND_T ),
Command_Processor_Access_Burst},
{
USF_COMMAND_MESSAGE_ID ,
&hostif.command_interface.usf_command,
sizeof(USF_COMMAND_T ),
Command_Processor_USF},
{
DSP_POWER_SAVINGS_COMMAND_MESSAGE_ID ,
&hostif.command_interface.dsp_power_savings_command,
sizeof(DSP_POWER_SAVINGS_COMMAND_T ),
Command_Processor_DSP_Power_Savings},
{
RX_TIMESLOT_COUNT_COMMAND_MESSAGE_ID ,
&hostif.command_interface.rx_timeslot_count_command,
sizeof(RX_TIMESLOT_COUNT_COMMAND_T ),
Command_Processor_RX_Timeslot_Count},
{
CLEAR_SOFTBIT_CACHE_COMMAND_MESSAGE_ID ,
NULL,
0,
Command_Processor_Clear_Softbit_Cache},
{
RX_PTCCHD_COMMAND_MESSAGE_ID ,
NULL,
0,
Command_Processor_RX_PTCCHD},
{
TRAINING_SEQUENCE_CODE_COMMAND_MESSAGE_ID ,
&hostif.command_interface.training_sequence_code_command,
sizeof(TRAINING_SEQUENCE_CODE_COMMAND_T),
Command_Processor_Training_Sequence_Code},
{
DETECT_FCH_COMMAND_MESSAGE_ID ,
&hostif.command_interface.detect_fch_command,
sizeof(DETECT_FCH_COMMAND_T ),
Command_Processor_Detect_FCH},
{
DETECT_SCH_COMMAND_MESSAGE_ID ,
&hostif.command_interface.detect_sch_command,
sizeof(DETECT_SCH_COMMAND_T ),
Command_Processor_Detect_SCH}
};
/* The command message and command message data buffers used between the ISR
and Command_Processor */
COMMAND_MESSAGE_T command_message;
COMMAND_INTERFACE_UNION_T command_message_data;
/* The indication message array is in order of the indications
as defined in the indication registers, going from least-significant
bit to most-significant, and counting indication registers 1 and 2
as one 32-bit control register (indication register 1 is the least-significant
word). The message pointers here point inside of the EHPI. */
const INDICATION_MESSAGE_T indication_messages[] = {
{
0, /* the semaphore flag is not really an indication */
NULL,
0},
{
TX_PROCESSING_COMPLETE_INDICATION_MESSAGE_ID,
NULL,
0},
{
SOFTBIT_CACHE_STATE_INDICATION_MESSAGE_ID,
&hostif.indication_interface.softbit_cache_state_indication,
sizeof(SOFTBIT_CACHE_STATE_INDICATION_T)},
{
TX_BUFFER_AVAILABLE_INDICATION_MESSAGE_ID,
NULL,
0},
{
RX_BUFFER_READY_INDICATION_MESSAGE_ID,
NULL,
0},
{
DETECT_FCH_RESULT_INDICATION_MESSAGE_ID,
&hostif.indication_interface.detect_fch_result_indication,
sizeof(DETECT_FCH_RESULT_INDICATION_T)},
{
DETECT_SCH_RESULT_INDICATION_MESSAGE_ID,
&hostif.indication_interface.detect_sch_result_indication,
sizeof(DETECT_SCH_RESULT_INDICATION_T)},
{
USF_1ST_SLOT_INDICATION_MESSAGE_ID,
&hostif.indication_interface.usf_1st_slot_indication,
sizeof(USF_INDICATION_T)},
{
USF_2ND_SLOT_INDICATION_MESSAGE_ID,
&hostif.indication_interface.usf_2nd_slot_indication,
sizeof(USF_INDICATION_T)},
{
RX_PTCCHD_INDICATION_MESSAGE_ID,
&hostif.rx_ptcchd_buffer,
sizeof(RX_PTCCHD_BUFFER_T)}
};
/*-- public functions --*/
/******************************************************************************
NAME
Initialize_Host_Interface()
AUTHOR
Randy Yates
DATE
5-16-2000
PARAMETERS
void
RETURN
Boolean value indicating whether or not the initialization
was successful.
DESCRIPTION
This routine initializes the host interface as follows:
1. zero all indications in the indication interface.
2. zero the message ID in the command_message structure
which indicates there is no command to be processed.
3. initialize the message pointer in command_message to
point to the command_message_data union.
******************************************************************************/
BOOL_T Initialize_Host_Interface(void)
{
/* 1. zero all indications in the indication interface. */
memset(&hostif.indication_interface, 0, sizeof(INDICATION_INTERFACE_T));
/* 2. zero the message ID in the command_message structure
which indicates there is no command to be processed. */
command_message.message_id = 0;
/* 3. initialize the message pointer in command_message to
point to the command_message_data union. */
command_message.message = (UINT16_T*)(&command_message_data);
return TRUE;
}
/******************************************************************************
NAME
ISR_Hostif()
AUTHOR
Randy Yates
DATE
5-16-2000
PARAMETERS
void
RETURN
void
DESCRIPTION
This is the interrupt service routine for the host interface
(EHPI) interrupt. The routine will go through the command
registers and use the command_messages array to copy the
control words into a local buffer for the commands whose
bits are set in the command register(s).
NOTE
In the current non-RTOS, POC version, we only process one command
per interrupt. Later versions will have the ability to process
multiple commands per interrupt. If more than one command is sent,
the command in the most-significant bit of the 32-bit "virtual command
register" will be the one that is processed.
******************************************************************************/
void ISR_Hostif(void)
{
UINT16_T command_index;
UINT32_T command_mask;
UINT32_T virtual_command_register;
/* Create a "virtual command register" that is all 32 bits of the two 16-bit command registers. */
virtual_command_register = (UINT32_T)(hostif.command_interface.command_register_1) | ((UINT32_T)(hostif.command_interface.command_register_2) << 16);
/* For each bit in the command registers, copy command and data to the command_message and command_message_data buffers: */
for (command_index = 1, command_mask = 1; command_index < 15; command_index++, command_mask <<= 1) { /* note we skip the semaphore flag in bit 0
and we end at the bit before the ER2 (the most-significant
bit of control word 1) since there are currently no
messages in control word 2. */
if (virtual_command_register & command_mask) {
/* copy command message data */
memcpy(command_message.message, command_messages[command_index].message, command_messages[command_index].length);
/* copy command message */
command_message.message_id = command_messages[command_index].message_id;
/* (the message pointer is initialized by the initialization routine to point to command_message_data) */
command_message.length = command_messages[command_index].length;
command_message.command_processor = command_messages[command_index].command_processor;
}
}
/* reset the semaphore */
hostif.command_interface.command_register_1 &= 0xFFFE;
return;
}
/******************************************************************************
NAME
Command_Processor()
AUTHOR
Randy Yates
DATE
5-16-2000
PARAMETERS
void
RETURN
void
DESCRIPTION
This is the top-level command processing routine for processing
the incoming host commands coming from the EHPI. This routine
should be called from the top-level idle loop to process the
messages that have arrived. It uses the common buffers
"command_message" and "command_message_data" that are
shared between ISR_Hostif() and this routine to pass information.
******************************************************************************/
void Command_Processor(void)
{
if (command_message.message_id) {
command_message.command_processor(command_message.message);
}
return;
}
/******************************************************************************
NAME
Indication_Processor()
AUTHOR
Randy Yates
DATE
5-16-2000
PARAMETERS
INDICATION_MESSAGE_T *indication_message = a pointer to the indication message
RETURN
boolean indicating whether or not the indication was successfully sent
DESCRIPTION
This routine handles sending indication messages to the host
over the host interface (the EHPI). This routine should NOT
be called from an interrupt handler (it ain't re-entrant).
A FALSE return value indicates the host has not yet read the
prior indication message as indicated by the semaphore flag.
******************************************************************************/
BOOL_T Indication_Processor(INDICATION_MESSAGE_T *indication_message)
{
/* Check the semaphore flag to see if the host has read prior message */
if (hostif.indication_interface.indication_register_1 & 0x0001) {
/* host has not processed previous message */
return FALSE;
}
/* copy indication message data into the EHPI */
memcpy(indication_messages[indication_message->message_id].message, indication_message->message, indication_message->length);
/* set the appropriate indication register bit and the semaphore bit */
hostif.indication_interface.indication_register_1 = (1 << indication_message->message_id) | 1;
/* Generate the EHPI interrupt to the host */
/* ???? */
return TRUE;
}
/*-- private functions --*/
void Command_Processor_DSP_Operating_Mode(void *msg)
{
return;
}
void Command_Processor_TFI_Assignment(void *msg)
{
return;
}
void Command_Processor_TX_Buffer_Ready(void *msg)
{
return;
}
void Command_Processor_RX_Buffer_Available(void *msg)
{
return;
}
void Command_Processor_DSP_Detection_Mode(void *msg)
{
return;
}
void Command_Processor_Access_Burst(void *msg)
{
return;
}
void Command_Processor_USF(void *msg)
{
return;
}
void Command_Processor_DSP_Power_Savings(void *msg)
{
return;
}
void Command_Processor_RX_Timeslot_Count(void *msg)
{
return;
}
void Command_Processor_Clear_Softbit_Cache(void *msg)
{
return;
}
void Command_Processor_RX_PTCCHD(void *msg)
{
return;
}
void Command_Processor_Training_Sequence_Code(void *msg)
{
return;
}
void Command_Processor_Detect_FCH(void *msg)
{
return;
}
void Command_Processor_Detect_SCH(void *msg)
{
return;
}
/******************************************************************************
--- E R I C S S O N --
Copyright 2000 by Ericsson Inc. All rights reserved. No part of
this publication, or any software included with it, may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any other means, including photocopying, electronic or
mechanical recording, or otherwise, without prior written permission
of the copyright holder.
Ericsson Confidential and Proprietary information.
******************************************************************************/
#ifndef HOSTIF_H__
#define HOSTIF_H__
/*-- includes --*/
#include "dsptypes.h"
/*-- definitions --*/
/* For the initialization, command, and indication structures, the elements
are given the name of the individual bits, while the comments to the
right name the 16-bit word as specified in the host-dsp interface
specification. If there are no individual bits, the field is named the
same as the word name. */
/* The initialization table definitions */
typedef struct {
UINT16_T application_address_high; /* DSP application address (high word) */
UINT16_T application_address_low; /* DSP application address (low word) */
unsigned reserved : 15; /* DSP ready */
unsigned dr : 1;
unsigned reservedb: 15; /* DSP PLL clock mode */
unsigned pcm : 1;
UINT16_T dsp_version; /* DSP version */
UINT16_T low_softbit_cache_threshold; /* low softbit cache threshold */
UINT16_T adequate_softbit_cache_threshold; /* adequate softbit cache threshold */
} INITIALIZATION_TABLE_T;
/* The command definitions. These include the command registers and a control word structure
for each command. */
/* command register 1 */
typedef struct {
unsigned cr2_cmd : 1; /* command register 1 */
unsigned ds_cmd : 1;
unsigned df_cmd : 1;
unsigned tsc_cmd : 1;
unsigned rxp_cmd : 1;
unsigned sbc_cmd : 1;
unsigned nrxt_cmd : 1;
unsigned ps_cmd : 1;
unsigned usf_cmd : 1;
unsigned ab_cmd : 1;
unsigned dm_cmd : 1;
unsigned rxba_cmd : 1;
unsigned txbr_cmd : 1;
unsigned tfi_cmd : 1;
unsigned om_cmd : 1;
unsigned sf_cmd : 1;
} COMMAND_REGISTER_1_T;
/* command register 2 */
typedef struct {
unsigned reserved : 16; /* command register 2 */
} COMMAND_REGISTER_2_T;
/* Individual control word structures. These structures are used for the command interface as
well as the individual command messages. */
/* DSP operating mode command */
typedef struct {
unsigned reserved : 15; /* dsp operating mode */
unsigned dom : 1;
} DSP_OPERATING_MODE_COMMAND_T;
/* TFI assignment command */
typedef struct {
unsigned reserved : 11; /* temporary flow indentifier */
unsigned tfi : 5;
} TFI_ASSIGNMENT_COMMAND_T;
/* TX buffer ready command */
typedef struct {
unsigned reserved : 6; /* transmit buffer pointer */
unsigned txptr : 10;
} TX_BUFFER_READY_COMMAND_T;
/* DSP detection mode command */
typedef struct {
unsigned reserved : 15; /* DSP detection mode */
unsigned ddm : 1;
} DSP_DETECTION_MODE_COMMAND_T;
/* access burst command */
typedef struct {
unsigned reserved : 14; /* access burst type */
unsigned abt : 2;
unsigned reservedb: 5; /* access burst data */
unsigned access_burst_data : 11;
UINT16_T access_burst_bsic; /* access burst BSIC */
} ACCESS_BURST_COMMAND_T;
/* uplink status flag command */
typedef struct {
unsigned reserved : 12; /* uplink status flag */
unsigned usf : 3;
} USF_COMMAND_T;
/* DSP power savings command */
typedef struct {
unsigned reserved : 12; /* DSP power savings */
unsigned pss : 4;
} DSP_POWER_SAVINGS_COMMAND_T;
/* RX timeslot count command */
typedef struct {
unsigned reserved : 13; /* number of received timeslots */
unsigned rxtscount: 3;
} RX_TIMESLOT_COUNT_COMMAND_T;
/* training sequence code command */
typedef struct {
unsigned reserved : 13; /* training sequence code */
unsigned tscode : 3;
} TRAINING_SEQUENCE_CODE_COMMAND_T;
/* detect FCH command */
typedef struct {
unsigned reserved : 12; /* FCH control */
unsigned fchom : 2;
unsigned fchi : 1;
unsigned fchr : 1;
unsigned reservedb: 4; /* FCH detection threshold */
unsigned detection_threshold : 12;
unsigned reservedc: 3; /* FCH quality threshold */
unsigned quality_threshold : 13;
UINT32_T sample_count; /* FCH sample count */
} DETECT_FCH_COMMAND_T;
/* detect SCH command */
typedef struct {
unsigned reserved : 4; /* SCH detection threshold */
unsigned detection_threshold : 12;
UINT16_T sample_count; /* SCH sample count */
INT16_T frequency_offset; /* frequency offset, 8 Hz/bit */
} DETECT_SCH_COMMAND_T;
/* the command interface structure */
typedef struct {
UINT16_T command_register_1;
UINT16_T command_register_2;
DSP_OPERATING_MODE_COMMAND_T dsp_operating_mode_command;
TFI_ASSIGNMENT_COMMAND_T tfi_assignment_command;
TX_BUFFER_READY_COMMAND_T tx_buffer_ready_command;
DSP_DETECTION_MODE_COMMAND_T dsp_detection_mode_command;
ACCESS_BURST_COMMAND_T access_burst_command;
USF_COMMAND_T usf_command;
DSP_POWER_SAVINGS_COMMAND_T dsp_power_savings_command;
RX_TIMESLOT_COUNT_COMMAND_T rx_timeslot_count_command;
TRAINING_SEQUENCE_CODE_COMMAND_T training_sequence_code_command;
DETECT_FCH_COMMAND_T detect_fch_command;
DETECT_SCH_COMMAND_T detect_sch_command;
} COMMAND_INTERFACE_T;
/* A union that can store any of the commands */
typedef union {
DSP_OPERATING_MODE_COMMAND_T dsp_operating_mode_command;
TFI_ASSIGNMENT_COMMAND_T tfi_assignment_command;
TX_BUFFER_READY_COMMAND_T tx_buffer_ready_command;
DSP_DETECTION_MODE_COMMAND_T dsp_detection_mode_command;
ACCESS_BURST_COMMAND_T access_burst_command;
USF_COMMAND_T usf_command;
DSP_POWER_SAVINGS_COMMAND_T dsp_power_savings_command;
RX_TIMESLOT_COUNT_COMMAND_T rx_timeslot_count_command;
TRAINING_SEQUENCE_CODE_COMMAND_T training_sequence_code_command;
DETECT_FCH_COMMAND_T detect_fch_command;
DETECT_SCH_COMMAND_T detect_sch_command;
} COMMAND_INTERFACE_UNION_T;
typedef struct {
UINT16_T message_id;
void *message; /* pointer to the message structure */
UINT16_T length; /* length of message structure, in "sizeof" units */
void (*command_processor)(void *); /* function that handles this message */
} COMMAND_MESSAGE_T;
/* The command message IDs. Note that these must correspond to the bit position in the "virtual command register."
*
* When defining a new command message, perform the following steps:
*
* 1. If there are command words (parameters) associated with the command bit in the command register,
* do the following:
*
* a. Define the command message structure (if any) type in the format of the command words associated
* with the message. End the message atructure type name in "COMMAND_T," e.g., "DETECT_FCH_COMMAND_T."
* b. Place an instance of the new command message structure in the COMMAND_INTERFACE_T structure.
*
* 2. Define the command message id below.
* 3. Declare the command message processor in this file. Begin the the name with "Command_Processor," e.g., "Command_Processor_Detect_FCH."
* 4. Define the command message processor in hostif.c
* 5. Create a new entry in the initialization of "command_messages[]" in hostif.c for this command message.
*/
#define DSP_OPERATING_MODE_COMMAND_MESSAGE_ID 1
#define TFI_ASSIGNMENT_COMMAND_MESSAGE_ID 2
#define TX_BUFFER_READY_COMMAND_MESSAGE_ID 3
#define RX_BUFFER_AVAILABLE_COMMAND_MESSAGE_ID 4
#define DSP_DETECTION_MODE_COMMAND_MESSAGE_ID 5
#define ACCESS_BURST_COMMAND_MESSAGE_ID 6
#define USF_COMMAND_MESSAGE_ID 7
#define DSP_POWER_SAVINGS_COMMAND_MESSAGE_ID 8
#define RX_TIMESLOT_COUNT_COMMAND_MESSAGE_ID 9
#define CLEAR_SOFTBIT_CACHE_COMMAND_MESSAGE_ID 10
#define RX_PTCCHD_COMMAND_MESSAGE_ID 11
#define TRAINING_SEQUENCE_CODE_COMMAND_MESSAGE_ID 12
#define DETECT_FCH_COMMAND_MESSAGE_ID 13
#define DETECT_SCH_COMMAND_MESSAGE_ID 14
/* The indication definitions. These include the indication registers and a control word structure
for each indication. */
/* indication register 1 */
typedef struct {
unsigned ir2_ind : 1; /* indication register 1 */
unsigned reserved : 5;
unsigned rxpb_ind : 1;
unsigned ud2_ind : 1;
unsigned ud1_ind : 1;
unsigned dsr_ind : 1;
unsigned dfr_ind : 1;
unsigned rxbr_ind : 1;
unsigned txba_ind : 1;
unsigned sbc_ind : 1;
unsigned txc_ind : 1;
unsigned sf_ind : 1;
} INDICATION_REGISTER_1_T;
/* indication register 2 */
typedef struct {
unsigned reserved : 16; /* indication register 2 */
} INDICATION_REGISTER_2_T;
/* Individual indication control word structures. These structures are used for the indication
interface as well as the individual indication messages. */
/* soft bit cache state indication */
typedef struct {
unsigned reserved : 15; /* soft bit cache memory state */
unsigned sbcms : 1;
} SOFTBIT_CACHE_STATE_INDICATION_T;
/* detect FCH result indication */
typedef struct {
UINT16_T peak_count; /* number of peaks */
INT16_T peak_1_correlation; /* correlation value peak 1 */
UINT32_T peak_1_time_offset; /* time offset peak 1 */
INT16_T peak_1_frequency_offset; /* frequency offset peak 1 */
UINT16_T peak_1_quality; /* quality value peak 1 */
INT16_T peak_2_correlation; /* correlation value peak 2 */
UINT32_T peak_2_time_offset; /* time offset peak 2 */
INT16_T peak_2_frequency_offset; /* frequency offset peak 2 */
UINT16_T peak_2_quality; /* quality value peak 2 */
INT16_T peak_3_correlation; /* correlation value peak 3 */
UINT32_T peak_3_time_offset; /* time offset peak 3 */
INT16_T peak_3_frequency_offset; /* frequency offset peak 3 */
UINT16_T peak_3_quality; /* quality value peak 3 */
INT16_T peak_4_correlation; /* correlation value peak 4 */
UINT32_T peak_4_time_offset; /* time offset peak 4 */
INT16_T peak_4_frequency_offset; /* frequency offset peak 4 */
UINT16_T peak_4_quality; /* quality value peak 4 */
} DETECT_FCH_RESULT_INDICATION_T;
/* detect SCH result indication */
typedef struct {
unsigned sd : 1; /* SCH decoded flag */
unsigned reserve : 6;
unsigned t3 : 3;
unsigned bsic : 6;
unsigned t2 : 5; /* reduced frame number (T1 and T2) */
unsigned t1 : 11;
UINT16_T sch_correlation_value; /* SCH correlation value */
UINT16_T sch_time_offset; /* fine time offset */
} DETECT_SCH_RESULT_INDICATION_T;
/* USF indication */
typedef struct {
unsigned reserved : 13; /* uplink status flag */
unsigned usf : 3;
} USF_INDICATION_T;
/* the indication interface structure */
typedef struct {
UINT16_T indication_register_1;
UINT16_T indication_register_2;
SOFTBIT_CACHE_STATE_INDICATION_T softbit_cache_state_indication;
DETECT_FCH_RESULT_INDICATION_T detect_fch_result_indication;
DETECT_SCH_RESULT_INDICATION_T detect_sch_result_indication;
USF_INDICATION_T usf_1st_slot_indication;
USF_INDICATION_T usf_2nd_slot_indication;
} INDICATION_INTERFACE_T;
/* A union that can store any of the indications */
typedef union {
SOFTBIT_CACHE_STATE_INDICATION_T softbit_cache_state_indication;
DETECT_FCH_RESULT_INDICATION_T detect_fch_result_indication;
DETECT_SCH_RESULT_INDICATION_T detect_sch_result_indication;
USF_INDICATION_T usf_1st_slot_indication;
USF_INDICATION_T usf_2nd_slot_indication;
} INDICATION_INTERFACE_UNION_T;
typedef struct {
INT16_T test;
} RX_BUFFER_T;
typedef struct {
INT16_T test;
} TX_BUFFER_T;
typedef struct {
INT16_T test;
} RX_PTCCHD_BUFFER_T;
/* The entire host interface area. Note that we skip the level of "control table" abstraction
in order to reduce the levels of nested structures. */
typedef struct {
INITIALIZATION_TABLE_T initialization_table;
COMMAND_INTERFACE_T command_interface;
INDICATION_INTERFACE_T indication_interface;
RX_BUFFER_T rx_buffer[4];
TX_BUFFER_T tx_buffer[2];
RX_PTCCHD_BUFFER_T rx_ptcchd_buffer;
} HOST_INTERFACE_T;
typedef struct {
UINT16_T message_id;
void *message; /* pointer to the message structure */
UINT16_T length; /* length of message structure, in "sizeof" units */
} INDICATION_MESSAGE_T;
/* The indication message IDs. Note that these must correspond to the bit position in the "virtual indication register."
*
* When defining a new indication message, perform the following steps:
*
* 1. If there are indication words (parameters) associated with the indication bit in the indication register,
* do the following:
*
* a. Define the indication message structure (if any) type in the format of the indication words associated
* with the message. End the message atructure type name in "INDICATION_T," e.g., "DETECT_FCH_RESULT_INDICATION_T."
* b. Place an instance of the new indication message structure in the INDICATION_INTERFACE_T structure.
* 2. Define the indication message id below.
* 3. Create a new entry in the initialization of "indication_messages[]" in hostif.c for this indication message.
*/
#define TX_PROCESSING_COMPLETE_INDICATION_MESSAGE_ID 1
#define SOFTBIT_CACHE_STATE_INDICATION_MESSAGE_ID 2
#define TX_BUFFER_AVAILABLE_INDICATION_MESSAGE_ID 3
#define RX_BUFFER_READY_INDICATION_MESSAGE_ID 4
#define DETECT_FCH_RESULT_INDICATION_MESSAGE_ID 5
#define DETECT_SCH_RESULT_INDICATION_MESSAGE_ID 6
#define USF_1ST_SLOT_INDICATION_MESSAGE_ID 7
#define USF_2ND_SLOT_INDICATION_MESSAGE_ID 8
#define RX_PTCCHD_INDICATION_MESSAGE_ID 9
/*-- public variables --*/
/*-- public function prototypes --*/
extern BOOL_T Initialize_Host_Interface(void);
extern void ISR_Hostif(void);
extern void Command_Processor(void);
extern BOOL_T Indication_Processor(INDICATION_MESSAGE_T *);
/*-- private variables --*/
extern HOST_INTERFACE_T hostif;
extern const COMMAND_MESSAGE_T command_messages[];
extern COMMAND_MESSAGE_T command_message;
extern COMMAND_INTERFACE_UNION_T command_message_data;
extern const INDICATION_MESSAGE_T indication_messages[];
extern INDICATION_MESSAGE_T indication_message;
extern INDICATION_INTERFACE_UNION_T indication_message_data;
/*-- private function prototypes --*/
/* The command message processing routines */
extern void Command_Processor_DSP_Operating_Mode(void *);
extern void Command_Processor_TFI_Assignment(void *);
extern void Command_Processor_TX_Buffer_Ready(void *);
extern void Command_Processor_RX_Buffer_Available(void *);
extern void Command_Processor_DSP_Detection_Mode(void *);
extern void Command_Processor_Access_Burst(void *);
extern void Command_Processor_USF(void *);
extern void Command_Processor_DSP_Power_Savings(void *);
extern void Command_Processor_RX_Timeslot_Count(void *);
extern void Command_Processor_Clear_Softbit_Cache(void *);
extern void Command_Processor_RX_PTCCHD(void *);
extern void Command_Processor_Training_Sequence_Code(void *);
extern void Command_Processor_Detect_FCH(void *);
extern void Command_Processor_Detect_SCH(void *);
#endif /* HOSTIF_H__ */
/*
* Copyright 1999, 2000 by Ericsson Inc. All rights reserved. No
* part of this publication, or any software included with it, may be
* reproduced, stored in a retrieval system, or transmitted in any
* form or by any other means, including photocopying, electronic or
* mechanical recording or otherwise, without prior written permission
* of the copyright holder.
*
* Ericsson Confidential and Proprietary information.
*
*/
#ifndef dsptypes_h__
#define dsptypes_h__
typedef short INT16_T;
typedef long INT32_T;
typedef unsigned short UINT16_T;
typedef unsigned long UINT32_T;
typedef struct
{
INT16_T r;
INT16_T i;
} COMPLEX_T;
typedef enum {
FALSE = 0,
TRUE
} BOOL_T;
#endif /* dsptypes_h__ */
/*
* Local variables:
* c-file-style: "edge"
* End:
*/