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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 z3 n# L- n7 |4 R+ ?2 d
  1. [code]EDMA sample test application! z5 p9 C0 O  @+ J
  2. /*+ F4 Q+ a8 t" P4 k9 f' f! C! V) E
  3. * edma_test.c
    * y( G1 B! h% z4 t
  4. *
    # s9 h, u  g, U5 G1 ^7 S' y
  5. * brief  EDMA3 Test Application' y+ l1 q2 B% Q! C1 I
  6. *
    * e  t5 H9 @$ z
  7. *   This file contains EDMA3 Test code.& t. T" w! J; a
  8. *
    " J3 c0 J1 S; }" \- k; c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # |* }4 Q: m; I2 [$ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % E, |4 ]' d7 r6 E, e# H
  11. *         TO CHANGE.+ w2 u: i; a2 [
  12. *
    ( N3 ]# q$ |! D' H' Y* Z4 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p" u# O: E0 P: a* |
  14. *
    . H; n5 u2 {; Y; N
  15. * This program is free software; you can redistribute it and/or: B( M$ V% s' C; {, J" `. z6 d' X) M
  16. * modify it under the terms of the GNU General Public License as
    & x% m8 c8 i3 d* Z9 S, `& p& {
  17. * published by the Free Software Foundation version 2.
    3 J2 z4 Q8 g5 a1 a
  18. *
    4 k" U- P4 v! r4 y- Y- {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * i, U+ {' _* N0 ?2 Z
  20. * kind, whether express or implied; without even the implied warranty3 v( L% j! l! W$ Y" j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , u  [$ {- i/ F0 |) M( ^2 a9 N5 Z- n, l
  22. * GNU General Public License for more details.
    9 l4 r) C; p7 P7 q- k) y
  23. */
    ) S7 ?! L* ]" O7 c$ i5 k: c

  24. 4 x! m& C, Q5 D
  25. #include <linux/module.h>
    " Z2 d/ v) w& l+ A& ~9 P0 }9 i
  26. #include <linux/init.h>% p3 [) B- @0 R! X
  27. #include <linux/errno.h>; z: d& @1 P: h# ~& [# N/ S
  28. #include <linux/types.h>% L  h- X6 {4 W& B% W5 _
  29. #include <linux/interrupt.h>! j: A7 r2 I8 l% S
  30. #include <asm/io.h>' [+ J" u, V9 l# [
  31. #include <linux/moduleparam.h>
    ! P* n; R* x$ H  \5 ?, @
  32. #include <linux/sysctl.h>
    ( r% T3 Z* j( b3 [( t
  33. #include <linux/mm.h>
    0 M  V2 _% r* G/ O& L
  34. #include <linux/dma-mapping.h>. v/ n9 ]: Z4 h) V: \2 ^
  35. 7 ~! l" M8 K% u
  36. #include <mach/memory.h>
    . ^5 j% }$ P2 R! z3 [
  37. #include <mach/hardware.h>
    7 N9 H5 D9 d) d3 D+ a
  38. #include <mach/irqs.h>( q. I5 k. _8 y; L
  39. #include <asm/hardware/edma.h>& D+ c1 L7 y1 Z, q) _! I$ `

  40. 1 D$ X& ]- j% M3 p. c8 M9 }
  41. #undef EDMA3_DEBUG& b  x2 A; r; z5 T
  42. /*#define EDMA3_DEBUG*/) x7 t; Z, q' E0 n4 b" {  f( y( E
  43. 4 i5 v+ J7 A* x! B* @+ E
  44. #ifdef EDMA3_DEBUG" o( k. R- ~4 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). O0 ]6 ]! V9 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % e% b8 y  W2 F+ A, [% Z" b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; _# l! f( m# N/ |. d
  48. #else
    7 j0 D% V# m! t. L+ D. e
  49. #define DMA_PRINTK( x... )' A* U* g' I  c9 J) r
  50. #define DMA_FN_IN
    - a) @; t* }; V: Y2 M
  51. #define DMA_FN_OUT
    " C+ c) f8 }* c7 {+ I" h3 D
  52. #endif
    2 L" j, B0 N0 ~" V3 I. K

  53. 3 [2 n/ O6 |) m3 F  `) G% X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; M: d2 ?* W+ f( m* W
  55. #define STATIC_SHIFT                3
    " t! Q( k: [0 i. F1 s
  56. #define TCINTEN_SHIFT               20/ J$ T, w# e9 b; F
  57. #define ITCINTEN_SHIFT              21' p; o/ O6 U. b% ]/ H! l7 r
  58. #define TCCHEN_SHIFT                22! l0 m7 y: x6 N" B2 O+ m9 J* C
  59. #define ITCCHEN_SHIFT               23
      A. }# G  W' `
  60. 6 Q3 |, a! y: V+ ]' t
  61. static volatile int irqraised1 = 0;, Z# D, {$ |6 g4 V
  62. static volatile int irqraised2 = 0;. f8 a5 E( T% h5 q' S2 g' F, T
  63. 4 [% `5 _' w8 E! H4 n/ D2 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g7 m- d7 S$ O2 D; n6 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . M# u& a, e  T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. d, c4 v. O4 f
  67. / i% m8 a' ^9 }0 _2 y, H2 \: l
  68. dma_addr_t dmaphyssrc1 = 0;
    - A9 N/ |) g% R. s
  69. dma_addr_t dmaphyssrc2 = 0;
    6 B$ p: U; w1 z" W  G& r, j" V
  70. dma_addr_t dmaphysdest1 = 0;
    - u8 W; M3 \% ~$ k
  71. dma_addr_t dmaphysdest2 = 0;, n$ w4 F' X+ e( F. l( F0 t  g6 }

  72. 8 D1 j+ X! ^4 g: H
  73. char *dmabufsrc1 = NULL;
    / Q! @, W; v# s' v# h
  74. char *dmabufsrc2 = NULL;! r! J7 S  [) _' Q0 X: c
  75. char *dmabufdest1 = NULL;6 F4 u% I5 ?2 J1 G* l! f
  76. char *dmabufdest2 = NULL;. h# n1 j7 ~( l$ W3 o

  77. 6 v3 w% M% h. Z+ a: g
  78. static int acnt = 512;0 T2 I7 {2 u2 O  r+ ^( o' E
  79. static int bcnt = 8;$ `2 X+ L" M4 C$ P' @
  80. static int ccnt = 8;2 ?( ^# e3 Q, N! `: [- ^' R6 k
  81.   j0 G$ }, {( u$ e
  82. module_param(acnt, int, S_IRUGO);
    ' A' v& }' H# ]" v
  83. module_param(bcnt, int, S_IRUGO);
    7 y: \6 B* V; Q) N" I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* j: O6 Y  J) L, ], q! A5 o+ A

' q3 f4 {; g1 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ A# ]+ X) P& C4 _9 m  _4 [4 [( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W7 u; L8 q  S! {. L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ]+ j1 H0 |1 p; P& O; ]! G- U' V" L/ M! H" ?

9 N* v# H/ E1 I* v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 07:24 , Processed in 0.040422 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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