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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 [. W% v4 G& x  @4 J: V$ }) D
  1. [code]EDMA sample test application
    ) w# k- o" F" f
  2. /*; ^1 \; U0 t0 D" F% X" ^  Y+ D
  3. * edma_test.c
    . C' r& j- Q7 V. r: B) @1 _; n
  4. *
    * f! @& x! W6 g7 L
  5. * brief  EDMA3 Test Application! R3 e# a) y( o5 T6 F0 m
  6. *" w0 k/ Y  {, [; K% o( X
  7. *   This file contains EDMA3 Test code.* Y: Q$ W/ Q# O) {) ~
  8. *0 k! q; n- ?; L9 r$ E& _$ b& A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p! G8 s$ F7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; C" a; X1 n0 ?  r0 `  u# g
  11. *         TO CHANGE.3 h! }' Y# s# P, l  |0 {- A  N4 h
  12. *5 w- P% K( `& `# r: C: j; ~2 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* b- l/ r) p/ ~" L) B, f
  14. *1 w, _2 V# }6 B! D, I4 T
  15. * This program is free software; you can redistribute it and/or$ `: R9 J4 ]$ G0 E' Z( Y
  16. * modify it under the terms of the GNU General Public License as: {$ G2 C0 Y4 l6 }5 s
  17. * published by the Free Software Foundation version 2.( C$ J  \# E! ~4 ^; p
  18. *
    - X0 }. F; N5 Y3 O- D5 N6 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 m1 F/ y3 W! E) `5 i, o( l
  20. * kind, whether express or implied; without even the implied warranty7 \9 D1 ?, ^; m. H! b/ x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* E# k$ n. x6 Z  @; C
  22. * GNU General Public License for more details.
    : E8 M% s2 L8 e8 t& `/ h
  23. */
    ; m+ z% a& m$ o1 a
  24. ) A! W4 {/ X, U  j% R9 C" w1 @$ I
  25. #include <linux/module.h>
    , R3 r% I" j& ?' I2 N. v
  26. #include <linux/init.h>/ k. N- p$ `. U7 a) ?
  27. #include <linux/errno.h>& B/ M4 m% _, G5 w$ K
  28. #include <linux/types.h>6 {9 T: t6 U8 |" c1 @; R
  29. #include <linux/interrupt.h>$ {5 ?. u: i# m+ O' h8 H; U; C" d
  30. #include <asm/io.h>. P. s6 b: U3 O4 }  [
  31. #include <linux/moduleparam.h>& c1 N2 x2 {* C: T/ h
  32. #include <linux/sysctl.h>5 ?; ]( N: ^2 ?2 N" N; o9 B% G% b
  33. #include <linux/mm.h>
    $ ^0 \" s: P1 x$ t: r
  34. #include <linux/dma-mapping.h>
    0 H5 x' n& {) c/ T7 [  V: E
  35. ; I, [: ?* P/ D
  36. #include <mach/memory.h>' P# y# V; r+ a9 i. C
  37. #include <mach/hardware.h>3 U9 g/ f# j6 T. x5 ~8 n
  38. #include <mach/irqs.h>
    % O3 m$ C0 x& h) L  g
  39. #include <asm/hardware/edma.h>' h6 N( q+ |  T0 n  I! b

  40. 7 H/ V# B0 R+ a6 ~
  41. #undef EDMA3_DEBUG
    1 N* L3 V0 u* o" v5 b' X* u
  42. /*#define EDMA3_DEBUG*/
    3 ^1 c  H7 A( S

  43.   N! f8 B7 N; G. ?. v
  44. #ifdef EDMA3_DEBUG
    7 U: E& U! r% v: j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 b( m. C* H: `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \# w2 R2 J7 V+ \' A  n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& F( t; a" D7 S8 d, @
  48. #else
    9 Y; A9 G6 s* U: W! w
  49. #define DMA_PRINTK( x... )1 P9 K; D/ o7 U" k: n
  50. #define DMA_FN_IN1 [& B3 \$ W+ s3 r/ b
  51. #define DMA_FN_OUT
    1 A, T. a- C$ x- ~* V4 `7 D
  52. #endif5 S: ]  W% f* U1 v# e. X
  53. & V" K( D' W: t  B3 c0 O" D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 j  T- \& _! p; e. E
  55. #define STATIC_SHIFT                3
    , A) l* \: |( w/ y
  56. #define TCINTEN_SHIFT               20
    . I6 S( a9 O, Z9 o# ~; |5 u9 z
  57. #define ITCINTEN_SHIFT              21
    , @( |5 |8 x: X, C' _* e5 V6 h& X
  58. #define TCCHEN_SHIFT                22
    * v( d3 W5 U& |! |" R0 ^) P3 C
  59. #define ITCCHEN_SHIFT               23
    % F: c, D# M# D' W) v, X1 S

  60. 6 |0 l0 z& ]$ Q' z# e
  61. static volatile int irqraised1 = 0;
    + c' D# }5 i' C8 c! l, s
  62. static volatile int irqraised2 = 0;
    9 {! V7 P. S, n5 ?: E. \3 {2 Q4 M% C

  63. " ^( l" }1 R, x/ X  Z; x- _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G5 ?5 {) V. n+ i* P4 o: j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * q/ G) O  ?" v! ?- I5 N" c+ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N- Y: Q6 A) @* N- z+ d

  67. 7 L" @: n1 `6 D% r0 S
  68. dma_addr_t dmaphyssrc1 = 0;
    # _, f% ?) x  J
  69. dma_addr_t dmaphyssrc2 = 0;
    8 H" l5 g9 Z6 X) O/ j) I" q
  70. dma_addr_t dmaphysdest1 = 0;$ w/ Z# I; C5 T: `4 A1 f' t9 ^" }2 n. }
  71. dma_addr_t dmaphysdest2 = 0;
    " \; M& i: E9 t2 X  g6 s

  72. ) W' o. P8 k( K1 }% R1 s5 r# b
  73. char *dmabufsrc1 = NULL;2 M4 d% L8 s3 o' ^
  74. char *dmabufsrc2 = NULL;) w. e( [' t  C( }( V7 R4 B
  75. char *dmabufdest1 = NULL;
    $ {, ?1 S7 `2 F  H& q9 G. A
  76. char *dmabufdest2 = NULL;
    6 }, [  ~* H& c2 A6 {

  77. # L; O- g% H" @1 D  p; v1 I: t/ u% J
  78. static int acnt = 512;
    * D$ E" j# q. d& d) c% a( O
  79. static int bcnt = 8;4 h1 }4 X8 x. w5 }8 j" u
  80. static int ccnt = 8;
    ( M" q# P0 c& L8 _) E& r

  81. ( A( ^9 d; @0 \8 Q
  82. module_param(acnt, int, S_IRUGO);" U9 S5 M# [% A, {) |
  83. module_param(bcnt, int, S_IRUGO);( X& C3 \9 g$ _" p6 [- R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 H) k% s1 k* P0 ?1 u! E: ]

; G1 B* v: x" \2 \3 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" J- O0 u* b2 M8 M0 k- Q5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 V0 h3 `. M/ b5 ~7 q' e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: f. Y  f- d3 E( j# e; g: N
0 n/ @! g! r* `2 Y# d2 I2 O* E; G* W; c- q  I* [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-9 01:50 , Processed in 0.039922 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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