dect
/
linux-2.6
Archived
13
0
Fork 0

dect: coa: don't load BMC config twice on TX

Move RX BMC configuration from the radio initialization to the
receive functions to avoid double configuration on TX.

Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Patrick McHardy 2011-04-07 02:07:27 +02:00
parent cbf1cafc33
commit 8e819940f0
4 changed files with 76 additions and 69 deletions

View File

@ -679,7 +679,7 @@ static void sc1442x_tx(const struct dect_transceiver *trx, struct sk_buff *skb)
sc1442x_to_dmem(dev, off + SD_PREAMBLE_OFF,
skb_mac_header(skb), skb->mac_len);
sc1442x_to_dmem(dev, off + SD_DATA_OFF, skb->data, skb->len);
sc1442x_dwriteb(dev, off + TX_DESC + TRX_DESC_FN, cb->frame);
sc1442x_dwriteb(dev, off + BMC_TX_CTRL + BMC_CTRL_MFR_OFF, cb->frame);
/* Init DCS for slots in the first half frame */
if (ts->flags & DECT_SLOT_CIPHER && slot < DECT_HALF_FRAME_SIZE)
@ -842,7 +842,7 @@ out:
dect_transceiver_record_rssi(event, slot, rssi);
/* Update frame number for next reception */
sc1442x_dwriteb(dev, off + RX_DESC + TRX_DESC_FN, framenum + 1);
sc1442x_dwriteb(dev, off + BMC_RX_CTRL + BMC_CTRL_MFR_OFF, framenum + 1);
/* Init DCS for slots in the first half frame */
if (ts->flags & DECT_SLOT_CIPHER && slot < DECT_HALF_FRAME_SIZE)
@ -925,8 +925,8 @@ static void sc1442x_init_slot(const struct coa_device *dev, u8 slot)
sc1442x_switch_to_bank(dev, banktable[slot]);
off = sc1442x_slot_offset(slot);
sc1442x_write_bmc_config(dev, off + TX_DESC, slot < 12, true);
sc1442x_write_bmc_config(dev, off + RX_DESC, slot < 12, false);
sc1442x_write_bmc_config(dev, off + BMC_TX_CTRL, slot < 12, true);
sc1442x_write_bmc_config(dev, off + BMC_RX_CTRL, slot < 12, false);
dev->radio_ops->rx_init(dev, off);
dev->radio_ops->tx_init(dev, off);
}
@ -994,7 +994,7 @@ int sc1442x_init_device(struct coa_device *dev)
for (i = 1; i < SC1442X_CC_SIZE; i++)
sc1442x_dwriteb(dev, DIP_CC_INIT + i, 0);
sc1442x_write_bmc_config(dev, DIP_RF_INIT, false, false);
sc1442x_write_bmc_config(dev, BMC_CTRL_INIT, false, false);
for (slot = 0; slot < DECT_FRAME_SIZE; slot += 2)
sc1442x_init_slot(dev, slot);

View File

@ -34,14 +34,21 @@ BANK6_HIGH EQU 0xd0
BANK7_LOW EQU 0xe0
BANK7_HIGH EQU 0xf0
DIP_RF_INIT EQU 0x00
BMC_CTRL_INIT EQU 0x00
; Codec Control
DIP_CC_INIT EQU 0x10
; Radio configuration word
RF_DESC EQU 0x3a
TX_DESC EQU 0x40
RX_DESC EQU 0x48
; BMC control information
BMC_CTRL_SIZE EQU 7
BMC_TX_CTRL EQU 0x40
BMC_RX_CTRL EQU 0x48
; (multi) frame number for scambler and DCS
BMC_CTRL_MFR_OFF EQU 6
; Cipher IV/Key
DCS_DESC EQU 0x50
@ -52,9 +59,6 @@ DCS_CK EQU DCS_DESC + 0x8
DCS_STATE EQU 0x70
DCS_STATE_SIZE EQU 11
; scrambler frame number offset to {RX,TX}_DESC
TRX_DESC_FN EQU 0x06
SD_PREAMBLE_OFF EQU 0x01
SD_A_FIELD_OFF EQU 0x06
SD_B_FIELD_OFF EQU 0x0E
@ -205,7 +209,10 @@ label_58: B_RST
; Enable the receiver, receive the S-field and the first 61 bits of the D-field
; (93 bits total)
;
Receive: P_LDH PB_RX_ON
Receive: B_RST
B_RC BMC_RX_CTRL
WT BMC_CTRL_SIZE + 1
P_LDH PB_RX_ON
P_LDL PB_RSSI ; enable RSSI measurement
WT 25
WNT 1 ; Wait until beginning of slot |
@ -224,7 +231,10 @@ ClockSyncOff: P_SC 0x00 ; | p: 30 S: 46
WT 62 ; Receive first 61 bits of A-field | p: 32-92 A: 0-60
RTN ; Return | p: 93 A: 61
ReceiveSync: P_LDH PB_RX_ON
ReceiveSync: B_RST
B_RC BMC_RX_CTRL
WT BMC_CTRL_SIZE + 1
P_LDH PB_RX_ON
P_LDL PB_RSSI ; enable RSSI measurement
WT 25
WNT 1 ; Wait until beginning of slot |
@ -260,7 +270,7 @@ ReceiveEnd: P_LDH PB_RSSI ; |
Transmit: P_LDH 0x00 ;
WT 40 ;
B_RST ;
B_RC TX_DESC ;
B_RC BMC_TX_CTRL ;
WNT 1 ; Wait until beginning of slot
B_ST 0x00 ; Start transmission of S-field data |
WT 1 ; Wait one bit | p: -8 S: 0
@ -326,11 +336,8 @@ RFInit: RFEN ; Enable RF-clock
MEN1
WT 1
RFInit2: P_LDL 0x20
RFInit3: B_RST
B_RC RX_DESC
WT 8
P_LDL 0x20
WT 10
MEN2
WT 182
MEN2N
@ -390,8 +397,8 @@ InitDIP: B_RST
BK_C BANK0_LOW
C_LD DIP_CC_INIT
WT 10
B_RC DIP_RF_INIT
WT 8
B_RC BMC_CTRL_INIT
WT BMC_CTRL_SIZE + 1
B_RST
;C_ON
WT 10
@ -402,8 +409,8 @@ InitDIP: B_RST
RFStart: BR SyncInit
;-------------------------------------------------------------
SHARED DIP_CC_INIT,DIP_RF_INIT
SHARED RF_DESC,RX_DESC,TX_DESC,TRX_DESC_FN
SHARED DIP_CC_INIT,RF_DESC
SHARED BMC_CTRL_INIT,BMC_RX_CTRL,BMC_TX_CTRL,BMC_CTRL_MFR_OFF
SHARED SD_RSSI_OFF,SD_CSUM_OFF,SD_PREAMBLE_OFF,SD_DATA_OFF
SHARED SlotTable

View File

@ -15,51 +15,51 @@ const unsigned char sc1442x_firmware[] = {
0x08, 0x02, 0x0f, 0xa0, 0x08, 0x02, 0x6d, 0x00,
0x0f, 0xb0, 0x08, 0x02, 0x0f, 0xc0, 0x08, 0x02,
0x0f, 0xd0, 0x08, 0x02, 0x6f, 0x00, 0x01, 0x02,
0x02, 0xa6, 0x02, 0x5d, 0x2d, 0x0e, 0x02, 0x83,
0x01, 0x51, 0x02, 0xa6, 0x02, 0x6f, 0x2d, 0x0e,
0x02, 0x83, 0x01, 0x51, 0x02, 0xa6, 0x02, 0x5d,
0x2d, 0x0e, 0x02, 0x81, 0x01, 0x58, 0x02, 0xbd,
0x01, 0x2a, 0x02, 0xa6, 0x02, 0x5d, 0x3d, 0x0e,
0x02, 0x9e, 0x09, 0x03, 0x2b, 0x00, 0x09, 0x06,
0x02, 0x83, 0x39, 0x00, 0x09, 0x06, 0x01, 0x5a,
0x02, 0xa6, 0x02, 0x86, 0x02, 0x95, 0x01, 0x53,
0x02, 0xa6, 0x02, 0x86, 0x25, 0x0e, 0x02, 0x92,
0x01, 0x54, 0x02, 0xbd, 0x01, 0x40, 0x02, 0xa6,
0x02, 0x86, 0x35, 0x0e, 0x02, 0x9e, 0x09, 0x03,
0x24, 0x00, 0x09, 0x0d, 0x20, 0x00, 0x02, 0x95,
0x01, 0x5a, 0x39, 0x00, 0x09, 0x06, 0x20, 0x00,
0xec, 0x50, 0x09, 0x05, 0x08, 0x01, 0x04, 0x00,
0x39, 0x00, 0x09, 0x06, 0x20, 0x00, 0xec, 0x50,
0x04, 0x00, 0xed, 0x40, 0xec, 0x01, 0x09, 0x19,
0x02, 0xa8, 0x02, 0x5b, 0x2d, 0x0e, 0x02, 0x85,
0x01, 0x4f, 0x02, 0xa8, 0x02, 0x6f, 0x2d, 0x0e,
0x02, 0x85, 0x01, 0x4f, 0x02, 0xbd, 0x02, 0xa8,
0x02, 0x5b, 0x2d, 0x0e, 0x02, 0x83, 0x01, 0x56,
0x02, 0xa8, 0x02, 0x5b, 0x3d, 0x0e, 0x02, 0xa0,
0x09, 0x03, 0x2b, 0x00, 0x09, 0x06, 0x02, 0x85,
0x39, 0x00, 0x09, 0x06, 0x01, 0x58, 0x02, 0xa8,
0x02, 0x88, 0x02, 0x97, 0x01, 0x51, 0x02, 0xbd,
0x02, 0xa8, 0x02, 0x88, 0x25, 0x0e, 0x02, 0x94,
0x01, 0x52, 0x02, 0xa8, 0x02, 0x88, 0x35, 0x0e,
0x02, 0xa0, 0x09, 0x03, 0x24, 0x00, 0x09, 0x0d,
0x20, 0x00, 0x02, 0x97, 0x01, 0x58, 0x39, 0x00,
0x09, 0x06, 0x20, 0x00, 0xec, 0x50, 0x09, 0x05,
0x08, 0x01, 0x04, 0x00, 0x39, 0x00, 0x09, 0x06,
0x20, 0x00, 0xec, 0x50, 0x04, 0x00, 0x20, 0x00,
0x33, 0x48, 0xed, 0x40, 0xec, 0x01, 0x09, 0x19,
0x08, 0x01, 0x09, 0x08, 0x27, 0x00, 0xea, 0x20,
0xed, 0x02, 0x09, 0x05, 0x29, 0x00, 0x2c, 0x00,
0x09, 0x0c, 0xec, 0x02, 0x09, 0x20, 0xea, 0x00,
0x3f, 0x06, 0x09, 0x3e, 0x04, 0x00, 0xed, 0x40,
0xec, 0x01, 0x09, 0x19, 0x08, 0x01, 0x09, 0x08,
0x27, 0x00, 0xea, 0x20, 0xed, 0x02, 0x09, 0x05,
0x29, 0x00, 0x2c, 0x00, 0x09, 0x0c, 0xec, 0x02,
0x09, 0x20, 0xea, 0x00, 0x3f, 0x06, 0x09, 0x3e,
0x04, 0x00, 0x09, 0xf9, 0x09, 0x4f, 0xed, 0x01,
0xec, 0x40, 0x01, 0xc5, 0xed, 0x00, 0x09, 0x28,
0x20, 0x00, 0x33, 0x40, 0x08, 0x01, 0x31, 0x00,
0x09, 0x01, 0xed, 0x10, 0x09, 0x25, 0x37, 0x06,
0x09, 0x3e, 0x04, 0x00, 0x09, 0xf9, 0x09, 0x54,
0x20, 0x00, 0xec, 0x10, 0x09, 0x08, 0xec, 0x00,
0x01, 0xc5, 0x27, 0x00, 0x09, 0x0f, 0x26, 0x00,
0x09, 0x3d, 0x04, 0x00, 0x09, 0x3d, 0x02, 0x99,
0x02, 0x99, 0x02, 0x99, 0x09, 0x01, 0x27, 0x00,
0x09, 0x0b, 0x04, 0x00, 0x0b, 0x00, 0x09, 0x02,
0xa4, 0x00, 0xb9, 0x3a, 0x09, 0x19, 0xa9, 0x00,
0xa5, 0x00, 0xa4, 0x00, 0xb9, 0x3d, 0x09, 0x0a,
0xa9, 0x00, 0xa5, 0x00, 0x09, 0x01, 0xec, 0x20,
0x20, 0x00, 0x33, 0x48, 0x09, 0x08, 0xa7, 0x00,
0x3f, 0x06, 0x09, 0x3e, 0x04, 0x00, 0x20, 0x00,
0x33, 0x48, 0xed, 0x40, 0xec, 0x01, 0x09, 0x19,
0x08, 0x01, 0x09, 0x08, 0x27, 0x00, 0xea, 0x20,
0xed, 0x02, 0x09, 0x05, 0x29, 0x00, 0x2c, 0x00,
0x09, 0x0c, 0xec, 0x02, 0x09, 0x20, 0xea, 0x00,
0x3f, 0x06, 0x09, 0x3e, 0x04, 0x00, 0x09, 0xf9,
0x09, 0x4f, 0xed, 0x01, 0xec, 0x40, 0x01, 0xc5,
0xed, 0x00, 0x09, 0x28, 0x20, 0x00, 0x33, 0x40,
0x08, 0x01, 0x31, 0x00, 0x09, 0x01, 0xed, 0x10,
0x09, 0x25, 0x37, 0x06, 0x09, 0x3e, 0x04, 0x00,
0x09, 0xf9, 0x09, 0x54, 0x20, 0x00, 0xec, 0x10,
0x09, 0x08, 0xec, 0x00, 0x01, 0xc5, 0x27, 0x00,
0x09, 0x0f, 0x26, 0x00, 0x09, 0x3d, 0x04, 0x00,
0x09, 0x3d, 0x02, 0x9b, 0x02, 0x9b, 0x02, 0x9b,
0x09, 0x01, 0x27, 0x00, 0x09, 0x0b, 0x04, 0x00,
0x0b, 0x00, 0x09, 0x02, 0xa4, 0x00, 0xb9, 0x3a,
0x09, 0x19, 0xa9, 0x00, 0xa5, 0x00, 0xa4, 0x00,
0xb9, 0x3d, 0x09, 0x0a, 0xa9, 0x00, 0xa5, 0x00,
0x09, 0x01, 0xec, 0x20, 0x09, 0x0a, 0xa7, 0x00,
0x09, 0xb6, 0xa6, 0x00, 0xed, 0x00, 0x09, 0x10,
0x04, 0x00, 0x40, 0x00, 0x50, 0x50, 0x09, 0x10,
0x50, 0x00, 0x44, 0x00, 0x09, 0x27, 0x44, 0x00,
0x04, 0x00, 0x5f, 0x70, 0x09, 0x0b, 0x5f, 0x00,
0x40, 0x00, 0x04, 0x00, 0x40, 0x00, 0x57, 0x70,
0x09, 0x0b, 0x57, 0x00, 0x04, 0x00, 0x0f, 0x20,
0x02, 0xa6, 0x09, 0xfa, 0xea, 0x20, 0xed, 0x42,
0x02, 0xa8, 0x09, 0xfa, 0xea, 0x20, 0xed, 0x42,
0x28, 0x00, 0x09, 0x40, 0x26, 0x00, 0x29, 0x00,
0x08, 0x14, 0x03, 0xde, 0x20, 0x00, 0x6b, 0x00,
0x08, 0x17, 0x01, 0xd0, 0x08, 0x17, 0xea, 0x00,

View File

@ -4,11 +4,11 @@
extern const unsigned char sc1442x_firmware[509];
#define DIP_CC_INIT 0x10
#define DIP_RF_INIT 0x0
#define RF_DESC 0x3A
#define RX_DESC 0x48
#define TX_DESC 0x40
#define TRX_DESC_FN 0x6
#define BMC_CTRL_INIT 0x0
#define BMC_RX_CTRL 0x48
#define BMC_TX_CTRL 0x40
#define BMC_CTRL_MFR_OFF 0x6
#define SD_RSSI_OFF 0x0
#define SD_CSUM_OFF 0x1
#define SD_PREAMBLE_OFF 0x1
@ -53,13 +53,13 @@ extern const unsigned char sc1442x_firmware[509];
#define PSC_EOPSM 0x10
#define RX_P00 0x20
#define RX_P00_Sync 0x25
#define RX_P32U 0x2A
#define RX_P32P 0x31
#define RX_P32U_Enc 0x2F
#define TX_P00 0x3C
#define RX_P32U 0x2B
#define RX_P32P 0x30
#define RX_P32U_Enc 0x2A
#define TX_P00 0x3B
#define TX_P32U 0x40
#define TX_P32P 0x47
#define TX_P32U_Enc 0x45
#define TX_P32P 0x45
#define TX_P32U_Enc 0x3F
#define DCS_IV 0x50
#define DCS_CK 0x58
#define DCS_STATE 0x70