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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ~, ~9 {$ d" C, t. K
  1. [code]EDMA sample test application
    8 l/ H4 v3 J) f4 A% Z* D% i9 q+ v% o
  2. /*
    8 I; W9 U- |& M8 r$ x9 ]
  3. * edma_test.c: `: Z4 W0 P, W9 i) ?
  4. *2 }+ {  S" R% O  E  f( W
  5. * brief  EDMA3 Test Application
    # C# R) p3 \) q
  6. *( G% h$ n) Z' b# z1 O+ B  Q; H
  7. *   This file contains EDMA3 Test code.
    ' G# X- S( `8 [/ d4 l2 Z+ k
  8. *
    8 r; _$ T. g* X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : a* u( a3 B! o, w" ?0 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Z; H; s- a/ O7 g7 T
  11. *         TO CHANGE.
    $ m$ q% k( m: g' D/ G+ [' h5 m
  12. *7 A4 D. r* T9 y) p6 z$ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& n) H$ s8 D; y- t* n$ |3 |
  14. *8 s: A8 G  @7 e: q3 h8 D
  15. * This program is free software; you can redistribute it and/or" B4 d* q2 w% @% Z) s* g4 X
  16. * modify it under the terms of the GNU General Public License as1 l/ E5 _' B3 i1 F. T$ d# c& j5 ~3 g
  17. * published by the Free Software Foundation version 2.+ }3 r. |) O8 ^3 T, p4 X1 g
  18. *
    8 e% |; M+ `/ w) q7 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 O0 W& t. x; \) k
  20. * kind, whether express or implied; without even the implied warranty
    9 m: m) V- P0 o; }8 T- c8 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 q2 S0 t7 E: z) G7 R; f
  22. * GNU General Public License for more details.
    $ A1 b, z: I- m' j$ i) z* y' o
  23. */
    4 C1 D# V4 j, N
  24. $ }. B4 U5 g% |% j5 T
  25. #include <linux/module.h>
    , ^+ ]" V5 `9 {! z$ i
  26. #include <linux/init.h>
    7 W8 j5 t5 F' {" o
  27. #include <linux/errno.h>
    - U6 C2 X1 r8 E! X
  28. #include <linux/types.h>
    5 Q+ H' ]; A( F0 l
  29. #include <linux/interrupt.h>
    ! X7 c1 Z- e. p7 @, H% a
  30. #include <asm/io.h>. n7 V$ d) d- W, C; N
  31. #include <linux/moduleparam.h>) x; d3 L0 L, d5 f1 `
  32. #include <linux/sysctl.h>; D8 K* ~) O0 T6 |3 T
  33. #include <linux/mm.h>
    - T5 v' c1 C: a9 O. J9 a( j
  34. #include <linux/dma-mapping.h>* W( E1 ?6 I1 n

  35.   K1 `9 w  w# a3 z2 Q2 J: P
  36. #include <mach/memory.h>
      S) N: |8 a) G. T8 Y
  37. #include <mach/hardware.h>
      t& T# B: V7 N7 x
  38. #include <mach/irqs.h>
    * h( L2 N6 Z  \* Z7 |
  39. #include <asm/hardware/edma.h>* g' t9 Q/ h  R& N$ J

  40. # d: I- i+ f' y6 s
  41. #undef EDMA3_DEBUG
    6 O7 W9 |. e0 G
  42. /*#define EDMA3_DEBUG*/! J" W, A5 q' W
  43. . i* h7 Y! o, c8 G& J$ E2 U
  44. #ifdef EDMA3_DEBUG
    8 }& {& l) p' X. {7 g8 f/ L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 F& q& C6 J3 l! t5 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / I) Y0 K6 ?3 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ F3 v; Q- ~9 R& F4 T
  48. #else) b0 X. m1 ]% a3 j" b% n5 e$ ~
  49. #define DMA_PRINTK( x... )/ L- K2 ^5 A- X# @; `5 \! v
  50. #define DMA_FN_IN
    5 ~' {% b5 e' Y& U+ D1 e
  51. #define DMA_FN_OUT  b# J$ X2 ?$ l
  52. #endif) ^* {; L9 F: o4 |2 H8 O
  53. / a3 C) l$ S- M$ B9 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " @5 T# L- q- ^+ t9 W8 |
  55. #define STATIC_SHIFT                37 ?6 m+ L  i" X
  56. #define TCINTEN_SHIFT               20! A3 }  U6 h  @& T3 X
  57. #define ITCINTEN_SHIFT              21
    * ^' G0 W9 i; R$ t' @
  58. #define TCCHEN_SHIFT                22
    + K1 Y+ G# r* e% _, Z% X
  59. #define ITCCHEN_SHIFT               23
    $ P! R% S: a: t4 ?5 M7 y' c; U$ v
  60.   [4 e) N% H9 |/ M& Q
  61. static volatile int irqraised1 = 0;1 h4 [- Q5 Y( u4 t1 r
  62. static volatile int irqraised2 = 0;2 s7 [2 P! X/ f+ g

  63. ; w) r  ?: L) n( M' I3 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q6 z& x: B, D+ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z4 K) X% S3 }& L5 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 z  Z% d  O$ H; D
  67. + k) F& I9 J% ], y" `( c- R
  68. dma_addr_t dmaphyssrc1 = 0;1 Y" u5 r2 Z5 l* M2 x) L( {0 i. N
  69. dma_addr_t dmaphyssrc2 = 0;& s5 `+ [7 a  _/ j- V) |' a
  70. dma_addr_t dmaphysdest1 = 0;
    9 G5 T3 a4 C' N
  71. dma_addr_t dmaphysdest2 = 0;
    6 i( J6 {0 l( A# p# V% P5 V- v
  72. * f* A# P/ X* d
  73. char *dmabufsrc1 = NULL;  W% E9 Z+ U% L
  74. char *dmabufsrc2 = NULL;
    ; o: G3 e. p: q4 ~; W
  75. char *dmabufdest1 = NULL;( s5 \, i, e+ v* {' y% h; |! e
  76. char *dmabufdest2 = NULL;
    9 M1 ^6 X- ^8 `" n! X* z* ?
  77. ' X  L9 y2 Z9 [; o' y5 e
  78. static int acnt = 512;
    0 u, A2 T) d9 T  _* X) F4 J
  79. static int bcnt = 8;
    / ?+ p2 I5 T9 }* K: \
  80. static int ccnt = 8;0 u" o7 |' ?& ~! ?+ N% h, y

  81. 4 L. l2 q7 }) u' S! M1 L
  82. module_param(acnt, int, S_IRUGO);
    1 d3 T1 D( |+ B# B
  83. module_param(bcnt, int, S_IRUGO);
    5 u* ]" s" Q2 A& B8 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' f1 s2 X, [* ?% C+ a

& p: S# h5 i- M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. G3 L1 P' q4 u* O  E8 r$ [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' r" |- X, |* Z- B# Y3 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. M- P! W% P6 ^1 |4 x+ N

% K" @, @% v2 [. X) g+ e/ U$ N. ~" i  }4 Z$ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 06:40 , Processed in 0.043330 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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