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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 P  }5 g/ @7 f( j
  1. [code]EDMA sample test application) X: [/ a0 @9 K1 E4 @" W
  2. /*3 ^" V9 r; F( O' m
  3. * edma_test.c
    , g6 M+ L" j$ c  [# U! ?
  4. *
    - M) u) q$ T' ^7 z7 w
  5. * brief  EDMA3 Test Application- [9 v4 `: u# ]' g
  6. *
    5 F2 e! V7 ~/ v' \) J
  7. *   This file contains EDMA3 Test code.
    : r) S8 S3 x( a* k6 E5 X8 \
  8. *- d% j# r& n& l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " g- U  e. c% I) ^- V% d% ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' l* a8 F% o  u4 e
  11. *         TO CHANGE.
      @. K7 x% D* A3 Z6 f
  12. *
      {4 R9 l- Q! D, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i& f" [" `- G3 B  a( t: [
  14. *' K1 W) `( k# |
  15. * This program is free software; you can redistribute it and/or' J* O0 o3 w- c, R/ H. p
  16. * modify it under the terms of the GNU General Public License as
    ! m' X( P  m* A' u  Q$ }
  17. * published by the Free Software Foundation version 2.
    2 ?. |' d, N( b! Y
  18. *
    1 R3 t5 M( H4 B9 x& D' l$ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ g1 m" P9 y8 f$ n" C+ h! G: F6 h
  20. * kind, whether express or implied; without even the implied warranty" k0 O! w; P0 Z$ Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ s5 ^6 Z- e- M+ m% e
  22. * GNU General Public License for more details.* i+ {+ L3 e. k+ M+ k# S+ ]6 B
  23. */" l. B8 \, P  M1 L( j. F

  24. ( y- s6 z  z8 A0 ?! r5 n1 m
  25. #include <linux/module.h>
    - X/ Y3 q% z2 O% K4 s4 g
  26. #include <linux/init.h>
    1 A+ j% B8 b( {6 v, S! `
  27. #include <linux/errno.h>
    * E  G3 C' H/ B6 U0 m
  28. #include <linux/types.h>7 J) k1 i' t* {: E* K3 K
  29. #include <linux/interrupt.h>
    - d7 S, R! v0 |4 I1 ]/ p0 G
  30. #include <asm/io.h>
    ' j0 e2 k2 v& h
  31. #include <linux/moduleparam.h>
    % d( L$ E8 d% I4 `& T
  32. #include <linux/sysctl.h>
    " {- G% Z& A5 S1 e* f0 S# F
  33. #include <linux/mm.h>
    ! u3 J% ?# c7 B5 O3 i% P
  34. #include <linux/dma-mapping.h>. K% Z+ e  c8 B- h
  35. ) X: _3 e9 S$ L2 r
  36. #include <mach/memory.h>
    " E" M! h, V: a! @
  37. #include <mach/hardware.h>2 Q/ _6 h' Q  o
  38. #include <mach/irqs.h>
    : X  }4 V. z% _! [" N+ |
  39. #include <asm/hardware/edma.h>
    , D$ W3 u3 J* u

  40. 9 w4 \- x% C4 p3 c
  41. #undef EDMA3_DEBUG
    ! i% u4 Q$ m- I) Q/ K$ O
  42. /*#define EDMA3_DEBUG*/
    7 w, m6 }4 I: z  B: i/ H( h4 ]

  43. 8 \" S5 u* h, w2 S- \
  44. #ifdef EDMA3_DEBUG
    * b6 `; B( K) |. u+ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# t7 V! y, n/ O( p% l# p% ]8 W/ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T1 z4 t7 t* c9 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 D& @; Y  F, \" r) ?
  48. #else& w+ k9 X8 w% N$ v/ b- f) }: n
  49. #define DMA_PRINTK( x... )
    * u0 z, V3 I, Z! N0 ~: ]! d! ~4 w
  50. #define DMA_FN_IN
    6 D! |$ E* H  {4 [
  51. #define DMA_FN_OUT" m7 K* v5 V# F
  52. #endif4 E0 v' ]* H* ?; V+ ^' u
  53. 5 w( @: x% r8 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * w3 O) K5 K/ e3 h
  55. #define STATIC_SHIFT                38 C& ], S- C' d8 z& z
  56. #define TCINTEN_SHIFT               20
    * A9 g' l- \4 _0 d8 O- v/ y4 }
  57. #define ITCINTEN_SHIFT              21* y5 e9 X4 X, J% C2 f: k! W
  58. #define TCCHEN_SHIFT                22: d7 p" Q  g5 h4 B5 I
  59. #define ITCCHEN_SHIFT               23* y2 V# u  T) m" V3 j. \

  60. ' \3 U  M4 t2 q/ p
  61. static volatile int irqraised1 = 0;4 V! S* c" N( M1 l1 g6 g
  62. static volatile int irqraised2 = 0;0 k/ u, V" f! u2 \" \. I

  63. ! B0 g+ s5 r  j" b) ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r! n. I/ g5 k1 R1 I" Z" ?5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j0 ?7 f$ j  {1 N+ u$ J* [$ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- {1 l+ D, t  M) S' S

  67. - u1 l% C& o7 [; ?
  68. dma_addr_t dmaphyssrc1 = 0;% k9 }+ t( `) D& W6 ~; q( o
  69. dma_addr_t dmaphyssrc2 = 0;
    2 T% n0 p. S2 R5 r" \' J
  70. dma_addr_t dmaphysdest1 = 0;3 V0 _8 q5 M* F+ w% f
  71. dma_addr_t dmaphysdest2 = 0;& o3 Y* n. X- K2 [8 m/ N

  72. ! n" J! N/ O/ p
  73. char *dmabufsrc1 = NULL;0 U* W! C, K2 P) e
  74. char *dmabufsrc2 = NULL;* Q7 C" C2 F! Y0 j0 Q
  75. char *dmabufdest1 = NULL;  J+ ~# J! s/ v) i- l, K- y
  76. char *dmabufdest2 = NULL;+ F. d( T0 y8 n$ R( J

  77. # f2 a: D) o& v) A
  78. static int acnt = 512;+ e7 P" k8 [, w$ ]! {. ?7 m9 z
  79. static int bcnt = 8;
    : x8 N$ l& n( I  z1 J' D
  80. static int ccnt = 8;. e& Y) i4 n4 `) q/ j, _+ \' {

  81. 0 w9 d% P" g3 A& N  u" I
  82. module_param(acnt, int, S_IRUGO);
    2 U+ U* v8 Q- K9 @
  83. module_param(bcnt, int, S_IRUGO);
    % y5 J9 p3 [- x. ]. P% p/ k" v- y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 e0 p+ G: b/ C: `9 o
0 q2 B; `1 w% b3 B6 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w. v+ [" q8 L- A% g: l9 S3 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ G+ A7 i1 a9 ?' s2 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  ]+ m- o; j7 p4 T7 x+ v7 y

6 g& g& Y4 t7 p) H
3 n+ X" N( W! ]+ v5 M9 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 19:21 , Processed in 0.037886 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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