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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 {2 ^6 ?1 ~6 J( W8 v
  1. [code]EDMA sample test application4 \, }) O2 ?0 m# Y/ I9 G
  2. /*
    , ~3 g3 I$ _7 G( j' c6 M
  3. * edma_test.c
    % u+ i  @7 T) Q) m  j
  4. *
    2 S8 Y; ^& v; B( {8 Z- _
  5. * brief  EDMA3 Test Application
    2 y" q1 @" D/ i- ]
  6. *  m' e  g; W8 A1 b
  7. *   This file contains EDMA3 Test code.# G! {! e2 e, i
  8. *0 K6 ~8 Q5 S% S1 \( @+ E& ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q* f! X  m2 C# q  h# {8 K5 P- _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + f: n& y# }' k
  11. *         TO CHANGE.+ F' h# {8 y- p2 l
  12. */ G# m' j4 [4 B( b) D, E5 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x, o" r. E) C. o1 K- P
  14. *( f: B* `' n; S
  15. * This program is free software; you can redistribute it and/or& n0 T. [, G* ]1 v
  16. * modify it under the terms of the GNU General Public License as
    - a5 a& D0 ^9 Q
  17. * published by the Free Software Foundation version 2.
    ( g( U/ i4 J( k, Z( M
  18. *
    9 V; A+ _# a# ^" G8 Y# r3 a( b  Q3 B1 `$ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 y/ J. E! Y; q3 L! q+ q" ]3 h) U% J
  20. * kind, whether express or implied; without even the implied warranty
    0 s, |. l2 W9 g* I4 }1 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) |# K9 G0 x. A
  22. * GNU General Public License for more details.
    & K3 G8 p, _/ G1 t7 y2 j8 {6 Z
  23. */
    1 R  K- j% G  m; I) N+ ?

  24. + `4 T3 a+ h: S, C$ @9 Y- i* Q# a
  25. #include <linux/module.h>! V$ K) G- }( p
  26. #include <linux/init.h>
    ! u( z, I, z/ |: ]: a
  27. #include <linux/errno.h>
    & A* R) ?5 L0 M# P; H) r0 b
  28. #include <linux/types.h>
    ' \" @- t8 s, Y( N5 _' g, L
  29. #include <linux/interrupt.h>- o4 D$ W8 t+ m  W4 ^4 b
  30. #include <asm/io.h>
    ( J# Q# |9 \6 Y: e  f  X# Q  C
  31. #include <linux/moduleparam.h>
    0 G) U" M* K, i
  32. #include <linux/sysctl.h>
    1 k+ x  [" e' e6 h9 e7 \  u4 a
  33. #include <linux/mm.h>
    . @( F- h  t5 h' k% F
  34. #include <linux/dma-mapping.h>) Q; @6 A  @4 e+ K& I4 I; C

  35. ' j0 g" d+ S, {) J6 C, l  ^
  36. #include <mach/memory.h>& T. [; Z$ m" x/ ^% Y$ H  ^
  37. #include <mach/hardware.h>
    : A5 n; Y* Z$ a$ i; Q$ a0 \. x- g
  38. #include <mach/irqs.h>
    ' S* g; b( F% J9 _. I( E* Y
  39. #include <asm/hardware/edma.h>
    , Z1 [7 {7 T# \( t4 i' P- O

  40. 8 W; }  v# X% C( K0 q6 |$ U
  41. #undef EDMA3_DEBUG( p" a3 n- ]9 g1 [- q$ c% ?
  42. /*#define EDMA3_DEBUG*/4 q: C. m: ~" |  p$ E8 F- A4 j* B/ `
  43. 2 I; l& u" z. s, T8 m% ?7 s
  44. #ifdef EDMA3_DEBUG
    9 f* k9 ^2 L$ F# ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % N" a! Q0 ?1 i! y- Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 B) @2 u$ z( ^/ {: ^4 N! _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T% J2 H' [" y" Z6 @
  48. #else
    ; y2 ?( L1 n, Z
  49. #define DMA_PRINTK( x... )' `( b, k2 Z' g# L' i+ `! O7 c
  50. #define DMA_FN_IN
    7 ^/ T5 [0 r* F7 G5 P( q
  51. #define DMA_FN_OUT, [- t  o6 U' J$ n
  52. #endif
    1 J' K1 _, g7 @# _9 j
  53. 2 C  u; r; q4 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 p. O9 L6 @7 D! I% W$ ^3 ?
  55. #define STATIC_SHIFT                3# H6 z. S! Z8 X2 d) H
  56. #define TCINTEN_SHIFT               20
    5 |* H& \. }7 l. b* }( g
  57. #define ITCINTEN_SHIFT              21
    0 \7 o+ |. r0 |& g0 p7 G
  58. #define TCCHEN_SHIFT                223 P+ o8 ?9 j" H+ P' L3 s
  59. #define ITCCHEN_SHIFT               23
    * x9 {% g& e. u. Q

  60. + Q  G7 o: L$ c1 w5 i
  61. static volatile int irqraised1 = 0;( N& _8 H" q& e6 ^# q9 f  @. ?+ T+ g
  62. static volatile int irqraised2 = 0;  {8 G0 t/ Q0 ?$ X6 ]( V. D

  63. 2 a4 N3 s# N0 H5 n( d; d6 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ X# ?  P* R7 y+ k+ B, b: k; i. C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" O8 R' P. j' E. a% E/ U) ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o5 ]/ `  r- z* A' @! z
  67. ; c" X7 P1 o$ G: z5 V
  68. dma_addr_t dmaphyssrc1 = 0;
    % H  K! `4 {! o1 e
  69. dma_addr_t dmaphyssrc2 = 0;
    . F, C. E- ~. `3 J5 X
  70. dma_addr_t dmaphysdest1 = 0;
    2 ^/ |7 m  ~& K$ _8 f* H
  71. dma_addr_t dmaphysdest2 = 0;
    ( t8 N; v/ B0 F/ i" u. y
  72. ' i: M8 D3 S* P# {, X5 g
  73. char *dmabufsrc1 = NULL;
    2 Z- o+ \& ]; _2 c; a5 T0 u( a
  74. char *dmabufsrc2 = NULL;3 a% u$ f" [: r
  75. char *dmabufdest1 = NULL;
    . P. Q& O" b5 V8 o3 i% p5 X
  76. char *dmabufdest2 = NULL;( Q# w5 {6 m( B& v/ Y6 u
  77. * h1 x. }. z9 r9 g
  78. static int acnt = 512;+ s& {: z. R" J* Y; o7 Z% _. I
  79. static int bcnt = 8;1 G* \" r) c+ I
  80. static int ccnt = 8;3 ^6 j  `$ W* w1 d
  81. ) f' }0 n# G  a+ m0 H# R
  82. module_param(acnt, int, S_IRUGO);
    ( b, }! Q0 ?' |% I' j2 @( M4 g0 m
  83. module_param(bcnt, int, S_IRUGO);
    4 R8 g% N. A; g% J  {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! q4 A- n7 x4 n7 n* c* V
- y' x6 }" p4 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. B8 Z7 U  e! e7 M" m6 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Q* M& g8 |+ q+ i# E/ d, M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ T( G# \; L4 S9 f! [

( ?7 ^, I2 b. h0 e+ I
- q8 N# t* ?- }6 b* ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 13:29 , Processed in 0.039117 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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