- SSC_PIO_PDR = BV(SSC_TK) | BV(SSC_TF) | BV(SSC_TD);
- PIO_PERIPH_SEL(SSC_PORT, BV(SSC_TK) | BV(SSC_TF) | BV(SSC_TD), SSC_TRAN_PERIPH);
+ (void)channel;
+ i2s->ctx.write = sam3_i2s_write;
+ i2s->ctx.tx_buf = sam3_i2s_txBuf;
+ i2s->ctx.tx_isFinish = sam3_i2s_isTxFinish;
+ i2s->ctx.tx_start = sam3_i2s_txStart;
+ i2s->ctx.tx_wait = sam3_i2s_txWait;
+ i2s->ctx.tx_stop = sam3_i2s_txStop;
+
+ i2s->ctx.read = sam3_i2s_read;
+ i2s->ctx.rx_buf = sam3_i2s_rxBuf;
+ i2s->ctx.rx_isFinish = sam3_i2s_isRxFinish;
+ i2s->ctx.rx_start = sam3_i2s_rxStart;
+ i2s->ctx.rx_wait = sam3_i2s_rxWait;
+ i2s->ctx.rx_stop = sam3_i2s_rxStop;
+
+ DB(i2s->ctx._type = I2S_SAM3X;)
+ i2s->hw = &i2s_hw;
+
+ PIOA_PDR = BV(SSC_TK) | BV(SSC_TF) | BV(SSC_TD);
+ PIO_PERIPH_SEL(PIOA_BASE, BV(SSC_TK) | BV(SSC_TF) | BV(SSC_TD), PIO_PERIPH_B);
+ PIOB_PDR = BV(SSC_RD) | BV(SSC_RF);
+ PIO_PERIPH_SEL(PIOB_BASE, BV(SSC_RD) | BV(SSC_RF), PIO_PERIPH_A);
+
+ /* clock the ssc */
+ pmc_periphEnable(SSC_ID);