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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  g) O; N2 H, T5 a% e# m
  1. [code]EDMA sample test application+ Z5 p" H; Y6 n
  2. /*
    ) g- \" I" ?+ T* ~# t- P1 r
  3. * edma_test.c
    ; V3 f  i6 P- {  S0 ~( f, D
  4. *
    : L) s# K  N5 h/ N% G) ~* b+ d1 q
  5. * brief  EDMA3 Test Application
    9 q" Y) r" \; D& K3 e
  6. *; ^5 y: n/ _. E/ D. b) ?! L. v
  7. *   This file contains EDMA3 Test code.
    : D. R4 Z6 W( i, a
  8. *- ], N3 F# o+ Z7 ?' S  F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m1 @) ?, T9 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `1 s% M7 v/ C  l
  11. *         TO CHANGE.
    - U4 B2 m5 F: H$ ~  {  g
  12. *( q- B3 t8 Z& `  X$ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ?. c6 t5 n1 v) @
  14. *3 A8 l. N- ?% }) J
  15. * This program is free software; you can redistribute it and/or5 N/ b0 N9 ^9 ]7 q
  16. * modify it under the terms of the GNU General Public License as* G4 s8 ~2 ^8 l: L4 `
  17. * published by the Free Software Foundation version 2.
    , u# N2 K" ?7 s) w4 A
  18. *
    % @1 |# P5 A0 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 n: d2 T+ p" d0 z8 l: D
  20. * kind, whether express or implied; without even the implied warranty
    9 v+ b9 k: Z# ?: F9 W3 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - s+ P/ a" U3 P( N  S4 @
  22. * GNU General Public License for more details.3 E0 i7 n# C8 L, q; r, f
  23. */; N; p3 H8 w( X2 }) H# x. D
  24. 6 B# o7 L& W8 J% x; ]
  25. #include <linux/module.h>* Z% K5 B$ m3 ~7 m5 y
  26. #include <linux/init.h>
    + }4 I5 M! i* \/ f9 I3 I
  27. #include <linux/errno.h>
      a1 V# i6 v/ \& F! T8 U& K. F3 q
  28. #include <linux/types.h>1 `) R2 V% L5 X5 R: m4 p# J
  29. #include <linux/interrupt.h>; C  p/ `( k% R+ q8 p4 w% s
  30. #include <asm/io.h>, r5 z! _; }3 a0 c* w
  31. #include <linux/moduleparam.h>9 ~. d" @2 S) o+ l) L
  32. #include <linux/sysctl.h>
    0 H# ~& ]4 |2 t) B% ?* j. n  s
  33. #include <linux/mm.h>' O% f, L- e' D& p, `4 ?1 J. G
  34. #include <linux/dma-mapping.h>! t# ?! ?% U# {8 t3 o! }% N

  35. 6 _; W* `: [: B  K1 i1 f; e
  36. #include <mach/memory.h>
    7 L* p4 l9 }0 p! [. `
  37. #include <mach/hardware.h>
    ) g7 B8 J( V2 S! T  e* t( U+ c
  38. #include <mach/irqs.h>* W/ Z; p6 ]" J+ ~. q0 S
  39. #include <asm/hardware/edma.h>" V/ u1 g: _7 n3 @0 G; a4 P
  40. $ o; r% S; v8 K- ]! S
  41. #undef EDMA3_DEBUG* @+ h7 U2 r5 [" q' s  o1 ]1 M
  42. /*#define EDMA3_DEBUG*/# J  [4 M0 W: z) M: X

  43. . O5 ^) n  ?1 j
  44. #ifdef EDMA3_DEBUG
    , w6 `- b# G! M' s" R3 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! i. `3 R/ H* E, ^. @  s3 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! L' i5 `0 Q# s1 ^9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 \& f' X0 {9 U" |
  48. #else
    - `4 H; B7 `; w; d
  49. #define DMA_PRINTK( x... )! Y+ C) m9 ^& O+ I
  50. #define DMA_FN_IN
    ( |- s/ e3 A: E# u
  51. #define DMA_FN_OUT
    $ |9 @2 l$ H; V; n( n% M
  52. #endif5 o; L6 o# R1 P3 l- `# O/ k5 ~5 \, O

  53. 7 f4 K$ u5 _! o) n* m8 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 S3 X: ~- s9 w
  55. #define STATIC_SHIFT                3
    9 y. _: u: J6 w3 @% B) |$ F
  56. #define TCINTEN_SHIFT               20- e" _+ O+ C: E6 G( S, a0 r
  57. #define ITCINTEN_SHIFT              213 c* f7 ^9 x6 r$ L" j" |. ?
  58. #define TCCHEN_SHIFT                22/ @' V, @- f6 U/ D
  59. #define ITCCHEN_SHIFT               23, m+ ~: X" Z) p. u( b& x& d

  60. 1 N; ^* R3 f; u" ]% g! H9 \. G8 b
  61. static volatile int irqraised1 = 0;
    ' Z( @( |' {3 T0 L& D( K  L
  62. static volatile int irqraised2 = 0;
    ) v; Z3 j& m, t0 |, P

  63. : e+ n! r" |7 j9 l' n5 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 a0 r$ k0 I! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [& B' J8 ?/ y5 q' T4 s" G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j' c0 Y8 t1 Y. A6 v- R: D6 j# k2 X

  67. : g% Z' w, ^, \$ T5 l; T5 t
  68. dma_addr_t dmaphyssrc1 = 0;
    ) o6 x: M8 ?0 w% C
  69. dma_addr_t dmaphyssrc2 = 0;( a3 ?4 t  p' S5 ~0 y1 X
  70. dma_addr_t dmaphysdest1 = 0;
    9 _4 S+ c. [) x
  71. dma_addr_t dmaphysdest2 = 0;
    & I2 E, j! K5 m  b0 y: a* c

  72. ' P: [0 q, h. c+ U
  73. char *dmabufsrc1 = NULL;  P! Z6 C* H+ |" l. G3 E" c8 P
  74. char *dmabufsrc2 = NULL;) ^2 C' j3 ^% t7 b# t6 w" s
  75. char *dmabufdest1 = NULL;! a" W! K6 o# G5 u( m4 p
  76. char *dmabufdest2 = NULL;
    9 K; W7 D5 g6 e, V

  77. ' [/ R2 a8 S; R3 _% @" q" N6 M8 r
  78. static int acnt = 512;7 T' |3 ?$ k* [1 ]' `6 S  O$ C: y& O
  79. static int bcnt = 8;
    7 ^5 [) x! K$ f# M. R
  80. static int ccnt = 8;
    ; h" f# F8 e+ J$ W+ x
  81. 0 b6 D0 j1 ~  o/ S) Q$ }2 t' E
  82. module_param(acnt, int, S_IRUGO);
    9 k3 n2 b+ ^2 j+ T
  83. module_param(bcnt, int, S_IRUGO);
    9 p7 a9 O8 k; C/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  p8 s% r6 ]4 U; Y, F- o, w; W" k) U& e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. S7 c5 {- D% `  B6 t4 f+ S( k/ t% \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ~) L9 g3 \% V( }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; K  I: h6 p: t1 H! N4 [

! X" D; J& A) c7 x4 M# ]% Q6 y+ ^5 Q- q5 U0 ]" J1 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 03:18 , Processed in 0.038111 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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