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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 [: _  g, o7 |/ s
  1. [code]EDMA sample test application
    * o# t# D# u5 t1 F
  2. /*% m5 A3 t: |! ~( t# t2 Y" U: u
  3. * edma_test.c& Y6 t( j/ d2 P5 F& Z" ]( a
  4. *. d5 R& [: M* v) ]1 y( C6 {
  5. * brief  EDMA3 Test Application) }, m! y( ~& K2 T3 D. R' B* l
  6. *
    * X: g# E2 R% {2 R
  7. *   This file contains EDMA3 Test code.: h* E* [8 P( I
  8. *7 ^) U0 }% z4 V+ F% G# ^! C# u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- k' l& }4 `1 B! A. A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  y  S; J* u0 P1 `6 f  B
  11. *         TO CHANGE.
    $ z8 B0 U- Z1 O% f( J4 l
  12. *
    ) M9 K1 l- J1 Q/ J+ |$ ~4 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F" |/ Y% o( c2 P  c# ?( {
  14. *
    & t, i# [8 x" u9 N# `0 Z% _! F0 M
  15. * This program is free software; you can redistribute it and/or
    . z. J% {& i) t( F
  16. * modify it under the terms of the GNU General Public License as& w, P7 c! b- Z: C5 W  v' `' ]. K) d/ t
  17. * published by the Free Software Foundation version 2.
    9 H* R* z! d- _$ ^
  18. *
    ! G: U) z& t2 I4 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 }/ W9 o# P$ V% w% |
  20. * kind, whether express or implied; without even the implied warranty2 D* `# A8 j8 V: e5 y& u; q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ w# w* Y% @% [$ }8 A/ S, o
  22. * GNU General Public License for more details.
    0 T! l1 O, @. \2 ]. `
  23. */
    0 o3 l& v; X1 W

  24. 9 R9 A" K! j8 c9 e
  25. #include <linux/module.h>
    ' h1 \" S; ^: r
  26. #include <linux/init.h>
    & p: l" j+ D& l
  27. #include <linux/errno.h>
    8 t4 N" c% o+ f3 s+ p" W" n. x
  28. #include <linux/types.h>
    * r. v8 W' r) L5 s
  29. #include <linux/interrupt.h>* |1 n8 Y5 q) ~7 S% C
  30. #include <asm/io.h>
    8 B& h; x  t' C( O" D
  31. #include <linux/moduleparam.h>8 @- Q) e4 \7 N
  32. #include <linux/sysctl.h>) N! p2 l0 p3 }/ j6 h
  33. #include <linux/mm.h>
    : P8 v: e; X6 y2 |- a
  34. #include <linux/dma-mapping.h>
    1 D" D* H  f2 a  v6 F8 b- v% y

  35. 7 {* o- f: B5 m8 Y1 y
  36. #include <mach/memory.h>
    " Y2 @1 u5 a. |1 L/ ~! @) s5 L
  37. #include <mach/hardware.h>& z/ {* C& ]: F
  38. #include <mach/irqs.h>8 q$ Q, D# f$ n9 W& ^+ B0 J, P
  39. #include <asm/hardware/edma.h># m/ j+ ^7 h6 z- y3 n) T
  40. ! f' D/ g5 u  Q/ u* t4 e- a6 j  B
  41. #undef EDMA3_DEBUG$ u( f# a+ i* F+ B: t
  42. /*#define EDMA3_DEBUG*/
    % M) v/ v# a6 ]' |

  43. + E1 o  E& h1 k- P
  44. #ifdef EDMA3_DEBUG
    ) ], ?( ?& m$ [& Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c6 r$ T  Q1 r, C7 @3 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , S' h3 i# b8 b/ ]- s( ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % t1 N9 c1 P# W4 b) T, d
  48. #else
    , S  s# f, ?% `
  49. #define DMA_PRINTK( x... )
    5 t& `& a/ B3 U8 K! D( F) n7 s
  50. #define DMA_FN_IN- o- r& M! L/ f( F. P' h+ o$ S
  51. #define DMA_FN_OUT
    9 }! T7 F0 R0 ^3 }1 U: a3 n
  52. #endif
    ( ]# R+ x4 A6 @
  53.   V3 n" o6 L1 P( a6 p! J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ L9 \, n! z& H3 H: X7 j% N
  55. #define STATIC_SHIFT                3
    4 h  Z5 ?) t% }$ Y) s7 c
  56. #define TCINTEN_SHIFT               201 P/ n3 _' T7 o; b+ W: ~
  57. #define ITCINTEN_SHIFT              21) R# `8 u1 E7 [2 _& H& `* z9 b; E
  58. #define TCCHEN_SHIFT                22. _' a) G9 G  ]2 R! x# m& e4 \4 f
  59. #define ITCCHEN_SHIFT               23
    ( D4 V' P% P2 b6 _) H0 }
  60. - ^7 ~% r; U$ `! `  w
  61. static volatile int irqraised1 = 0;
    9 k, R% N4 i# W& n- a+ a$ g/ S; E: y$ x
  62. static volatile int irqraised2 = 0;1 {. q4 w% J9 T( K+ O: G1 S1 ~4 e( P% O

  63. . n2 U7 j) o1 x( l) [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }2 a- I  r* a# u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s0 y, s+ \+ {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' k' f" [0 @  o$ j3 f- ^. h& l; R, F

  67. 7 K. z/ \' d; J5 P) t) o, |
  68. dma_addr_t dmaphyssrc1 = 0;
    - y2 ?+ Q1 ~2 s0 O' w
  69. dma_addr_t dmaphyssrc2 = 0;
    " d) R, Q7 L# x: s7 T
  70. dma_addr_t dmaphysdest1 = 0;2 q/ A4 d  W/ Q
  71. dma_addr_t dmaphysdest2 = 0;
    . c( b0 q+ o" v; r$ _3 t
  72. 9 v/ Q! l+ }9 e! I0 B7 a7 v! X
  73. char *dmabufsrc1 = NULL;
    7 E' l7 \5 W3 R. m" T$ k+ r
  74. char *dmabufsrc2 = NULL;- Z- t: p- L: O  n2 H' H: u+ _. _
  75. char *dmabufdest1 = NULL;. I3 W) j$ h7 Y
  76. char *dmabufdest2 = NULL;) |; m3 T5 |0 }6 R/ U3 f
  77. % I# e  i: q: i: r# s1 s* z! B- h
  78. static int acnt = 512;
    " A. }* ?  M" j8 H, i4 ?  X
  79. static int bcnt = 8;
    ) Y& @1 S# _, u7 O1 ^; }/ J
  80. static int ccnt = 8;1 ^  i/ K! Q8 N3 F4 O/ v

  81. + G' u7 b) b% L9 A) [
  82. module_param(acnt, int, S_IRUGO);5 ?0 c; {# G& [" X- y
  83. module_param(bcnt, int, S_IRUGO);
    2 D6 b; V: I! a6 G7 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 G4 [6 H' \; x  `4 R1 Z

7 y% I. d) H: O3 \' f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J. u( e7 ^  x. o8 ~+ x  ]( m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) B7 Z$ C# I, Y% q. M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 k) C: M1 O8 o8 Z! s2 @

" U8 v* }  B5 i7 Z0 v1 p/ R$ o" y6 |% N0 ?- @/ K6 C- T6 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 03:23 , Processed in 0.039629 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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