This new name makes more sense.
#include "drv/spi_tms570.h"
#include "drv/port.h"
-UL_LIST_CUST_DEC(spi_rq_queue, spi_drv_t, spi_msg_head_t, rq_queue, node)
+UL_LIST_CUST_DEC(spi_rq_queue, spi_drv_t, spi_msg_t, rq_queue, node)
int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void *rx_buf);
-int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg);
+int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_t *msg);
int8_t port_spi_set(const struct port_desc *port, void *values, size_t size);
#endif /* _SPI_DRV_H_ */
typedef int (spi_ctrl_fnc_t)(struct spi_drv *ifc, int ctrl, void *p);
-typedef struct spi_msg_head {
+typedef struct spi_msg {
uint16_t flags; // message flags
uint16_t addr; // message destination address -- used as index into the "address translation table"*/
ul_list_node_t node;
//struct spi_drv *ifc;
- int (*callback)(struct spi_drv *ifc, int code, struct spi_msg_head *msg); // Called when whole transfer is finished
+ int (*callback)(struct spi_drv *ifc, int code, struct spi_msg *msg); // Called when whole transfer is finished
long private; // If set -- msg is processed by HW
-} spi_msg_head_t;
+} spi_msg_t;
typedef struct spi_drv {
uint16_t flags; // Flags
//uint16_t self_addr;
ul_list_head_t rq_queue; // Queue containing MSG requests to process
- spi_msg_head_t *msg_act; // MSG being actually processed
+ spi_msg_t *msg_act; // MSG being actually processed
spi_ctrl_fnc_t *ctrl_fnc; // Device dependent function responsible for sending data
//long private;
} spi_drv_t;
* @return always zero
*/
int drv_hbr_spi_wdg_callback(struct spi_drv *ifc, int code,
- struct spi_msg_head *msg)
+ struct spi_msg *msg)
{
hbr_spi_code = code;
if (code == SPI_MSG_FINISHED) {
}
// SPI message format definition for watchdog reset command
-spi_msg_head_t hbr_spi_wdg = {
+spi_msg_t hbr_spi_wdg = {
.flags = 0,
.addr = 0,
.rq_len = 2,
//#include "ul/ul_list.h"
#include "drv/spi.h"
-int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg)
+int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_t *msg)
{
spi_isr_lock_level_t saveif;
return 0;
}
-int spi_transfer_callback(struct spi_drv *ifc, int code, struct spi_msg_head *msg)
+int spi_transfer_callback(struct spi_drv *ifc, int code, struct spi_msg *msg)
{
if (msg->private)
msg->private = 0;
*/
int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void *rx_buf)
{
- spi_msg_head_t msg;
+ spi_msg_t msg;
msg.flags = 0;
//msg.ifc = NULL;
void spi_tms570_isr(int spi_ifc, uint32_t flags)
{
- spi_msg_head_t *msg;
+ spi_msg_t *msg;
spi_tms570_iface_t *iface = &spi_ifcs[spi_ifc];
spi_isr_lock_level_t saveif;
uint8_t val_to_wr;