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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b1 E9 a- ^" q3 d3 {' s
  1. [code]EDMA sample test application
    , j6 e( G* t) B) W  Z! m" o, O' w' _
  2. /*
    , d! q/ F1 G. V, H
  3. * edma_test.c' r/ _* g/ r* s& m' W* E0 S5 s
  4. *
    1 y5 w3 G- X, T6 O8 J+ D& j) x7 @1 n. w# y
  5. * brief  EDMA3 Test Application
    ! P* z* e( S7 a# g( s" _! E0 Y) t
  6. *
      E7 Q+ E9 {( l2 E: I
  7. *   This file contains EDMA3 Test code.
    ' a) [2 {% u9 Y
  8. *7 e+ u* }' k2 t9 }0 P" ]3 W2 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + K" Z5 r9 {4 O/ d% Z1 x( f6 K. u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& @% P3 G$ z7 a; m) K- y) v
  11. *         TO CHANGE.
    1 C$ g6 B5 u( a- }0 ]8 Y6 q: F( K
  12. *5 A- y- m6 ^- t" s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }2 s8 E: C+ L
  14. *
    & y1 V4 ~# e8 Q( C
  15. * This program is free software; you can redistribute it and/or
    5 q, J; `8 q" V7 a. Y
  16. * modify it under the terms of the GNU General Public License as
    ! ^% E! C4 L2 {4 e) J' K% g: ^- X
  17. * published by the Free Software Foundation version 2.
    + I2 b% t/ t1 X: F- o9 X) r
  18. *, V: l0 ~+ K7 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 d! h* _7 v2 Q, l) V, |+ @
  20. * kind, whether express or implied; without even the implied warranty6 s" Y8 U& T7 ^: k" O; ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) e; }9 j' q- _1 e4 q- A
  22. * GNU General Public License for more details.
    % L6 b* O0 K5 k7 f
  23. */9 \5 w3 d% }( y! e0 T; e% A# z+ U/ L6 u

  24. , u% ]$ u; O5 V5 {9 I9 n9 ?2 u
  25. #include <linux/module.h>, K1 w; [7 S) E. O0 D& l
  26. #include <linux/init.h>  l2 L4 U! ^9 v* l
  27. #include <linux/errno.h>
    - F% P4 ?2 Y/ {. {
  28. #include <linux/types.h>
    0 S7 y2 ~& Q! t, j' |
  29. #include <linux/interrupt.h>
    " Z3 L& j5 x2 U- e
  30. #include <asm/io.h>- i4 |0 Y8 V  w* q3 f! L* r$ X
  31. #include <linux/moduleparam.h>- r# M( j  C- I9 s: A& W& T
  32. #include <linux/sysctl.h>
    & w+ c7 Z( [, |4 j
  33. #include <linux/mm.h>
      G7 ]# R$ r" U3 `" u
  34. #include <linux/dma-mapping.h>; r! u; v5 ]" w+ a9 s3 u
  35. - N7 e2 j! O  b1 r
  36. #include <mach/memory.h>6 x1 a1 }2 w9 E: _0 {, o0 S
  37. #include <mach/hardware.h>
    # l. {6 u* I; r& K/ _% z
  38. #include <mach/irqs.h>
    0 M  G7 x* c* S* E0 J$ n+ E
  39. #include <asm/hardware/edma.h>! }7 O& u9 F- Y( `: n

  40. : t$ o% J) T& H
  41. #undef EDMA3_DEBUG
    2 z) f9 S  }/ X: v4 p: O) _
  42. /*#define EDMA3_DEBUG*/: F# m8 {5 i9 a

  43. 0 S8 D" x4 O/ |
  44. #ifdef EDMA3_DEBUG
    " W' P, @1 G% ?& h5 Q; N+ G* m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) u8 s! L+ [% \# e) x! v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 L) C4 G2 w2 a, m  {0 W0 w2 q( g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); f: c0 l+ \: `  I- o% n/ l0 x
  48. #else# N' b, _' Q8 i, G
  49. #define DMA_PRINTK( x... )  P# {6 [/ }$ e
  50. #define DMA_FN_IN
    + o, A/ F$ {9 Q& b2 Y( j+ R) k
  51. #define DMA_FN_OUT% V& H( s# k- e  z4 E2 ?
  52. #endif
    + k+ @" J  t, d: P  Y8 J2 \

  53. - y! W% d/ s5 ]+ c% o* b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! P  {  X& S" x0 z9 H2 W3 ]* `
  55. #define STATIC_SHIFT                31 c& ]% n8 s0 D" ^6 F. m  B* h
  56. #define TCINTEN_SHIFT               20; d  e4 I- }+ l8 N! f9 H/ F- Z0 f" l
  57. #define ITCINTEN_SHIFT              21( R: W0 a0 n5 H$ N3 D
  58. #define TCCHEN_SHIFT                22
    ' O% A8 m( x  }
  59. #define ITCCHEN_SHIFT               23/ U: [! T* A2 g. g& K: i6 W1 n

  60. " t, }4 K( E6 J* m
  61. static volatile int irqraised1 = 0;
    & t* R+ R! V# W! z, M; ]: ]
  62. static volatile int irqraised2 = 0;  M, o: d1 c/ `7 V, V

  63. & @8 ~; e0 Y" r) h8 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W" d2 l+ ]" f3 ?- S6 q2 E6 n2 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 s- W* L3 k3 ^6 C) {# k6 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ^7 G  d" R9 j  r3 Z- Q: m
  67. + L0 Q; v- b3 C
  68. dma_addr_t dmaphyssrc1 = 0;
    # E& w- k# W: Z9 H* Q- e
  69. dma_addr_t dmaphyssrc2 = 0;' p: s% v+ h! y7 Z: X
  70. dma_addr_t dmaphysdest1 = 0;
    2 u& R4 V% ]; d0 B/ Y2 k1 S
  71. dma_addr_t dmaphysdest2 = 0;
    : }- [$ ~2 F% k+ \

  72. ( ~/ ?& j5 P* O' Z6 F+ R0 k
  73. char *dmabufsrc1 = NULL;' T9 l6 I" f4 l6 z$ @
  74. char *dmabufsrc2 = NULL;
    % p& S+ D: g  l% v+ K
  75. char *dmabufdest1 = NULL;. S7 \7 K4 ?* M* u' Q, e
  76. char *dmabufdest2 = NULL;( Y! A. p5 w' c% I) m: Z" Y' w
  77. * C) a! D9 e$ y9 g
  78. static int acnt = 512;. C- d9 e! k3 T
  79. static int bcnt = 8;, H8 e* U! ?0 K0 y
  80. static int ccnt = 8;
    5 q  h7 p2 z6 G: J& {

  81. 5 O% [# f# c5 M, W0 Q, ?, g
  82. module_param(acnt, int, S_IRUGO);9 q5 q9 P, \" D8 p
  83. module_param(bcnt, int, S_IRUGO);' c+ C- i: M) C* s' R  f; L: S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) K8 y% P# q- q; n& V" W1 t" Q

% f1 [7 {$ P, ]  O9 W' Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y/ y# @) k* k/ _6 D, f# Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 r$ h) r! Y& J) g2 ]. [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v8 ~. O) o& f; ^

6 x# ]2 a; Q# w* H. F8 K/ L! \+ [& ]* L7 {  L+ Z* o' w" C, I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 18:02 , Processed in 0.058037 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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