Header file for kernel drivers. More...
#include "pruio.bi"
Go to the source code of this file.
Classes | |
class | __prussdrv |
Date structure for uio_pruss userspace part. More... | |
Typedefs | |
typedef __prussdrv | tprussdrv |
Forward declaration for uio_pruss data. | |
Functions | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_open (BYVAL_AS_UInt32) |
Open an kernel driver interrupt file. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_pru_enable (BYVAL_AS_UInt32, BYVAL_AS_UInt32) |
Enable one PRU subsystem. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_pru_disable (BYVAL_AS_UInt32) |
Disable one PRU. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_pru_reset (BYVAL_AS_UInt32) |
Reset one PRU. More... | |
FUNCTION_CDECL_ALIAS_AS_ZSTRING_PTR | prussdrv_pru_resume (BYVAL_AS_UInt32) |
Resume one PRU. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_pru_write_memory (BYVAL_AS_UInt32, BYVAL_AS_UInt32, BYVAL_AS_CONST_UInt32_PTR, BYVAL_AS_UInt32) |
Write data to PRUSS memory. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_pruintc_init (BYVAL_AS_CONST_tpruss_intc_initdata_PTR) |
Initialize the interrupt controller. More... | |
SUB_CDECL_ALIAS | prussdrv_pru_send_event (BYVAL_AS_UInt32) |
Send a system event to PRUSS. More... | |
FUNCTION_CDECL_ALIAS_AS_UInt32 | prussdrv_pru_wait_event (BYVAL_AS_UInt32) |
Wait for an event. More... | |
SUB_CDECL_ALIAS | prussdrv_pru_clear_event (BYVAL_AS_UInt32, BYVAL_AS_UInt32) |
Clear a pending system event. More... | |
SUB_CDECL_ALIAS | prussdrv_map_extmem (BYVAL_AS_ANY_PTR_PTR) |
Map external ram (ERam). More... | |
FUNCTION_CDECL_ALIAS_AS_UInt32 | prussdrv_extmem_sIze () |
Get size of external memory. More... | |
FUNCTION_CDECL_ALIAS_AS_Int32 | prussdrv_map_prumem (BYVAL_AS_UInt32, BYVAL_AS_ANY_PTR_PTR) |
Adress pointer mapping. More... | |
FUNCTION_CDECL_ALIAS_AS_UInt32 | prussdrv_get_phys_addr (BYVAL_AS_CONST_ANY_PTR) |
Compute physical adress. More... | |
SUB_CDECL_ALIAS | prussdrv_exIt () |
End the driver session. More... | |
Header file for kernel drivers.
The header contains declarations to bind the user space part of the kernel drivers. Two loadable kernel modules are in use, named:
The first controls memory mapping and interrupt handling, the second supports pinmuxing and PWM features.
Definition in file pruio_prussdrv.bi.
SUB_CDECL_ALIAS prussdrv_exIt | ( | ) |
End the driver session.
The procedure unmaps all memory and closes all interrupt files.
Definition at line 576 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_UInt32 prussdrv_extmem_sIze | ( | ) |
Get size of external memory.
The procedure returns the size of the external memory. The kernel driver uio_pruss
allocates a block of coherent memory. This function returns the size if this block. See section ERam for details.
Definition at line 517 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_UInt32 prussdrv_get_phys_addr | ( | BYVAL_AS_CONST_ANY_PTR | Addr | ) |
Compute physical adress.
Addr | Memory pointer or mmap value |
The function computes the physical adress from a prussdrv memory pointer or from an value returned form a mmap() call.
Definition at line 556 of file pruio_prussdrv.bas.
SUB_CDECL_ALIAS prussdrv_map_extmem | ( | BYVAL_AS_ANY_PTR_PTR | Addr | ) |
Map external ram (ERam).
Addr | The pointer to set. |
The procedure maps the external memory allocated by the uio_pruss
kernel driver to pointer parameter. Memory is then accessed by an array.
Definition at line 503 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_map_prumem | ( | BYVAL_AS_UInt32 | RamId, |
BYVAL_AS_ANY_PTR_PTR | Addr | ||
) |
Adress pointer mapping.
RamId | The memory ID. |
Addr | The pointer to set. |
The procedure maps PRU memory (DRAM, IRAM, SHARED) to the pointer parameter. Memory is then accessed by an array.
Definition at line 535 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_open | ( | BYVAL_AS_UInt32 | Irq | ) |
Open an kernel driver interrupt file.
Irq | The interrupt number. |
The function tries to open an interrupt file dev/uio[0-7]
, corresponding to Host[2-9] of the PRU INTC. In case of a problem a negative error number gets returned.
At least one call to that function is mandatory, since it initializes the memory. Call it again for each interrupt you need. A single call to prussdrv_exIt() closes all open files.
Definition at line 250 of file pruio_prussdrv.bas.
SUB_CDECL_ALIAS prussdrv_pru_clear_event | ( | BYVAL_AS_UInt32 | Irq, |
BYVAL_AS_UInt32 | Event | ||
) |
Clear a pending system event.
Irq | The host interrupt. |
Event | The system event. |
The procedure clears an event, previously sent from PRU to ARM. Once a system event occurs, the registers have to get released, in order to get ready for the next event.
Definition at line 487 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_pru_disable | ( | BYVAL_AS_UInt32 | PruId | ) |
Disable one PRU.
PruId | The PRUSS number. |
The function disables a PRU subsystem by stopping its clock.
Definition at line 292 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_pru_enable | ( | BYVAL_AS_UInt32 | PruId, |
BYVAL_AS_UInt32 | PCnt = 0 |
||
) |
Enable one PRU subsystem.
PruId | The PRU number. |
PCnt | The byte adress where to start (defaults to 0 = zero). |
The function enables a PRU subsystem by starting its clock. Parameter PCnt
specifies a byte address where to start, as used in function prussdrv_pru_write_memory().
.origin 7
the matching PCnt
value is 28 = 7 * 4.Definition at line 274 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_pru_reset | ( | BYVAL_AS_UInt32 | PruId | ) |
Reset one PRU.
PruId | The PRUSS number. |
The function forces a reset at a PRU subsystem by writing 0 (zero) to the control register.
Definition at line 309 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_ZSTRING_PTR prussdrv_pru_resume | ( | BYVAL_AS_UInt32 | PruId | ) |
Resume one PRU.
PruId | The PRUSS number. |
The function restarts a PRUSS after SLP 1
or HALT
command. The PRU re-starts executing the next instruction.
Definition at line 326 of file pruio_prussdrv.bas.
SUB_CDECL_ALIAS prussdrv_pru_send_event | ( | BYVAL_AS_UInt32 | Event | ) |
Send a system event to PRUSS.
Event | The interrupt number to send. |
The procedure sets the interrupt registers to send an event to the PRUSS.
Definition at line 454 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_UInt32 prussdrv_pru_wait_event | ( | BYVAL_AS_UInt32 | Irq | ) |
Wait for an event.
Irq | The event number to wait for. |
The function blocks the calling thread until the corresponding event input occurs.
Definition at line 470 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_pru_write_memory | ( | BYVAL_AS_UInt32 | RamId, |
BYVAL_AS_UInt32 | Offs, | ||
BYVAL_AS_CONST_UInt32_PTR | Dat, | ||
BYVAL_AS_UInt32 | Size | ||
) |
Write data to PRUSS memory.
RamId | The ID of the memory. |
Offs | The offset to start at. |
Dat | A pointer to the data. |
Size | The size of data in bytes. |
The function writes a chunk of data to PRUSS memory (DRam, IRam or SRam), depending on parameter RamId. The start writing position gets specified by parameter Offs.
Definition at line 350 of file pruio_prussdrv.bas.
FUNCTION_CDECL_ALIAS_AS_Int32 prussdrv_pruintc_init | ( | BYVAL_AS_CONST_tpruss_intc_initdata_PTR | DatIni | ) |
Initialize the interrupt controller.
DatIni | Data structure to initialize |
The function initializes and enables the PRU interrupt controller. The input is a structure of arrays that determine which system events are enabled and how each is mapped to a host event. This structure is pre-defined as a member variable PTR PruIo::IntcInit in header file src/pruio/pruio.bi
. Experts can adapted the default arrays to meet custom needs before the CTOR PruIo::PruIo() call, but note that wrong settings can cause serious malfunctions.
Definition at line 385 of file pruio_prussdrv.bas.