6502-OS/system/spi.h65

53 lines
1.6 KiB
Plaintext

;;********************************************************************************
;; @module SPI-P
;; @type driver
;; @details
;; Support being a peripheral SPI device.
;; @depends IO-W65C22N
;;********************************************************************************
.ifndef INCLUDE_SPI
INCLUDE_SPI = 1
.include "system/system.h65"
;;********************************************************************************
;; @brief SPI-Peripheral
;;********************************************************************************
.scope spi_p
SPI_IO = IO2
Import spi_p, init, irq_handler, status, buffer_size, recv_size
ImportZp spi_p, buffer_ptr
Import spi_p, begin_read, end_read, irq_read_byte, recv_bytes
Import spi_p, begin_write, end_write, irq_write_byte, sent_bytes
;;********************************************************************************
;; @brief Status of a SPI transfer
;;********************************************************************************
.enum STATUS
XFER_SIZEL = %10000000
XFER_SIZEH = %01000000
XFER = %00000001
DONE = %00000000
ERROR = %00100000
.endenum
.endscope
.endif ; guard
; .struct SPI_P_Pins
; ; VIA addresses
; DDR_a .word ; address of the data direction register
; R_a .word ; address of the register
; ; pin mask
; SCLK_p .byte ; Serial Clock
; POCI_p .byte ; Peripheral Out / Controller In
; PICO_p .byte ; Peripheral In / Controller Out
; CSB_p .byte ; Chip Select
; ; settings
; CPOL .byte ; Clock Polarity
; CPHA .byte ; Clock Phase
; .endstruct