Home

Allwinner Technology CO., Ltd. - linux

image

Contents

1. System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 43 April 22 2011 OM sinner Technology CO Ltd By calling function OSAL_GPIO_DevSetONEPIN_IO_STATUS the GPIO are altered to output and then set fwi scl to high level and twi sda to low level by calling OSAL GPIO DevWRITE ONEPIN DATA If there is only one GPIO PA14 controlled by the handle the gpio name can be empty as shown below System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 44 April 22 2011 When requested PA14 is set to output high level By calling function 1 it is set to output low level and then it s set to input making the port level unconfigurable so when function 2 is called to set it to high level 1 is returned because it is not in output status System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 45 April 22 2011 iw Allwinner Technology CO Ltd 5 11 The Handle in GPIO Management 5 11 1 What Handles are Used for The handle is only an address pointing to a memory area that stores some valid data such as the file pointer Handles are used in GPIO management for GPIO safety especially in cases where GPIO are multiplexed For example if PCO can be used by both NAND and Card which has the access A conflict check mechanism in GPIO management helps to fi
2. 0 INPUT gpio_info pull 1 the build in resistor is pulled up 0 high resistance 2 pull down gpio_info drv_level 1 the driver strength is Level 1 The driver strength level can be 0 3 gpio_info data 1 output high level by default O low level and 1 high level After value assignment the function can be called just as below System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 27 April 22 2011 Aw Allwinner Technology CO Ltd hdle gpio hd gpio hd OSAL GPIO Request amp gpio info 1 return gpio hd Supposing in the example above value has been assigned to gpio info so after the function is called a handle will be returned and PA14 will be in the customized state output build in resistor pulled up driver strength level 1 and output high level 5 2 Release GPIO Following function can be used to release the requested GPIO handles regardless of how they are requested Function __ 832 OSAL_GPIO_Release __hdle p_handler if_release_to_default_status Parameters p_handler GPIO handle originating from the GPIO request function if_release_to_default_status to control the GPIO status after it is released Returned Value if succeed return 0 if fail return 1 This function enables you to control the GPIO status after it s released Parameter if release to default status can be 0 1 and 2 0 1 means a
3. Aw Allwinner Technology CO Ltd Configuration System amp GPIO Management V1 01 April 22 2011 Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved April 22 2011 Aw Allwinner Technology CO Ltd Revision History Section Page Changes Compared to Previous Issue V1 01 2011 4 22 Add configuration system workflow Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 1 April 22 2011 Aw Allwinner Technology CO Ltd Table of Contents Revision HIStOLY P 1 srl SORGE o cstsisesves EE ieee teu seesaeeuaves GE 2 I Introd ctoi PP E 4 2 Term DefimnitioD uie rot D ro m red iei tern tite i rd eir at respuere un 5 2 1 ConfiguratioDnS CHP Ess scien ri eO SEP EL ete Gen t n aut i restos 5 Did Main m inrunner a ie a a o a EN 5 29e UDR SY EE 5 p MEE ATUM na a E a a a 6 2 3 GIJIONPI Team 6 2 6 Configuration Script Modification essent ener nnne 8 3 Configuration System Workflow and Application esee 10 3 1 Generate Configuration Data in PC sess enne 10 32 Data Transfer in System Boot eese tnnt ennee adios eiri nnns 11 3 3 Data Transfer in Configuration System Calling eene 11 3 4 Configuration System Application essesseeseeeeeeeeeeeeerenne
4. Script FetchParser Data is firstly called to fetch all the configurations of the GPIO whose main key name is twi para and subkey name is twi scl The fetched System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 26 April 22 2011 GW Allwinner Technology CO Ltd information will be stored in gpio_info and the fetched data size is sizeof user_gpio_set_t sizeof int Therefore the gpio_info will end up gpio info gpio name twi scl gpio_info port 2 gpio_info port_num 0 gpio_info mul_sel 2 gpio_info pull 1 gpio_info drv_level 1 gpio_info data 1 Secondly function OSAL_GPIO_Request is called the second parameter 1 indicates only ONE GPIO needs to be configured and a handle will be returned By now twi scl pin configuration of twi para has completed 5 1 3 Request GPIO Through Customization In GPIO request you can write code to determine which GPIO is used For example to use the input output function of ja pin of GPIOA following method can be adopted Firstly define a struct variable user_gpio_set_t gpio_info and then assign value to it default to be output and high level and the GPIO name attribute can either be empty or a customized name strepy gpio_info gpio_name test key name this step is optional gpio_info port 1 Port A is used gpio info port num 14 the 14 pin is used gpio_info mul_sel 1 select OUTPUT
5. bytes For example the string test value is String test string 1234567890 2 5 GPIO Description 1 Port Group such as PortA PortB Each port group includes several GPIO The port group numbers vary in different IC 2 Serial Number The serial number refers to the sequence of a GPIO in a port group For example the 22th pin of PortA 22 is its serial number Since the serial number of each group begins with 0 PB3 refers to the third pin of PortB but it s actually in the fourth sequence This 0 rule is of little significance in practice you just need to refer to the IC pins given on circuit diagram 3 Function The function indicates which module uses the GPIO As for that reference can be made to related Specification For example in the main key twi para twi scl port PB0 2 default default default its two subkeys are used as Function 2 4 Build in Resistor The build in resistor also called Pull up Resistor or Pull down Resistor is an attribute of pins Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 6 2011 04 22 Aw Allwinner Technology CO Ltd Generally the pull up resistor is used by default In GPIO description the build in resistor description is in the second lt gt behind the Function description 0 High resistance 1 Pull up 2 Pull down Default default state Pull up Except 0 1 2 Defa
6. this item is meaningless gpio count max defines the number of this strcut variable X if the GPIO number Y exceeds gpio count max X X lt Y the number of fetched GPIO will be X if gpio count max X exceeds the GPIO number Y X Y the fetched GPIO number will be Y if get from hardware defines the source of the GPIO configuration if it s 1 it means to fetch parameters from GPIO hardware controller if it s 0 it means to fetch the GPIO configuration parameter when it s initially requested Here takes twi para as an example to illustrate the configuration parameters acquisition Supposing the twi para value in configuration script has been requested and its GPIO handle is gpio_hd therefore in order to fetch the GPIO configuration information System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 29 April 22 2011 In this function the gpio info has 10 members In practice if the twi para GPIO number is 2 you can directly write 2 here if the number cannot be fixed a large enough number say 10 can be written here In the example the initial configuration parameters are fetched so the result should be gpio info 0 stores twi_scl value gpio_info 1 stores twi sda value and values of others from gpio_info 2 to gpio_info 9 are 0 gpio info 0 gpio name twi_scl gpio info l gpio name twi sda gpio_info 0 port 2 gpio_info 1 port 2 gpio info 0 po
7. Following Function is used to modify a GPIO configuration of the handle Copyright 2011 Allwinner Technology All Rights Reserved 33 April 22 2011 OM inner Technology CO Ltd The modified GPIO attribute is specified in gpio name similar to that in OSAL_GPIO_DevGetONEPins_Status if set to current input status defines the modified data source 0 means that the modification is based on the original configuration so the second parameter is meaningless 1 means that the modification is based on currently input attributes i e the attributes of the second parameter Here takes the twi_para as an example to demonstrate how to use this function Supposing the GPIO handle gpio_hd controls twi_sda and twi_scl and twi_sda has been modified in order to modify it back to the initial configuration following function can be called In the parameter list the first one is the handle gpio_hd the second is 0 a null pointer the third is the GPIO name and the last one is 0 indicating the initial input configuration is used in which case the second parameter is meaningless However if the last parameter is 1 and the second parameter is 0 an error will be returned in that the currently input data is invalid System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 34 April 22 2011 Here is another example supposing the GPIO handle is gpio
8. IO management Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 4 April 22 2011 LN Allwinner Technology CO Ltd 2 Term Definition This section briefs some basic terms in configuration system and GPIO management 2 1 Configuration Script The configuration system takes the form of a Script on PC and is suffixed with ini Its content is shown in Figure 2 1 2 20 Main Key In Figure2 2 character strings in square brackets are called Main Keys such as target twi para etc They can be as long as 32 characters excluding the end mark Moreover main key names in one configuration script should be different 2 3 Subkey UltraEdit 32 D winners eBase eGON eGOH2 workspace sun_20 eFex sys_configl AFO REO BFO ARO NEV BRO AYO FW HES AAW BOM Heo DESH SEea B 2 BR C apprs_ooocc v E iS S E sys config1 fex L mom T epe 2 debogenable MSS LZ LL LLLLLLLLLL LO A AI LL 3 storage mode 4 boot clock 5 core vol 6 7 twi para 8 twi port 0 9 twi scl port PB0 2 default default default 10 twi sda port Pbi lt 2 gt lt default gt lt default gt lt default gt 11 12 uart para 13 uart debug port 0 14 uart debug tx port pb22 2 15 uart debug rx port pb23 2 16 17 jtag para 18 jtag enable i 19 jtag ms port pbi4 2 20 jtag ck port pbi5 2 21 jtag do port pbi16 2 22 jtag di port pbi7 2 23 jtag spec port pa7
9. _hd to modify twi scl according to the currently input parameters By calling this function the twi sc can be changed to output i e the PB1 pin is changed to output high level System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 35 April 22 2011 5 6 Set One GPIO IO Status of the Handle The OSAL GPIO DevSetONEPIN IO STATUS can be used to modify the input output status of a GPIO but not other functions otherwise errors will be returned This function is confined to IO function allocation Since the gpio name comes from configuration script it can be left empty for a single GPIO Supposing there is following configuration in the script After the GPIO handle is fetched in order to modify the GPIO to input following function should be called If it s confirmed that there is only one GPIO subkey in Main Key fest or the GPIO is requested through main keys and subkeys or the GPIO is requested through customization this function can System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 36 April 22 2011 be called with the key name concealed as shown 5 7 Set One GPIO Build in Resistor Status of the Handle Function OSAL GPIO DevSetONEPIN PULL STATUS is used to modify the build in resistor status of a GPIO controlled by the handle There are three status options to choose from pull up
10. dels and configuration values are clarified in Spec or related materials In fact following function is called in RTC driver to process the configuration int rtc pattern int ret ret OSAL Script FetchParser Data rtc select rtc pattern amp rtc pattern 1 if ret gt 0 return rtc_pattern else return ret By calling this function the RTC driver can fetch the RTC model set by users As long as the user configuration is identical with the program the RTC can work normally This method enables RTC model modification without having to regenerating or replacing the RTC driver 3 4 3 Difference Parameters for the Same Modules As for this point here takes the Card Detect as an example Generally the GPIO is used as the Card Detect Pin the card is regarded as inserted when it s low level and not inserted when it s high level Since the card detect pins vary in different programs instead of altering card pin detect modules configuration items can be used to report which pin is used see below Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 14 April 22 2011 w Allwinner Technology CO Ltd sddet para detect pin port PI4 lt 0 gt lt 1 gt lt 1 gt The main key sddet_para shows that this is a parameter related to card detect The subkey detect_pin indicates which is the detect pin ae pin of Port I input build in resist
11. ducts different operations at high level and low level whereas Module B wants to alter PCO level output high level and low level at different time If two modules operate at the same time errors may occur therefore handles can be introduced to settle the conflict System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 48 April 22 2011 Aw Allwinner Technology CO Ltd 6 Declaration This Configuration System and GPIO Management is the original work and copyrighted property of Allwinner Technology Allwinner Reproduction in whole or in part must obtain the written approval of Allwinner and give clear acknowledgement to the copyright owner The information furnished by Allwinner is believed to be accurate and reliable Allwinner reserves the right to make changes in circuit design and or specifications at any time without notice Allwinner does not assume any responsibility and liability for its use Nor for any infringements of patents or other rights of the third parties which may result from its use No license is granted by implication or otherwise under any patent or patent rights of Allwinner This documentation neither states nor implies warranty of any kind including fitness for any particular application System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 49 April 22 2011
12. ed But for those modules whose hardware models cannot be scanned they should be reconfigured Take the RTC as an example The RTC needs configuration system for management in that some programs use internal RTC modules while others use external RTC Detailed method is that first put all supported RTC models to RTC driver and provide corresponding codes as well second write configuration items to configuration system and specify the relationship between configuration and RTC for example supposing the internal RTC driver external RTC XXXX driver and external RTC YYYY driver have been provided Configuration 0 is related to internal RTC Configuration 1 is related to external RTC model XXXX Configuration 2 is related to external RTC model Y Y Y Y To realize that a main key should be created in the configuration script and then name the key the name is recommended to be in line with its function rtc select And then create the subkeys below the main key rtc pattern 0 Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 13 April 22 2011 Aw Allwinner Technology CO Ltd This indicates that internal RTC is used and the model is 0 If the subkey is This indicates that external RTC is used and the model is Y Y Y Y In conclusion in order to use a supported RTC you just modify the RTC subkey value in configuration script All supported RTC mo
13. eters This function is powerful enough to fetch any value in the configuration script For example if you want to get the subkey value of boot clcok in main key Target The value fetched will be put to integer variable value and usually the value is 406 Configuration System and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 17 April 22 2011 This function will put the fetched GPIO information into gpio info which can then be used to call functions provided by GPIO management module Besides you can use the script function to get a character string For example with regards to following main key and subkey string test string demo string abcdefghijkImn the subkey string demo value can be accessed by calling following function and the value saved in string info will be abcdefghijklmn in normal circumstances Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 18 April 22 2011 4 2 Fetch the Number of Subkeys This function definitely is capable of fetching the number of subkeys in a main key nevertheless it s mainly used for check Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 19 April 22 2011 By calling the function you will get the number of all subkeys in target 4 4 3 Fetch the Number of Main Keys This function is capable of fetch
14. fter released the GPIO is input which won t lead to external level error 2 means that after released the GPIO remains the same status Function Usage call the function transfer a valid handle and a parameter that defines the post release GPIO status You can judge from the returned value whether the handle release succeeds and whether the transferred parameter is correct 5 3 Fetch all the GPIOs Configuration of a Handle Function OSAL_GPIO_DevGetAllPins_Status can be used to fetch all the GPIOs configuration of a handle System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 28 April 22 2011 Aw Allwinner Technology CO Ltd Function Int OSAL GPIO DevGetAllPins Status hdle devpin user gpio set t gpio status u32gpio count max u32if get from hardware Parameters devpin GPIO handle originating from GPIO request function gpio status data address used to store GPIO configuration attribute gpio count max the maximum number of the struct variables if get from hardware indicating which configuration attribute will be fetched 0 to get the initial configuration attribute 1 to get the current hardware configuration attribute By calling this function you can get the status attribute of all GPIOs controlled by the handle The fetched information will be stored in gpio status For non input output GPIOs the data item will be 1 indicating
15. guration management module Check the parameters validity e parameters valid Y N Y Match the main key name in configuration data Y The main key matches Y N Match the subkey name in configuration data Y Subkey name matches Y N Put the matched configuration data to user buffer Fig 3 3 Data Transfer in Configuration System Calling Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved April 22 2011 Aw Allwinner Technology CO Ltd 3 4 Configuration System Application 3 4 1 Application Overview The discrepancies among different programs can be classified into four categories 1 Different hardware modules such as NAND Flash RTC etc 2 Different parameters for the same hardware modules such as GPIO card detect pin SPI pin etc and different work frequency such as DRAM frequency CPU frequency etc 3 Different routing 4 Other differences If programs have adopted different hardware modules or different parameters for the same module the system may need recompilation while differences in routing or other aspects needn t 3 4 2 Different Hardware Modules To handle the hardware module difference some code can be made self adaptive for example if the NAND model can be automatically scanned the flash driver needn t be reconfigur
16. gure out the question if PCO is not used NAND can access it on request and before it is released by NAND it cannot be accessed by Card This mechanism helps in three aspects 1 Avoid conflict of GPIO access among modules 2 Avoid conflict between module function and IO function 3 Avoid conflict between IO input and IO output 5 11 2 Avoid Conflict of GPIO Access among Modules Actually both request and handles are necessary in GPIO management Without the request the Card can access PCO any time even when PCO is used by NAND and that may render errors in NAND Likewise if NAND accesses PCO when it s used by Card errors may occur to Card If there is request but no handles it seems that NAND can directly control the GPIO with configuration script data as shown below but when PCO is released without the handle it s hard to know which module controlled PCO System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 46 April 22 2011 Since the handle is not required to be returned on GPIO request Card can request PCO as well even when PCO is used by NAND Since PCO is used by NAND the card request will fail so in that case Card may choose to mandatorily release PCO from NAND which will bring about errors to NAND System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 47 April 22 2011 Aw All
17. ing the number of all the main keys however it s primarily used for check as well Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 20 April 22 2011 By calling this function you can get the number of main keys in configuration script 4 4 Get the Number of GPIO in Main Keys By calling this function the number of GPIO subkeys can be available For example that the twi para has 2 GPIO subkeys can be known through Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 21 April 22 2011 If the parameter twi para above is changed to target 0 is returned if it s changed to nand para 23 is returned 4 5 Fetch the GPIO Data in Main Keys Function OSAL Script FetchMainKey GPIO Data is used to fetch the GPIO data in main keys Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 22 April 22 2011 By calling this function you can get the GPIO subkey data in twi para Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 23 April 22 2011 Aw Allwinner Technology CO Ltd 5 GPIO Management The GPIO configuration is used to define the GPIO usage in the script and it can be realized by heaps of functions provided by the system 5 1 Request GPIO Following function is
18. iver strength has flatter wave more time consuming but will not render overshoot Even though Level 1 is suitable System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 38 April 22 2011 for most cases other driver strength levels may be required by some demanding devices This function resembles OSAL GPIO DevSetONEPIN PULL STATUS in parameters and usage excluding the second parameter Here are two examples illustrating how to modify the driver strength of a GPIO Supposing the GPIO handle gpio_hd controls two GPIOs of twi para twi scl and twi sda now to modify the twi scl driver strength to Level 3 And following is a user defined GPIO to modify its driver strength from Level 1 to Level 2 System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 39 April 22 2011 W avinner Technology CO Ltd 5 9 Read One GPIO Level of the Handle Function OSAL GPIO DevREAD ONEPIN DATA can be used to read the level of an input GPIO if the returned value is 0 it is low level if the returned value is 1 it is high level if the returned value is 1 it means the current GPIO is not in INPUT status OM sinner Technology CO Ltd Supposing the handle gpio_hd controls two GPIOs of twi_para sda and scl to read their port levels following method can be adopted Obviously both returned values retl and ret2
19. l port PB0 lt 2 gt lt default gt lt default gt lt default gt 1 twi_scl port PB0 lt 2 gt lt default gt lt default gt 2 twi scl port PB0 lt 2 gt lt default gt 3 twi scl port PB0 lt 2 gt 4 These four have the same meaning the 0 pin of Port B Function2 default build in resistor 1 pull up default driver strength since it s used as TWI function a non output state the output level is invalid The 1 is a complete GPIO description format The 2 leaves out the output level information which can be applied to situations where the Function is non output if the GPIO is set to output the IO level will remain unchanged The 3 leaves out the output level and driver strength information in which case the driver strength is Level 1 and the output level remains unchanged The 4 leaves out the output level driver strength and build in resistor information in which case the resistor is pulled up and driver strength is Level 1 and the output level remains unchanged 2 6 Configuration Script Modification Modification can be made to configuration script easily via text compilation tools These modifications can be 1 modify the main key name such as modify target to targetX 2 modify the subkey name such as modify the boot clock of Target to bootO clock 3 modify the subkey value such as change the boot clock value from 406 to 384 change the twi sda value to twi sda port pb0 lt 2 gt
20. lt 2 gt lt 2 gt lt 1 gt 4 remove a main key If a main key has been removed all its subkeys should be deleted as well For example after target is removed its subkeys debugenable storage mode boot clock core vol and their values should be removed 5 remove a subkey If a subkey is removed its name and value should be removed 6 adda main key A main key can be empty without any subkey For example there is a main key empty and then another main key target locates directly below it then the empty is an empty Configuration System and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 8 2011 04 22 Aw Allwinner Technology CO Ltd main key 7 add a subkey To add a subkey please confirm which main key it belongs to Usually a subkey doesn t stand alone and belongs to the nearest main key above Besides the subkey value should be finalized in the mean time If the value cannot be confirmed set it to 0 8 Adjust the subkey position It s pointless adjusting a subkey position within the main key but relocating it to another main key endows it with a different meaning Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 2011 04 22 Ow Allwinner Technology CO Ltd 3 Configuration System Workflow and Application This section will detail how the configuration script goes from PC to devices a
21. lt i gt lt i gt lt i gt lt i gt 24 jiE3 amp RA 5gTAG GPIoXEFLIBUI DULT AARAA 3E 25 26 nand para 27 NAND WE port pC00 lt 2 gt lt default gt lt default gt lt default gt 28 NAND ALE port PCOi 2 default default default C CEPET r ELELLA atu Ha Soe de 47 2 Alie co EOI 2011 4 12 11 32 10 XHA 10985 Fig 2 3Configuration Script Demo The subkeys refer to the components of main keys For example there are four entries below target Debugenable 1 Configuration System and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 5 2011 04 22 iw Allwinner Technology CO Ltd Storage mode 0 Boot clock 406 Core vol 1400 Character strings at the left of are subkeys of the main key Target The subkey can be as long as 32 characters excluding the end mark The subkeys names in one main key should be different but subkey names in different main Keys in a script can be identical 2 4 Subkey Value The subkey value takes three forms 1 The subkey values in Fig 2 4 are integers such as 1 0 406 etc It can be in hexadecimal system but not expressions For example in twi para the twi port subkey value is 0 2 The subkey value can also be a GPIO description For example twi scl value is twi scl port PB0 2 default default default 3 The subkey value can also be a character string following string which cannot exceed 128
22. n ener 13 3 4 1 Application OverVIew ee eterne eterno denuo an etuer oue 13 3 42 Different Hardware Modules essere 13 3 4 3 Difference Parameters for the Same Modules sess 14 3 4 4 Customized Parameters eene enne 15 4 Howto Use Configuration Script erepto nete n ERE OT Y TEE ER epe eden 17 4 Fetch Configuration Parameters essent enne teens 17 4 2 Fetch the Number of Subkeys oo cece ceceeseesecseceeeeseeaeceeeseeesesseseseeeesesseeseseaeeas 19 4 3 Fetch the Number of Main Keys sese eene iania 20 4 4 Get the Number of GPIO in Main Keys sese eee 21 4 5 Fetch the GPIO Data in Main Keys sese renreneennes 22 Ds GPIO Mana Semen ss EP 24 Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 2 April 22 2011 Aw Allwinner Technology CO Ltd DL Request GPIO nece ORE NI e REN SISSE HERE SUXRE E TEES Rb HERES eG 24 5 1 4 Request GPIO Through Main Keys essere 25 5 1 2 Request GPIO Through Main Keys and Subkeys esses 26 5 1 3 Request GPIO Through Customization eeeeeeeeenenenene 27 32 Release GPIO d nee teri ere ipeo e EENE E EEEE EET REESE HERE E e TIS 28 5 3 Fetch all the GPIOs Configuration of a Handle eee 28 5 4 Fetch One GPIO Configu
23. nd how data is delivered in system when the configuration script is used 3 1 Generate Configuration Data in PC Following figure has illustrated how a data file in PC is made accessible to devices Packing System Fig 3 1 Device End Configuration File Generation It can be seen that after the configuration script is generated it can be embedded into boot just by simple packing and loading Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 10 April 22 2011 OM vine Technology CO Ltd 3 2 Data Transfer in System Boot After system startup data will be read from boot to OS defined location for OS access as shown below Fig 3 2 Data Transfer in System Boot During the Boot phase data is read from boot bin and then delivered to the OS After acquiring the data OS will initialize it and then wait for user operations When the system is shutdown OS needs to call the exit function of configuration management 3 3 Data Transfer in Configuration System Calling The following figure has presented how data is transferred to the system and how the system reacts when the configuration system is called Configuration System and GPIO Management V 1 01 Copyright O 2011 Allwinner Technology All Rights Reserved 11 April 22 2011 CS Allwinner Technology CO Ltd The OS acquires parameters and deliver them to confi
24. or pulled up driver strength level 1 With these configuration items you can only change the detect pin simply by modifying the configuration here For example to change the 14 pin of port A as the detect pin sddet_para detect_pin port PA14 lt 0 gt lt 1 gt lt 1 gt 3 4 4 Customized Parameters This section introduces how to use configuration customization to meet different requirements For example if you want to use configuration for the FM module management which happens rarely though steps below can be followed First create following configuration items fm_para fm_pattern 0 According to the relationship between fm type and FM models for example 0 is RDA5820 1 is TEAS5767 and 2 is QN8006 FM adopted here is RDA5820 In the FM driver following code is used to fetch the used FM pattern RDA5820 so that the right code can be found later for FM driver to work normally Configuration System and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 15 April 22 2011 OM winner Technology CO Ltd Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 16 April 22 2011 4 How to Use Configuration Script This section will elaborate on how to use the configuration script In the system following functions are provided to fetch the configuration information 4 1 Fetch Configuration Param
25. pull down and high resistance so if other status functions are selected errors will be returned If the handle controls more than one GPIO the gpio name helps to narrow down to a specific GPIO The GPIO name either comes from the configuration file or is a user defined character string Here takes twi para as an example to demonstrate how to set the GPIO build in resistor attribute suppose the handle is gpio_hd so in order to change the twi_scl build in resistor to pull down status System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 37 April 22 2011 The second parameter 2 means the resistor is pulled down Except 0 1 2 other parameters are invalid If the handle controls only one GPIO 0 instead of the GPIO name can be written to the GPIO name For example if there is only one GPIO named twi scl in twi para following method is adoptable But if there are more than one GPIO in twi para write 0 to the third parameter will lead to errors 5 8 Set One GPIO Driver Strength of the Handle The function GPIO DevSetONEPIN DRIVER LEVEL STATUS can be used to modify the driver strength of a GPIO controlled by the handle The driver strength refers to the GPIO ability to drive external devices The stronger the driver strength the stronger the ability to change the level and the steeper the waves will be but it may lead to overshoot whereas weaker dr
26. ration of a Handle sess 32 5 5 Set One GPIO Configuration of the Handle sese 33 5 6 Set One GPIO IO Status of the Handle sese 36 5 7 Set One GPIO Build in Resistor Status of the Handle sess 37 5 8 Set One GPIO Driver Strength of the Handle sse 38 5 9 Read One GPIO Level of the Handle sess 40 5 10 Set One GPIO Port Level of the Handle eese 43 5 11 The Handle in GPIO Management eese eren enne eene 46 5 11 1 What Handles are Used for e entente nettes 46 5 11 2 Avoid Conflict of GPIO Access among Modules sess 46 5 11 3 Avoid Conflict between Modules and IO sese 48 5 11 4 Avoid Conflict between IO Input and IO Output eese 48 OE on PCEEE ER RENBE Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 3 April 22 2011 Aw Allwinner Technology CO Ltd l Introduction This user manual introduces some conceptions and function interfaces of configuration system and GPIO management It also provides lots of examples so that users can solve related problems accordingly The targeted readers of this manual cover all those people who have used or interested in configuration system and GP
27. rom hardware Parameters devpin GPIO handle originating from GPIO request function gpio status Data address used to store GPIO configuration attribute This address has only one member gpio name GPIO name originating from configuration script if get from hardware indicating which configuration attribute will be fetched 0 fetch the original configuration attribute 1 fetch current hardware configuration attribute Returned Value 1f succeed return 0 if fail return 1 By calling this function the configuration of a single GPIO controlled by the handle can be fetched gpio status is used to store GPIO configuration information whose source is defined in the 4 parameter if get from hardware if it s 0 it means to fetch the initial configuration if it s 1 it means to fetch from the realtime hardware controller gpio name the GPIO name serves to focus on some specific GPIO in a group For example in order to fetch the twi_scl pin of twi para the GPIO name should be twi_scl Supposing the handle is gpio Ad in order to fetch the twi sda pin configuration in twi para from the current hardware controller System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 32 April 22 2011 After this function is called the twi sda GPIO attribute controlled by gpio hd can be acquired from the hardware controller 5 5 Set One GPIO Configuration of the Handle
28. rt num 0 gpio info l port num 1 gpio info 0 mul sel 2 gpio info 1 mul sel 2 gpio_info 0 pull 1 gpio info 1 pull 1 gpio_info 0 drv_level 1 gpio_info 1 drv_level 1 gpio_info 0 data 1 gpio_info 1 data 1 System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 30 April 22 2011 Next we ll take twi para as an example to illustrate fetching parameters from hardware controller in the case of space deficiency Since there is only one member in the group less than the TWO GPIO in twi para only one GPIO configuration attribute will be fetched from the actual hardware parameters after this function is called These values seem identical with values in above example because no operations are made to the hardware after the request gpio info 0 gpio name twi_scl gpio_info 0 port 2 gpio info 0 port num 0 gpio info 0 mul sel 2 gpio_info 0 pull 1 gpio_info 0 drv_level 1 gpio_info 0 data 1 System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 31 April 22 2011 Aw Allwinner Technology CO Ltd 5 4 Fetch One GPIO Configuration of a Handle Function OSAL GPIO DevGetONEPins Status is used to fetch the attribute of a single GPIO controlled by the handle Function Int OSAL GPIO DevGetONEPins Status hdle devpin user gpio set t gpio status constchar gpio name u32if get f
29. to fetch the GPIO configuration and then parameter twi_para is used to search all GPIO subkeys fitting the main key name twi para in configuration script and the searched GPIO configuration parameters are put to gpio info All attributes should be stored accordingly gpio name stores the subkey names in configuration script for example GPIO name of twi scl is twi scl and GPIO name of twi sda is twi sda The third parameter 2 means to fetch two GPIO only If the number of GPIO of a System Configuration and GPIO Management V 1 01 Copyright 2011 Allwinner Technology All Rights Reserved 25 April 22 2011 module cannot be fixed a large enough number can be put here to make sure that all GPIO can be fetched If the parameter X here is below the actual GPIO number the fetched GPIO number will be X 2 Next function OSAL GPIO Request is called if succeed a handle will be returned otherwise a NULL will be returned Meanwhile the twi para becomes valid in hardware that is to say the two GPIOs of TWI are successfully configured 5 1 2 Request GPIO Through Main Keys and Subkeys This method is limited to situations where only one GPIO needs to be configured search the single GPIO by matching the main key names and subkey names You can also call the function repeatedly to fetch all GPIO configurations if there are multiple GPIOs in a main key such as the card detect pin Here is an example In this function OSAL
30. ult other options are invalid For example to twi scl twi_scl port PBO lt 2 gt lt default gt lt default gt lt default gt the first default refers to the state of internal resistor i e Pull up 5 Driver Strength The driver strength defines the ability of a GPIO the larger the driver strength the sharper the IO level changes Generally the default value is used The driver strength is described in the third lt gt just following the build in resistor description 0 the drive strength level is 0 1 the drive strength level is 1 2 the drive strength level is 2 3 the drive strength level is 3 Except 0 1 2 3 other options are invalid For example in twi para the SCL and SDA driver strength is default that is Level 1 6 Output Level The last item in GPIO description is the GPIO output level When a GPIO is used as an IO i e Functionl the IO output level status can be set here 0O low level I high level If a GPIO is not used as an IO this item in description is pointless In conclusion the complete format of GPIO description is Port Port Group Serial Number Function Build in Resistor gt lt Driver Strength gt lt Output Level And this form has some variants Here takes twi para as an example Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 7 2011 04 22 Aw Allwinner Technology CO Ltd twi sc
31. used to request the GPIO handle and configure the GPIO attribute It should work with configuration script or a customized GPIO Function _ hdle OSAL GPIO Request user gpio set t gpio list __u32 group count max Parameters gpio list data address used to save the GPIO attribute originating from configuration script or user customization group count max the maximum number of GPIO data structs that can be saved Returned Value if succeed return a non NULL pointer if fail return a NULL pointer The data struct of user gpio set tis shown below typedef struct char gpio name 32 the GPIO name int port GPIO Port int port num GPIO Port number int mul sel GPIO function int pull GPIO build in resistor status int drv level GPIO driver strength int data GPIO level user gpio set t After this function is called all configurations become valid Configuration System and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 24 2011 04 22 As for how to configure GPIO following THREE methods are provided 5 1 1 Request GPIO Through Main Keys The GPIO information can be fetched by searching main keys in configuration script if GPIO information comes from the configuration script GPIO in main keys can be one or more but if there is no GPIO the fetch will fail Here is an example In the example above 1 OSAL Script FetchMainKey GPIO Data is called
32. will be 1 in that they are in non input status Following code exemplifies how to read the port level of a customized GPIO System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 41 April 22 2011 In the example above OSAL GPIO DevREAD ONEPIN DATA is called twice 1 Since the PA14 is set to input initially its level can be read 2 Since PA14 is then modified to output so its level cannot be read Just as other functions mentioned above the second parameter in this function can be written to 0 if there is only one GPIO controlled by the handle otherwise it s should be a specific GPIO name System Configuration and GPIO Management V1 01 Copyright 2011 Allwinner Technology All Rights Reserved 42 April 22 2011 5 10 Set One GPIO Port Level of the Handle The function OSAL GPIO DevWRITE ONEPIN DATA can be used to modify the port level of an OUTPUT GPIO to high level 1 or low level 0 However if the GPIO is not in output status this function is invalid and 1 will be returned Following example demonstrates how to modify a GPIO output level Supposing the GPIO handle controls the two GPIO of twi para twi sda and twi scl to modify their output level Obviously this function cannot be successfully called since neither twi sda nor twi scl is output and a feasible method is to modify their port level after altering two GPIOs to output
33. winner Technology CO Ltd user gpio set t gpio_info 1 gpio_info port 3 luse Port C gpio info port num 0 use the 0 pin of Port C gpio info mul sel 3 fased for card gpio_info pull 1 build in resistor is pulled up gpio_info drv_level 1 driver strength is Level 1 OSAL_GPIO_Release gpio_info 0 return 0 To settle these problems handles can be introduced in for the GPIO management when PCO is accessible and requested by NAND NAND will get a handle that controlling PCO which cannot be forcefully released by other modules like Card 5 11 3 Avoid Conflict between Modules and IO In Linux OS the port level can be easily set and read through a function but this is based on the premises that the GPIO is not used at that time otherwise errors may occur For example if the PCO level is read when it is used by NAND errors may occur to NAND because this operation will alter PCO function to input A solution is to request the PCO handle before operating PCO if the handle cannot be requested it means PCO is used and not accessible If operation is made to it forcefully errors may occur However with handles introduced in the GPIO management if the PCO handle cannot be requested it cannot be operated 5 11 4 Avoid Conflict between IO Input and IO Output The IO conflict is similar to that of module conflict Here takes PCO as an example to illustrate Module A wants to read PCO level and con

Download Pdf Manuals

image

Related Search

Related Contents

Manual de uso  Swordfish Varipoint Pencil Sharpener  Pacemaker temporário de dupla câmara Manual técnico  Vertrag - Tchibo    トイレ・便座・手洗器などの紹介ページへ ユニットバス・浴槽などの紹介  MP3-Player Istruzioni per l`uso - Migros  Apostila Ângulos – parte 1  Fichier PDF 121 K  Toshiba Satellite L745-S4126  

Copyright © All rights reserved.
Failed to retrieve file