79 struct raspi_PCM_CS_reg init_cs = {
91 const struct raspi_PCM_MODE_reg mode_master = {
101 const struct raspi_PCM_MODE_reg mode_slave = {
111 const struct raspi_CM_CTL_reg pcm_cm_ctl = {
118 const struct raspi_CM_DIV_reg pcm_cm_div = {
128 while (
HW.PCM.CS.B.RXD) (void)
HW.PCM.FIFO;
138 HW.PCM.INTSTC.U = 15;
141 HW.PCM.RXC.B.CH1WEX = 0;
142 HW.PCM.RXC.B.CH1POS = 0;
143 HW.PCM.RXC.B.CH1WID = 0;
144 HW.PCM.RXC.B.CH1EN = 1;
146 HW.PCM.TXC.B.CH1WEX = 0;
147 HW.PCM.TXC.B.CH1POS = 0;
148 HW.PCM.TXC.B.CH1WID = 0;
149 HW.PCM.TXC.B.CH1EN = 1;
152 HW.CM[CM_PCM].DIV.B = pcm_cm_div;
153 HW.CM[CM_PCM].CTL.B = pcm_cm_ctl;
154 HW.PCM.MODE.B = mode_master;
155 HW.PCM.MODE.B.CLK_DIS = 0;
156 HW.PCM.CS.B = init_cs;
158 while (!
HW.PCM.CS.B.SYNC);
159 HW.PCM.CS.B.SYNC = 0;
160 while (
HW.PCM.CS.B.SYNC);
163 HW.PCM.MODE.B.CLK_DIS = 1;
164 HW.PCM.MODE.B = mode_slave;
173 HW.PCM.MODE.B.CLK_DIS = 0;
184 if (num <= 0)
return 1;
185 return HW.PCM.CS.B.RXD;
192 while (!
HW.PCM.CS.B.RXD);
203 while (!
HW.PCM.CS.B.TXD);
205 while (
HW.PCM.CS.B.RXD) dummy =
HW.PCM.FIFO;
213 while (!
HW.PCM.CS.B.TXE);
235 uint8_t marker = 0x81;
241 if (incoming != marker) {
242 HW.PCM.MODE.B.CLK_DIS = 1;
245 HW.PCM.MODE.B.CLK_DIS = 0;
254 while (incoming != marker) incoming =
spisl_read();