-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpio_driver.c
46 lines (39 loc) · 1.17 KB
/
pio_driver.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* pio_driver.c
*
* Created on: 14 maj 2016
* Author: opetany
*/
#include "../inc/pio_driver.h"
#include "altera_avalon_pio_regs.h"
#include "system.h"
// ==================================================================================
void PIO_Write(int port, int value)
{
IOWR_ALTERA_AVALON_PIO_DATA(port, value);
}
// ==================================================================================
int PIO_Read(int port)
{
return IORD_ALTERA_AVALON_PIO_DATA(port);
}
// ==================================================================================
int PIO_ReadBit(int port, int pin)
{
return IORD_ALTERA_AVALON_PIO_DATA(port) & pin;
}
// ==================================================================================
void PIO_SetBit(int port, int value)
{
IOWR_ALTERA_AVALON_PIO_SET_BITS(port, value);
}
// ==================================================================================
void PIO_ClearBit(int port, int value)
{
IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(port, value);
}
// ==================================================================================
void PIO_Direction(int port, int value)
{
IOWR_ALTERA_AVALON_PIO_DIRECTION(port, value);
}