6502-OS/system/spi.s65
2023-10-26 19:51:20 +02:00

42 lines
1.1 KiB
Plaintext

;********************************************************************************
; @module SPI
; @type driver
; @details
; @depends IO-W65C22N
;********************************************************************************
.include "system/system.h65"
.ifndef INCLUDE_SPI
INCLUDE_SPI = 1
.segment "CODE"
.struct SPI_Pins
; VIA addresses
DDR_a .word ; address of the data direction register
R_a .word ; address of the register
; pin mask
SLK_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
;********************************************************************************
; @function Send bytes
; @param X Number of bytes to send
; @param ARG0-1 Address of the first byte
; @param ARG2-3 Address of the SPI_Pins struct
;********************************************************************************
send_data:
_send_byte:
.endif