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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R- N! f7 C- D
  1. [code]EDMA sample test application6 \4 M0 O+ U0 A0 A5 N
  2. /*9 o4 J2 i& U4 [$ d
  3. * edma_test.c# |5 J5 [: u' ^& l7 ^7 _& _
  4. *8 l- `# t. k) R* Y' H1 i
  5. * brief  EDMA3 Test Application
    5 |; G1 K& ~' e1 C# J5 o
  6. *
    ! s- j) X3 ]$ ?, @4 R" {
  7. *   This file contains EDMA3 Test code.
    : R$ {7 r' H2 I" K* m) h# Z
  8. *( b3 K- [7 `+ p+ h& u7 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' v& }" d. O, N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& R, p2 p. W2 T
  11. *         TO CHANGE.& t) u  R9 Q2 B) P
  12. *2 M6 h- P1 p; K) P- @& D: Y- p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 O  N/ F1 H: f- b" `
  14. *! p; C: J+ J, q- E% Q
  15. * This program is free software; you can redistribute it and/or( R! B0 {- R- [6 T+ J- S
  16. * modify it under the terms of the GNU General Public License as& b' C5 K; P, z; q/ W: M
  17. * published by the Free Software Foundation version 2.: @! s4 [* ^5 E; b  Y
  18. *
    4 C0 \% Q( ?; [( M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 b. |6 r. ^3 s% }- c* I
  20. * kind, whether express or implied; without even the implied warranty
    / a) E% t3 L) |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % M" E! a1 H& ~% v
  22. * GNU General Public License for more details.
    5 n% d3 r; w% q7 i  J) X. v
  23. */) V6 `! E1 |- u; Y: N" K/ n

  24. ; N; {# J9 ^- w4 Z( P5 B9 {
  25. #include <linux/module.h>
    0 m- d* B( u4 k8 n+ p2 y  B
  26. #include <linux/init.h>( e- U( w1 D; r( z2 I  |6 m
  27. #include <linux/errno.h>+ ^. |5 N/ L: |6 ]8 ^
  28. #include <linux/types.h>
    2 W# p$ }, ?4 b' g1 m, x
  29. #include <linux/interrupt.h>
    ( j/ Q" _. o0 ~# j$ p* L+ G
  30. #include <asm/io.h>
    / u" V0 T) d% e' i
  31. #include <linux/moduleparam.h>/ Z9 n8 |! [4 Y, @) o+ x
  32. #include <linux/sysctl.h>
    , U8 m, @: S& A* u7 W9 S, L$ e5 H0 M
  33. #include <linux/mm.h>" H/ A# h  L2 i
  34. #include <linux/dma-mapping.h>
    ' z! h7 A6 f6 C& a9 |, I) a  @

  35. ! N; `* X$ w) ^8 b1 y
  36. #include <mach/memory.h>4 \( e4 w) |2 `6 N
  37. #include <mach/hardware.h>
    . S$ ~6 S1 l4 h) o3 @# [1 g1 V
  38. #include <mach/irqs.h>
    ' ^. _6 v; A( _! s5 f
  39. #include <asm/hardware/edma.h>
    $ T3 X: S& S7 b$ g

  40. 9 Z  J4 h: `; B  _2 W8 c* b
  41. #undef EDMA3_DEBUG
    # b1 P8 E) z; p+ c
  42. /*#define EDMA3_DEBUG*/
    - `( D9 f+ z. m0 t% T7 j! |5 S
  43. 3 Q7 O9 u: f# _( S/ h
  44. #ifdef EDMA3_DEBUG# l6 b; N4 b% |; ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : a: h- D. U( H' h! @5 B# w! u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), d8 o# U& `7 \* Q& q4 N, P7 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 j- ]& ~2 a6 [0 {$ M6 U3 x
  48. #else
    ! N! \! N( V! [  m+ W5 d) }/ t
  49. #define DMA_PRINTK( x... )) v" {' f) ?2 d- x- G8 a
  50. #define DMA_FN_IN8 q/ j3 h, m6 E
  51. #define DMA_FN_OUT3 V4 o5 r+ @' r% j+ m; G. c
  52. #endif
    4 Q. g  v4 q5 G) Y% @
  53. " u6 v$ k. u7 {' ~$ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 b7 o, A9 m+ I7 H% P/ z
  55. #define STATIC_SHIFT                3+ O+ V" k# B$ k
  56. #define TCINTEN_SHIFT               20, N0 M8 U! e: v- {" U5 R
  57. #define ITCINTEN_SHIFT              21; u( ?( s" D/ r
  58. #define TCCHEN_SHIFT                22
    8 G' L5 ~- {5 n/ x- r% n1 C
  59. #define ITCCHEN_SHIFT               23
    ' `, |' |  ]/ x2 u

  60. ; m  M1 z2 |5 p- Z
  61. static volatile int irqraised1 = 0;+ V) V& x. H% d: F, s& Z& \$ Q
  62. static volatile int irqraised2 = 0;
    4 c2 M  S% u# k3 @: r2 {: x

  63. + v/ o! d* p2 h  a1 O: R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * W; S$ n" f  s- _! C; j& T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / `+ ]; h: W$ e! P2 F, i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ j8 i7 q2 Y: @3 q6 m

  67.   V- y- A5 l0 ?7 D& f: p# q
  68. dma_addr_t dmaphyssrc1 = 0;, z7 r1 O+ Q- t. N
  69. dma_addr_t dmaphyssrc2 = 0;
    # E+ h& B% ?& f( q- q0 C7 D" A
  70. dma_addr_t dmaphysdest1 = 0;% {# G" ~  f, C5 D
  71. dma_addr_t dmaphysdest2 = 0;! ?% Z0 ^6 Y" K7 Y$ o" t
  72. 2 R5 ~6 n/ E) h/ T, b
  73. char *dmabufsrc1 = NULL;0 L6 h$ n& Z4 U% }: k
  74. char *dmabufsrc2 = NULL;
    - S* K" n8 U* g# k+ H* ~" s
  75. char *dmabufdest1 = NULL;
    / T& ^  y1 S. V0 @  d
  76. char *dmabufdest2 = NULL;
    ) o; b6 R2 V, p' y0 H
  77. , d/ Z0 F/ Q  ?; D0 ?1 E, }' K
  78. static int acnt = 512;
    * I. X7 w0 b% f) P$ t) }
  79. static int bcnt = 8;2 v6 V6 z0 B8 S8 d
  80. static int ccnt = 8;6 F+ E. K: O0 z# a

  81. 2 q& r- _5 z& k% p- ~* o) o
  82. module_param(acnt, int, S_IRUGO);
    ) |7 }! ?- X* t) _
  83. module_param(bcnt, int, S_IRUGO);# h3 ^  j4 Z- _" _' A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ J% C! [3 q; n0 S* |2 l  {+ O; E
$ g3 S! ^5 e  j  W$ p3 m6 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) |7 u; K7 J# l1 S) k6 t. N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 l0 m& M3 ?3 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! {/ e1 }3 Z. ^8 F# v& R; m$ w& J
$ O5 r$ ^% q- H7 p' z% Z& r6 x. C1 w0 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 01:50 , Processed in 0.040045 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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