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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # m( e$ L. P( ~. T
  1. [code]EDMA sample test application- L! s0 {. z2 j4 a
  2. /** K# z! O! o  x% a- h
  3. * edma_test.c' ^# a) l3 d0 g0 {% t6 V' ]
  4. *
    1 I% q1 N  [( Z( W
  5. * brief  EDMA3 Test Application
    ) n& Z* y# Y8 j8 b+ D8 L
  6. *4 c: T' J4 V% h! R1 D( _
  7. *   This file contains EDMA3 Test code.+ L  C' r9 S6 a/ ~7 r0 k& \( M- E
  8. *
    2 Y- r5 R1 S# Q; e$ `2 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " P, n1 L. a7 r9 D0 I3 M$ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) _+ c3 ?* ~  }" o* N9 ?7 f
  11. *         TO CHANGE.7 M; N* z9 v0 ^9 h5 ]2 j0 ?$ i
  12. *
    # U5 H- u4 q$ N# }2 V9 J- m$ @& s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 X4 ~9 B/ C& r& u
  14. *
    ; q6 i& ]1 o- C+ n! \( W) n
  15. * This program is free software; you can redistribute it and/or' c& o# E! l1 J8 O! t( D$ s
  16. * modify it under the terms of the GNU General Public License as
    ! l' c  _" u/ _5 @8 A
  17. * published by the Free Software Foundation version 2.
    * k9 J$ E% a* f" u+ S/ Y4 ^: b
  18. *( K" o+ t" _* Q7 P; F, c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G5 G% G- z& M3 z9 f9 Y
  20. * kind, whether express or implied; without even the implied warranty
    % Y7 Q" v. H( a7 M6 U# ~9 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' @6 e0 ~/ u2 G; n( Y" Z- ?5 n
  22. * GNU General Public License for more details.
    6 t& T! P+ O; f1 }; }3 j
  23. */
    ( Y! X& K- c7 \" X6 K- m8 E. L
  24. # ?1 S' w" g& f" c5 x  M
  25. #include <linux/module.h>- Y1 x  B0 J" o( a" ~3 \- m
  26. #include <linux/init.h>
    * w* k) o, w( G. r- l
  27. #include <linux/errno.h>( n6 D3 a& N$ W! e
  28. #include <linux/types.h>
    7 w1 q/ g: Y3 ?. Z" u9 B. ?
  29. #include <linux/interrupt.h>1 ~4 J/ k2 B8 K: y
  30. #include <asm/io.h>/ t. h+ C$ E9 p4 O: w
  31. #include <linux/moduleparam.h>$ t, m" n7 i5 C4 ^) Z% _
  32. #include <linux/sysctl.h>
    + L/ J" _  L  H$ G- g
  33. #include <linux/mm.h>
    . G3 J& R% o" C% V
  34. #include <linux/dma-mapping.h>
    " ^# O# J) L; Q) T% I& ~. p8 y/ S

  35. , T* X+ P+ e7 G4 h% ~8 o: \
  36. #include <mach/memory.h>
    3 w6 k% T5 w) i8 ^- B) N  @1 H
  37. #include <mach/hardware.h>6 m, K/ n+ K- f  M4 q
  38. #include <mach/irqs.h>& R5 H: w7 x+ [; q
  39. #include <asm/hardware/edma.h>
    5 ?' @; [1 {3 ~; c# [. \
  40. 6 v2 o7 m/ D% V& F* W; w; e% H) L1 m
  41. #undef EDMA3_DEBUG
    ' N' {8 U. P- H- N4 f
  42. /*#define EDMA3_DEBUG*/
    # c5 x; u+ j% a  n0 ~

  43. : W+ t! |9 P9 Z& d5 k$ D, o
  44. #ifdef EDMA3_DEBUG. T& S$ p. A1 @% U; x+ x7 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 n* p5 ?$ ?3 Q$ p$ f# z" a0 z% Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # y; k+ c( c" _% A7 [4 ^! j- G2 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R+ u  y$ W; p2 n
  48. #else
    5 `; _  ^& y" b+ j
  49. #define DMA_PRINTK( x... )4 L5 v6 v5 M& m7 g& u5 [7 \
  50. #define DMA_FN_IN
    3 O) q- V/ W2 V
  51. #define DMA_FN_OUT3 {- U0 g+ r" h) e: D
  52. #endif
    * i! z8 r0 g  u- n2 l( J

  53. ' U8 b: E, F" i8 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- t; s7 z* b+ P( z
  55. #define STATIC_SHIFT                3& h4 N4 U$ Z( a
  56. #define TCINTEN_SHIFT               20# b  J1 h" W0 S0 \" Y- y
  57. #define ITCINTEN_SHIFT              21: J: j3 d  z# M; U: f7 H) Z$ J
  58. #define TCCHEN_SHIFT                22
    7 M' S' i7 Q9 O. r5 @1 e
  59. #define ITCCHEN_SHIFT               23
    * C7 C" B, Q. Q  O- w

  60. # R' d5 K- g% s/ j1 L" I
  61. static volatile int irqraised1 = 0;
    " i* D3 e7 f1 ~/ {
  62. static volatile int irqraised2 = 0;3 z) V4 j7 m( p3 n9 I" _( x! O

  63. 4 C6 ?: [! R# [9 P& W% O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / o: q- C7 D/ x; z. x- y! ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - l' I( V+ k" ]4 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ^+ P9 w; w' W- v' c6 h+ i% o

  67. , l9 n/ j9 {8 [' G
  68. dma_addr_t dmaphyssrc1 = 0;
    ( }! M6 L# D5 g" w" y7 K
  69. dma_addr_t dmaphyssrc2 = 0;% p! Z1 L4 z0 |( |. L. U
  70. dma_addr_t dmaphysdest1 = 0;
    0 [/ x% R6 B( _* _  K
  71. dma_addr_t dmaphysdest2 = 0;* c  w; e! i7 a7 f8 q
  72. ) F4 M& }% B, l  h. O
  73. char *dmabufsrc1 = NULL;7 f1 ?" e: z* K+ }  _
  74. char *dmabufsrc2 = NULL;+ p* C* C7 @, d9 }3 w$ e
  75. char *dmabufdest1 = NULL;5 z% Y8 s  b/ K/ z6 R, l
  76. char *dmabufdest2 = NULL;
    " u# m) k2 o7 V& G

  77. : v  e! K. L6 @6 E$ h6 n1 |
  78. static int acnt = 512;
    ( w  y- K& {  {% z1 N
  79. static int bcnt = 8;
    $ B% _6 E- _  k6 E
  80. static int ccnt = 8;
    % _! N3 U, U+ t, ?) P( r8 R- J

  81. - A) H: x7 ]4 ?( k0 z
  82. module_param(acnt, int, S_IRUGO);5 e; O2 h4 c. G1 Y1 L. K
  83. module_param(bcnt, int, S_IRUGO);
    & ^9 B! z3 D6 [; {3 \. u* G  F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 f# b- n* Q' r% m: Q1 w  k+ f" P% o& u" d& k4 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 T4 n' _" {3 c- X( ^5 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; T4 G& @1 F( W4 s; }- T( ~* h5 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 K' I& d) ^8 ~+ ]1 {6 U1 G6 d6 F: r* F# ^; M3 i

. d# U: C  ^" H4 l  \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 03:15 , Processed in 0.045112 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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