以配置gpio3_31为例:
查看芯片手册:
这里gpio3_31为复用管脚,首先要配置寄存器将此管脚设置为gpio功能。
vim board/ti/am57xx/mux_data.h 所有多路复寄存器信息都在此定义:
const struct pad_conf_entry core_padconf_array_essential_x15[] = {
{GPMC_AD0, (M2 | PIN_INPUT | MANUAL_MODE)}, /*gpmc_ad0.vin3a_d0 */
{GPMC_AD1, (M2 | PIN_INPUT | MANUAL_MODE)}, /* gpmc_ad1.vin3a_d1 */
{GPMC_AD2, (M2 | PIN_INPUT | MANUAL_MODE)}, /* gpmc_ad2.vin3a_d2 */
{GPMC_AD3, (M2 | PIN_INPUT | MANUAL_MODE)}, /* gpmc_ad3.vin3a_d3 */
{GPMC_AD4, (M2 | PIN_INPUT | MANUAL_MODE)}, /* gpmc_ad4.vin3a_d4 */
...
{VIN2A_FLD0, (M14 | PIN_INPUT_PULLUP)}, /* vin2a_fld0.gpio3_30 */
{VIN2A_HSYNC0, (M14 | PIN_INPUT_PULLUP)}, /* vin2a_hsync0.gpio 3_31 */
{VIN2A_VSYNC0, (M14 | PIN_INPUT)}, /* vin2a_vsync0.gpio4_0 */
{VIN2A_D0, (M11 | PIN_INPUT)}, /* vin2a_d0.pr1_uart0_rxd */
{VIN2A_D1, (M11 | PIN_OUTPUT)}, /* vin2a_d1.pr1_uart0_txd */
...
接下来看看uboot代码中如何设置多路复用的:
vim board/ti/am57xx/board.c
512 *ctrl = &dra7xx_ctrl;
660 pconf = core_padconf_array_essential_x15;
661 pconf_sz =ARRAY_SIZE(core_padconf_array_essential_x15);
678 /* Do the muxing here */
679 do_set_mux32((*ctrl)->control_padconf_core_base, pconf, pconf_sz);
照猫画虎,自己的代码这样写:
1.定义结构体:
const struct pad_conf_entry my_