classA{ public: int i_ = 0; voidfunc(int x, int y){ auto x1 = []{ return i_; }; auto x2 = [=]{ return i_ + x + y; }; auto x3 = [&]{ return i_ + x + y; }; auto x4 = [this]{ return i_; }; auto x5 = [this]{ return i_ + x + y; }; auto x6 = [this, x, y]{ return i_ + x + y; }; auto x7 = [this]{ return i_++; }; } };
int a = 0, b = 1; auto f1 = []{ return a; }; auto f2 = [&]{ return a++; }; auto f3 = [=]{ return a; }; auto f4 = [=]{ return a++; }; auto f5 = [a]{ return a + b; }; auto f6 = [a, &b]{ return a + (b++); }; auto f7 = [=, &b]{ return a + (b++); };
If you are using type-C receptacle and plug combination you will not
need a switch. If you have both USB-C connectors as receptacles,
connected via a type-C cable (EMCA) then you will require a switch. DP
source (FPGA) <---->Switch<------> USB-C receptacle
<---------------------> USB-C plug <------> DP sink (FPGA)
otherwise, DP source (FPGA) <-----> Switch <-----> USB-C
receptacle <---------- USB-C cable ----------> USB-C receptacle
<-----> Switch <-----> DP sink (FPGA)
当然,设备端的MUX也会影响最终性能,就如水路一样,最后的出水速度是受到整条链路上所有环节的影响的
经过了设备端的解复用之后,留给下游的又是简单纯粹的 USB 协议口和 DP
协议口(USB2.0 和 DP的 Configuration 通道仍需要
PD控制器转发来保证正常功能),在原先开发的各种USB 玩法 以及 DP玩法
可以直接捡起来套上去,不得不说这样的Type-C
开发出来对原先的硬件环境十分友好,和先前仅有的区别是,原本井水不犯河水的
USB 和DP 配件,如今由于 DP Alt Mode的存在被整合到一块电路板上了。
Dual DisplayPort displays: Up to 4096 x 2160p @ 24Hz or 3840 x 2160p
@ 30Hz Single DisplayPort display: Up to 4096 x 2160p @ 60Hz or 3840 x
2160p @ 60Hz
此外还有 Kensington 的 SD4820P USB-C 10Gbps Dual Video Driverless
Docking Station 可惜这次连使用的芯片信息都没有了
[^](about:reader?url=https%3A%2F%2Fzhuanlan.zhihu.com%2Fp%2F342165494#ref_27_0)Surface
Dock 2 teardown
https://dancharblog.wordpress.com/2020/05/28/surface-dock-2-teardown/comment-page-1/#comment-7200
The TWI and the UART have separate interrupt outputs. Both
peripherals are already connected via the P14I (DPI) by default. However
both peripherals allow separate connectivity into the PICR that are not
routed by default. This provides more flexibility for priority change
across the DAI/DPI interrupts.
During the addressing phase of a transfer, the TWI controller, with
its master enabled, transmits the contents of the TWI master mode
address register. When programming this register, omit the read/write
bit. That is, only the upper 7 bits that make up the slave address
should be written to this register. For example, if the slave address is
1010000X, then TWIMADDR is programmed with 1010000, which corresponds to
0x50. When sending out the address on the bus, the TWI controller
appends the read/write bit as appropriate, based on the state of the
TWIMDIR bit in the master mode control register.
图 A-146 TWIMADDR 寄存器
TWIMSTAT
Not directly associated with the generation of interrupts but offer
information on the current transfer.
Slave mode operation does not affect master mode status bits.
如果TWIMSTAT寄存器中的第2位是1
TWIFIFOCTL
TWIFIFOCTL(FIFO Control
Register),即先进先出控制寄存器,只控制FIFO,完全不与主机模式
或 从机模式操作绑定。
Identify the peripherals that you are trying to connect to the SHARC
DSP, and count the unique signals. List the unique I/O signals and look
carefully to see what else you may be able to eliminate.
如果时钟或帧同步连接至多个设备,算作一个信号。If the same
clock or frame sync
is connected to multiple devices, it counts as one signal.
如果与一个串行数据流驱动多个设备,也算作一个信号。When a
serial data stream drives multiple output
devices, it also counts as a single signal.
The TWI controller always decodes and acknowledges a general call
address if it is enabled as a slave (TWISEN) and if general call is
enabled using the TWIGCE bit. General call addressing (0x00) is
indicated by the setting of the GCALL bit, and by the nature of the
transfer, the TWI controller is a slave-receiver. If the data associated
with the transfer is to be not acknowledged (NAKed), the TWINAK bit can
be set.
If the TWI controller is to issue a general call as a
master-transmitter, the appropriate address and transfer direction can
be set along with loading transmit FIFO data.
从设备模式寻址 Slave Mode
Addressing
With the appropriate selection of 7-bit addressing using the TWISLEN
bit, the corresponding number of address bits (SADDR) are referenced
during the address phase of a transfer.
Whether enabled as a master-transmitter or master-receiver with 7-bit
addressing using the TWIMLEN bit, the TWI
master performs all addressing and data transfers as required. This
includes generating the repeated start condition, re-transmission of the
7-bits of the first address byte, and acknowledgement and generation of
a new transfer direction change (indicated by the
TWIMLEN bit).
快速模式 Fast Mode
Fast mode (400 kHz) uses essentially the same mechanics as standard
mode (100 kHz). It is the electrical specifications and timing that are
different. When fast mode is enabled using the
TWIFAST bit, the following timings are
modified to meet the electrical requirements.
Serial data rise times before arbitration evaluation (tr)
Stop condition setup time from serial clock to serial data
(tSUSTO)
Bus free time between a stop and start condition (tBUF)
以下为单主机传输模式的的编程过程: 1. Program the
TWIMADDR register. - This defines the address transmitted
during the address phase of the transfer. 2. Program the
TXTWI8 or TXTWI16 registers. - This is the
initial data transmitted. - It is considered an error to complete the
address phase of the transfer and not have data available in the
transmit FIFO buffer. 3. Program the TWIFIFOCTL register. -
Indicate if transmit FIFO buffer interrupts should occur with each byte
transmitted (8 bits) or with each 2 bytes transmitted (16 bits). 4.
Program the TWIIMASK register. - Enable the bits associated
with the desired interrupt sources. - For example, programming the value
0x0030 results in an interrupt output to the processor when
the master transfer completes, or if a master transfer error has
occurred. 5. Program the TWIMCTL register. - This prepares
and enables master mode operation. - As an example, programming the
value 0x0201 enables master mode operation, generates a
7-bit address, sets the direction to master-transmit, uses standard mode
timing, and transmits 8 data bytes before generating a stop
condition.
Clock
The PLLD bits define the VCO output clock to core clock ratio to
build the processor core clock (CCLK). The post divider can be changed
any time and new division ratios are implemented on the fly.
The PCLK and CLKIN clocks are used in the arbitration logic for the
shared external bus.
The PLL bit settings PLLM/PLLD in PMCTL register need to be
programmed such that the PLLM/PLLD ratio is integer (for example
15/2=7.5 fractional, is not allowed).
IOP Clock (PCLK)
The peripheral clock is derived from the
core clock with a fixed post
divisor of 2.
This clock is the master clock for most
peripherals including the I/O processor
(IOP).
PLL
PLL Registers
PMCTL
PMCTL 寄存器,Power management control
register。(是的,没错,就是不知道为啥管PLL的要叫PMCTL)
Controls the SDCLK to core clock ratio
or DDR2CLK to core clock ratio
related to the external port timing.
The fundamental timing clock of the external port is
SDRAM clock (SDCLK). The SDRAM clock ratio
settings are independent from the peripheral clock (PCLK).
The AMI/SDRAM controller is capable of running at up to
133 MHz for ADSP-2147x processors. See Table
4-2 for more information about EXTERNAL PORT CLOCK
FREQUENCIES.
The fundamental timing clock of the external port is
DDR2 clock (DDR2_CLK). The DDR2 clock ratio
settings are independent from the peripheral
clock (PCLK).
32位内存映射寄存器(32-bit memory-mapped register)
包含控制位,可控制:锁相环(PLL, phase lock
loop)(PLL乘法器值(multiplier)、PLL除法器值(divider)、锁相环旁路模式(PLL
bypass mode) 和 外围设备使能时钟控制(clock control for enabling
peripherals))
// Step 3 - set INDIV bit now to bring down the VCO speed and enter the bypass mode temp&=~DIVEN; temp|=(INDIV | PLLBP); *pPMCTL = temp;
// Step 4 -等待PLL锁定 SysWait(4096);
// Step 5 - come out of the bypass mode temp=*pPMCTL; temp&=~PLLBP; *pPMCTL = temp;
// Step 6 - 等待分频器稳定 SysWait(16);
// Step 7 - set the required PLLM and INDIV values here and enter the bypass mode //PLLM=16, INDIV=0, fVCO=2*PLLM*CLKIN = 2*16*16.625 = 532 MHz temp = *pPMCTL; temp&=~ (INDIV | PLLM63); temp|= (PLL_MULT| PLLBP); *pPMCTL = temp;
// Step 8 - wait for the PLL to lock for(i=0;i<4096;i++);
// Step 9 - come out of the bypass mode temp = *pPMCTL; temp&=~PLLBP; *pPMCTL=temp;
// Step 10 - wait for dividers to stabilize SysWait(16); // Step 11 - set the required values of PLLD(=2) and SDCKR (=2.5 for ADSP-21489 and 2 for ADSP-21479) here // fCCLK = fVCO/PLLD = 532/2 = 266 MHz, fSDCLK = fCCLK/SDCKR = 266/2 = 133 MHz temp=*pPMCTL; temp&=~(PLLD16 | 0x1C0000 ); temp|= (SDCKR2 | PLLD2 | DIVEN); *pPMCTL=temp; // Step 12 - wait for the dividers to stabilize SysWait(16); }
// Set INDIV bit in PMCTL register pmctlsetting = *pPMCTL; // 备份PMCTL寄存器的原始值 pmctlsetting |= INDIV; //设置锁相环输出的分频率,0则是1分频,1则是2分频,此处通过或运算设置为二分频 *pPMCTL = pmctlsetting; // 将至重新写入PMCTL寄存器
// Program PLL multiplier to same value as CLK_CFGx pins/previously programmed value in software…… *pPMCTL = pmctlsetting; pmctlsetting |= PLLBP; //设置锁相环旁路模式 *pPMCTL = pmctlsetting;
//Wait for recommended number of cycles for (i = 0; i < 4096; i++) NOP;
// Bring PLL out of bypass mode by clearing PLLBP bit *pPMCTL ^= PLLBP; // 通过异或操作 取消旁路模式
pmctlsetting |= PLLBP; //Setting the Bypass bit pmctlsetting ^= DIVEN; //Clearing the DIVEN bit *pPMCTL = pmctlsetting; // Putting the PLL into bypass mode
//Wait for around 4096 cycles for the pll to lock. for (i = 0; i < 5000; i++) NOP;
当多通道被复用至一个中断输出信号时,中断确认的操作方式不尽相同。当DAI/DPI中的服务必须被处理时,三者任一的中断服务程序(interrupt
service routines)(DAILI, DAIHI 和
DPII)必须查询RIC以确定中断源。该中断源可能是一个或多个DAI/DPI通道(DAI_INT31-0
、 DPI_INT13-0)。
当 DAI_IRPTL_H
被读取时,高优先级锁存的中断将会被清除。
当 DAI_IRPTL_L
被读取时,低优先级锁存的中断将会被清除。
当 DPI_IRPTL 被读取时,锁存中断将会被清除。
当 DAI_IRPTL_H/L 寄存器被读取时,
IDP_FIFO_GTN_INT
中断不会被清除。当中断需要离开的情况发生时,中断自然会被清除。(This
interrupt is cleared automatically when the situation that caused the
interrupt goes away.)
锁存器必须在被读取的时候清除中断源,因此DAI/DPI被设计来正确地执行此项工作。需要注意的是,锁存器读取操作会在退出中断程序(exiting
an interrupt routine)前自动确认请求(automatically acknowledges the
request)。在W1C机制,程序必须写入锁存器的特定位(specific
bit)以正确清除中断(terminate the interrupt properly)。
注意:如果确认机制没有被正确遵守,中断将可能在未可预知且频率不定(unwanted
and sporadic)的情况下发生。
These registers (where x signifies SPORT 0 through 7) allow programs
to set frame sync edge detection for I2S compatibility.
These registers also allow interrupts to be generated when
transmit DMA count is expired or when the last bit of last word is
shifted out.
注意:212XX系列和213xx系列芯片上并没有这个寄存器。
SPMCTLx
串行接口多通道控制寄存器,Serial ports multichannel control
registers
注意:DMAC,即Directory Memory Access Control
(Rigister),直接内存访问控制寄存器。
TCB
1 2 3 4 5 6 7 8 9
/* TCB = "Transfer Control Block" */ /* TCB format: ECx (length of destination buffer), EMx (destination buffer step size), EIx (destination buffer index (initialized to start address)), GPx ("general purpose"), CPx ("Chain Point register"; points to last address (IIx) of next TCB to jump to upon completion of this TCB.), Cx (length of source buffer), IMx (source buffer step size), IIx (source buffer index (initialized to start address)) */