public int i2s_write(ref i2s_t obj, byte[] p_data, int data_size, IntPtr p_notify_func, IntPtr p_app_data) { if (!interfaces.TryGetValue(obj.id, out var uif)) { throw new ArgumentException(); } return(((I2S)uif).Write(p_data, data_size, p_notify_func, p_app_data)); }
public void i2s_config_channel(ref i2s_t obj, ref ssif_channel_cfg_t cfg) { if (!interfaces.TryGetValue(obj.id, out var uif)) { throw new ArgumentException(); } ((I2S)uif).ConfigChannel(ref cfg); }
public void i2s_config(ref i2s_t obj, ref ssif_channel_cfg_t cfg, int max_write_num, int max_read_num) { if (!interfaces.TryGetValue(obj.id, out var uif)) { throw new ArgumentException(); } ((I2S)uif).Config(ref cfg, max_write_num, max_read_num); }
private void DeleteI2S(ref i2s_t obj) { if (!interfaces.TryGetValue(obj.id, out var uif)) { return; } pin_if.Remove(((I2S)uif).tx); pin_if.Remove(((I2S)uif).rx); pin_if.Remove(((I2S)uif).sck); pin_if.Remove(((I2S)uif).ws); pin_if.Remove(((I2S)uif).audio_clk); interfaces.Remove(obj.id); }
private IUnitInterface CreateI2S(ref i2s_t obj, PinName tx, PinName rx, PinName sck, PinName ws, PinName audio_clk) { var p = PinMap.Peripheral(tx, PinMap.PinMap_I2S_TX); if (p == (int)PinName.NC) { return(null); } var t = PinMap.Peripheral(rx, PinMap.PinMap_I2S_RX); if ((t == (int)PinName.NC) || (t != p)) { return(null); } t = PinMap.Peripheral(sck, PinMap.PinMap_I2S_SCK); if ((t == (int)PinName.NC) || (t != p)) { return(null); } t = PinMap.Peripheral(ws, PinMap.PinMap_I2S_WS); if ((t == (int)PinName.NC) || (t != p)) { return(null); } t = PinMap.Peripheral(audio_clk, PinMap.PinMap_I2S_AUDIO_CLK); if ((t != (int)PinName.NC) && (t != p)) { return(null); } if (!interfaces.TryGetValue(obj.id, out var uif)) { if (pin_if.ContainsKey(tx) || pin_if.ContainsKey(rx) || pin_if.ContainsKey(sck) || pin_if.ContainsKey(ws)) { throw new ArgumentException(); } uif = new I2S((I2SName)p, tx, rx, sck, ws, audio_clk); obj.id = uif.GetHashCode(); interfaces.Add(obj.id, uif); } return(uif); }
public void i2s_init(ref i2s_t obj, PinName tx, PinName rx, PinName sck, PinName ws, PinName audio_clk) { CreateI2S(ref obj, tx, rx, sck, ws, audio_clk); }