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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 `1 a% }! u/ U+ }$ x, A
  1. [code]EDMA sample test application# E) f) D# i/ f7 u  q* H
  2. /*
    7 v% m% ^, d7 p% P" Y
  3. * edma_test.c: y+ ^0 s% W! P; }
  4. *
    " ^# V/ p# a3 K! C& |, E
  5. * brief  EDMA3 Test Application! F& m# }' w) z& H
  6. *
    , z/ W0 Q, [) i% i5 |2 y3 u
  7. *   This file contains EDMA3 Test code.
    / a- }4 B( ]9 Q* V, d5 P
  8. *
    9 h9 h" M/ j# l/ a" C- X1 i0 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 d9 X/ [; @+ P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# i4 Q3 I# ^5 P' N
  11. *         TO CHANGE.5 y- `' z7 i5 v+ e
  12. *
    & Q0 ?5 K! Y9 p; A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" \0 T6 i4 y+ _/ i+ g( d9 _; |
  14. *' [+ \2 D: e2 X  n
  15. * This program is free software; you can redistribute it and/or
    5 [. x: o' n3 t% @4 e
  16. * modify it under the terms of the GNU General Public License as" i- _7 _4 `  B  V% M, }
  17. * published by the Free Software Foundation version 2.9 T" i. e% \0 N: [) N) T7 w' Z
  18. *( d) W6 t& M- \9 n0 L$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 g; s. B7 _+ R/ A, R
  20. * kind, whether express or implied; without even the implied warranty! K5 p& |1 D* ?8 n7 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! ?$ s3 P! y- L( L" x
  22. * GNU General Public License for more details./ N8 Y$ s& ~7 C2 W: W5 d1 ?7 [
  23. */
    * K( @4 e" m. F- X

  24. 2 K& c/ Y/ {# Y- J
  25. #include <linux/module.h>
    $ H5 A, B+ J4 D& T% o+ h
  26. #include <linux/init.h>
    # Q2 h& a, e7 S
  27. #include <linux/errno.h>
    $ d; i1 B! h" B/ Y% R; ~# J" i: K
  28. #include <linux/types.h>
    6 a, q! c3 L0 g% J1 s
  29. #include <linux/interrupt.h>
      H4 {. Z3 t$ \  q+ j* ]* c1 w* ?
  30. #include <asm/io.h>; x% @/ N" S' R0 Y
  31. #include <linux/moduleparam.h># _6 k( T3 W: Z2 L: w3 ^
  32. #include <linux/sysctl.h>
    2 [4 B) z& i3 s7 W" }
  33. #include <linux/mm.h>) J5 u6 V2 p2 G7 n, ~0 s/ e
  34. #include <linux/dma-mapping.h>
    , G& j! B6 R  R
  35. . n* r+ J5 m$ E9 \; z7 ^5 [
  36. #include <mach/memory.h>
    1 r& O+ z$ u% X. B! q2 b
  37. #include <mach/hardware.h>9 K" \. ]3 I/ `9 E; P
  38. #include <mach/irqs.h>
    ( v9 D. Y% k. B1 N  Y
  39. #include <asm/hardware/edma.h>
    ' D( j- C7 e  n- ~
  40. % d2 ]- c2 L5 W" j/ {
  41. #undef EDMA3_DEBUG- |4 i- X* p2 k, E: u3 j; l5 h3 r" Z
  42. /*#define EDMA3_DEBUG*/
    - F  V3 D' m' R
  43. 6 D( s. W( @9 L) F0 u
  44. #ifdef EDMA3_DEBUG7 k% \. f6 R6 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 X& k# Y" |, S) W0 M0 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 R1 J3 ~7 t' v; Z4 n' f7 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! s( j' _& T, [- S! f  `2 ]
  48. #else
    ; B  ~% [9 D) f& M- Z) [: j- i0 Z. C
  49. #define DMA_PRINTK( x... )
    $ G- s0 O: x" F7 C! @' l- K
  50. #define DMA_FN_IN) I, W% t4 M9 ]& J% m" g. V. T8 O
  51. #define DMA_FN_OUT
    , B$ a7 [2 O" s& N
  52. #endif
    # R2 ^- q6 U+ \' X

  53. 8 b! q- A+ C& a5 m; [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?/ u% K$ h2 C& k9 N2 N
  55. #define STATIC_SHIFT                3
    - k: g* U  @4 z4 w7 @/ [
  56. #define TCINTEN_SHIFT               20
    5 Z% k* I4 e) k2 x
  57. #define ITCINTEN_SHIFT              21$ g5 f' b) t+ L
  58. #define TCCHEN_SHIFT                22
    4 Z( T8 R! C9 ~/ n
  59. #define ITCCHEN_SHIFT               238 j9 H% C2 d! F# U! b  S# Q

  60. 4 d( U" L0 g2 h. N/ N
  61. static volatile int irqraised1 = 0;- z$ e- D3 c6 a+ @' d
  62. static volatile int irqraised2 = 0;0 c3 @' J7 W& @5 S) g8 E

  63.   j- f$ z; Z& c4 }/ f8 b5 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R9 y- h' i  Y7 A, C9 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" A1 L& ]3 v$ e' L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  f2 q" x; H8 {# G+ T

  67. - }5 ^( H: ^5 k8 x( [
  68. dma_addr_t dmaphyssrc1 = 0;
    ; ]2 i3 p! Z, D( O7 Z+ U* W
  69. dma_addr_t dmaphyssrc2 = 0;
      i& j  v# @% E
  70. dma_addr_t dmaphysdest1 = 0;! e8 ^7 `" R) ~' }( s
  71. dma_addr_t dmaphysdest2 = 0;$ M) u4 m% i- S4 ~/ a

  72. % B# |% A  G- u$ y% J2 E& M
  73. char *dmabufsrc1 = NULL;0 i6 H3 c$ I" i  c. v, a# Z
  74. char *dmabufsrc2 = NULL;! p/ j2 \; ^2 ?, [4 B. h( n5 d
  75. char *dmabufdest1 = NULL;
    1 U. |, b$ I" `: l! _
  76. char *dmabufdest2 = NULL;, }# o& e$ Z5 l' D! h! ]
  77. + T* V* I. S: h/ Z$ c) d
  78. static int acnt = 512;$ x( w6 [) c+ T& O6 n0 b5 ~- }1 J
  79. static int bcnt = 8;
    : L# W- A$ L: W, t% c
  80. static int ccnt = 8;
    & \+ w3 A+ A1 |  V

  81. ! m/ K5 d2 ^7 W  W3 x3 S" B% t5 N
  82. module_param(acnt, int, S_IRUGO);7 f  T: v, p: C7 j6 {) p9 t
  83. module_param(bcnt, int, S_IRUGO);
    + [5 g+ `0 K1 V$ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( J5 {& u& U3 u. I+ y  u1 `

" b1 m0 x# r$ e) k) W- j3 J( J, W- W: a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @  N4 {' f& x1 z8 {7 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( T, a" B7 L' H& K/ L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' h8 r6 v8 b, Y0 ]& k5 a0 y
' L) i) }" [4 s2 P: J+ @2 [5 ]$ E2 d) W4 i  x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 10:53 , Processed in 0.039817 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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