OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 A% A) U7 d( u# z! [. a) _
  1. [code]EDMA sample test application+ n" q/ p# }) o) H' b$ F7 R
  2. /*3 u1 U% |& [" X9 e& [8 [
  3. * edma_test.c9 D' N1 T3 W0 l# t
  4. *
    ; i: b  v* Y, E& b1 i7 Y
  5. * brief  EDMA3 Test Application
    $ t- q' H5 {  U$ }$ |! _: Q: J
  6. *
    & ?, \0 r3 K( b! v4 Q6 n  k9 Z+ O
  7. *   This file contains EDMA3 Test code., G( s+ A* p4 m; c$ v- b6 x  }0 A
  8. *
    + _* v2 F9 V, L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ]2 }+ n2 y( L2 p* M/ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 z% S0 i! v. }' x6 N
  11. *         TO CHANGE.# u( Q2 r/ P: c( j& @. Z( K( w7 a
  12. *+ q1 H; R* a. t, |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. r' |" }3 @+ g& a# g% j
  14. *
    2 \2 L/ }0 [0 b
  15. * This program is free software; you can redistribute it and/or
    4 n; w. \4 _- V9 y5 N
  16. * modify it under the terms of the GNU General Public License as" f$ d+ N0 l* A; `% k( k
  17. * published by the Free Software Foundation version 2.
    ! V) g- `: {: u; r& A) [9 n4 ~
  18. *) U7 m( S6 K7 r+ k1 ?! v8 a% ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( ~$ a# r1 G' u0 o
  20. * kind, whether express or implied; without even the implied warranty: s' y) s8 v( ?& J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( i" H" C9 T5 O3 N- g) S* |. t
  22. * GNU General Public License for more details.
    7 L9 X* M  F3 D' C6 z3 u- L
  23. */
    . s/ J7 Z7 v" U( x" B; V
  24. : J1 ]8 p1 e& z- z& \
  25. #include <linux/module.h>+ [7 q+ S1 P8 T2 E7 v' P, t1 t
  26. #include <linux/init.h>- W! v7 \. o" [# A/ [7 m* L; Y
  27. #include <linux/errno.h>
    0 L- e3 p7 F9 j+ g
  28. #include <linux/types.h>/ X4 z$ k2 L$ f- Y& R
  29. #include <linux/interrupt.h>+ S" T% [) c7 Q! c0 ]7 b" H
  30. #include <asm/io.h>
    3 M. A) V! {* f. r* K
  31. #include <linux/moduleparam.h>% P  W$ r0 M$ X# X2 O. K. b
  32. #include <linux/sysctl.h>
    2 o8 J6 q* m% m% W/ G
  33. #include <linux/mm.h>, z* T3 ]' |7 C) R+ C
  34. #include <linux/dma-mapping.h>+ x1 D% ^3 r2 K. q) i* F
  35. - N% z% |5 z7 }+ x- A  q$ I
  36. #include <mach/memory.h>
    2 M! w' K1 v: J  [
  37. #include <mach/hardware.h>+ B! [) v( }4 w
  38. #include <mach/irqs.h>* b* ?# ~% ~$ @8 B
  39. #include <asm/hardware/edma.h>- m' _7 N- ?, t7 F6 m/ ]: N

  40. 3 X; H1 c) q$ J* a; w
  41. #undef EDMA3_DEBUG
    ' S8 e# z7 `! X" Y" n3 y
  42. /*#define EDMA3_DEBUG*/
    & h9 [% r  g$ n' B* R+ l6 @! C' V& E
  43. ) l! X8 |0 _! Y) }. m2 r* I
  44. #ifdef EDMA3_DEBUG
    , O, {4 R& B1 w8 b$ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , N7 d# w' S' @3 \" g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " R& f% {8 q% q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      k# u3 X/ g' }' }9 F
  48. #else
    2 B6 [# T. h/ T* r% x; Z1 ]
  49. #define DMA_PRINTK( x... )
    2 k( v! D8 q6 J. c% Q4 i% G
  50. #define DMA_FN_IN' A; ^/ q5 R1 g8 n  e+ ^* x' [
  51. #define DMA_FN_OUT9 k% U6 M4 _/ t6 t/ a0 D
  52. #endif* b1 v- ]4 F& X

  53. % z8 C4 u, @1 Y# F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 t4 E: H: e, B9 J
  55. #define STATIC_SHIFT                3
    " `2 m7 Y) R, g/ h6 X% r; l
  56. #define TCINTEN_SHIFT               20
    ' o' m$ B$ S% p! G2 b
  57. #define ITCINTEN_SHIFT              21$ d: ^% J0 b5 n
  58. #define TCCHEN_SHIFT                22
    5 y# i) q) p; {
  59. #define ITCCHEN_SHIFT               23
    . E- ~) ~9 d3 W0 U8 E3 w
  60. ! y! G2 o! ~# C' ]6 |2 M0 R
  61. static volatile int irqraised1 = 0;
    ' [" F! K4 v9 [: Z
  62. static volatile int irqraised2 = 0;
    ' X& p* [/ e6 h$ Z- g" t

  63. * ]0 R& y& v9 z; y& l/ ^* J- m( C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y+ S1 R" r3 Z/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; e7 M! _" ~- l2 u6 j3 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h0 N/ [  B4 Q3 h4 y
  67. . }3 ^7 H7 n% T, `/ p
  68. dma_addr_t dmaphyssrc1 = 0;! ^( [2 i5 \- o) c( t7 b' @
  69. dma_addr_t dmaphyssrc2 = 0;) b& n: K$ Q: o  |& B4 A* E5 K- ?
  70. dma_addr_t dmaphysdest1 = 0;
    " L# C& ~# H9 E# I
  71. dma_addr_t dmaphysdest2 = 0;: j$ e$ v) @$ ?; L( V

  72. 2 O1 H% K1 P; w  m; T' w7 b
  73. char *dmabufsrc1 = NULL;- g7 o" z7 z5 `2 E; o6 l0 p
  74. char *dmabufsrc2 = NULL;' O6 [& g/ R" \- m" D- `% P0 e  ?
  75. char *dmabufdest1 = NULL;% A4 M! Z4 P: s( g5 P- h. F
  76. char *dmabufdest2 = NULL;
    3 o) X$ c( g2 N* n9 B  f' D

  77. ' n  K6 X, D( w
  78. static int acnt = 512;
      W3 e3 @: K3 w7 g
  79. static int bcnt = 8;
    ; u: g# q! }" C7 V; u+ D8 I+ F
  80. static int ccnt = 8;
    3 {% {0 _. l5 K4 `

  81. 5 Y" m  h8 _" G/ i  x  S
  82. module_param(acnt, int, S_IRUGO);
    0 M+ U8 l- N4 X
  83. module_param(bcnt, int, S_IRUGO);. x, r) j2 x& Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 O6 ~6 _* Q7 l3 \# _/ D9 f$ ^8 O
9 }  c1 M5 W* ?8 ?! Q7 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% S. S, o4 @7 T, b7 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; q3 g  N' d" s0 _8 Q. q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 s( R+ m( P8 w6 E* e' l0 Y2 D% [2 B( s' \# w

. z/ R" }6 x) f8 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 23:33 , Processed in 0.036437 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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