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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   a( z) Z3 Z0 a" e1 r1 W  `4 A+ s% G3 t
  1. [code]EDMA sample test application
    - q6 W% x( o( v5 v
  2. /*
    : a) T2 h9 p. f! _3 \/ n( l; a
  3. * edma_test.c) N1 b# V# W) O- c, I7 a
  4. *
    $ P( h! u* O. f+ n: ?1 T6 ~
  5. * brief  EDMA3 Test Application
    / k8 d7 B, ?* p$ o& c; E4 G, S6 h. c
  6. *' u+ R1 b! j# o9 |, ]' }4 B
  7. *   This file contains EDMA3 Test code.& K  x$ w/ h: j0 x4 w& z
  8. *
    % c3 y  b. Z7 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 c- ~1 ]* w* v8 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - @" r4 J; k, q; j
  11. *         TO CHANGE.
    3 R7 k7 d5 T5 G( q2 ?
  12. *8 Q: I9 w$ J' B% Q/ J* {- [2 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : d8 w# F5 U. o$ R
  14. *: G# l6 J- l  T; w" L7 x: r
  15. * This program is free software; you can redistribute it and/or* b! O5 F9 ^4 o4 C% |# G! K
  16. * modify it under the terms of the GNU General Public License as
    5 |7 ], ~) j9 W) u: L- {) r) _
  17. * published by the Free Software Foundation version 2.1 e: t) z/ u/ q# [2 G- E* I( S. h0 t
  18. *
    # h1 L. g0 ?+ U8 {0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! j: m% D$ T% F9 V3 b
  20. * kind, whether express or implied; without even the implied warranty
    $ x. ~0 g, a4 h* G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) `+ C# j6 S: s( B: O
  22. * GNU General Public License for more details.0 g1 W9 y3 T" y
  23. */9 s6 P. ?3 l! n9 b  J8 [  R
  24. 4 _2 D% N" {' Q9 v, B
  25. #include <linux/module.h>
    6 @' b; q( m7 {" x  g$ e; c: v
  26. #include <linux/init.h>/ z5 V4 p: n6 b  d' P, o
  27. #include <linux/errno.h>2 E% B& J1 ~4 W8 h5 g0 Z+ D. i
  28. #include <linux/types.h>6 f# J4 r; E) ^2 B  F* ]1 ^5 ]
  29. #include <linux/interrupt.h>: |( U7 ~) s7 K* o5 m& W, a" C) H
  30. #include <asm/io.h>
    ; D/ K8 s, Z& f5 J0 |! s) P
  31. #include <linux/moduleparam.h>
    3 f4 w& R2 N! C9 [" i6 C' ~
  32. #include <linux/sysctl.h>
    , Y) Z. Q( d' K0 N+ r3 k
  33. #include <linux/mm.h>
    ( R6 L5 x  d, |$ p9 |$ @
  34. #include <linux/dma-mapping.h>7 T! F9 h3 K( Z$ S( Q

  35. 5 g( x7 U4 j1 E  s, C# Q7 A
  36. #include <mach/memory.h>
    " u( X. d* d6 {9 x5 j( [' m
  37. #include <mach/hardware.h>$ l0 @. u  g9 f( [8 s
  38. #include <mach/irqs.h>
    7 Z; N* r" o% r# E0 ~
  39. #include <asm/hardware/edma.h>
    1 A$ J1 U, y. B! c9 D

  40. 7 P& ~1 N3 s- h1 Z( V% x8 |
  41. #undef EDMA3_DEBUG: S1 F9 ^9 Q9 K$ \3 I. j0 {
  42. /*#define EDMA3_DEBUG*/" d+ m# h) i6 X2 o

  43. 1 K8 q1 d; u. h; z6 ^: m3 X
  44. #ifdef EDMA3_DEBUG7 p! r' _9 {( k% C3 N% R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # q3 V- W; L3 d* }/ s; l3 l" v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 B* W9 \" Z( T+ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * e# o- T& \5 C8 S: i2 @) v
  48. #else+ W/ h% s* V% W6 _
  49. #define DMA_PRINTK( x... )# D& o% \2 B1 @- s; f" G
  50. #define DMA_FN_IN
    * ~, X- U# D0 J* W% c% }0 n, a. F
  51. #define DMA_FN_OUT
    ) Z$ }, z% I# O& _, Q& U, G
  52. #endif2 c; E$ {% [/ M; y6 z' t3 d
  53. * F: b( M/ t: Y  \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). |" a- F3 |. B4 U
  55. #define STATIC_SHIFT                3
    ) I5 G& u& k7 d  T) q) d
  56. #define TCINTEN_SHIFT               201 u$ {$ T( Y) s" L- e, g# S& Y( i
  57. #define ITCINTEN_SHIFT              21- j7 e, M5 z- W3 O
  58. #define TCCHEN_SHIFT                22, p4 g/ T, f0 p/ ?) F
  59. #define ITCCHEN_SHIFT               237 W9 j8 e0 S3 A/ g- s! |; {% E

  60. " G+ j8 c* X4 Y
  61. static volatile int irqraised1 = 0;) C4 \( H' ^& M& k8 X+ V
  62. static volatile int irqraised2 = 0;
    9 S/ M* n. r9 X

  63. . L; T' x( O6 i% m9 u. w; i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m3 L  }. h3 S; ^- u) ~( H5 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r6 c5 q9 S' q, t2 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , B" H. I/ K5 G4 b
  67. , O6 |. u1 e* j
  68. dma_addr_t dmaphyssrc1 = 0;
      A% T! J- O- }
  69. dma_addr_t dmaphyssrc2 = 0;6 |/ I  E3 w8 D5 J7 y
  70. dma_addr_t dmaphysdest1 = 0;& D0 O# U/ x. k0 x
  71. dma_addr_t dmaphysdest2 = 0;, W9 o. ^, Y9 J$ H
  72. ! F5 w9 ?& M' _- D. b
  73. char *dmabufsrc1 = NULL;
    / E4 z0 U8 Q+ O: I; j; p& q( f
  74. char *dmabufsrc2 = NULL;
    ( E7 B/ n) E% }' e7 D0 g
  75. char *dmabufdest1 = NULL;
    2 P: X) a4 c- e2 o9 a% s
  76. char *dmabufdest2 = NULL;  @9 r! f2 K9 y7 T" [( g

  77. ( M# I; b; o$ L
  78. static int acnt = 512;
    4 Q, Q  N( e6 q) U/ I7 v4 W0 E  R
  79. static int bcnt = 8;+ y4 I( }& e2 |
  80. static int ccnt = 8;
    $ O2 F8 N% q. q" i
  81. , ~7 l0 `) s7 P  x, n
  82. module_param(acnt, int, S_IRUGO);
    ; s3 P; G: ~  Y
  83. module_param(bcnt, int, S_IRUGO);0 a' T! ~9 J8 f& ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- T/ f: w* H7 M- X/ K1 l

# M& a+ m) H9 D* S4 E5 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( ?4 {  |+ [5 g5 q5 q8 j# I* p5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  H5 K* o1 A& u4 q% y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: |' T- s! I$ ], u/ g: C2 N/ z" {0 L
: g  w7 B) _5 g: \4 x6 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 22:18 , Processed in 0.040128 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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