本帖最后由 sedatefire 于 2014-3-5 21:23 编辑
typedef volatile unsigned long * P_V_UINT32;
typedef struct
{
P_V_UINT32 port_pmd;
P_V_UINT32 pin;
uint32_t pmd_msk;
uint32_t out_msk;
}IO_TYPE;
static const IO_TYPE IO_TAB[] =
{
{ &P3_PMD, /*k0*/ &P32_DOUT, Px2_PMD, Px2_OUT },
{ &P2_PMD, /*k1*/ &P24_DOUT, Px4_PMD, Px4_OUT },
{ &P0_PMD, /*k2*/ &P07_DOUT, Px7_PMD, Px7_OUT },
{ &P0_PMD, /*k3*/ &P06_DOUT, Px6_PMD, Px6_OUT },
{ &P0_PMD, /*k4*/ &P05_DOUT, Px5_PMD, Px5_OUT },
{ &P0_PMD, /*k5*/ &P04_DOUT, Px4_PMD, Px4_OUT },
{ &P0_PMD, /*k6*/ &P01_DOUT, Px1_PMD, Px1_OUT },
{ &P0_PMD, /*k7*/ &P00_DOUT, Px0_PMD, Px0_OUT },
{ &P1_PMD, /*k8*/ &P10_DOUT, Px0_PMD, Px0_OUT },
{ &P1_PMD, /*k9*/ &P14_DOUT, Px4_PMD, Px4_OUT },
};
void set_input_enable(IO_TYPE const *p)
{
*p->port_pmd &= (~(p->pmd_msk));
*p->pin = 1; /* 上拉输入 */
}
|