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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! t2 Y8 n7 X1 `3 H$ T
  1. [code]EDMA sample test application
    # Z) _. u6 n) G/ V1 ^  b; {) j
  2. /*
    ) }8 e* {) t+ j& ]7 Q2 L2 ]) j
  3. * edma_test.c
    % e8 I/ |9 I7 ^
  4. *9 B7 D$ ]3 R6 p* V% E5 C0 r5 J
  5. * brief  EDMA3 Test Application
    + {; Z" P, h- Y+ F0 _
  6. *& C% f3 g8 D' h4 u4 a
  7. *   This file contains EDMA3 Test code.
    0 [, [( C; P) ^
  8. *) Q) U, w! h, M) _' k* W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . ~7 j% n' z7 R7 P8 s0 L6 i: s  D/ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 S+ K, x% o7 i3 a
  11. *         TO CHANGE.
    0 M  S2 ~& U1 |6 R2 ~0 ]* ]9 y. D
  12. *; I* v5 R# ^0 r9 s2 z, b* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " |$ p$ w7 o( Z- d
  14. *  ?+ l' H$ D0 R) w7 E6 t
  15. * This program is free software; you can redistribute it and/or
      U( o" d- P! \& k/ t( c. U
  16. * modify it under the terms of the GNU General Public License as
    ) f6 C! j$ g& o  P3 Z
  17. * published by the Free Software Foundation version 2.
    - _, H$ w' G& b" ]8 ]/ |1 A
  18. *; L% c1 e, z) F. t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / }. v1 N3 ^8 R
  20. * kind, whether express or implied; without even the implied warranty
    : }. _0 o7 O/ m3 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ D& f$ L  p) U
  22. * GNU General Public License for more details.+ \& J8 Y: D- _7 B" Y# G3 K2 D+ K) B
  23. */+ u$ d( o# t* \, Y/ L8 l

  24. ( n* R; M1 S. q
  25. #include <linux/module.h>
    - |6 K4 ~) ?/ g) N) X# v
  26. #include <linux/init.h>+ j+ G* l: c8 x, g$ a3 ]
  27. #include <linux/errno.h>
    . p) J, K6 W. N1 O4 ?9 O
  28. #include <linux/types.h>( w, z% S7 a' C' y# s: j2 X7 M
  29. #include <linux/interrupt.h>
    6 ~! o9 D8 Y7 z+ R" |
  30. #include <asm/io.h>3 ?* ~4 e0 X5 y7 _+ {3 Y6 N* ]1 u
  31. #include <linux/moduleparam.h>
    . v. A7 O0 n7 a, \3 r
  32. #include <linux/sysctl.h>0 X* D4 O" `5 I. k
  33. #include <linux/mm.h>9 q/ b9 E' F+ k/ ]; \) X0 a
  34. #include <linux/dma-mapping.h>7 s2 q' h' _6 N& j! K

  35. 4 g7 L8 d6 K! @8 K
  36. #include <mach/memory.h>
    7 C  q1 ~# c2 o, `
  37. #include <mach/hardware.h>
    : m( {% C( H  O
  38. #include <mach/irqs.h>
    / I# v5 b3 F+ F& g& P- Z9 K# v+ m
  39. #include <asm/hardware/edma.h>
    + q+ Z5 Q0 W; [$ Z
  40. ! o6 C& a5 V0 p2 q! J) C
  41. #undef EDMA3_DEBUG
    . G- _# V- B7 l+ ~2 k7 p) u
  42. /*#define EDMA3_DEBUG*/
    * L7 S- P* c: a" d8 o" o

  43. ( e! d; |2 P$ R- t
  44. #ifdef EDMA3_DEBUG
    ! F4 A5 e0 I$ _1 @5 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 W* y/ ^  @8 K3 i; G6 u& n1 S6 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 y8 s- l$ G% ?8 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ~1 C2 X  z0 c1 s# `6 X- C' {
  48. #else
    . Q& N9 h$ q- Q5 A" d: X7 Q: ?/ A
  49. #define DMA_PRINTK( x... ). p  u+ T9 K# N
  50. #define DMA_FN_IN6 D: A! a" T' }* A# `4 y% v
  51. #define DMA_FN_OUT/ g* ^, y6 N9 W# t& v" n$ R. X
  52. #endif$ m3 |& l( g5 v! Q% w( F* V

  53. 8 I: N* f, c) I" L' d+ s  L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 D  Z  l9 i( U, V1 M
  55. #define STATIC_SHIFT                32 B. A' d9 s& f8 N( g: U/ ^
  56. #define TCINTEN_SHIFT               208 C. Q9 ]/ U) g* N& R
  57. #define ITCINTEN_SHIFT              21/ X7 c* M+ J- T6 e; E8 P
  58. #define TCCHEN_SHIFT                22
    3 e* ^& P! X9 s2 f( T
  59. #define ITCCHEN_SHIFT               23  m2 V( f3 p0 O# j

  60. ' w% i' v  j5 p; @
  61. static volatile int irqraised1 = 0;  n0 h# Q) t- r3 z
  62. static volatile int irqraised2 = 0;1 n9 a9 {9 j! p9 ~2 x% k- \
  63. ! ]. y( Q5 C- Q4 e9 p$ s' S& [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; l% b6 T+ d' E! b( d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 z: a! r$ C6 r0 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      X# ]+ Y% J; c7 o' T, |, q6 A: D
  67. ! g) y6 h" a$ w. X( W
  68. dma_addr_t dmaphyssrc1 = 0;
    4 \# C3 I! X. V" d& a3 H- ^
  69. dma_addr_t dmaphyssrc2 = 0;
    - I$ \: U8 s' h2 O  K7 {
  70. dma_addr_t dmaphysdest1 = 0;
    1 a( H- M/ t# w$ M2 h+ r" a5 F" T
  71. dma_addr_t dmaphysdest2 = 0;
    / p. F& ^* R; g" v! a

  72. : k1 F, y5 x/ s. T; m
  73. char *dmabufsrc1 = NULL;
    / m  |5 i' {; i2 }# Y
  74. char *dmabufsrc2 = NULL;
    & E  X" o; A" `- G0 ?
  75. char *dmabufdest1 = NULL;
    9 q5 b2 h& Q+ Q$ x( x
  76. char *dmabufdest2 = NULL;
      S; q* K0 a4 H3 R" v

  77. 1 q4 `5 w3 p" k4 D& ?5 \) ?) j
  78. static int acnt = 512;
    & R( j2 D" b1 m! a
  79. static int bcnt = 8;  L! p/ `0 B0 k& U- Z
  80. static int ccnt = 8;, T  u* Y6 h1 K! N; t7 p% i# i7 x, X
  81. 9 q+ ~3 L1 |" E/ c
  82. module_param(acnt, int, S_IRUGO);; s: m- h5 |8 M5 i: A$ n5 z
  83. module_param(bcnt, int, S_IRUGO);# ?3 m6 Y( v- V3 l3 ^8 x) t1 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# p9 W, Q8 }% d4 ~
* r8 E8 f# a1 h2 ]$ V/ p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y6 L6 q% r* |" J' I/ Q! o' ~9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x- c9 u- c6 r/ h% l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, {# A* a( y, L7 Q7 j: I$ @

8 M; e" |: q" z/ D9 k! @0 ~& f$ \$ C3 A, x! h" z) t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 15:54 , Processed in 0.039946 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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