|
我实际写了个程序做测试.
- /*
- * LED Bilnk Pruss code for tl_am572x.
- * vefone <vefone2lemon@gmail.com>
- * Copyright (C) 2016 Tronlong, Inc.
- *
- */
- #include <stdint.h>
- #include <pru_cfg.h>
- #include "resource_table_empty.h"
- /* LED port address */
- #define GPIO3_BASE_ADDR 0x48057000
- #define GPIO_OE_OFFSET 0x134
- #define GPIO_CLRDATAOUT_OFFSET 0x190
- #define GPIO_SETDATAOUT_OFFSET 0x194
- #define CTRL_CORE_PAD_VIN1A_D15 0x4A003530
- //volatile register uint32_t __R30;
- volatile pruCfg CT_CFG __attribute__((cregister("PRU_CFG", near), peripheral));
- int main(void) {
- uint32_t i;
- uint32_t value;
- /* GPI Mode 0, GPO Mode 0 */
- CT_CFG.GPCFG0 = 0;
- /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
- CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
- uint32_t led_set_addr;
- uint32_t led_clr_addr;
- uint32_t led_oe_addr;
- uint32_t ctrl_core_io_mode;
- led_oe_addr = GPIO3_BASE_ADDR + GPIO_OE_OFFSET;
- ctrl_core_io_mode = CTRL_CORE_PAD_VIN1A_D15;
- led_set_addr = GPIO3_BASE_ADDR + GPIO_SETDATAOUT_OFFSET;
- led_clr_addr = GPIO3_BASE_ADDR + GPIO_CLRDATAOUT_OFFSET;
- *(uint32_t*)led_clr_addr |= 1 << 19; //turn down LED0 (GPIO3_19)
- *(uint32_t*)ctrl_core_io_mode = 0x0001000E;
- *(uint32_t*)led_oe_addr = 0x00000000;
- while(1) {
- value = 1 << 19;
- *(uint32_t*)led_set_addr |= value;
- __delay_cycles(100000000); // half-second delay
- *(uint32_t*)led_clr_addr |= value;
- __delay_cycles(100000000); // half-second delay
- }
- /* Halt the PRU core - shouldn't get here */
- //__halt();
- }
复制代码 然后先连接A15核心,再连接PRU0核心,就像下图一样.寄存器数值没手动改过,ARM端也没跑程序.然后LED就闪烁起来了.看图.
这么说PRU也是有权限的啊,是为什么呢?还是说因为仿真?
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|