Merge pull request #16 from damien-lemoal/master

Various fixes
This commit is contained in:
Alistair Francis
2019-01-03 07:52:42 -08:00
committed by GitHub
5 changed files with 30 additions and 1919 deletions

View File

@@ -285,26 +285,26 @@ install_firmwares: $(build_dir)/$(platform_subdir)/lib/libplatsbi.a $(build_dir)
.PHONY: clean
clean:
$(V)mkdir -p $(build_dir)
$(if $(V), @echo " RM <build_directory>/*.o")
$(if $(V), @echo " RM $(build_dir)/*.o")
$(V)find $(build_dir) -type f -name "*.o" -exec rm -rf {} +
$(if $(V), @echo " RM <build_directory>/*.a")
$(if $(V), @echo " RM $(build_dir)/*.a")
$(V)find $(build_dir) -type f -name "*.a" -exec rm -rf {} +
$(if $(V), @echo " RM <build_directory>/*.elf")
$(if $(V), @echo " RM $(build_dir)/*.elf")
$(V)find $(build_dir) -type f -name "*.elf" -exec rm -rf {} +
$(if $(V), @echo " RM <build_directory>/*.bin")
$(if $(V), @echo " RM $(build_dir)/*.bin")
$(V)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
# Rule for "make distclean"
.PHONY: distclean
distclean: clean
$(V)mkdir -p $(build_dir)
$(if $(V), @echo " RM <build_directory>/*.dep")
$(if $(V), @echo " RM $(build_dir)/*.dep")
$(V)find $(build_dir) -type f -name "*.dep" -exec rm -rf {} +
ifeq ($(build_dir),$(CURDIR)/build)
$(if $(V), @echo " RM <build_directory>")
$(if $(V), @echo " RM $(build_dir)")
$(V)rm -rf $(build_dir)
endif
ifeq ($(install_dir),$(CURDIR)/install)
$(if $(V), @echo " RM <install_directory>")
$(if $(V), @echo " RM $(install_dir)")
$(V)rm -rf $(install_dir)
endif

View File

@@ -18,14 +18,14 @@
#define K210_UART_BAUDRATE 115200
int k210_console_init(void)
static int k210_console_init(void)
{
uarths_init(K210_UART_BAUDRATE, UARTHS_STOP_1);
return 0;
}
void k210_console_putc(char c)
static void k210_console_putc(char c)
{
uarths_putc(c);
}

File diff suppressed because it is too large Load Diff

View File

@@ -782,164 +782,9 @@ typedef struct _sysctl_general_pll {
} __attribute__((packed, aligned(4))) sysctl_general_pll_t;
/**
* System controller object instanse
* Get frequency of CPU
* @return The frequency of the CPU
*/
extern volatile sysctl_t *const sysctl;
/**
* Enable clock for peripheral
* @param[in] clock The clock to be enable
* @return result
* - 0 Success
* - Other Fail
*/
int sysctl_clock_enable(sysctl_clock_t clock);
/**
* Enable clock for peripheral
* @param[in] clock The clock to be disable
* @return result
* - 0 Success
* - Other Fail
*/
int sysctl_clock_disable(sysctl_clock_t clock);
/**
* Sysctl clock set threshold
* @param[in] which Which threshold to set
* @param[in] threshold The threshold value
* @return result
* - 0 Success
* - Other Fail
*/
int sysctl_clock_set_threshold(sysctl_threshold_t which, int threshold);
/**
* Sysctl clock get threshold
* @param[in] which Which threshold to get
* @return The threshold value
* - Other Value of threshold
* - -1 Fail
*/
int sysctl_clock_get_threshold(sysctl_threshold_t which);
/**
* Sysctl clock set clock select
* @param[in] which Which clock select to set
* @param[in] select The clock select value
* @return result
* - 0 Success
* - Other Fail
*/
int sysctl_clock_set_clock_select(sysctl_clock_select_t which, int select);
/**
* Sysctl clock get clock select
* @param[in] which Which clock select to get
* @return The clock select value
* - Other Value of clock select
* - -1 Fail
*/
int sysctl_clock_get_clock_select(sysctl_clock_select_t which);
/**
* Get PLL frequency
* @param[in] pll The PLL id
* @return The frequency of PLL
*/
u32 sysctl_pll_get_freq(sysctl_pll_t pll);
/**
* Get base clock frequency by clock id
* @param[in] clock The clock id
* @return The clock frequency
*/
u32 sysctl_clock_get_freq(sysctl_clock_t clock);
/**
* Reset device by reset controller
* @param[in] reset The reset signal
*/
void sysctl_reset(sysctl_reset_t reset);
/**
* Enable the PLL and power on with reset
* @param[in] pll The pll id
* @return Result
* - 0 Success
* - Other Fail
*/
int sysctl_pll_enable(sysctl_pll_t pll);
/**
* Disable the PLL and power off
* @param[in] pll The pll id
* @return Result
* - 0 Success
* - Other Fail
*/
int sysctl_pll_disable(sysctl_pll_t pll);
/**
* Select DMA channel handshake peripheral signal
* @param[in] channel The DMA channel
* @param[in] select The peripheral select
* @return Result
* - 0 Success
* - Other Fail
*/
int sysctl_dma_select(sysctl_dma_channel_t channel, sysctl_dma_select_t select);
/**
* Set SPI0_D0-D7 DVP_D0-D7 as spi and dvp data pin
* @param[in] en Enable or not
* @return Result
* - 0 Success
* - Other Fail
*/
u32 sysctl_set_spi0_dvp_data(u8 en);
/**
* Set io power mode
* @param[in] power_bank IO power bank
* @param[in] io_power_mode Set power mode 3.3v or 1.8
* @return Result
* - 0 Success
* - Other Fail
*/
void sysctl_set_power_mode(sysctl_power_bank_t power_bank, sysctl_io_power_mode_t io_power_mode);
/**
* Set frequency of CPU
* @param[in] freq The desired frequency in Hz
* @return The actual frequency of CPU after set
*/
u32 sysctl_cpu_set_freq(u32 freq);
/**
* Init PLL freqency
* @param[in] pll The PLL id
* @param[in] pll_freq The desired frequency in Hz
*/
u32 sysctl_pll_set_freq(sysctl_pll_t pll, u32 pll_freq);
/**
* Enable interrupt
*/
void sysctl_enable_irq(void);
/**
* Disable interrupt
*/
void sysctl_disable_irq(void);
/**
* Get the time start up to now
* @return The time of microsecond
*/
u64 sysctl_get_time_us(void);
void sysctl_usleep(u64 usec);
u32 sysctl_get_cpu_freq(void);
#endif /* _K210_SYSCTL_H_ */

View File

@@ -21,7 +21,7 @@ static volatile struct uarths *const uarths =
void uarths_init(u32 baud_rate, enum uarths_stopbit stopbit)
{
u32 freq = sysctl_clock_get_freq(SYSCTL_CLOCK_CPU);
u32 freq = sysctl_get_cpu_freq();
u16 div = freq / baud_rate - 1;
/* Set UART registers */