i'm using pru0

/* host c code */

#include <stdio.h>
#include <stdlib.h>

#include <prussdrv.h>
#include <pruss_intc_mapping.h>

#define PRU_NUM         0
#define AM33XX

int main (int argc, char **argv)
{
    unsigned int ret;
    tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;

    /* Initialize the PRU */
    prussdrv_init ();

    /* Open PRU Interrupt */
    ret = prussdrv_open(PRU_EVTOUT_0);
    if (ret) {
        printf("prussdrv_open open failed\n");
        return (ret);
    }

    prussdrv_map_prumem (PRUSS0_SHARED_DATARAM, &prudata); 
/* some macros from prussdrv.h 
#define PRUSS0_PRU0_DATARAM 0
#define PRUSS0_PRU1_DATARAM 1
#define PRUSS0_PRU0_IRAM 2
#define PRUSS0_PRU1_IRAM 3
#define PRUSS0_SHARED_DATARAM 4 */








    pru0data_int = (unsigned int *) prudata;  /*    (pru0data_int) memory 
location to send data to pru0 from host code */
    *(pru0data_int) = 1;

    /* Get the interrupt initialized */
    prussdrv_pruintc_init(&pruss_intc_initdata);

    /* Execute example on PRU */
    prussdrv_exec_program (PRU_NUM, "./text.bin");

    /* Wait until PRU0 has finished execution */
    prussdrv_pru_wait_event (PRU_EVTOUT_0);
    prussdrv_pru_clear_event (PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);

    /* Disable PRU and close memory mapping*/
    prussdrv_pru_disable (PRU_NUM);
    prussdrv_exit ();

    return(0);
} 

/* pru code */

.origin 0
.entrypoint START

#define PRU_EVTOUT_0    3
//#define USER_DELAY    50

START:
    MOV    r0, 0x00000000 
    LBBO    r4, r0, 0, 4 /* read data from host code */
 /* do some more stuff */
END:
    MOV    r31.b0, 35
    HALT

On Monday, 15 June 2015 19:53:51 UTC+5:30, Pat H. wrote:
>
> Hello everyone,
>
> I am a newbie when it concerns embedded Linux/BBB and I've been having 
> some difficulties about shared memory access.
> Using the main processor, I could perfectly read/write data into shared 
> memory (I want to share them with the PRUs).
>
> And when it comes to PRU, I cannot access shmemory (maybe my code to map 
> the registers is not working - I am coding in C).
> Has anyone tried to write and read shared memory in PRU code?
>
>
> Thanks!
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to