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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 d. Y! V% W( x$ E7 a2 _  o
  1. [code]EDMA sample test application
    ) V# J& K% g) K# [1 x9 n9 i
  2. /*
    + K6 `6 b6 U8 P+ b& H+ u+ U
  3. * edma_test.c
    5 L* t2 \( V' G# t
  4. *# c( {. i2 s" \/ Q- E* f" [
  5. * brief  EDMA3 Test Application
    5 @- C; _" U* c0 [5 ?0 }
  6. *
    & t: S  W- K" ^' ?$ ]
  7. *   This file contains EDMA3 Test code.! s; Z& @; {8 Z( }5 n
  8. *  M9 g2 g5 X1 H: A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * k1 J4 `& }# f* t! f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 a0 u0 g9 G( T$ f5 _4 P9 G: d1 L
  11. *         TO CHANGE.$ M4 d+ S, S8 R4 j! }
  12. *
      h, s$ o3 D+ H) M1 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! t5 U' A* M  ?. F0 C& F, x; k
  14. *! E& f7 M0 [- A
  15. * This program is free software; you can redistribute it and/or
    ( t8 L  \; I, d, ~
  16. * modify it under the terms of the GNU General Public License as
    ( n2 p7 c6 a( n6 j* j
  17. * published by the Free Software Foundation version 2.1 Q: z2 N1 ]( R- x( N3 q+ ^  T( i
  18. *
    # y; o# y9 y% z& I0 {- a0 h5 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ]3 N2 C# h' R8 j- A( g3 y
  20. * kind, whether express or implied; without even the implied warranty
    $ \3 k4 `7 I" `' r) T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& D) p" ^/ ~+ Y9 p4 A) M. W% x
  22. * GNU General Public License for more details.
    0 h- b: f0 C6 O. L& V; }& ]/ q
  23. */) m- }7 Q; x3 [- S* Q8 a7 J, ?2 T* V
  24. , [8 r- E3 ?5 T: A) _6 ^
  25. #include <linux/module.h>, H, W1 Q' K) S5 }+ E- U
  26. #include <linux/init.h>
    $ G5 e5 m$ @- ~- J" c! G) j
  27. #include <linux/errno.h>( Z; z$ n7 V5 |: S
  28. #include <linux/types.h>
    ( U9 o3 y5 V! p5 T9 F
  29. #include <linux/interrupt.h>$ t# f' y" y2 y2 B
  30. #include <asm/io.h>
    4 Z$ E3 o2 t' U* X4 m
  31. #include <linux/moduleparam.h>( g  j5 A/ j9 g  {1 a
  32. #include <linux/sysctl.h>& N5 J: E: g- G0 _. v( M2 j) ~* o
  33. #include <linux/mm.h>
    6 }  Q3 J( z- i9 l  k! t
  34. #include <linux/dma-mapping.h>, k6 x& g* o5 l: X8 p' Z3 H' v7 E
  35. / {5 E, }6 c' N( O1 b; Z% }
  36. #include <mach/memory.h>
    8 B) v# U7 k0 V( @- ?
  37. #include <mach/hardware.h>; j1 a( R, E! q( w" M* _
  38. #include <mach/irqs.h>
    % f/ P. ~' Y- l  W" d6 n
  39. #include <asm/hardware/edma.h>
    1 n$ a; ?# Z' o$ {3 l# S6 m' g
  40. 3 ]7 q4 I5 m) H- R, n9 r$ R
  41. #undef EDMA3_DEBUG& c; _* @$ _# k. v# t# t8 p# r8 O
  42. /*#define EDMA3_DEBUG*/. r5 F1 _# J, _. V6 p" m
  43. ' Y# ~: [0 N9 S
  44. #ifdef EDMA3_DEBUG  _: C, ?5 M& K2 z& o5 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c2 B6 [+ ]5 Q- m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 K7 B  C; t% {/ N8 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; X% [+ U; B0 H. ~
  48. #else
    ' ^8 _8 H+ N/ k: a
  49. #define DMA_PRINTK( x... )0 T* W$ \0 ?/ p$ I" H
  50. #define DMA_FN_IN
      ?/ e2 ^: a1 ^8 O" ~. |
  51. #define DMA_FN_OUT
    ' R% Q; ]# B8 g) @
  52. #endif
    6 Q( f. c" J: Q" y! K
  53. $ H( z" R8 m9 L9 c4 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! X0 @# k; _+ v+ `' i- N
  55. #define STATIC_SHIFT                3
    0 ]; r- U7 C* [% j: J
  56. #define TCINTEN_SHIFT               20
    $ {# _6 z2 L  U: W/ O% }! D
  57. #define ITCINTEN_SHIFT              21
    3 q8 S' E  k" {$ m& d; ?' T
  58. #define TCCHEN_SHIFT                22& l+ H7 v$ W. q
  59. #define ITCCHEN_SHIFT               232 |1 @& E" b* i! P/ S& \9 d

  60. / j% a2 C8 Z  n& }% |- o1 s3 l% I
  61. static volatile int irqraised1 = 0;
    & l) w) K, q; g* q( _& p
  62. static volatile int irqraised2 = 0;2 A4 j) O  p' ~) q  w% j. e

  63. # S+ K# z" N. x3 e  [3 |/ o; b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y: |7 H% x$ Q/ y& x" K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a4 d2 }' S/ v; B/ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # u# V: u, J# _8 e# O2 N& h
  67. , B3 P4 H" T5 {* |' I1 W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ @' Q+ s6 t( W3 P' h
  69. dma_addr_t dmaphyssrc2 = 0;, z* _2 ^: f" W+ ]$ v! {1 z- w3 F
  70. dma_addr_t dmaphysdest1 = 0;
    ' a0 c1 \. C( J+ |/ X9 G
  71. dma_addr_t dmaphysdest2 = 0;
    % P2 V! q+ g, z

  72. & h  t$ C# n9 P
  73. char *dmabufsrc1 = NULL;' }/ d7 ^" d) f' t1 g( |5 Y& u
  74. char *dmabufsrc2 = NULL;
    ) z& U& z  A2 V% r3 o: Y/ h5 v6 _- Z& g
  75. char *dmabufdest1 = NULL;
    # `: h5 f- `0 Q! x" z( X
  76. char *dmabufdest2 = NULL;$ h% I& N+ D# Z! T" S$ U

  77. ; n" E$ n4 V8 _3 H
  78. static int acnt = 512;
    - c3 o7 M$ U# }5 V
  79. static int bcnt = 8;2 S" \: T# U8 f0 @, Z3 I
  80. static int ccnt = 8;1 F/ ~) t$ D" m
  81. 7 k" a1 E3 R. B; Z
  82. module_param(acnt, int, S_IRUGO);
    3 u6 L  F' C8 b  b
  83. module_param(bcnt, int, S_IRUGO);
    5 U$ Z( l7 g2 S6 k8 R/ I# P; q' _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. A; D% w5 p! R0 A; ]
- [! x/ F0 \# ^0 g6 H0 B; P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J3 C5 ^5 r/ g, z1 B  [" b  f8 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 L2 R3 {' H1 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ^( I: d/ V5 T3 X. h3 U. D& G" G
3 p% g9 p% v) T; P1 d# p

& K% j$ j. V* m( g* z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 19:03 , Processed in 0.038710 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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