Configuration (GVL) ¶ InOut: Scope Name Type Initial Comment Constant gc_iNrOfMemRegions INT 8 g_cMemRegionIndex_CM_PER INT 0 Regions g_cMemRegionIndex_GPIO0 INT 1 g_cMemRegionIndex_GPIO1 INT 2 g_cMemRegionIndex_GPIO2 INT 3 g_cMemRegionIndex_GPIO3 INT 4 g_cMemRegionIndex_CM INT 5 g_cMemRegionIndex_ADC_TSC INT 6 g_cMemRegionIndex_AIBuffer INT 7 CM_PER_GPIO1_CLKCTRL_OFFSET POINTER TO DWORD 16#AC Register addresses CM_PER_GPIO2_CLKCTRL_OFFSET POINTER TO DWORD 16#B0 CM_PER_GPIO3_CLKCTRL_OFFSET POINTER TO DWORD 16#B4 GPIO_OE_OFFSET DWORD 16#134 ADC_TSC_STEPCONFIG1_OFFSET DWORD 16#64 16#0000 0001 ADC_TSC_STEPCONFIG2_OFFSET DWORD 16#6C ADC_TSC_STEPCONFIG3_OFFSET DWORD 16#74 ADC_TSC_STEPCONFIG4_OFFSET DWORD 16#7C ADC_TSC_STEPCONFIG5_OFFSET DWORD 16#84 ADC_TSC_STEPCONFIG6_OFFSET DWORD 16#8C ADC_TSC_STEPCONFIG7_OFFSET DWORD 16#94 ADC_TSC_STEPCONFIG8_OFFSET DWORD 16#9C ADC_TSC_STEPCONFIG9_OFFSET DWORD 16#A4 ADC_TSC_STEPCONFIG10_OFFSET DWORD 16#AC ADC_TSC_STEPCONFIG11_OFFSET DWORD 16#B4 ADC_TSC_STEPCONFIG12_OFFSET DWORD 16#BC ADC_TSC_STEPCONFIG13_OFFSET DWORD 16#C4 ADC_TSC_STEPCONFIG14_OFFSET DWORD 16#CC ADC_TSC_STEPCONFIG15_OFFSET DWORD 16#D4 ADC_TSC_STEPCONFIG16_OFFSET DWORD 16#DC ADC_TSC_FIFO0DATA_OFFSET DWORD 16#100 ADC_TSC_FIFO0COUNT_OFFSET DWORD 16#E4 ADC_TSC_ADCSTAT_OFFSET DWORD 16#44 ADC_TSC_STEPENABLE_OFFSET DWORD 16#54 ADC Stepenable register ADC_TSC_CTRL_OFFSET DWORD 16#40 ADC control register, for enabling/disabling the ADC, value = 16#00000001 CM_WKUP_ADC_TSC_CLKCTRL_OFFSET DWORD 16#4BC CM_WKUP control register, for waking up ADC g_aMemRegions ARRAY [0..(gc_iNrOfMemRegions - 1)] OF MemRegion [STRUCT(pPhysical := 16#44E00000, dwSize := 16#4000), STRUCT(pPhysical := 16#44E07000, dwSize := 16#1000), STRUCT(pPhysical := 16#4804C000, dwSize := 16#1000), STRUCT(pPhysical := 16#481AC000, dwSize := 16#1000), STRUCT(pPhysical := 16#481AE000, dwSize := 16#1000), STRUCT(pPhysical := 16#44E10000, dwSize := 16#2000), STRUCT(pPhysical := 16#44E0D000, dwSize := 16#2000), STRUCT(pPhysical := 16#0, dwSize := 16#10)]
IoDrvGPIOBBB (FB) ¶ FUNCTION_BLOCK IoDrvGPIOBBB EXTENDS IoDrvGPIOBase Methods: ConfigurePinAI ConfigurePinDI ConfigurePinDO IsChannelEnabled ReadPin GetRegisterOffset , inherited from IoDrvGPIOBase IoDrvGetConnector , inherited from IoDrvGPIOBase IoDrvGetModuleDiagnosis , inherited from IoDrvGPIOBase IoDrvReadParameter , inherited from IoDrvGPIOBase IoDrvWriteParameter , inherited from IoDrvGPIOBase Phys2Virt , inherited from IoDrvGPIOBase QueryInterface , inherited from IoDrvGPIOBase SetBitOffset , inherited from IoDrvGPIOBase SetRegisterOffset , inherited from IoDrvGPIOBase SetRegisterPointer , inherited from IoDrvGPIOBase WritePin , inherited from IoDrvGPIOBase Structure: ConfigurePinAI (Method) ConfigurePinDI (Method) ConfigurePinDO (Method) IsChannelEnabled (Method) ReadPin (Method)
IoDrvGPIOBBB.ConfigurePinAI (METH) ¶ METHOD ConfigurePinAI : BOOL InOut: Scope Name Type Comment Return ConfigurePinAI BOOL Input dwPinNr DWORD 128.. 134
IoDrvGPIOBBB.ConfigurePinDI (METH) ¶ METHOD ConfigurePinDI : BOOL InOut: Scope Name Type Return ConfigurePinDI BOOL Input dwPinNr DWORD
IoDrvGPIOBBB.ConfigurePinDO (METH) ¶ METHOD ConfigurePinDO : BOOL InOut: Scope Name Type Return ConfigurePinDO BOOL Input dwPinNr DWORD
IoDrvGPIOBBB.IsChannelEnabled (METH) ¶ METHOD IsChannelEnabled : BOOL InOut: Scope Name Type Return IsChannelEnabled BOOL Input dwChannel DWORD eFunction PinFunction
IoDrvGPIOBBB.ReadPin (METH) ¶ METHOD ReadPin : BOOL InOut: Scope Name Type Return ReadPin BOOL Input dwParameterID DWORD
IoDrvGPIOBase (FB) ¶ FUNCTION_BLOCK IoDrvGPIOBase EXTENDS IoDrvBase IMPLEMENTS ICmpIoDrvParameter This is a rather generic FB, which is able to handle the I/Os on linux based systems. It is not fully generic, that’s why it not resides in an own library. Still the configuration of the I/O pins for the different functions needs to be implemented in a specialized FB. Every single pin is configured with the functions: ConfigurePinDI (pin number) ConfigurePinDO (pin number) The configuration is done based on enums where the Parameter ID corresponds to the pin number. One special paramter (10.000) defines the total number of pins. All registers are mapped into our address space. As we are running on linux, where we have a virtual address space, the addresses need to be converted. This allocation and convertion is done in this base driver: UpdateConfiguration manages the regions, which are defined in g_aMemRegions[] SetRegister* / SetBit* / Phys2Virt are using those regions To exchange the I/Os, the physical address for the exchange is specified in the driverSpecific value in the device description for each parameter. Those addresses are converted to their virtual counterparts in UpdateConfiguration. Furthermore, UpdateConfiguration takes care about not configured I/Os. All I/O channels which are not configured are getting a driver specific value in the device description. This is then the physical address, which is converted by UpdateConfiguration to the virtual addresses, so that ReadInputs() and WriteOutputs() can copy the data easily with the standard IoMgrCopyInputs()/-CopyOutputs() functions. Methods: ConfigurePinAI ConfigurePinDI ConfigurePinDO GetRegisterOffset IoDrvGetConnector IoDrvGetModuleDiagnosis IoDrvReadParameter IoDrvWriteParameter IsChannelEnabled Phys2Virt QueryInterface ReadPin SetBitOffset SetRegisterOffset SetRegisterPointer WritePin Structure: IBase QueryInterface (Method) ICmpIoDrv IoDrvGetModuleDiagnosis (Method) ICmpIoDrvConfig IoDrvGetConnector (Method) ICmpIoDrvParameter IoDrvReadParameter (Method) IoDrvWriteParameter (Method) PinConfiguration ConfigurePinAI (Method) ConfigurePinDI (Method) ConfigurePinDO (Method) GetRegisterOffset (Method) IsChannelEnabled (Method) Phys2Virt (Method) ReadPin (Method) SetBitOffset (Method) SetRegisterOffset (Method) SetRegisterPointer (Method) WritePin (Method)
IBase ¶ QueryInterface (Method)
IoDrvGPIOBase.IoDrvReadParameter (METH) ¶ METHOD IoDrvReadParameter : UDINT InOut: Scope Name Type Return IoDrvReadParameter UDINT Input pConnector POINTER TO IoConfigConnector pParameter POINTER TO IoConfigParameter pData POINTER TO BYTE dwBitSize DWORD dwBitOffset DWORD