linux spi子系统驱动分析

原文网址 : http://blog.chinaunix.net/u2/66039/showart_1686204.html

2.6.18内核下已经添加了完整的spi子系统了,参考mtd的分析,将从下到上层,再从上到下层的对其进行分析。

以下先从下到上的进行分析:

driver/spi下有两个底层相关的spi驱动程序:
spi_s3c24xx.c和spi_s3c24xx_gpio.c
其中spi_s3c24xx.c是基于s3c24xx下相应的spi接口的驱动程序,spi_s3c24xx_gpio.c允许用户指定3个gpio口,分别充当spi_clk、spi_mosi和spi_miso接口,模拟标准的spi总线。
s3c2410自带了两个spi接口(spi0和spi1),在此我只研究基于s3c2410下spi接口的驱动程序spi_s3c24xx.c。
首先从spi驱动的检测函数进行分析:

  1. static int s3c24xx_spi_probe(struct platform_device *pdev)
  2. {
  3. struct s3c24xx_spi *hw;
  4. struct spi_master *master;
  5. struct spi_board_info *bi;
  6. struct resource *res;
  7. int err = 0;
  8. int i;
  9. /* pi_alloc_master函数申请了struct spi_master+struct s3c24xx_spi大小的数据,
  10. * spi_master_get_devdata和pi_master_get分别取出struct s3c24xx_spi和struct spi_master结构指针
  11. */
  12. master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));
  13. if (master == NULL) {
  14. dev_err(&pdev->dev, "No memory for spi_master/n");
  15. err = -ENOMEM;
  16. goto err_nomem;
  17. }
  18. /* 填充struct spi_master结构 */
  19. hw = spi_master_get_devdata(master);
  20. memset(hw, 0, sizeof(struct s3c24xx_spi));
  21. hw->master = spi_master_get(master);
  22. hw->pdata = pdev->dev.platform_data;
  23. hw->dev = &pdev->dev;
  24. if (hw->pdata == NULL) {
  25. dev_err(&pdev->dev, "No platform data supplied/n");
  26. err = -ENOENT;
  27. goto err_no_pdata;
  28. }
  29. platform_set_drvdata(pdev, hw);//dev_set_drvdata(&pdev->dev, hw)
  30. init_completion(&hw->done);
  31. /* setup the state for the bitbang driver */
  32. /* 填充hw->bitbang结构(hw->bitbang结构充当一个中间层,相当与input system的input_handle struct) */
  33. hw->bitbang.master = hw->master;
  34. hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer;
  35. hw->bitbang.chipselect = s3c24xx_spi_chipsel;
  36. hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
  37. hw->bitbang.master->setup = s3c24xx_spi_setup;
  38. dev_dbg(hw->dev, "bitbang at %p/n", &hw->bitbang);
  39. /* find and map our resources */
  40. /* 申请spi所用到的资源:io、irq、时钟等 */
  41. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  42. if (res == NULL) {
  43. dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM/n");
  44. err = -ENOENT;
  45. goto err_no_iores;
  46. }
  47. hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1,
  48. pdev->name);
  49. if (hw->ioarea == NULL) {
  50. dev_err(&pdev->dev, "Cannot reserve region/n");
  51. err = -ENXIO;
  52. goto err_no_iores;
  53. }
  54. hw->regs = ioremap(res->start, (res->end - res->start)+1);
  55. if (hw->regs == NULL) {
  56. dev_err(&pdev->dev, "Cannot map IO/n");
  57. err = -ENXIO;
  58. goto err_no_iomap;
  59. }
  60. hw->irq = platform_get_irq(pdev, 0);
  61. if (hw->irq < 0) {
  62. dev_err(&pdev->dev, "No IRQ specified/n");
  63. err = -ENOENT;
  64. goto err_no_irq;
  65. }
  66. err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw);
  67. if (err) {
  68. dev_err(&pdev->dev, "Cannot claim IRQ/n");
  69. goto err_no_irq;
  70. }
  71. hw->clk = clk_get(&pdev->dev, "spi");
  72. if (IS_ERR(hw->clk)) {
  73. dev_err(&pdev->dev, "No clock for device/n");
  74. err = PTR_ERR(hw->clk);
  75. goto err_no_clk;
  76. }
  77. /* for the moment, permanently enable the clock */
  78. clk_enable(hw->clk);
  79. /* program defaults into the registers */
  80. /* 初始化spi相关的寄存器 */
  81. writeb(0xff, hw->regs + S3C2410_SPPRE);
  82. writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
  83. writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
  84. /* add by lfc */
  85. s3c2410_gpio_setpin(S3C2410_GPE13, 0);
  86. s3c2410_gpio_setpin(S3C2410_GPE12, 0);
  87. s3c2410_gpio_cfgpin(S3C2410_GPE13, S3C2410_GPE13_SPICLK0);
  88. s3c2410_gpio_cfgpin(S3C2410_GPE12, S3C2410_GPE12_SPIMOSI0);
  89. s3c2410_gpio_cfgpin(S3C2410_GPE11, S3C2410_GPE11_SPIMISO0);
  90. /* end add */
  91. /* setup any gpio we can */
  92. /* 片选 */
  93. if (!hw->pdata->set_cs) {
  94. s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
  95. s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
  96. }
  97. /* register our spi controller */
  98. /* 最终通过调用spi_register_master来注册spi控制器(驱动) */
  99. err = spi_bitbang_start(&hw->bitbang);
  100. if (err) {
  101. dev_err(&pdev->dev, "Failed to register SPI master/n");
  102. goto err_register;
  103. }
  104. dev_dbg(hw->dev, "shutdown=%d/n", hw->bitbang.shutdown);
  105. /* register all the devices associated */
  106. /* 注册所用使用本spi驱动的设备 */
  107. bi = &hw->pdata->board_info[0];
  108. for (i = 0; i < hw->pdata->board_size; i++, bi++) {
  109. dev_info(hw->dev, "registering %s/n", bi->modalias);
  110. bi->controller_data = hw;
  111. spi_new_device(master, bi);
  112. }
  113. return 0;
  114. err_register:
  115. clk_disable(hw->clk);
  116. clk_put(hw->clk);
  117. err_no_clk:
  118. free_irq(hw->irq, hw);
  119. err_no_irq:
  120. iounmap(hw->regs);
  121. err_no_iomap:
  122. release_resource(hw->ioarea);
  123. kfree(hw->ioarea);
  124. err_no_iores:
  125. err_no_pdata:
  126. spi_master_put(hw->master);;
  127. err_nomem:
  128. return err;
  129. }
  130. /*
  131. * spi_alloc_master - allocate SPI master controller
  132. * @dev: the controller, possibly using the platform_bus
  133. * @size: how much driver-private data to preallocate; the pointer to this
  134. * memory is in the class_data field of the returned class_device,
  135. * accessible with spi_master_get_devdata().
  136. *
  137. * This call is used only by SPI master controller drivers, which are the
  138. * only ones directly touching chip registers. It's how they allocate
  139. * an spi_master structure, prior to calling spi_register_master().
  140. *
  141. * This must be called from context that can sleep. It returns the SPI
  142. * master structure on success, else NULL.
  143. *
  144. * The caller is responsible for assigning the bus number and initializing
  145. * the master's methods before calling spi_register_master(); and (after errors
  146. * adding the device) calling spi_master_put() to prevent a memory leak.
  147. */
  148. /*注释已经写得很清楚了,本函数旨在分配spi_master struct
  149. *其中,device为主控制设备,size为需要预分配的设备私有数据大小
  150. *该函数被spi主控制器驱动所调用,用于在调用spi_register_master注册主控制器前
  151. *分配spi_master struct,分配bus number和初始化主控制器的操作方法
  152. *注意在分配spi_master struct的时候多分配了大小为size的设备私有数据
  153. *并通过spi_master_set_devdata函数把其放到class_data field里,以后可以通过spi_master_get_devdata来访问
  154. */
  155. struct spi_master * __init_or_module
  156. spi_alloc_master(struct device *dev, unsigned size)
  157. {
  158. struct spi_master *master;
  159. if (!dev)
  160. return NULL;
  161. master = kzalloc(size + sizeof *master, SLAB_KERNEL);
  162. if (!master)
  163. return NULL;
  164. class_device_initialize(&master->cdev);
  165. master->cdev.class = &spi_master_class;
  166. master->cdev.dev = get_device(dev);
  167. spi_master_set_devdata(master, &master[1]);
  168. return master;
  169. }
  170. /*
  171. * spi_bitbang_start - start up a polled/bitbanging SPI master driver
  172. * @bitbang: driver handle
  173. *
  174. * Caller should have zero-initialized all parts of the structure, and then
  175. * provided callbacks for chip selection and I/O loops. If the master has
  176. * a transfer method, its final step should call spi_bitbang_transfer; or,
  177. * that's the default if the transfer routine is not initialized. It should
  178. * also set up the bus number and number of chipselects.
  179. *
  180. * For i/o loops, provide callbacks either per-word (for bitbanging, or for
  181. * hardware that basically exposes a shift register) or per-spi_transfer
  182. * (which takes better advantage of hardware like fifos or DMA engines).
  183. *
  184. * Drivers using per-word I/O loops should use (or call) spi_bitbang_setup and
  185. * spi_bitbang_cleanup to handle those spi master methods. Those methods are
  186. * the defaults if the bitbang->txrx_bufs routine isn't initialized.
  187. *
  188. * This routine registers the spi_master, which will process requests in a
  189. * dedicated task, keeping IRQs unblocked most of the time. To stop
  190. * processing those requests, call spi_bitbang_stop().
  191. */
  192. int spi_bitbang_start(struct spi_bitbang *bitbang)
  193. {
  194. int status;
  195. if (!bitbang->master || !bitbang->chipselect)
  196. return -EINVAL;
  197. /*bitbang_work
  198. * 初始化a work,后面再create_singlethread_workqueue,
  199. * 等到有数据要传输的时候,在spi_bitbang_transfer函数中通过调用queue_work(bitbang->workqueue, &bitbang->work)
  200. * 把work扔进workqueue中调度运行
  201. * 这是内核的一贯做法,在mmc/sd驱动中也是这样处理的^_^
  202. */
  203. INIT_WORK(&bitbang->work, bitbang_work, bitbang);
  204. /* 初始化自旋锁和链表头,以后用到 */
  205. spin_lock_init(&bitbang->lock);
  206. spi_new_device INIT_LIST_HEAD(&bitbang->queue);
  207. if (!bitbang->master->transfer)
  208. bitbang->master->transfer = spi_bitbang_transfer;//spi数据的传输就是通过调用这个方法来实现的
  209. /* spi_s3c24xx.c驱动中有相应的txrx_bufs处理方法,在bitbang_work中被调用 */
  210. if (!bitbang->txrx_bufs) {
  211. bitbang->use_dma = 0;
  212. bitbang->txrx_bufs = spi_bitbang_bufs;
  213. if (!bitbang->master->setup) {
  214. if (!bitbang->setup_transfer)
  215. bitbang->setup_transfer =
  216. spi_bitbang_setup_transfer;
  217. bitbang->master->setup = spi_bitbang_setup;
  218. bitbang->master->cleanup = spi_bitbang_cleanup;
  219. }
  220. /* spi_s3c24xx.c驱动中有相应的setup处理方法,在稍后的spi_new_device中被调用 */
  221. } else if (!bitbang->master->setup)
  222. return -EINVAL;
  223. /* this task is the only thing to touch the SPI bits */
  224. bitbang->busy = 0;
  225. /* 创建工作者进程 */
  226. bitbang->workqueue = create_singlethread_workqueue(
  227. bitbang->master->cdev.dev->bus_id);
  228. if (bitbang->workqueue == NULL) {
  229. status = -EBUSY;
  230. goto err1;
  231. }
  232. /* driver may get busy before register() returns, especially
  233. * if someone registered boardinfo for devices
  234. */
  235. status = spi_register_master(bitbang->master);
  236. if (status < 0)
  237. goto err2;
  238. return status;
  239. err2:
  240. destroy_workqueue(bitbang->workqueue);
  241. err1:
  242. return status;
  243. }
  244. /**
  245. * spi_register_master - register SPI master controller
  246. * @master: initialized master, originally from spi_alloc_master()
  247. *
  248. * SPI master controllers connect to their drivers using some non-SPI bus,
  249. * such as the platform bus. The final stage of probe() in that code
  250. * includes calling spi_register_master() to hook up to this SPI bus glue.
  251. *
  252. * SPI controllers use board specific (often SOC specific) bus numbers,
  253. * and board-specific addressing for SPI devices combines those numbers
  254. * with chip select numbers. Since SPI does not directly support dynamic
  255. * device identification, boards need configuration tables telling which
  256. * chip is at which address.
  257. *
  258. * This must be called from context that can sleep. It returns zero on
  259. * success, else a negative error code (dropping the master's refcount).
  260. * After a successful return, the caller is responsible for calling
  261. * spi_unregister_master().
  262. */
  263. int __init_or_module
  264. spi_register_master(struct spi_master *master)
  265. {
  266. static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
  267. struct device *dev = master->cdev.dev;
  268. int status = -ENODEV;
  269. int dynamic = 0;
  270. if (!dev)
  271. return -ENODEV;
  272. /* convention: dynamically assigned bus IDs count down from the max */
  273. if (master->bus_num < 0) {
  274. master->bus_num = atomic_dec_return(&dyn_bus_id);
  275. dynamic = 1;
  276. }
  277. /* register the device, then userspace will see it.
  278. * registration fails if the bus ID is in use.
  279. */
  280. snprintf(master->cdev.class_id, sizeof master->cdev.class_id,
  281. "spi%u", master->bus_num);
  282. status = class_device_add(&master->cdev);//注册设备
  283. if (status < 0)
  284. goto done;
  285. dev_dbg(dev, "registered master %s%s/n", master->cdev.class_id,
  286. dynamic ? " (dynamic)" : "");
  287. /* populate children from any spi device tables */
  288. scan_boardinfo(master);
  289. status = 0;
  290. done:
  291. return status;
  292. }
  293. /* FIXME someone should add support for a __setup("spi", ...) that
  294. * creates board info from kernel command lines
  295. */
  296. /*
  297. * scan board_list for spi_board_info which is registered by spi_register_board_info
  298. * 很可惜,s3c24xx的spi驱动中不支持spi_register_board_info这种标准方式注册方式,而是直接调用spi_new_device内部函数
  299. */
  300. static void __init_or_module
  301. scan_boardinfo(struct spi_master *master)
  302. {
  303. struct boardinfo *bi;
  304. struct device *dev = master->cdev.dev;
  305. down(&board_lock);
  306. list_for_each_entry(bi, &board_list, list) {
  307. struct spi_board_info *chip = bi->board_info;
  308. unsigned n;
  309. for (n = bi->n_board_info; n > 0; n--, chip++) {
  310. if (chip->bus_num != master->bus_num)
  311. continue;
  312. /* some controllers only have one chip, so they
  313. * might not use chipselects. otherwise, the
  314. * chipselects are numbered 0..max.
  315. */
  316. if (chip->chip_select >= master->num_chipselect
  317. && master->num_chipselect) {
  318. dev_dbg(dev, "cs%d > max %d/n",
  319. chip->chip_select,
  320. master->num_chipselect);
  321. continue;
  322. }
  323. (void) spi_new_device(master, chip);
  324. }
  325. }
  326. up(&board_lock);
  327. }
  328. /*
  329. * Board-specific early init code calls this (probably during arch_initcall)
  330. * with segments of the SPI device table. Any device nodes are created later,
  331. * after the relevant parent SPI controller (bus_num) is defined. We keep
  332. * this table of devices forever, so that reloading a controller driver will
  333. * not make Linux forget about these hard-wired devices.
  334. *
  335. * Other code can also call this, e.g. a particular add-on board might provide
  336. * SPI devices through its expansion connector, so code initializing that board
  337. * would naturally declare its SPI devices.
  338. *
  339. * The board info passed can safely be __initdata ... but be careful of
  340. * any embedded pointers (platform_data, etc), they're copied as-is.
  341. */
  342. int __init
  343. spi_register_board_info(struct spi_board_info const *info, unsigned n)
  344. {
  345. struct boardinfo *bi;
  346. bi = kmalloc(sizeof(*bi) + n * sizeof *info, GFP_KERNEL);
  347. if (!bi)
  348. return -ENOMEM;
  349. bi->n_board_info = n;
  350. memcpy(bi->board_info, info, n * sizeof *info);
  351. down(&board_lock);
  352. list_add_tail(&bi->list, &board_list);
  353. up(&board_lock);
  354. return 0;
  355. }
  356. /* On typical mainboards, this is purely internal; and it's not needed
  357. * after board init creates the hard-wired devices. Some development
  358. * platforms may not be able to use spi_register_board_info though, and
  359. * this is exported so that for example a USB or parport based adapter
  360. * driver could add devices (which it would learn about out-of-band).
  361. */
  362. struct spi_device *__init_or_module
  363. spi_new_device(struct spi_master *master, struct spi_board_info *chip)
  364. {
  365. struct spi_device *proxy;//这个结构很重要,以后就是通过这个结构来操作实际的spi设备的
  366. struct device *dev = master->cdev.dev;
  367. int status;
  368. /* NOTE: caller did any chip->bus_num checks necessary */
  369. if (!spi_master_get(master))
  370. return NULL;
  371. proxy = kzalloc(sizeof *proxy, GFP_KERNEL);
  372. if (!proxy) {
  373. dev_err(dev, "can't alloc dev for cs%d/n",
  374. chip->chip_select);
  375. goto fail;
  376. }
  377. /* 初始化spi_device 结构各成员 */
  378. proxy->master = master;
  379. proxy->chip_select = chip->chip_select;
  380. proxy->max_speed_hz = chip->max_speed_hz;
  381. proxy->mode = chip->mode;
  382. proxy->irq = chip->irq;
  383. proxy->modalias = chip->modalias;
  384. snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id,
  385. "%s.%u", master->cdev.class_id,
  386. chip->chip_select);
  387. proxy->dev.parent = dev;
  388. proxy->dev.bus = &spi_bus_type;
  389. proxy->dev.platform_data = (void *) chip->platform_data;
  390. proxy->controller_data = chip->controller_data;
  391. proxy->controller_state = NULL;
  392. proxy->dev.release = spidev_release;
  393. /* drivers may modify this default i/o setup */
  394. /* 调用master->setup(即s3c24xx_spi_setup)函数初始化spi设备 */
  395. status = master->setup(proxy);
  396. if (status < 0) {
  397. dev_dbg(dev, "can't %s %s, status %d/n",
  398. "setup", proxy->dev.bus_id, status);
  399. goto fail;
  400. }
  401. /* driver core catches callers that misbehave by defining
  402. * devices that already exist.
  403. */
  404. status = device_register(&proxy->dev);//真正注册原始设备
  405. if (status < 0) {
  406. dev_dbg(dev, "can't %s %s, status %d/n",
  407. "add", proxy->dev.bus_id, status);
  408. goto fail;
  409. }
  410. dev_dbg(dev, "registered child %s/n", proxy->dev.bus_id);
  411. return proxy;
  412. fail:
  413. spi_master_put(master);
  414. kfree(proxy);
  415. return NULL;
  416. }
  417. static int s3c24xx_spi_setup(struct spi_device *spi)
  418. {
  419. int ret;
  420. /* 进行一些检查性操作 */
  421. if (!spi->bits_per_word)
  422. spi->bits_per_word = 8;
  423. if ((spi->mode & SPI_LSB_FIRST) != 0)
  424. return -EINVAL;
  425. ret = s3c24xx_spi_setupxfer(spi, NULL);
  426. if (ret < 0) {
  427. dev_err(&spi->dev, "setupxfer returned %d/n", ret);
  428. return ret;
  429. }
  430. dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz/n",
  431. __FUNCTION__, spi->mode, spi->bits_per_word,
  432. spi->max_speed_hz);
  433. return 0;
  434. }
  435. static int s3c24xx_spi_setupxfer(struct spi_device *spi,
  436. struct spi_transfer *t)
  437. {
  438. struct s3c24xx_spi *hw = to_hw(spi);
  439. unsigned int bpw;
  440. unsigned int hz;
  441. unsigned int div;
  442. bpw = t ? t->bits_per_word : spi->bits_per_word;
  443. hz = t ? t->speed_hz : spi->max_speed_hz;
  444. if (bpw != 8) {
  445. dev_err(&spi->dev, "invalid bits-per-word (%d)/n", bpw);
  446. return -EINVAL;
  447. }
  448. div = clk_get_rate(hw->clk) / hz;
  449. /* is clk = pclk / (2 * (pre+1)), or is it
  450. * clk = (pclk * 2) / ( pre + 1) */
  451. div = (div / 2) - 1;//求出预分频值
  452. if (div < 0)
  453. div = 1;
  454. if (div > 255)
  455. div = 255;
  456. dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)/n", div, hz);
  457. writeb(div, hw->regs + S3C2410_SPPRE);//设置预分频值
  458. spin_lock(&hw->bitbang.lock);
  459. if (!hw->bitbang.busy) {
  460. hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);//修改时钟,先禁用spi
  461. /* need to ndelay for 0.5 clocktick ? */
  462. }
  463. spin_unlock(&hw->bitbang.lock);
  464. return 0;
  465. }
  466. static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
  467. {
  468. struct s3c24xx_spi *hw = to_hw(spi);
  469. unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
  470. unsigned int spcon;
  471. switch (value) {
  472. case BITBANG_CS_INACTIVE:
  473. /* 禁用spi(禁用片选) */
  474. if (hw->pdata->set_cs)
  475. hw->pdata->set_cs(hw->pdata, value, cspol);
  476. else
  477. s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);
  478. break;
  479. case BITBANG_CS_ACTIVE:
  480. /*
  481. * 启用spi:根据需要设置寄存器并启用使能片选
  482. * (如果spi_board_info中没有设置相应的mode选项的话,那就只能使用默认值SPPIN_DEFAULT和SPCON_DEFAULT了)
  483. */
  484. spcon = readb(hw->regs + S3C2410_SPCON);
  485. if (spi->mode & SPI_CPHA)
  486. spcon |= S3C2410_SPCON_CPHA_FMTB;
  487. else
  488. spcon &= ~S3C2410_SPCON_CPHA_FMTB;
  489. if (spi->mode & SPI_CPOL)
  490. spcon |= S3C2410_SPCON_CPOL_HIGH;
  491. else
  492. spcon &= ~S3C2410_SPCON_CPOL_HIGH;
  493. spcon |= S3C2410_SPCON_ENSCK;
  494. /* write new configration */
  495. writeb(spcon, hw->regs + S3C2410_SPCON);
  496. if (hw->pdata->set_cs)
  497. hw->pdata->set_cs(hw->pdata, value, cspol);
  498. else
  499. s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);
  500. break;
  501. }
  502. }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值