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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . i0 n- i) `# M: m3 W( k* K9 _
  1. [code]EDMA sample test application3 [: I4 V4 q1 D# U1 z8 B
  2. /*
    $ W9 p+ e+ L$ r/ J0 C  W/ _
  3. * edma_test.c
    2 }9 b* z) @9 i8 I. E
  4. *+ n: R1 c: a# Z. }8 e6 H* O" p
  5. * brief  EDMA3 Test Application* W' g0 i6 x% p) V$ h/ M7 \7 i
  6. *
    & O7 X! @; {* i8 Z+ a  I+ K; i$ z
  7. *   This file contains EDMA3 Test code.& F$ h' Z; l. R) \5 C# e
  8. *
    2 w. K, e8 m! ~/ M! f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 A/ i. V' r4 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 k# J8 o" R: W; e' n$ W
  11. *         TO CHANGE.
    / F, E3 u4 u6 i4 k3 ~) {( G+ r
  12. *' D1 o5 ^& X3 t; \; Q7 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * W6 B0 w$ O6 l3 k0 B
  14. *
    ; F6 h( G1 _" t% G. T
  15. * This program is free software; you can redistribute it and/or
    9 |2 P- t: _5 z% K' f( v/ w
  16. * modify it under the terms of the GNU General Public License as3 S" K; l$ k1 f# i
  17. * published by the Free Software Foundation version 2.
    * g" d+ R7 a9 P9 @9 ^7 M
  18. *
    % s+ }( L3 `8 h6 b+ I$ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 c( P" n6 ^2 m* _& z8 j; r
  20. * kind, whether express or implied; without even the implied warranty% R! p. A" s( r0 @, _' Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 n$ x. g4 N) B
  22. * GNU General Public License for more details.
    ; N  ]0 B0 `) g0 S6 B, r/ Y
  23. */0 b+ o; W, K! o5 \. A- ], y! i
  24. # X: w) h: e) ?* m# k9 h) g8 c
  25. #include <linux/module.h>/ j- N5 H' ?% `0 V
  26. #include <linux/init.h>
    % b! s0 P8 }. v/ \% Y" g
  27. #include <linux/errno.h>' e1 I5 G# F4 B; N% X/ L# f# m
  28. #include <linux/types.h>
    4 f9 q& g+ A4 T$ V% G
  29. #include <linux/interrupt.h>6 A' I# m. @# R
  30. #include <asm/io.h>
    8 o4 s. Q6 `) m2 g1 p- |
  31. #include <linux/moduleparam.h>
    , \) z! }) E6 L
  32. #include <linux/sysctl.h>2 g# {: X, \& q% z0 I" P3 M; E
  33. #include <linux/mm.h>; f1 i2 T. `% n. r: N: E5 f! b
  34. #include <linux/dma-mapping.h>  P! U' r" F% f- u* `- ]

  35. / J, m1 q( B$ w1 F& s* l
  36. #include <mach/memory.h>8 L$ r) U- J9 }4 `, e
  37. #include <mach/hardware.h>
    1 L/ _, z! {" J  k7 x9 b/ s; o, u
  38. #include <mach/irqs.h># Y! r* k. X( D) S. z  J; o: j$ D
  39. #include <asm/hardware/edma.h>. a7 V& c3 h& @9 k3 k  D
  40. 7 G( M8 ~: E% F. r/ M
  41. #undef EDMA3_DEBUG; Q# v7 y$ t6 c
  42. /*#define EDMA3_DEBUG*/
    ' K- k$ F& x; t: h9 d; n" C1 z' c
  43. 7 R9 x0 \( R# b+ {" Y* h
  44. #ifdef EDMA3_DEBUG1 X. d9 Y3 `% `; h/ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 \# ?4 \7 ]$ @7 g; g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  P- S+ p0 h+ _3 v- ^4 v' W. T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( m# J( i+ S+ _7 {; K& [
  48. #else7 ?  r( i4 N5 w1 E$ l% c+ e; l  t; \
  49. #define DMA_PRINTK( x... )4 l6 u: Y- C" l# N0 I" ?- S! E- W# n
  50. #define DMA_FN_IN
    ! U1 M. g# Q7 E. x. P( O
  51. #define DMA_FN_OUT
    * S- O/ ~1 i  H& c1 ~4 @% z
  52. #endif
    ' b* `3 p: g( z/ B  h$ c

  53. ! S/ M2 j" z9 F2 L- i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Z8 q5 l+ L( Z9 [$ i
  55. #define STATIC_SHIFT                3
    1 [+ Y- f: R, _
  56. #define TCINTEN_SHIFT               20
    4 B7 E9 E: F6 ?1 t. m
  57. #define ITCINTEN_SHIFT              217 U; O' }8 V! d8 m  H' }
  58. #define TCCHEN_SHIFT                22
    & |9 U$ }' m/ {5 _$ P6 v4 Q
  59. #define ITCCHEN_SHIFT               233 ?7 ~, J5 ~0 u) Q

  60. / W8 q/ {9 a& p: m2 N
  61. static volatile int irqraised1 = 0;' R$ d' b0 Y9 `2 n+ M! B9 j+ Q6 j/ _
  62. static volatile int irqraised2 = 0;0 E5 t( ~2 N9 c# G) ^6 j! Z  x
  63. ! Q& B% i; x  s  ~3 P0 ~  m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O. F6 j' a& z2 L1 x, ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u* ^/ ]) e: M% X% X2 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I; l5 @- ]. t( o& Q
  67. 9 z! u& d- Q! _6 v) N( U/ O
  68. dma_addr_t dmaphyssrc1 = 0;3 F3 l8 x, B/ o9 P6 V5 @& b" Y" X
  69. dma_addr_t dmaphyssrc2 = 0;8 q- Z' Z$ z8 q) `" V( b
  70. dma_addr_t dmaphysdest1 = 0;. Y, P! n8 ?$ a
  71. dma_addr_t dmaphysdest2 = 0;1 {5 R, M$ n/ o  _
  72. 5 K- t' i9 ?1 o2 L* I. K: E
  73. char *dmabufsrc1 = NULL;, ~# m3 j; s1 c' `5 J  h: n
  74. char *dmabufsrc2 = NULL;
    " _4 t8 c" @6 r5 W& E( p+ d& O
  75. char *dmabufdest1 = NULL;
    9 i  i+ g" o7 o* o& Q5 B" u$ h, o( N
  76. char *dmabufdest2 = NULL;
    8 }4 a4 P$ ~/ i1 N4 _
  77. & v7 _) k. c( K7 O" q
  78. static int acnt = 512;9 K! x% r6 q2 D/ B4 @2 ^6 }
  79. static int bcnt = 8;' d6 f* d3 U' _. Y" @' n1 V
  80. static int ccnt = 8;: U8 k7 s2 O3 P: |, I' V

  81. ( X  I* c2 l! {' F
  82. module_param(acnt, int, S_IRUGO);6 j7 q5 v6 `) a1 C. v
  83. module_param(bcnt, int, S_IRUGO);  _7 Z" P, X7 n4 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) v* v/ t: t5 p8 j0 O% r- O( n$ B

+ H$ T" ~3 c" D0 [1 t+ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# N- P: M4 k, O6 ?; harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 W! Y5 j- W. b) b, e( [9 a& n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( V7 q$ ^7 X' u' a

7 }  R& k2 S  k( }
, ]& i# u1 @% h9 z2 ^- U7 E" m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 10:01 , Processed in 0.041266 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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