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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 b# v& }4 O, y# D( M8 Q' \
  1. [code]EDMA sample test application8 \+ M! B% S2 L, J
  2. /*, d3 g) m" g9 i3 g$ {- y  z
  3. * edma_test.c
    0 e+ \, r' i& r* E( M3 ~/ e8 ?
  4. *# E! |2 [( N$ {( O7 h) ^% c
  5. * brief  EDMA3 Test Application( Z1 b" o+ b9 q  G; J% N# ^
  6. *
    - m+ R. R6 X9 ~
  7. *   This file contains EDMA3 Test code.4 s. O& y/ N1 M" }; k% }" `) H1 i
  8. *+ m- |0 ~& K  b6 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * N8 T5 |- P  M. Z  a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % \: }; A3 |, D, s: P$ P0 |
  11. *         TO CHANGE.1 S8 D% l, S6 b6 _( U7 K
  12. *8 E! @2 U2 ~+ B- ^6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 N6 s3 Z, m$ E
  14. *
    - I1 l6 ~+ f7 V4 s8 A- ?% n& r: I
  15. * This program is free software; you can redistribute it and/or
    + m  v; W  u- E- F7 b/ ]* o
  16. * modify it under the terms of the GNU General Public License as6 J8 \7 ?, H; @- G
  17. * published by the Free Software Foundation version 2.4 s, Q0 H2 B( ~- c' E9 N% n1 P; M
  18. *
    3 t+ q9 X2 H4 L% P& R, h! T7 m4 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j6 a: _- f9 m6 w8 J9 U
  20. * kind, whether express or implied; without even the implied warranty
    5 \. Q* j1 \1 e# s& j1 q+ H* i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- X7 n7 C. t0 m. M
  22. * GNU General Public License for more details.4 p! @6 g1 T6 H& ?' O0 f
  23. */
    2 R% u; r, ?! g) r0 U9 H- Y' N" x

  24. 5 X. w3 N+ y7 U1 @* N1 s. g* G) R
  25. #include <linux/module.h>' f4 y% u1 J; U$ Y% k' q
  26. #include <linux/init.h>
    ; T5 J$ f, K6 D. W
  27. #include <linux/errno.h>% F; P% {+ i- x$ B
  28. #include <linux/types.h>0 j1 y0 @6 \9 y4 k% k# x! Z
  29. #include <linux/interrupt.h>
    ) S; u" @  w* J* _1 m5 \, V6 H
  30. #include <asm/io.h>
      Z- Z9 X6 ?8 z9 r2 x$ I8 v, s+ p
  31. #include <linux/moduleparam.h>
    ( Z* ]$ j; k2 M- T6 y- L# L/ X0 m
  32. #include <linux/sysctl.h>
    4 s( Y1 R6 ~, t
  33. #include <linux/mm.h>/ T) n4 k  i: y. w/ `9 }
  34. #include <linux/dma-mapping.h>
    6 T- K7 v+ K- I. a1 M  U" w

  35. 3 Y5 R; o; t  C: V
  36. #include <mach/memory.h>
    ! b" b* Z! I& f: b- a
  37. #include <mach/hardware.h>, v. K9 C2 n6 C' U. m5 w( |
  38. #include <mach/irqs.h>
    ' c7 F5 Q7 N+ S: f
  39. #include <asm/hardware/edma.h>% h$ d4 I4 [2 @7 G4 l6 D

  40.   ]& m  `/ p$ h. f+ }8 v
  41. #undef EDMA3_DEBUG4 W9 E" J0 S) G9 T( E- X
  42. /*#define EDMA3_DEBUG*/
    9 z- R  |( b3 _* {. P2 z
  43. . D$ M+ l$ a2 I9 }7 M2 }" i" \
  44. #ifdef EDMA3_DEBUG
    ; W0 e- t8 K7 e( i3 `- ~2 [3 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ^- X/ W: s- p! Y9 g! D& j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): W- U6 V# b# [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" h! x2 O  W$ G0 m9 s4 A- ^- A
  48. #else7 v, i, v# U1 W- |+ t, _! ?, D
  49. #define DMA_PRINTK( x... )
    , Z' H% F% ?2 ?& ~! @
  50. #define DMA_FN_IN2 _: R9 _3 ?- ~3 v" L9 Y) U
  51. #define DMA_FN_OUT
    . M; F* {9 V* n7 U  o
  52. #endif
      q( I3 j5 b5 R& G- R4 c  N

  53. $ F, F, x8 d2 j& I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! l! `4 }, A- q6 F% \6 X
  55. #define STATIC_SHIFT                33 M! C2 M# {& f  ]! b9 o/ n3 b
  56. #define TCINTEN_SHIFT               20
    + x; x2 _; k' N8 c6 E, B5 t. U0 C
  57. #define ITCINTEN_SHIFT              21
    ( d5 W' p7 l4 ~" K
  58. #define TCCHEN_SHIFT                22
    4 X0 e( a* I+ B- Z
  59. #define ITCCHEN_SHIFT               23
    2 r+ ^3 |+ F+ H; I# h

  60. 7 Q2 J! E% W3 H8 C
  61. static volatile int irqraised1 = 0;3 T! q' }% k( C* L, {: z1 R' N' a
  62. static volatile int irqraised2 = 0;
    $ \# a3 I4 T+ J  G) ~, o
  63. # a- v- `" k9 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q3 [# u/ r- j7 R! I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( i# n9 C+ I  o( q5 B& E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 B2 I0 }1 q0 d

  67. 9 v* l, M# g  N0 g! K3 B
  68. dma_addr_t dmaphyssrc1 = 0;* A+ U& m, @: B, E  j" @+ q% c1 X
  69. dma_addr_t dmaphyssrc2 = 0;$ F& v3 |3 i- {% q* H
  70. dma_addr_t dmaphysdest1 = 0;! }5 d& i! o8 B5 L( K
  71. dma_addr_t dmaphysdest2 = 0;
    / H/ P" m& q) }1 G( s6 v; W

  72. & T7 h1 h# R  ~* R* v. @! D6 M+ ]
  73. char *dmabufsrc1 = NULL;# b0 |4 i* H# f# A+ Z/ Q
  74. char *dmabufsrc2 = NULL;, \( ?, |/ M, s0 j
  75. char *dmabufdest1 = NULL;! k: T$ l- @: I
  76. char *dmabufdest2 = NULL;0 X+ l  ?8 \1 g) w4 D

  77. 4 m0 E1 Z. W, S/ F
  78. static int acnt = 512;
    - s* k; {7 m( m; f1 n# I
  79. static int bcnt = 8;+ S. |4 T2 x) B9 z' e
  80. static int ccnt = 8;
      b- G! S  p+ j  x) z2 N
  81. 6 K# E; @9 E: j; U% q
  82. module_param(acnt, int, S_IRUGO);; j- u) b8 U# l2 U/ C! J
  83. module_param(bcnt, int, S_IRUGO);
    ( U' m+ \: D: U# a2 @: t7 Q3 w- g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 s( C# E3 M/ \4 O- d
0 w/ x  J& z7 F- ?9 q0 h( D( W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  Y0 G6 g+ U1 N! B2 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 l7 z3 v8 v: J" ]7 o3 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 t9 ~6 n# X7 f8 z. V: B

) z, I5 W/ \% K7 c5 N$ F) }0 g5 b0 ?. X# p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 22:03 , Processed in 0.040661 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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