AnsweredAssumed Answered

the function spi_init() in No-OS software?

Question asked by angleIsDancing on Apr 25, 2016
Latest reply on Apr 25, 2016 by DragosB

Hi all,

     In the function spi_init(), there are some lines code below:

==================================== ============

control_val = XSPIPS_CR_SSFORCE_MASK |

                                                  XSPIPS_CR_SSCTRL_MASK |

                                                  4 << XSPIPS_CR_PRESC_SHIFT |

                                                  (clk_pha ? XSPIPS_CR_CPHA_MASK : 0) |

                                                  (clk_pol ? XSPIPS_CR_CPOL_MASK : 0) |

                                                  XSPIPS_CR_MSTREN_MASK;

XSpiPs_WriteReg(base_addr, XSPIPS_CR_OFFSET, control_val);

=================================================

Literally the code writes control information to configuration register( am I right?). And my questions are:

1. what is the meaning of each macro in variable control_val?

2. why the code set variable control_val to this value(not other values)? It depends what?

thanks.

Outcomes