OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12642|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ y5 |, t. O5 v2 s3 B& }4 }
  1. [code]EDMA sample test application2 t2 c) j# ?( [7 g' N9 |
  2. /*6 ?/ ?# c. M" y
  3. * edma_test.c" T* J/ U% \' A0 y
  4. *
    # k5 T4 S3 i5 |" r
  5. * brief  EDMA3 Test Application
    8 Z) E& X. m0 w; U/ w0 L" }
  6. *! \4 j9 m  n  |$ q6 X& s1 Q2 n8 s
  7. *   This file contains EDMA3 Test code.
      Y* D8 N/ ?1 @! S- b$ @) ]! U
  8. *
    $ Z1 \+ p/ G/ z- V9 U; }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, R* R! a* Q3 I) u  Z. h" z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% u& q6 J: `2 u# u
  11. *         TO CHANGE.8 I# t" W  U( O8 W( D* W
  12. *7 x- F: K) `+ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* m# d5 f& \, d: q) Y
  14. *
    3 J/ ^' G5 v& q  C& H/ K3 q4 `
  15. * This program is free software; you can redistribute it and/or
    ( {9 a/ @% x7 m( o8 F$ V
  16. * modify it under the terms of the GNU General Public License as
    4 _5 T. \- s2 X, W2 @
  17. * published by the Free Software Foundation version 2.2 y/ n- a8 p7 Z  _
  18. *
    - s8 N/ ~: n6 d/ z5 l. e( ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 O( B( B( }/ _5 p( M" ~
  20. * kind, whether express or implied; without even the implied warranty; Q3 \4 W$ Q$ S4 L4 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; F0 G' |' b5 q4 H& ?
  22. * GNU General Public License for more details.
    " L) M4 s# C8 F# ^, m3 h
  23. */; L. e; f. _' T1 \/ O$ P, K$ f. E
  24. 4 O+ a1 m, P; {$ i( w" b+ ^# X/ z
  25. #include <linux/module.h>
    3 i9 W& J5 E& ~( N( C
  26. #include <linux/init.h>
    . C+ x9 x. p! Q" c
  27. #include <linux/errno.h>. j2 v( k) }$ D' a1 S& H6 K
  28. #include <linux/types.h>& t$ `9 m5 U! w) U6 f- r
  29. #include <linux/interrupt.h>
    7 c. `0 d/ U* O, |  L* _& }+ @
  30. #include <asm/io.h>4 |) p  J$ U/ A
  31. #include <linux/moduleparam.h>
    * F2 b0 u" ~! X& Q& G: }& G. Y2 w
  32. #include <linux/sysctl.h>
    9 k- [& a; N/ b9 L2 i
  33. #include <linux/mm.h>
    $ X9 M# f; R  ?. f4 J0 U7 d
  34. #include <linux/dma-mapping.h>
    . z2 q9 Y/ W, R. ?& u/ T: Q& f! e
  35. : |( {0 F$ h; y- N2 C
  36. #include <mach/memory.h>
    3 g- ]2 h  S  `( H  t* N2 f
  37. #include <mach/hardware.h>( u$ L* q/ t1 _- {& a* f# P' H
  38. #include <mach/irqs.h>
    3 c. p/ q) t5 X+ q8 _+ r
  39. #include <asm/hardware/edma.h>
    6 A8 A$ p, }# L
  40. 7 Z6 g! U6 A7 l5 @
  41. #undef EDMA3_DEBUG
    . Q6 ~) l/ n% B3 t, \$ f' ~% ~
  42. /*#define EDMA3_DEBUG*/
    / N4 h! P1 }& R- A" k6 |4 m

  43. - S2 J5 {* z- y9 p$ {
  44. #ifdef EDMA3_DEBUG' j: u3 w3 h: q! k; E) e, J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' r7 q4 G. z, m0 ^# t) m0 t6 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! \7 h4 d# d1 t+ q* A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 X+ t6 O* Q- u  w, H
  48. #else
    : j+ B) k; F, u. P8 e: [7 O9 V- P  I
  49. #define DMA_PRINTK( x... )3 S! P  o9 z, ?3 i# ]* D' {1 T
  50. #define DMA_FN_IN
    4 ?" l! n1 _  u3 s
  51. #define DMA_FN_OUT
    / _; n5 z' X# R& D
  52. #endif
    " s! w8 [% R: ^6 G5 Z

  53. 2 t# ~& {% j& Y+ O0 Q6 n3 \( Z% y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : G. q' i& C! v* y. A
  55. #define STATIC_SHIFT                3* j1 N& u  y- J% `% h
  56. #define TCINTEN_SHIFT               202 T1 k' X$ s$ z5 o/ _
  57. #define ITCINTEN_SHIFT              21
    6 u, h' @5 P# O8 [# l: s. Z! `* j
  58. #define TCCHEN_SHIFT                22
    - P: k7 ~- S8 ]5 F
  59. #define ITCCHEN_SHIFT               23% Z* u+ o$ J  ~  q( c6 y

  60. 1 r. F: I9 S8 h
  61. static volatile int irqraised1 = 0;3 d) O& j" Q& H+ s% H4 \4 ^
  62. static volatile int irqraised2 = 0;
    4 n( A- n; I) p+ e! P* M0 I4 H
  63. # T9 u1 u" z( t+ B9 @/ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 k5 ~2 X! X* M2 i/ j3 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      t3 v+ }* M: F7 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G6 F1 j+ T: r* a. j& g
  67. ) B& ?% l' Z- X- E
  68. dma_addr_t dmaphyssrc1 = 0;
    " V$ R. a3 M% U/ f5 W2 {" C
  69. dma_addr_t dmaphyssrc2 = 0;
    2 Y" o: J5 N, F. J* s: L1 H  o
  70. dma_addr_t dmaphysdest1 = 0;) l3 _6 A1 _3 V
  71. dma_addr_t dmaphysdest2 = 0;+ e3 L1 W1 ]8 @7 G4 M" {

  72. # v6 i' L* @) Z& G5 _  n" P* W2 \
  73. char *dmabufsrc1 = NULL;$ D8 c- F4 S: }- m
  74. char *dmabufsrc2 = NULL;
    0 J, }4 U- P8 t" y, u0 n
  75. char *dmabufdest1 = NULL;
    5 R2 Q: z7 m; n  g  \" m
  76. char *dmabufdest2 = NULL;6 C+ \9 |. T0 f% a' Z1 v- Z

  77. + \6 g* v: I! C: c0 p) F1 S) z
  78. static int acnt = 512;
    9 y7 Q9 `- y3 f  @. G& ?2 l
  79. static int bcnt = 8;
    - p* I) f% a! I
  80. static int ccnt = 8;! P" K% i! @3 p4 P9 V9 R. A
  81. . a& {. H/ u( n' r* O7 t9 N
  82. module_param(acnt, int, S_IRUGO);8 F9 T- F+ k% E: G0 Q# a' j
  83. module_param(bcnt, int, S_IRUGO);
    7 o+ Y: P/ w* U7 ]7 j7 ?( E* f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- a9 H' Q5 @8 U3 r+ p* w* U
4 H# r: B8 f0 |* b9 H1 r9 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @* W: ]% t; \( O; yarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x  v/ @  N. Y& j1 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w9 T* ~, {" E
+ A  u5 b0 |" ~
0 ?: E+ x% i' _: ^9 G# @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-15 17:51 , Processed in 0.039058 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表