2014-08-28 16:56:48 +08:00
|
|
|
#ifndef __RTIO_H
|
|
|
|
#define __RTIO_H
|
|
|
|
|
2015-05-08 14:44:39 +08:00
|
|
|
#include <generated/csr.h>
|
|
|
|
|
|
|
|
#define RTIO_O_STATUS_FULL 1
|
|
|
|
#define RTIO_O_STATUS_UNDERFLOW 2
|
|
|
|
#define RTIO_O_STATUS_SEQUENCE_ERROR 4
|
2015-07-29 19:43:35 +08:00
|
|
|
#define RTIO_O_STATUS_COLLISION_ERROR 8
|
2015-05-08 14:44:39 +08:00
|
|
|
#define RTIO_I_STATUS_EMPTY 1
|
|
|
|
#define RTIO_I_STATUS_OVERFLOW 2
|
|
|
|
|
2014-08-28 16:56:48 +08:00
|
|
|
void rtio_init(void);
|
2015-05-08 14:44:39 +08:00
|
|
|
long long int rtio_get_counter(void);
|
2015-07-29 19:43:35 +08:00
|
|
|
void rtio_process_exceptional_status(int status, long long int timestamp, int channel);
|
2015-05-08 14:44:39 +08:00
|
|
|
|
|
|
|
static inline void rtio_write_and_process_status(long long int timestamp, int channel)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
|
|
|
|
rtio_o_we_write(1);
|
|
|
|
status = rtio_o_status_read();
|
2015-07-29 19:43:35 +08:00
|
|
|
if(status)
|
|
|
|
rtio_process_exceptional_status(status, timestamp, channel);
|
2015-05-08 14:44:39 +08:00
|
|
|
}
|
|
|
|
|
2014-08-28 16:56:48 +08:00
|
|
|
#endif /* __RTIO_H */
|