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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z; l/ b' A- h
  1. [code]EDMA sample test application( a# h3 C9 I- {! s" u
  2. /*0 z' j+ W) g3 |: S
  3. * edma_test.c5 d; B9 w7 e# l# Q) O
  4. *
      Q4 D4 L7 s! r7 p! `' Q
  5. * brief  EDMA3 Test Application0 D, k: q0 H+ H6 y8 n& ^
  6. *
    3 _! P2 v, d, E6 O. g4 N
  7. *   This file contains EDMA3 Test code.( y2 M4 N" H7 g3 m$ m
  8. *& E6 _7 E) @6 l5 L5 Q0 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 h# Q$ z& b& ?- U  I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u1 X. j& n8 m$ C# T/ O# |
  11. *         TO CHANGE.
    " c: F6 E3 |7 ^( _* E# W
  12. *
    " P6 J# z; C7 L! v3 @4 N: c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( R4 W! W2 @( G  @% Q
  14. *4 `: L, I! V( S* e5 @
  15. * This program is free software; you can redistribute it and/or7 m5 _9 w" R1 I! \) h7 E
  16. * modify it under the terms of the GNU General Public License as9 t, l3 P2 d4 B
  17. * published by the Free Software Foundation version 2.
    / c8 j2 N7 c/ T* z( z# H5 K# f7 g
  18. *' W1 {" k) s7 ?4 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ a% r' p9 S) ^# }$ h. {7 y
  20. * kind, whether express or implied; without even the implied warranty
    $ n' U% G2 j* ?. g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) W/ _: ]! w4 m' ?6 P; d
  22. * GNU General Public License for more details.
    / @4 ]9 c. ^9 E$ [8 l2 @* @
  23. */
    - F+ x' y. Y2 @- ?# O
  24. 6 R3 O% Q+ x! {4 o
  25. #include <linux/module.h>
    6 N  N) a. \$ |2 C
  26. #include <linux/init.h>  n) d2 V6 x$ |# J0 G0 Z1 n$ E" u
  27. #include <linux/errno.h>3 r; b, \( B6 p! b4 F" e: X5 ]
  28. #include <linux/types.h>% c' z9 q- Y8 w2 z- d. [
  29. #include <linux/interrupt.h>2 V' {+ ~* n. g
  30. #include <asm/io.h>( m& m2 J* \* C5 W
  31. #include <linux/moduleparam.h>
    5 ?% C( ]3 f- z+ \1 l
  32. #include <linux/sysctl.h>
    0 ~8 w1 j* I& \- _5 C+ {/ P% Y
  33. #include <linux/mm.h>
    $ c1 c8 {+ G4 P; t
  34. #include <linux/dma-mapping.h>
    2 A7 I! ~; k1 y, j! |1 ^
  35. 2 x) l9 x/ G  V! D! H1 T+ U3 x3 f
  36. #include <mach/memory.h>
    * t% p: y) N, A- @7 O
  37. #include <mach/hardware.h>
    ' k+ o8 [* a6 Z. H" B0 g/ |  i
  38. #include <mach/irqs.h>' s9 R0 w6 O3 B8 g9 q, y' s
  39. #include <asm/hardware/edma.h>
    7 Y$ v# M6 B) Z$ ?9 O# {

  40. 7 K6 B4 K' l% P+ @
  41. #undef EDMA3_DEBUG
    : h) ?0 V6 h) H3 Y/ V
  42. /*#define EDMA3_DEBUG*/
    1 F! w3 ^8 B9 G1 r+ q

  43. * c  w; |& @2 X/ i9 w
  44. #ifdef EDMA3_DEBUG
    7 m: }/ I/ p4 y; v) `2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P  ]7 Q' x  Q8 J. \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * k3 N% p! K5 `3 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l. o- O4 Z$ k$ a% x! u. i- W& H
  48. #else5 |" V9 I3 X' S- P7 z" q
  49. #define DMA_PRINTK( x... )
    9 Q8 G7 M! m$ W0 B9 T9 I4 B! E' x$ W
  50. #define DMA_FN_IN
    $ {8 d4 W5 U6 o# V
  51. #define DMA_FN_OUT
    6 `4 V0 X* [4 M$ ]- o' c
  52. #endif8 r, j: F8 R1 O4 ]" o9 ]9 ^. K
  53. . A8 _- R& ^# R( C! X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ ~: {+ a2 m! M' g
  55. #define STATIC_SHIFT                3
    2 D4 o8 d9 Z- l5 E5 d
  56. #define TCINTEN_SHIFT               20
    3 m! h1 f$ p$ E+ M
  57. #define ITCINTEN_SHIFT              21
      m8 N* b; f! x2 ^- p5 w8 f9 s7 k* l
  58. #define TCCHEN_SHIFT                22
    & W/ l& X; S+ n1 ~1 O
  59. #define ITCCHEN_SHIFT               234 l$ R7 K0 y/ T; w4 W; r

  60. 3 x+ V2 ]& l5 t! F3 k) {+ w) }
  61. static volatile int irqraised1 = 0;
    ) _% A, e) J$ v& y
  62. static volatile int irqraised2 = 0;
    + r1 Y8 n, S1 T, e& ^  w3 `7 ?

  63. % j* @/ h; E& k- Q; I. G) ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z% i3 A6 v- j  I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " @4 F4 K2 Z  W- f) y; i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?+ V8 M6 |$ r4 l5 x
  67. , o8 O! j9 f4 ?
  68. dma_addr_t dmaphyssrc1 = 0;/ C. S; ~( m) H# c
  69. dma_addr_t dmaphyssrc2 = 0;0 z: x# z" x, h% D1 ]0 @4 p
  70. dma_addr_t dmaphysdest1 = 0;
    ) |/ y' X6 d! e. P7 U
  71. dma_addr_t dmaphysdest2 = 0;7 B5 |& ?7 `# q; B% N$ d" O! P+ Z
  72. 4 I5 _9 Q' j$ x6 w: E  G
  73. char *dmabufsrc1 = NULL;
    : ?" f! t- P. j8 A. }$ ~- f0 ^
  74. char *dmabufsrc2 = NULL;
    " u* k3 c8 n/ \( ], B
  75. char *dmabufdest1 = NULL;
    0 |6 n) O$ p/ h
  76. char *dmabufdest2 = NULL;
    / e9 @: a" x+ z6 }
  77. 1 b5 n7 @7 o* m) A+ d7 w
  78. static int acnt = 512;) Y9 w+ [2 [# V0 V2 w4 i2 e
  79. static int bcnt = 8;
    / i' s: {2 u" X- r. d0 S+ ?/ X: ]4 Q  V
  80. static int ccnt = 8;; J& J/ `& A: @  {9 I) ?3 \

  81. ! Z) j7 T$ C" ]% s. g3 |0 S) ]
  82. module_param(acnt, int, S_IRUGO);7 p* w* O/ {8 g0 u
  83. module_param(bcnt, int, S_IRUGO);
    ! o6 ^3 N' Y% C' l  M3 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, T! {: u; d" o2 ^& M! k2 B# V. N( `9 a. D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# k. b6 s0 X1 [" b" Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 i2 ~) j: |1 \0 q& y' P: C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k. g- H7 t8 _5 v6 o, _

$ j7 r2 Y* S( @0 v, F
0 ]9 Z% p2 S' @# V, D- {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 14:05 , Processed in 0.048220 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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