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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 ^# p" s0 D+ X* r) f0 E
  1. [code]EDMA sample test application6 l: C3 @2 ?+ q" r) d
  2. /*: ~, t; r1 z. j
  3. * edma_test.c! X$ ^) g) _# q6 ]
  4. *
    / j" Q( f9 U9 {! E
  5. * brief  EDMA3 Test Application
    + ?/ \/ v. s# r* h0 t* G
  6. *
    , O5 W" |9 e4 }! W1 |3 M. {) P. ?
  7. *   This file contains EDMA3 Test code.1 a) ~; o) P3 n# @/ {- J3 x
  8. *
    - d9 ]* n7 @; q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 e4 K, c( `$ Z$ ?' W7 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 w4 F( e6 H- Q
  11. *         TO CHANGE.
    " p8 V! b% H  T" A8 F9 N2 V
  12. *) l* Z, V' S3 n, Y7 |+ C* A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : Y9 R! A5 U4 p0 s& r9 G
  14. */ ?7 A7 v7 {6 m% g0 E
  15. * This program is free software; you can redistribute it and/or
    - e. N# W4 D# h
  16. * modify it under the terms of the GNU General Public License as
    6 v$ n  s2 j% B
  17. * published by the Free Software Foundation version 2.
    1 h- ^* b  d* P0 z6 _9 Q
  18. *
    # O6 K% U4 g2 @' D  b- G3 G8 K1 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; |4 Z' ~. g4 R, d* P
  20. * kind, whether express or implied; without even the implied warranty
      H' |4 L0 q! [4 o6 u1 d2 _- r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ~% f4 a! Z1 {! ~. K( W
  22. * GNU General Public License for more details.# S7 O6 O/ @$ R4 P9 n
  23. */
    & i) _  ^8 p- n& R/ V
  24. ' g. F5 I* ]% H) a( \
  25. #include <linux/module.h>
    . C% W. D' e# ^
  26. #include <linux/init.h>0 }$ }, {0 w2 C1 B2 r$ A6 p
  27. #include <linux/errno.h>
    # X4 a2 w( f5 f
  28. #include <linux/types.h>$ M3 O+ |5 h. P# g* h! [) p# z4 d
  29. #include <linux/interrupt.h>
    ! `2 E0 j: ~" @
  30. #include <asm/io.h>
    2 E/ i6 @4 E/ @& s4 z8 j$ H: F% D
  31. #include <linux/moduleparam.h>
    - g6 |( \$ `' Y/ V( A5 L5 e
  32. #include <linux/sysctl.h>
    2 B& o9 T9 M! m0 B) f6 D% I
  33. #include <linux/mm.h>
    ! W: s! R/ ^6 O5 m8 O  s, B. Y
  34. #include <linux/dma-mapping.h>
    ( [! x- z) \  U4 B; y, g+ z

  35. ; @- U: y) M# i; U
  36. #include <mach/memory.h>  M6 M/ N& A/ m$ m- ]3 D$ E' B3 H1 B" y
  37. #include <mach/hardware.h>/ k. P  [: s' }" U
  38. #include <mach/irqs.h>
    9 j9 |0 W5 n5 f
  39. #include <asm/hardware/edma.h>9 O1 O  L- G8 d. Q1 s4 a1 s

  40. 0 {1 y% \8 W6 \3 V
  41. #undef EDMA3_DEBUG: @: `9 R6 t; ]0 q6 ^6 l, t; d) o- b. W
  42. /*#define EDMA3_DEBUG*/& @- E* }: t6 J+ W. E% [2 p

  43. 8 w! _; P3 s+ r! Z% b! z
  44. #ifdef EDMA3_DEBUG( E; q; e: p4 _- \2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 z7 d& |9 x6 N9 T. o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q9 h" J0 \) a5 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 E) ~- y3 p- i& m1 {3 r. ]' Y) u( u
  48. #else
    3 Y% M) [# G1 @6 @
  49. #define DMA_PRINTK( x... )
    * ]: Z8 _4 C6 B4 q) y" [! L+ ?
  50. #define DMA_FN_IN
    / I" M9 e: a/ @( H
  51. #define DMA_FN_OUT
    " Y2 u, g& K7 j- z1 j
  52. #endif
    ) B! j0 {, {  P# f: R( s
  53. % ~' M8 y& y. E7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 T7 E7 r' h: f7 }+ Q( ]- j, c
  55. #define STATIC_SHIFT                3$ z- V$ I/ P7 s9 ~- {
  56. #define TCINTEN_SHIFT               20; E2 G# \& Z; r6 }: ~, u- u
  57. #define ITCINTEN_SHIFT              21
    % J9 ^# [! [# f( }5 r
  58. #define TCCHEN_SHIFT                22- ?* V1 V- |& V: n! Q! E2 |
  59. #define ITCCHEN_SHIFT               23* j5 U: P4 b/ ?7 X0 h, R/ A6 t6 P
  60. ! r9 t; k% e( e; M
  61. static volatile int irqraised1 = 0;/ q, r9 A! k. H- w
  62. static volatile int irqraised2 = 0;8 |" q, E+ b# g- y
  63. ' V6 ~/ ]; B4 j. r0 {$ r1 A: S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }: e3 l0 `# n( f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 A7 j8 d: h. u2 r# B% O( x0 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R! D4 G# c; w4 ]
  67. % c0 E2 o1 B# _, {% n; \
  68. dma_addr_t dmaphyssrc1 = 0;
    2 O, O: A; K" J1 `& k. x; Y7 ?' \
  69. dma_addr_t dmaphyssrc2 = 0;
    / R. ]0 E, }$ q% a( A
  70. dma_addr_t dmaphysdest1 = 0;) ]  U9 ~$ w0 n/ i6 ~, p3 ?
  71. dma_addr_t dmaphysdest2 = 0;
    7 t) f  \( o3 \$ k2 N

  72. 4 y3 ]7 k' ], l5 ?$ _* n4 d: G
  73. char *dmabufsrc1 = NULL;
    . G5 G: I, [8 z! ~: F- \& u
  74. char *dmabufsrc2 = NULL;3 I0 X7 x2 g8 [5 Z' U2 Q
  75. char *dmabufdest1 = NULL;
    9 s  Z; [1 A; r, N$ ?
  76. char *dmabufdest2 = NULL;
    ' h! m' t$ T$ d

  77. 0 b$ g& m0 s- j
  78. static int acnt = 512;
    4 N" p9 K0 ]* L
  79. static int bcnt = 8;
    ! f3 g. i0 y& J5 A  c
  80. static int ccnt = 8;
    5 [- v8 l; e" @" V8 N6 |0 x
  81. ) ~6 j1 t( M& S0 n5 M6 k. h
  82. module_param(acnt, int, S_IRUGO);
    4 m6 N4 j3 J( q# L) {$ @% b
  83. module_param(bcnt, int, S_IRUGO);
    3 c7 W3 k9 X" N& w# M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% i/ S1 H' c  i3 A2 ^+ {6 x# N3 u. B

% @5 O' R' N& T( Y0 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 E8 v7 j+ C3 b' C3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 l1 W2 n/ U3 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s+ X; Z# b, {4 ^5 |8 s5 v& j. v" A; b, G. D
+ s$ L& ^* ^- W8 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 12:28 , Processed in 0.039615 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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