You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.3 KiB
88 lines
3.3 KiB
#ifndef __SPS2_SBUS_HEADERS__
|
|
#define __SPS2_SBUS_HEADERS__
|
|
|
|
#include "sbus_regs.h"
|
|
#include "sbus_priv.h"
|
|
|
|
#ifdef _IOP
|
|
#include <irx.h>
|
|
#define sbus_IMPORTS_start DECLARE_IMPORT_TABLE(sbus, 1, 1)
|
|
#define sbus_IMPORTS_end END_IMPORT_TABLE
|
|
#endif
|
|
|
|
typedef void (*sbus_irq_handler_func)( uint8_t irq, void *ptr );
|
|
|
|
typedef struct s_sbus_irq_handler{
|
|
sbus_irq_handler_func func;
|
|
void * param;
|
|
} sbus_irq_handler_t;
|
|
|
|
typedef struct s_sif2_cmd_pkt {
|
|
/** 32-bit command id */
|
|
uint32_t cid;
|
|
/** 32-bit size of command packet. */
|
|
uint32_t size;
|
|
/*??? Why Not to Use pkt ???*/
|
|
void * pkt;
|
|
/** 32-bit remote address of parameters */
|
|
void * extra;
|
|
/** 32-bit size of remote parameters */
|
|
uint32_t extra_size;
|
|
} sif2_cmd_pkt_t;
|
|
|
|
typedef void (*sif2_cmd_handler_func)( sif2_cmd_pkt_t *pkt, void *ptr );
|
|
|
|
typedef struct s_sif2_cmd_handler{
|
|
sif2_cmd_handler_func func;
|
|
void * param;
|
|
} sif2_cmd_handler_t;
|
|
|
|
// SBUS
|
|
int8_t SBUS_init( void );
|
|
int8_t SBUS_deinit( void );
|
|
void * SBUS_set_irq_handler( uint8_t irq, sbus_irq_handler_func func, void *param );
|
|
int8_t SBUS_rem_irq_handler( uint8_t irq );
|
|
uint32_t SBUS_get_reg( uint32_t reg_no);
|
|
void SBUS_set_reg( uint32_t reg_no, uint32_t val );
|
|
int8_t SBUS_interrupt_remote( int8_t irq );
|
|
|
|
// SIF2
|
|
uint8_t SIF2_init( void );
|
|
uint8_t SIF2_deinit( void );
|
|
uint8_t SIF2_set_dma( uint32_t addr, uint32_t size, uint32_t attr );
|
|
void SIF2_sync_dma( void );
|
|
|
|
// SIF2 Command
|
|
uint8_t SIF2_init_cmd( void );
|
|
uint8_t SIF2_set_cmd_handler( uint32_t cid, sif2_cmd_handler_func func, void *param );
|
|
uint8_t SIF2_rem_cmd_handler( uint32_t cid );
|
|
void SIF2_send_cmd( uint32_t cid, void *extra, uint32_t extra_size );
|
|
|
|
void SBUS_check_intr( void );
|
|
|
|
#ifdef _IOP
|
|
// SBUS
|
|
#define I_SBUS_init DECLARE_IMPORT(4, SBUS_init)
|
|
#define I_SBUS_deinit DECLARE_IMPORT(5, SBUS_deinit)
|
|
#define I_SBUS_set_irq_handler DECLARE_IMPORT(6, SBUS_set_irq_handler)
|
|
#define I_SBUS_rem_irq_handler DECLARE_IMPORT(7, SBUS_rem_irq_handler)
|
|
#define I_SBUS_get_reg DECLARE_IMPORT(8, SBUS_get_reg)
|
|
#define I_SBUS_set_reg DECLARE_IMPORT(9, SBUS_set_reg)
|
|
#define I_SBUS_interrupt_remote DECLARE_IMPORT(10, SBUS_interrupt_remote)
|
|
#define I_SBUS_check_intr DECLARE_IMPORT(11, SBUS_check_intr)
|
|
|
|
// SIF2 DMA
|
|
#define I_SIF2_init DECLARE_IMPORT(12, SIF2_init)
|
|
#define I_SIF2_deinit DECLARE_IMPORT(13, SIF2_deinit)
|
|
#define I_SIF2_set_dma DECLARE_IMPORT(14, SIF2_set_dma)
|
|
#define I_SIF2_sync_dma DECLARE_IMPORT(15, SIF2_sync_dma)
|
|
|
|
// SIF2 CMD
|
|
#define I_SIF2_init_cmd DECLARE_IMPORT(16, SIF2_init_cmd)
|
|
#define I_SIF2_set_cmd_handler DECLARE_IMPORT(17, SIF2_set_cmd_handler)
|
|
#define I_SIF2_rem_cmd_handler DECLARE_IMPORT(18, SIF2_rem_cmd_handler)
|
|
#define I_SIF2_send_cmd DECLARE_IMPORT(19, SIF2_send_cmd)
|
|
|
|
#endif
|
|
|
|
#endif /* __PS2_SBUS_H__ */
|