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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" e5 C8 g3 Y" a5 Y/ ~
  1. [code]EDMA sample test application
    7 P! T; c. ?; L
  2. /*
    : Q: O/ L/ m- K
  3. * edma_test.c' u  Y' o% H+ J3 J
  4. *
    # u6 |) X. S) f2 A0 y
  5. * brief  EDMA3 Test Application" x1 {4 F" m9 Z+ @) X, i5 i
  6. *0 ?' K; O" M0 ^% ?4 k
  7. *   This file contains EDMA3 Test code.' C! x1 H& s0 U% Z: G8 x2 L
  8. *1 M% R7 Z# ^. ?4 n* K* }7 y' i/ f: O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + {2 h$ v; t3 e8 E( U: r7 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% E. i8 C7 N" t  K9 [
  11. *         TO CHANGE.
    3 x( ]  u# W; U- t- O% H
  12. *
    ) g5 Q/ L$ S0 o) P* G+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 J/ a! i, T! g3 W3 b' c! |
  14. *
    0 J1 d/ k$ S; |+ `
  15. * This program is free software; you can redistribute it and/or' s: J. Q2 L+ L3 u5 O2 \2 f
  16. * modify it under the terms of the GNU General Public License as
    / }) t( f8 @# i+ `1 f
  17. * published by the Free Software Foundation version 2.
    ( N9 Q9 K* G$ J9 f7 x6 s( I; r# M
  18. *" k. m5 C, C# D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 l! v& \8 M9 @# Q$ g% g0 [/ U4 t0 f
  20. * kind, whether express or implied; without even the implied warranty6 f4 i- {7 Q7 l1 n4 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; K/ M' o  ~' h$ M) X
  22. * GNU General Public License for more details.
    $ [* i: R6 P$ S/ f% g" I6 y
  23. */1 l+ S+ N. l! `1 P* W/ M+ @  b+ K

  24. # w, @, }6 M1 p; f1 @3 ?  S/ d* V
  25. #include <linux/module.h>
    % ]% m" d4 X, v- Z9 O$ N  `
  26. #include <linux/init.h>
    4 m3 Z, w6 p, J) V. M. N) q- ?
  27. #include <linux/errno.h>8 y1 r" q% |' t- @+ Z. O. U& M
  28. #include <linux/types.h>
    + k, J9 ~) @& z- H! E, t
  29. #include <linux/interrupt.h>4 L/ j( Q  H1 ^& ~, n+ s; V" U
  30. #include <asm/io.h>4 e; m9 D6 ?+ l2 h! N
  31. #include <linux/moduleparam.h>
    . w1 m  H) X9 Q) n! u' T3 h1 M- W, d
  32. #include <linux/sysctl.h>& D; ^$ [: D9 l6 x
  33. #include <linux/mm.h>
    * y7 D- ?3 W. ]
  34. #include <linux/dma-mapping.h>/ {" y4 `  Z0 B% c4 {
  35. & |- J# a( [7 @- _, H0 T- f
  36. #include <mach/memory.h>
    ) K( X" g' D9 h; Z. z" Q
  37. #include <mach/hardware.h>
    . @' p( I3 }1 {3 m3 F
  38. #include <mach/irqs.h>
    + v' m" C3 w! t& Z; z$ ]; |
  39. #include <asm/hardware/edma.h>2 F0 H$ H8 d% z1 n; l& [6 d6 g/ }4 `
  40. 8 @; A+ k+ e3 a8 j; ^* k+ Z
  41. #undef EDMA3_DEBUG
    1 u5 W+ y- r! n5 B
  42. /*#define EDMA3_DEBUG*/
    ' ]$ {; ]4 D9 r1 ?* X0 R( L

  43. + [. _+ n& }- I2 @  q. I) o0 G+ C
  44. #ifdef EDMA3_DEBUG& ]" I1 P: Z  l# L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). v8 L# H7 t3 |# x- ?3 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! y) S. j0 i$ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q" F: y# T4 H1 {% R) G/ B' Q; Q3 A4 R
  48. #else, a; ?) j" N. }: H* U
  49. #define DMA_PRINTK( x... )
    6 Q# Z/ j: o1 j1 C; u0 `( A1 B6 R( g
  50. #define DMA_FN_IN
    * N* R' h7 H" z9 i
  51. #define DMA_FN_OUT
    + f! s6 m  [! G. i, b& h& q: L
  52. #endif
    6 c3 T! z9 P. ?. @4 |0 d

  53. . O; o6 J. ^& W" h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * W" m4 v. P, `. G( C9 ^, e
  55. #define STATIC_SHIFT                3. o6 j0 h' |, o; L% L
  56. #define TCINTEN_SHIFT               20% c0 h2 A7 p1 j9 O: Y& w; K& F/ z
  57. #define ITCINTEN_SHIFT              21
    , n, O0 G0 T6 |! B: Q5 A
  58. #define TCCHEN_SHIFT                22/ n: O0 c& ?+ @
  59. #define ITCCHEN_SHIFT               23
    # E; \* z% Q- j
  60. ; g& s5 \9 u- J* @
  61. static volatile int irqraised1 = 0;( T5 B6 t1 `4 e  T
  62. static volatile int irqraised2 = 0;" C6 x; W: C8 \4 ~

  63. 7 l2 D/ n+ a7 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `+ W7 {- j: F& [$ p& H, \/ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p  j, o% k1 k- |7 I" L; Y3 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O1 l2 G% `! k8 b! }( X% Q
  67. * p3 g$ x/ C% Y7 R: U1 b: |
  68. dma_addr_t dmaphyssrc1 = 0;
    ! }. t' ?% K0 s& y9 h8 ]; i
  69. dma_addr_t dmaphyssrc2 = 0;8 l! z/ h' z$ W* Z- F* ^
  70. dma_addr_t dmaphysdest1 = 0;$ N* W1 [, |& ?1 U
  71. dma_addr_t dmaphysdest2 = 0;2 |+ g7 W$ Y. _
  72. 8 J) r6 m4 X  }  g) b, e# |
  73. char *dmabufsrc1 = NULL;
    3 A# B% B# c" S" _, d
  74. char *dmabufsrc2 = NULL;
    9 R4 R; V/ m, U8 d% ^
  75. char *dmabufdest1 = NULL;# d% Q2 `7 u9 F6 M0 E& K7 v! p
  76. char *dmabufdest2 = NULL;( |7 F" W+ b( V0 C
  77. 5 G, S6 ^; P& T4 m5 y
  78. static int acnt = 512;$ g, y/ O/ @; i! P2 i
  79. static int bcnt = 8;
    & p" Q* f$ _& R% R  [! c9 l% B1 i8 N2 e* G
  80. static int ccnt = 8;( N0 l2 p# S" c

  81. : ]. W- a8 l: }6 V! c  K" R
  82. module_param(acnt, int, S_IRUGO);
    0 e* d$ e& j! ~9 l* b, x) h
  83. module_param(bcnt, int, S_IRUGO);
    - R, d) H9 N  t0 Y! F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 A  S: W0 H0 d; n/ q

) f& {! K7 B" T: t. O7 g) w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 I% Q2 G, f7 d" S
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I' R: U; X& `3 {) {( V0 S5 w7 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 R% I. R$ N! t2 Z4 z/ F+ ?* [5 B

$ F9 H5 u: v5 m1 Z" V8 e. z- I! l' p$ Y- R$ A* g* m9 C' s' ^3 j1 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-18 09:02 , Processed in 0.039979 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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