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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 g- b4 J! W8 z' J2 j' y3 `
  1. [code]EDMA sample test application
    1 T; C8 n( S! b$ O- |
  2. /*
    ; N% Q% A% N6 K3 A- Y0 H; u0 o
  3. * edma_test.c
    2 G  D/ Z0 I: d, D* q$ [. d0 O
  4. *5 m' s1 B( b1 m, I
  5. * brief  EDMA3 Test Application
    $ n, |1 y8 B& g  L+ W
  6. *
    # [* M# R& j% z$ r; s: S
  7. *   This file contains EDMA3 Test code.
    ! _$ q9 G) R1 r& Z$ K% L* g2 M" L
  8. *! u8 v" V$ @0 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % l0 k, P6 f9 {# v5 r! a9 F8 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Y+ `6 O2 c( R% o
  11. *         TO CHANGE.
    0 {& W  |8 ?# b4 D; q& [9 G, \
  12. *
    8 i9 Q7 i" Q5 q: ?6 }( A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; J- ?( h! ~8 ~
  14. *
    4 S- v8 y) }) {$ J  R% c; C
  15. * This program is free software; you can redistribute it and/or/ m6 V: }" z/ @6 L  K
  16. * modify it under the terms of the GNU General Public License as, \) L# b. m* w  Q7 b& `5 Z
  17. * published by the Free Software Foundation version 2.
    2 i7 K9 y! c. P7 M) w! |
  18. *" q# K" r+ l* p( v" U" ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _; }( l! m# u4 O% o7 }% E& [( T
  20. * kind, whether express or implied; without even the implied warranty, f; P- ~8 G* i) b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      N' r: D. _3 G; L1 q7 U" Z* Y
  22. * GNU General Public License for more details.
    . o! X; v% u" X# M5 N: w0 m
  23. */" p, r7 Q" O( U, U$ O: p9 @

  24. 6 C, ^, Z- h. A2 V
  25. #include <linux/module.h>! S( j0 Y2 u$ u: m! k
  26. #include <linux/init.h>% C$ j. B, V: L+ g  }
  27. #include <linux/errno.h>+ x" `+ d6 E2 W; N& \4 M* {
  28. #include <linux/types.h>
    + e3 ~4 r0 |! S0 N: C0 O/ a
  29. #include <linux/interrupt.h>
    9 c; c1 [, [# s5 _" i' @4 R
  30. #include <asm/io.h>
    7 h$ w) _9 Q' ^* q/ ^
  31. #include <linux/moduleparam.h>4 u- X+ q! Q8 t) n
  32. #include <linux/sysctl.h>3 m. i  H, q/ ^( P5 p& D: G
  33. #include <linux/mm.h>- c. o6 r, F5 c  [# x6 f
  34. #include <linux/dma-mapping.h>* G6 {. S# a! M+ a
  35. / m8 n+ b1 s6 m9 u" U) K
  36. #include <mach/memory.h>9 g3 h$ Y. N; u1 b/ e
  37. #include <mach/hardware.h>
    # [( Y+ M) `3 W9 x5 i
  38. #include <mach/irqs.h>
    + [# X/ p9 u, e1 b) L) |
  39. #include <asm/hardware/edma.h>
    & B3 K9 |) d$ y4 g7 d- F! f4 g

  40. 8 ]! m+ T, Z9 T
  41. #undef EDMA3_DEBUG
    / @! Q, r/ d& b) }6 W- k
  42. /*#define EDMA3_DEBUG*/
    % m2 S/ V3 O3 V+ ^, j6 S7 e1 V
  43. $ h: W6 o2 M0 {
  44. #ifdef EDMA3_DEBUG, r8 t+ q* V$ c$ M: k2 h1 ^9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" X% q7 E6 x& y( x9 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 l2 c; Y! B+ K: ?& |, C! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) K+ t  Z: P- }" n
  48. #else
    8 i+ P- G6 Y8 s4 W: a$ [
  49. #define DMA_PRINTK( x... )9 M0 Y  \  \$ @/ L+ k) e, ]
  50. #define DMA_FN_IN- K  m  k9 d$ ?* D! D+ K! }
  51. #define DMA_FN_OUT6 `+ Y* g- w( w) g3 y/ a
  52. #endif
    " c+ X" g) Z: w% S
  53. ' h, H1 w( E2 U7 k) i/ {) x) W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ d( l1 z) V+ |! ~* L; p
  55. #define STATIC_SHIFT                3  ^3 Z& I% ~$ M6 B' B
  56. #define TCINTEN_SHIFT               20+ W$ t9 h) Q3 L$ i5 \
  57. #define ITCINTEN_SHIFT              21( f  p, v, p, v% z4 y( L
  58. #define TCCHEN_SHIFT                22) A1 p; I8 k- k) \! w8 H% E% K
  59. #define ITCCHEN_SHIFT               23
    2 x$ q0 ~  n) x, F4 G9 K/ y+ f
  60. # @4 T2 q: S  G. t+ ~6 j, x
  61. static volatile int irqraised1 = 0;
    + l1 @  N$ ?/ _
  62. static volatile int irqraised2 = 0;
    ) [% v9 A, L4 {& V3 L
  63. 1 b7 ]; _: F# K4 r8 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?9 t8 M. u( Q0 d  w, ~. j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [- D4 x9 x7 Y5 m2 n8 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " L5 ~* O# Z5 o! S
  67. 6 A4 }% i% [! c$ F! i# B. E
  68. dma_addr_t dmaphyssrc1 = 0;
    5 C5 N. O* x5 `
  69. dma_addr_t dmaphyssrc2 = 0;- ?$ g+ b! t$ N8 \* m
  70. dma_addr_t dmaphysdest1 = 0;9 I3 W1 N0 U* F# L+ o5 G- R+ r; E6 D
  71. dma_addr_t dmaphysdest2 = 0;
    4 ~, Q- c1 a+ I+ v1 y1 r; f

  72. # m% a/ v+ c  H9 i2 q/ b! }
  73. char *dmabufsrc1 = NULL;( R* m7 B8 P  E+ w
  74. char *dmabufsrc2 = NULL;
    # o  E( {1 ~: B: B/ T
  75. char *dmabufdest1 = NULL;
    $ H# q# B; W0 a1 _3 @
  76. char *dmabufdest2 = NULL;8 U* b* a' t; f6 n1 f: ^# ?. ~

  77. / O; E" R0 z3 e
  78. static int acnt = 512;
    & }  h! U# O7 N9 F1 S
  79. static int bcnt = 8;  {0 {9 x* {! z3 C- M
  80. static int ccnt = 8;0 A$ ^2 E* j4 u- ^4 R( V
  81. / T3 G/ R5 i' [8 W) A* ?
  82. module_param(acnt, int, S_IRUGO);. _: _1 _% e( _0 c' |9 G6 ?
  83. module_param(bcnt, int, S_IRUGO);5 [! b& n6 X5 K+ S; M- f3 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* b! `+ s* W9 e* Z! E/ U- f

+ b$ [$ w2 j/ y" N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 C* O: f- b; a7 I  F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 a' Y$ D# \. i) n8 K: y+ Y- J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 S# @( A  K- _/ M/ C
# X+ b) _4 _* L% T) o5 d
) `- E- C( a8 P8 p' ^  y8 |: O' R! R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 11:04 , Processed in 0.038379 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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