[video member=miotatsu stream_platform=twitch project=riscy title="Understanding measure_cpu_freq, get_cpu_freq, & uart_init" vod_platform=youtube id=N-Dkoyx1jAc annotator=Miblo] [0:07][Recap and set the stage for the day] [2:24][Converting a remainder into a decimal][:blackboard :mathematics] [10:19][Apply the measure_cpu_freq() equation to the specified speeds of our HiFive1[ref site="Crowd Supply" page="HiFive1: Open Source, Arduino-Compatible RISC-V Dev Kit" url=https://www.crowdsupply.com/sifive/hifive1]][:blackboard] [20:07][Work back through the equation to determine the exact speed of our chip][:blackboard] [23:18][Perform integer division with the correction term on our speeds][:blackboard :mathematics] [27:04][@Miblo][/me slips into le stream] [27:07][Continue with the integer division][:blackboard :mathematics] [29:53][Try to rearrange the calculation avoiding the correction term][:blackboard :mathematics] [32:06][Ask on the forums[ref site="SiFive Forums" page="The Big RISCY BUSINESS Question Thread" url=https://forums.sifive.com/t/the-big-riscy-business-question-thread/531] why we couldn't just rearrange the computation][:mathematics] [37:05][@miblo][Does their code handle an arbitrary number of decimal places, while ours can't, perhaps?] [39:04][Review our understanding of init.c and resume studying uart_init()[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:hardware :research] [43:39][Read about the Transmit Control Register[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:hardware :research] [46:40][Determine that we fully understand uart_init() and look at the UART0_REG() macro[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:research] [50:28][Marry up the UART_REG_DIV and UART_REG_TXCTRL macros with the documentation[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:hardware :research] [51:47][Return to demo_gpio.c and hunt for the write() function called by print_instructions()][:research] [57:25][Consult man gcc[ref site=die.net page=gcc url=https://linux.die.net/man/1/gcc] and man ld[ref site=die.net page=ld url=https://linux.die.net/man/1/ld] to learn how --wrap works][:research] [59:34][Read __wrap_write() and __wrap_isatty()][:research] [1:01:19][Hunt for our copy of unistd.h][:research] [1:09:00][Read the standard file descriptors in posix/unistd.h][:research] [1:10:05][Continue studying __wrap_write()][:research] [1:11:52][We are out of time for today] [/video]