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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( I& E% k: a8 @8 A8 I4 d
  1. [code]EDMA sample test application
    , E, ^- w2 o: {9 r5 I
  2. /*
    % D1 g: Y( K$ f/ m9 b* B
  3. * edma_test.c3 a* |) q3 j  Y& o% ~* E2 M) h) f1 ?
  4. *# [. l% x; K2 c2 E
  5. * brief  EDMA3 Test Application
    $ W4 s# w8 @/ F! r  c. h4 @" c1 _
  6. *" n4 D, F% D& Q9 p6 d
  7. *   This file contains EDMA3 Test code.! d% f2 n2 k$ ?- b
  8. *
    ( d" \; r3 C4 Y# U! }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  B+ ~' h# b, Y7 S. N* u# R( _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ T2 v  L8 g( O( k3 v! m# D
  11. *         TO CHANGE.
    ( r) C) O' x/ ~
  12. *8 \2 H1 U' ?6 R5 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ c$ n0 ?- D* l
  14. *
    ) h6 ?: ~% q3 C2 H* ~: a0 o5 [
  15. * This program is free software; you can redistribute it and/or
    ' w' B- b" I; k$ S) M4 \/ G
  16. * modify it under the terms of the GNU General Public License as. }  w  ~, B5 W% E0 C
  17. * published by the Free Software Foundation version 2.$ p( |, B: A& N/ ^/ ?: B; J. s
  18. *+ O) q" @" W- Q$ t4 u  K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + j. h9 z  l! u5 a3 o* q! \
  20. * kind, whether express or implied; without even the implied warranty
    ) C& E6 F5 o8 N5 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' t, W, F5 Y3 k; e: G' v
  22. * GNU General Public License for more details.0 e+ d# E. R1 f, g2 k+ @4 N
  23. */
    - E: @# e; _, r  }/ f* _/ S
  24. + m- u; [& t! Y( ~  b
  25. #include <linux/module.h>+ Y9 ^8 l8 u1 |6 v
  26. #include <linux/init.h>% V( s1 T9 K8 `! M! w6 `
  27. #include <linux/errno.h>
    . Q9 q4 C- ^2 ^8 T( y
  28. #include <linux/types.h>
    / T! U! [7 K/ j
  29. #include <linux/interrupt.h>
    / g& o' D9 q% j% K4 V5 j& t
  30. #include <asm/io.h>0 G' s# c9 _/ {( j( }
  31. #include <linux/moduleparam.h>' w  U5 h9 [6 W. {# o, \! C
  32. #include <linux/sysctl.h>; ~( D% u7 q& m' j: Y+ ^" w
  33. #include <linux/mm.h>
    # `; g! ]( {7 v* Q) ~  [
  34. #include <linux/dma-mapping.h>  a! Y. F! x5 P+ u/ n3 c* Y) H
  35. # Z+ x2 O& i: ]6 F" g* a' o( F
  36. #include <mach/memory.h>
    6 a  F9 r0 w$ z2 w
  37. #include <mach/hardware.h>
    4 b  q& q1 h9 s5 ^: M. c
  38. #include <mach/irqs.h>
    ' m1 }6 A; J. F
  39. #include <asm/hardware/edma.h>* `" J$ p; u5 B" Z' w% B- \- @

  40. % n5 C1 s8 t( l( i1 C
  41. #undef EDMA3_DEBUG9 s1 [* j/ S8 U0 S+ I, Z
  42. /*#define EDMA3_DEBUG*/9 b- `4 Y$ |2 @7 L
  43. 7 I! O5 z; B* c% S7 \  _
  44. #ifdef EDMA3_DEBUG0 T% l0 ^3 Y& F! h+ T- P, u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 g( |, q5 D; L; o+ a; U; y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 J/ v4 @' N- ~2 g4 x& j: F1 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * v4 {/ A6 h! c! S" ]
  48. #else: M( r4 G# j( j5 Q3 ]8 C
  49. #define DMA_PRINTK( x... )6 @" U; q+ s" U" I) L. N; P+ X
  50. #define DMA_FN_IN; X# n5 i1 E2 ]. E: S/ j3 s
  51. #define DMA_FN_OUT+ }" Y( D* Y6 h1 [; H6 g$ U
  52. #endif
    . V8 E5 f% o( `
  53. 9 j/ c( `9 C# s9 m0 C9 ?! [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; n0 x9 o& o3 t0 m) ^5 a6 C
  55. #define STATIC_SHIFT                3
    - N4 C7 T% Z! V& O" a; y3 A% n
  56. #define TCINTEN_SHIFT               20/ E6 _! v5 [; J! O# y8 ^) K' l4 S! c; b
  57. #define ITCINTEN_SHIFT              21
    3 u, a9 x, j: i5 x+ {
  58. #define TCCHEN_SHIFT                22
    ; X% r; o; z1 Q* i/ t
  59. #define ITCCHEN_SHIFT               23& n# X' R: h& ^/ ]* V4 D- T4 g4 Q

  60. / U# \$ ~& R6 ^
  61. static volatile int irqraised1 = 0;
    / N$ o' e' |" p# J; J
  62. static volatile int irqraised2 = 0;+ @! d. ~2 y% U$ w# p, l# v* e" x

  63. 7 z6 ?. _6 k# q( r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r; [; j, P* T7 G; Y/ d) z5 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?9 d, f: g/ S. }- I9 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e) K. j9 r0 `! U4 W) d

  67. % j3 S; a) S$ n% {
  68. dma_addr_t dmaphyssrc1 = 0;
    ( e- |" g% h, |3 o! n
  69. dma_addr_t dmaphyssrc2 = 0;
      e) {3 x0 t- t! C. {* k! v
  70. dma_addr_t dmaphysdest1 = 0;' G( Y; H; E/ T+ u4 R) j; D
  71. dma_addr_t dmaphysdest2 = 0;
    % |0 I/ l- N( e: Q

  72. % k. `5 ~" P# w1 a* d0 q
  73. char *dmabufsrc1 = NULL;& {) i& j1 p. Z$ V
  74. char *dmabufsrc2 = NULL;
    . z- v6 p  y& z5 h& }* y, r1 n+ b
  75. char *dmabufdest1 = NULL;! V, n/ L. l& e, m$ v
  76. char *dmabufdest2 = NULL;3 Y& ]' g# R+ ~1 i
  77. + y% Q3 {& l7 ?' @1 T
  78. static int acnt = 512;- y8 O. i3 ~6 h- G0 J
  79. static int bcnt = 8;' D0 K' R5 _' O) m4 c6 U1 g" Q
  80. static int ccnt = 8;
    3 ?0 t" s' }) V  B: x

  81. 1 j) ~8 f  \& g" A  {8 Q6 d
  82. module_param(acnt, int, S_IRUGO);
    % w' T3 g: I9 }( y" k
  83. module_param(bcnt, int, S_IRUGO);9 Q0 z  C: z0 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' q$ O- }. k2 D, ]- F: J- j) m& q$ }
4 A! h* y5 I+ y; f/ _. e# F8 }: j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ f% a  X! \/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( g8 S, f! K- E/ S5 J, Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 S  j) z7 J4 b& s) f7 ]. m
% P; Q$ h/ o6 }4 A1 Z# @, X7 h) m- ~0 b3 J: z& ^" a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 16:33 , Processed in 0.039526 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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