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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ^( H% c  ?3 ?* q
  1. [code]EDMA sample test application
    ) m5 H7 c  I/ K' ]- h: {' [
  2. /*
    $ R- n( w* M: g. S0 Q
  3. * edma_test.c
    ! o1 a& H* L' r2 c6 D! v0 F: D0 {. M
  4. *
    / r5 \$ W3 y9 |7 r: g' v% z% c
  5. * brief  EDMA3 Test Application, C. m7 S  A2 f4 b$ v! \# i6 m+ z' p
  6. *% z5 Y8 k8 i6 S$ i: J  L0 w! ]% L
  7. *   This file contains EDMA3 Test code.
    & ^" d3 d" s. a# e$ |9 U4 U
  8. *
    ' R9 W" A) z4 F3 ^$ e% H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( N' J4 I% F$ [+ ?; R. f( N, ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" T& z) S+ S2 E
  11. *         TO CHANGE.6 @: X) J* G$ v9 O+ L% l
  12. *
    % X2 y9 Q1 {( o' G/ A( j" [3 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z8 K5 X: s! [% a
  14. *
    & d! x' [* Y6 H9 b3 `$ Y* ]
  15. * This program is free software; you can redistribute it and/or2 m, r$ S, N5 _% \, ^* i- O
  16. * modify it under the terms of the GNU General Public License as# G( G5 h5 D+ d7 R) Y; p
  17. * published by the Free Software Foundation version 2.- |; ?- [8 `$ [! n% R
  18. *
    " a1 V$ J* G# h3 s5 X( W. `6 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ R  W/ W* e# w( B; \9 ?! {
  20. * kind, whether express or implied; without even the implied warranty
    ! z! n, Z% A) j+ N. p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 Y+ T( A8 ]- f5 r1 }6 R
  22. * GNU General Public License for more details.
    & e" t. ~, Z  e) A; I
  23. */
    6 s9 S7 O! F* f) n* _* j$ Y! e

  24. 8 |0 B) _; J, m% y$ l; D3 \# o
  25. #include <linux/module.h>
    6 H+ [- i7 B9 h" D% A! b
  26. #include <linux/init.h>
    : C; E* S! v; w* w8 p1 w. J( L
  27. #include <linux/errno.h>- M9 Y" V8 B, W0 |6 U6 D" H0 c
  28. #include <linux/types.h>
    - j# ?% r0 J0 s- h6 ]/ B( g
  29. #include <linux/interrupt.h>
    : ^/ `$ Q  a' W. A' B+ y
  30. #include <asm/io.h>
    % G+ ?" F  @( X
  31. #include <linux/moduleparam.h>0 u% }% m, |& V; w' O
  32. #include <linux/sysctl.h>7 S" k' }# Y9 a9 t% e
  33. #include <linux/mm.h>
    : W" L( I; s, Q6 w& Y" G% G
  34. #include <linux/dma-mapping.h>
    , F/ f: S' J4 P) t3 j, u/ \

  35. 3 i, H; O( B9 I! C  @, }4 r
  36. #include <mach/memory.h>
    4 C$ ~& ^  n! e& d) ?
  37. #include <mach/hardware.h>) m& y2 [: W: u; _
  38. #include <mach/irqs.h>
    - r2 D6 Q, i! F! `4 D
  39. #include <asm/hardware/edma.h>
    9 h8 D6 }; F9 g2 c
  40. * @) l' l" G3 e& ?! Q& b8 z" \/ L' K
  41. #undef EDMA3_DEBUG
    5 V* R# d3 u  Q
  42. /*#define EDMA3_DEBUG*/$ H1 k& k0 m" W; E

  43. 7 l. i1 A3 O9 z; ~. u
  44. #ifdef EDMA3_DEBUG% ~, Z- J0 s9 _& g2 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( x/ r7 i5 {+ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^  n% o8 N: Z- d- Q7 R9 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ^8 O; o( S2 A. K6 I# |' u
  48. #else
    ' U  T) `6 \+ E
  49. #define DMA_PRINTK( x... )6 P: e; `5 O, `) D9 z/ b8 u9 d" ?
  50. #define DMA_FN_IN
    : X$ a( i# B6 L4 u
  51. #define DMA_FN_OUT
    2 l' ^) t1 E" c! ?% N
  52. #endif
    0 b/ c) S8 U2 B8 I8 s- b& R) I
  53. * w$ a& |9 r9 S5 _/ C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); m% y* C5 N% ?+ w- m
  55. #define STATIC_SHIFT                3
    4 P2 B% `6 D3 p  U2 v. l
  56. #define TCINTEN_SHIFT               20
    ( E5 G% _6 s$ l0 Y
  57. #define ITCINTEN_SHIFT              21
    + g& o/ h$ K5 P& p
  58. #define TCCHEN_SHIFT                22
    : Q$ Z1 p; K8 M3 x) p0 }" m
  59. #define ITCCHEN_SHIFT               23( j: M3 J2 e1 ^+ d9 b! B- I

  60. , X( v  \' P( F6 Y
  61. static volatile int irqraised1 = 0;
    % t& J! }* i: B) `1 G
  62. static volatile int irqraised2 = 0;" J/ \) p- Y" U: C# T' y( v

  63. 9 V! d2 }  o$ |2 `/ _+ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . P; W! X1 ]$ V1 q9 p9 l0 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U9 S8 c; ^* ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 B8 s8 R5 y' W; |* W: A1 g' U

  67. ; h/ L5 N. a; l7 p1 W: {0 R
  68. dma_addr_t dmaphyssrc1 = 0;/ }8 t, p2 S- h* R
  69. dma_addr_t dmaphyssrc2 = 0;
    + \1 e% u) s: H  W2 K- M. V& ?
  70. dma_addr_t dmaphysdest1 = 0;( A! ~! ]9 N3 r3 E2 l0 A
  71. dma_addr_t dmaphysdest2 = 0;
    1 i: s( n# r6 y2 }7 f
  72. , a2 g6 k1 Y( ?% B; O, q: b
  73. char *dmabufsrc1 = NULL;
    4 n! C+ @, k2 y; w; [/ s
  74. char *dmabufsrc2 = NULL;
    5 e* H+ \' B( L( a0 Y7 }
  75. char *dmabufdest1 = NULL;
    ; a. b4 T- y0 \& w* }) p. A
  76. char *dmabufdest2 = NULL;5 C, g1 i3 U& p: l
  77. . a2 X) g! U; K
  78. static int acnt = 512;+ v$ V" @/ N3 r+ W) B* A- D
  79. static int bcnt = 8;
    6 P# |) X9 _! S9 \
  80. static int ccnt = 8;. F* m1 I) d0 F& f

  81. / e5 X! s" I7 S5 E1 e. L1 {
  82. module_param(acnt, int, S_IRUGO);- }5 U( o0 I8 K* p' N
  83. module_param(bcnt, int, S_IRUGO);2 D/ T6 i5 K4 w. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 }" ~# k) c% h8 Y& q: u" J; b# Y& P
) @) z* B2 @/ T1 d8 ]' M1 i! ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ X  V& F3 H/ n8 h$ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  m) _' N# n5 n6 V% b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) F# W% `' q- [$ J! h1 k2 `: }

3 [3 E1 j8 g8 \& b
( f' R/ }7 H2 n7 E* \# v! n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 22:21 , Processed in 0.052772 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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