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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 I% K1 r. ^2 f& _' l0 Z
  1. [code]EDMA sample test application! D7 b; f  f" p6 E
  2. /*& g" `7 X3 {" R+ V* K
  3. * edma_test.c1 @( j- \( v5 E$ ]- p/ ?8 j; K
  4. *. h" N0 E/ A" w2 D# e: F: s
  5. * brief  EDMA3 Test Application
    ! p6 C& w7 U6 ^: w
  6. *
    8 q& ?  k- t( x
  7. *   This file contains EDMA3 Test code.
    1 \8 ]( K/ T2 C! L
  8. *7 m1 T( H7 w" D& \: D+ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- M7 ]. Q( w5 t- H& s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : z* A8 b! R  w4 s4 a( C% G2 Z: h
  11. *         TO CHANGE.. |6 c8 U, s1 ^3 b& O
  12. *& T) s% F# `4 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% `( C6 B- E' t
  14. *& w/ r- T# B8 \8 j9 C# S
  15. * This program is free software; you can redistribute it and/or
    6 k" b2 H/ W, I
  16. * modify it under the terms of the GNU General Public License as
    ( S! y6 J5 l- ?4 \9 f; M
  17. * published by the Free Software Foundation version 2." D5 W% \, T: q
  18. *% B8 W& |+ I/ o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 R5 ?& t  C3 t3 g' l
  20. * kind, whether express or implied; without even the implied warranty
    # p! m$ J  k! W8 i) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ D8 W1 u& [, o9 t
  22. * GNU General Public License for more details." t8 z" @8 ?) @7 e/ c1 O
  23. */8 k- R6 g+ B, Z3 C
  24. / h# U6 ?) h0 G/ z/ {! @
  25. #include <linux/module.h>) ?, u5 R7 {, y. R, B. J  T
  26. #include <linux/init.h>1 n5 R3 Y3 [; Y8 Q3 O. f/ v
  27. #include <linux/errno.h>
    4 ]6 ]! s1 b; a" c" R! N, A6 j0 C
  28. #include <linux/types.h>
    ! M1 r5 h& A  }8 n& u! N+ {( W
  29. #include <linux/interrupt.h># L: q7 R: q1 l6 X+ D$ D
  30. #include <asm/io.h>
    0 c9 M9 K' V( }: }4 ?
  31. #include <linux/moduleparam.h>
    ! c* y1 Y' O- ]% c, Q
  32. #include <linux/sysctl.h>: R, z% `" |( i3 C- n/ s
  33. #include <linux/mm.h>! f# `0 H% C" ]; C( q
  34. #include <linux/dma-mapping.h>
    0 q* q  I7 z, _6 Q, U# D7 |
  35. " X6 z  Q" \, u
  36. #include <mach/memory.h>
    ; X( M- Z  w, j% T
  37. #include <mach/hardware.h>5 c  Z/ y( h. E, Q% f0 `3 G
  38. #include <mach/irqs.h>3 d; v& d. |6 }# M+ G; Y0 X
  39. #include <asm/hardware/edma.h>, ?! O/ N) I2 @- B" Q3 |
  40. $ {( z. @0 V* K. q0 Q, {, f
  41. #undef EDMA3_DEBUG  ]3 ^: i/ J, _/ G  `( Z
  42. /*#define EDMA3_DEBUG*/
    ) l& ?) d1 b  B! y* u+ G
  43. ' o" E  N; C7 D6 ]% V& Y
  44. #ifdef EDMA3_DEBUG
    1 w/ J- m2 A; \" ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 `$ \) d4 e: Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* k0 ?, h9 j1 V5 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " E6 ]2 k$ x  x8 T
  48. #else( D2 x& D- S1 y9 o9 B: ]
  49. #define DMA_PRINTK( x... )
    % H$ f5 R( b5 h! z8 @7 }
  50. #define DMA_FN_IN# M7 C" X  x9 H+ C0 T
  51. #define DMA_FN_OUT: o- X0 i5 E* A  Y3 A6 Y0 ^% l( j- P  A, n
  52. #endif$ v" U  D( l2 w9 T- Y+ G: {
  53. 1 {! S- I! _5 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* T) F( \) l- j8 V
  55. #define STATIC_SHIFT                3
    + S! J! I! n; J* E' L, |
  56. #define TCINTEN_SHIFT               20
    $ A; Q* t8 w: o
  57. #define ITCINTEN_SHIFT              212 x. V- r& N! {" l
  58. #define TCCHEN_SHIFT                225 b, h4 I2 y3 d; t; f1 \: t
  59. #define ITCCHEN_SHIFT               23; ]: b, U7 U1 Y' b# a) ?, O/ p
  60. , i: {- j0 M( R' b
  61. static volatile int irqraised1 = 0;
    2 A! |0 S( w# v6 d# x
  62. static volatile int irqraised2 = 0;2 T# y* Y* P6 m8 [) k

  63. 8 y) U. N' O* T% z5 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ~" [2 R5 R2 E& ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 y9 p2 T- _' K3 V- W+ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K; }/ z  J3 e& ^; j% d
  67. & u8 V' G! E! Q  `/ w0 A
  68. dma_addr_t dmaphyssrc1 = 0;1 @$ k8 m1 Y$ t2 w% I* E( h7 z
  69. dma_addr_t dmaphyssrc2 = 0;
    . i- @; v) P- ?( r$ Y7 O0 c. D3 _
  70. dma_addr_t dmaphysdest1 = 0;5 s) j( M( ?7 \- k
  71. dma_addr_t dmaphysdest2 = 0;
    8 L! `; D6 t% n' o# b9 j% Q
  72. $ f$ {# }' J# ]1 s. s8 e4 B% _
  73. char *dmabufsrc1 = NULL;5 g5 L, Q) ^* c1 F* Q
  74. char *dmabufsrc2 = NULL;
    + o1 U- B% F9 F; N- d+ [8 ]  r
  75. char *dmabufdest1 = NULL;& H6 _! @- p/ _/ q) D8 r9 e/ n
  76. char *dmabufdest2 = NULL;1 J# W  A1 }& |; c
  77. " o5 ]% r8 k$ F& f( n) [8 F
  78. static int acnt = 512;
    5 m5 g" g9 T! z/ R
  79. static int bcnt = 8;
    6 `6 A" i! u4 U, {
  80. static int ccnt = 8;
    3 T" t7 |* m; m6 G
  81. & Q9 E. a2 d$ m. v# {& N: Y1 l7 s
  82. module_param(acnt, int, S_IRUGO);
    8 n2 `' G% J8 z* w$ b
  83. module_param(bcnt, int, S_IRUGO);4 W# a3 X' a; R/ }! x) u8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- v4 i9 i2 `7 U' Z7 B4 m8 ?2 V

" M) ^" b4 E# l. c! @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 R* M' y- ~+ Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, w7 e6 S8 o8 k$ F, [. {3 D, m0 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. |6 k+ t  W1 J+ m( Q
7 r* y; l5 m* V* H; S) @. s. I( g$ y+ L& g, ^4 \8 e" V0 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 12:55 , Processed in 0.038330 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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