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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 i5 E2 `9 M. C7 y5 ?& ?3 Q
  1. [code]EDMA sample test application# c  Q! z5 I" |% J, x& R0 P( Z: Z
  2. /*
    8 R$ t' Q! E. F' p. T+ ^7 v
  3. * edma_test.c
    ! E4 i+ i* M+ Z+ i$ ^
  4. *
    2 w$ ~# }& L1 s* Y# ~
  5. * brief  EDMA3 Test Application
    8 k8 W' d: ]; Y4 k' C2 }) K
  6. *
    % _5 B: E2 s4 ?0 y
  7. *   This file contains EDMA3 Test code.; s# u) b0 H9 ^! x
  8. *
    ! t( Z4 M1 C, e2 n( O" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! f3 s, j2 B+ @; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) T- e: |+ n& l& a. ^
  11. *         TO CHANGE.% S1 i: A$ w: Z; e
  12. *# s$ |# b5 o" h6 K8 w5 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * t% Y* F: w& C& u6 X* z; ~: `2 z
  14. *( k2 r9 a4 {0 T; w( E" a0 K
  15. * This program is free software; you can redistribute it and/or/ j0 K6 b' j- |  ~3 I
  16. * modify it under the terms of the GNU General Public License as! {; i) y. v  a. p- \
  17. * published by the Free Software Foundation version 2.
    - v2 g# Z9 N  \* I: f" y
  18. *9 v8 d1 n' X3 d- Q: q$ h& t4 E( ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E% R$ X. Q/ C/ n. H: \
  20. * kind, whether express or implied; without even the implied warranty
    . w& H8 B1 b4 B2 o- E3 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ L+ p8 ^7 M$ O
  22. * GNU General Public License for more details.: U5 q8 J& _" |8 j
  23. */
      i- \9 x( Z  D9 V8 v& l  N! \5 @7 X

  24. ! s% Y2 W/ W6 |3 k0 f- C5 ^  l
  25. #include <linux/module.h>& D" z$ x/ X+ X* L2 h
  26. #include <linux/init.h>
    , E& `. q5 A2 s8 s$ J( v0 U# N
  27. #include <linux/errno.h>
    4 V( ^9 u3 Q- M
  28. #include <linux/types.h>
    , j/ ^% G! j$ o9 F- }, T
  29. #include <linux/interrupt.h>
    + l1 @9 A* b  q
  30. #include <asm/io.h>( V4 b  i/ L& r
  31. #include <linux/moduleparam.h>
    * x" ?9 R! _, U3 D
  32. #include <linux/sysctl.h>5 Z/ ^0 [1 i) l* T7 R9 b! O+ t% K
  33. #include <linux/mm.h>3 u, b5 Z/ [0 |. A# ~" U
  34. #include <linux/dma-mapping.h>
    - k/ H- p4 N% F0 J. T. ?

  35. . `: X/ ?/ A& O' \
  36. #include <mach/memory.h>
    0 |3 K6 i& Q+ y- V
  37. #include <mach/hardware.h>  W( B4 H, w3 s5 `* P' S! I
  38. #include <mach/irqs.h>; x! ]( J5 \% j) u& f* w& t
  39. #include <asm/hardware/edma.h>
    : S1 f+ Q+ f) S" Q1 ^3 {
  40. " u$ H3 _( p$ a5 X0 S4 h# v
  41. #undef EDMA3_DEBUG+ n6 `! M2 d2 ?- s6 Y9 _# T
  42. /*#define EDMA3_DEBUG*/9 ^) l+ O6 B/ N$ e; L  T5 ]

  43. + }( B! a8 q2 |9 }
  44. #ifdef EDMA3_DEBUG9 d1 a5 W& D* F7 ^) m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b. R- M; e6 t% g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 [2 y  a1 v. v5 B9 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; F2 m! l4 [4 y1 `) g
  48. #else
    # E) z/ n7 p5 r8 K
  49. #define DMA_PRINTK( x... ). c0 y& O& W  [$ i  Q7 i
  50. #define DMA_FN_IN) |% y/ d! W/ D6 F
  51. #define DMA_FN_OUT8 |8 R6 D! s1 a
  52. #endif
    0 h" J5 u  C' K: q

  53. 8 h, }3 f, r, @# ^& l4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & p% u, ^7 |6 K/ J
  55. #define STATIC_SHIFT                3
    % h3 f2 d# q. b! s- x
  56. #define TCINTEN_SHIFT               20
    " C8 x* K# N+ s- y7 B" a: G" a
  57. #define ITCINTEN_SHIFT              21
    & q3 w$ s! A( A5 a3 f; E! i
  58. #define TCCHEN_SHIFT                223 G2 c$ B: F0 ?9 X& D2 y; l: Z) i
  59. #define ITCCHEN_SHIFT               23( c8 \$ h, o  C* n- L, [; I

  60. , z5 {6 W5 L3 k; w( {! P
  61. static volatile int irqraised1 = 0;* p3 K# I/ \  x" T% p
  62. static volatile int irqraised2 = 0;
    3 t1 _5 z& q) b8 Q- r0 Q

  63. / U& G& b: `+ A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Y, J2 N: I7 J6 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }: c: U& ]+ V8 T3 S& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; `4 G  r6 ~( r. N, Y3 Y5 Z4 z

  67. ) i4 b( t  M; _9 ?% u; u
  68. dma_addr_t dmaphyssrc1 = 0;
    ; {) E1 X  d& V+ \6 M
  69. dma_addr_t dmaphyssrc2 = 0;( s% S  z/ a1 m  o
  70. dma_addr_t dmaphysdest1 = 0;9 V6 m0 |* }6 X) m, p
  71. dma_addr_t dmaphysdest2 = 0;
    7 i0 w2 Z* ?$ O  V3 _5 F5 a. q; l2 R

  72. . D* i6 G0 N& a6 R" c
  73. char *dmabufsrc1 = NULL;8 M1 d( _  A+ ?% |: N* ~3 y
  74. char *dmabufsrc2 = NULL;3 `7 R( n' G8 \! A- r3 ?" S9 c
  75. char *dmabufdest1 = NULL;
    ( q( o' X; @4 y
  76. char *dmabufdest2 = NULL;
    % x: L4 M; _1 q* f" i
  77. 1 |! {. @) n; G$ r: r
  78. static int acnt = 512;
    % X: M# {5 @5 o3 U) X- M! w2 n8 D
  79. static int bcnt = 8;% {, j; Z( W) J$ a2 V' G
  80. static int ccnt = 8;
    - h3 J* x$ j& U* y
  81. ( _" T1 s' t8 q
  82. module_param(acnt, int, S_IRUGO);  Z+ S9 g: M2 n# M3 S# l% X5 i
  83. module_param(bcnt, int, S_IRUGO);' H( `; o& B$ Q3 P7 A: ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ^( |# T+ }. c9 R

, y& R$ ]$ q3 o% F2 U( Z% P7 r( s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ H, @. p! z7 c3 a1 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% m  f3 _7 Y7 S5 ~$ w5 j& ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 p# \1 ~& l6 l' ?- \# C. V
2 b& @5 C6 v* ^- g
; L8 t3 h* t( z; A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 16:08 , Processed in 0.050077 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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