在线时间828 小时
UID3079326
注册时间2015-2-11
NXP金币28
TA的每日心情 | 奋斗 2025-5-7 09:07 |
---|
签到天数: 353 天 连续签到: 1 天 [LV.8]以坛为家I
金牌会员
 
- 积分
- 5785
- 最后登录
- 2025-5-7
|
本帖最后由 wambob 于 2015-10-15 21:51 编辑
K64F例程有段代码,为何 PORTA测试与其它不同
gpio = (unsigned long *)&GPIO_PDDR_REG(PTA_BASE_PTR);
*gpio = 0xFFFFFFFF;
for (i = 4; i < 32; i++) {
if ((i == 18))
continue;
port = (unsigned long *)&PORT_PCR_REG(PORTA_BASE_PTR, i);
*port = 0x100;
}
- void test_allgpios(void)
- {
- unsigned long *port, *gpio, *tgl;
- int i, j;
- gpio = (unsigned long *)&GPIO_PDDR_REG(PTA_BASE_PTR);
- *gpio = 0xFFFFFFFF;
- for (i = 4; i < 32; i++) {
- if ((i == 18))
- continue;
- port = (unsigned long *)&PORT_PCR_REG(PORTA_BASE_PTR, i);
- *port = 0x100;
- }
- gpio = (unsigned long *)&GPIO_PDDR_REG(PTB_BASE_PTR);
- *gpio = 0xFFFFFFFF;
- for (i = 0; i < 32; i++) {
- port = (unsigned long *)&PORT_PCR_REG(PORTB_BASE_PTR, i);
- *port++ = 0x100;
- }
- gpio = (unsigned long *)&GPIO_PDDR_REG(PTC_BASE_PTR);
- *gpio = 0xFFFFFFFF;
- for (i = 0; i < 32; i++) {
- port = (unsigned long *)&PORT_PCR_REG(PORTC_BASE_PTR, i);
- *port++ = 0x100;
- }
- gpio = (unsigned long *)&GPIO_PDDR_REG(PTD_BASE_PTR);
- *gpio = 0xFFFFFFFF;
- for (i = 0; i < 32; i++) {
- port = (unsigned long *)&PORT_PCR_REG(PORTD_BASE_PTR, i);
- *port++ = 0x100;
- }
- gpio = (unsigned long *)&GPIO_PDDR_REG(PTE_BASE_PTR);
- *gpio = 0xFFFFFFFF;
- for (i = 0; i < 32; i++) {
- port = (unsigned long *)&PORT_PCR_REG(PORTE_BASE_PTR, i);
- *port++ = 0x100;
- }
- tgl = (unsigned long *)&GPIO_PTOR_REG(PTA_BASE_PTR);
- for (i = 0; i < 010; i++) {
- for (j = 0x10; j < 0x80; j++) {
- if (((j / 4) == 18) || ((j / 4) == 19))
- continue;
- *tgl = (1 << (j / 4));
- }
- }
- tgl = (unsigned long *)&GPIO_PTOR_REG(PTB_BASE_PTR);
- for (i = 0; i < 010; i++) {
- for (j = 0; j < 0x80; j++) {
- *tgl = (1 << (j / 4));
- }
- }
- tgl = (unsigned long *)&GPIO_PTOR_REG(PTC_BASE_PTR);
- for (i = 0; i < 010; i++) {
- for (j = 0; j < 0x80; j++) {
- *tgl = (1 << (j / 4));
- }
- }
- tgl = (unsigned long *)&GPIO_PTOR_REG(PTD_BASE_PTR);
- for (i = 0; i < 010; i++) {
- for (j = 0; j < 0x80; j++) {
- *tgl = (1 << (j / 4));
- }
- }
- tgl = (unsigned long *)&GPIO_PTOR_REG(PTE_BASE_PTR);
- for (i = 0; i < 010; i++) {
- for (j = 0; j < 0x80; j++) {
- *tgl = (1 << (j / 4));
- }
- }
- }
复制代码
|
|