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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " U% m; A8 a1 c$ b* s
  1. [code]EDMA sample test application
    ( t' D) y6 y4 m- E7 L' F
  2. /*
    : A: n( M: @' r" ]8 _
  3. * edma_test.c
    8 _) g" A- h' K7 \7 t- w
  4. *
    $ x0 v: H8 g  u( j1 e# j
  5. * brief  EDMA3 Test Application' Z5 L* S, D' E- @5 C6 X5 J) k
  6. *7 D4 S  z1 v2 D
  7. *   This file contains EDMA3 Test code.+ H+ u/ o& R+ S
  8. *7 X4 ?, s2 ?; r( m* L8 {5 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & J& Q8 y7 P& b4 `7 c* }4 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 T' p# @2 j: V  o8 `  I& U: P, y
  11. *         TO CHANGE.: g- N/ @# \, o# ~% k- Y
  12. *
      s7 m: o& I8 Y, q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " q7 Q5 P% Q3 S
  14. *
    # W' j& O3 M$ o1 j8 q: q# b
  15. * This program is free software; you can redistribute it and/or
    5 ]! @! v5 I8 v- m! n( F8 Y0 O
  16. * modify it under the terms of the GNU General Public License as
    + j- Y, Y5 U, W, M  j- |/ n
  17. * published by the Free Software Foundation version 2.- t6 o" F; Y5 L6 u
  18. *
    4 Y( ^: @) F+ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # b( Q+ a( d  u
  20. * kind, whether express or implied; without even the implied warranty0 Y- S+ s) e# |0 [' h, H/ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 z% {6 n2 j8 F  g6 _
  22. * GNU General Public License for more details.
    * q) Y# {$ W+ j# D, d8 D% |
  23. */- X+ G$ @8 V+ K" W
  24. , I9 O$ P  E/ D: H/ n2 x" h
  25. #include <linux/module.h>
    * v2 D" \" x8 ~5 Q9 i& i. m
  26. #include <linux/init.h># ]% r% k4 r' r3 B% q
  27. #include <linux/errno.h>" ~7 ~! ?. [5 u% y
  28. #include <linux/types.h>- B1 A2 _3 T/ d  @
  29. #include <linux/interrupt.h>% }* q( ~/ V) K4 S0 ?
  30. #include <asm/io.h>; b6 U0 d9 A( i7 B$ F  g5 u8 f
  31. #include <linux/moduleparam.h>
    ! j9 x: `: r! J" \' Z" v+ E1 T
  32. #include <linux/sysctl.h>8 w8 |/ ~# q7 K* U/ k) ]' C
  33. #include <linux/mm.h>% G$ _1 ~. A7 E! u7 l. c. W9 o+ G% \# _
  34. #include <linux/dma-mapping.h>
    ( C* p, m# t" Q1 K4 l% a

  35. - c- i: R5 a, Q+ G
  36. #include <mach/memory.h>: m0 ?. Z: d' e2 n- w& X/ y
  37. #include <mach/hardware.h>6 X# [* B* c" G( S/ E
  38. #include <mach/irqs.h>
    2 |! L& g3 [! V. n
  39. #include <asm/hardware/edma.h>
    4 c* }4 b' E+ q: b5 w7 `

  40. 3 w! ^$ `1 _% X! f$ a& Y, J
  41. #undef EDMA3_DEBUG
      U8 y" q. t2 |' v
  42. /*#define EDMA3_DEBUG*/
    $ n2 |, D3 Q& ]$ R
  43. . P) m  X5 n# B4 S
  44. #ifdef EDMA3_DEBUG
    ( m/ \  v: z( Z, `9 ]# N& j8 c, T  |* a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( i1 b& [( E  b/ c  A0 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W! J/ N" D% J6 i) l4 {7 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ~+ B4 L/ ?; i" V# \4 K# D
  48. #else- m  l* e9 S5 j1 j1 W
  49. #define DMA_PRINTK( x... )
    1 ^& L) J$ p0 I) y' R5 M' ?
  50. #define DMA_FN_IN/ m4 n' I; i! j
  51. #define DMA_FN_OUT) ]# F# W1 Z; ]' |' _- G2 K: y4 F
  52. #endif
    8 I1 Z! F' D6 f' Y, F
  53. " e, {8 z  j) V+ I% l: |  g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( T2 W4 J8 ^! q9 R+ T
  55. #define STATIC_SHIFT                3
    2 b3 y5 ^% E+ q; ]
  56. #define TCINTEN_SHIFT               20
    , O8 Y. G1 S0 Y) r
  57. #define ITCINTEN_SHIFT              21$ Z/ D9 R! [: ^& v
  58. #define TCCHEN_SHIFT                22& U8 E( a5 |$ u
  59. #define ITCCHEN_SHIFT               23( `7 L6 z; r6 O& _
  60. ' M' Q2 R8 ]* f& ~7 D
  61. static volatile int irqraised1 = 0;
    - g8 {/ ^7 @2 {: f$ c5 u3 O
  62. static volatile int irqraised2 = 0;
      H% F% B/ W* Y% Y$ \0 K8 s

  63. / s8 {9 m' \5 d+ \3 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w: s1 p9 R% ^$ J$ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p, J8 y9 |: d- s7 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j9 z' Z1 P6 `- \, j- v" P

  67. & v& O) I1 u( w
  68. dma_addr_t dmaphyssrc1 = 0;  d0 ]% x% ]9 [" e& ]$ T- h
  69. dma_addr_t dmaphyssrc2 = 0;& F) }3 J! m. _
  70. dma_addr_t dmaphysdest1 = 0;
    3 A- O- b- B4 _# f
  71. dma_addr_t dmaphysdest2 = 0;; U% h4 K% i: \* V' ^% s
  72. : N3 O% b; D2 _" ]( C' E8 [) S
  73. char *dmabufsrc1 = NULL;
    / Q7 s- q! q: a
  74. char *dmabufsrc2 = NULL;
    3 U/ m, {2 c$ s- x. ]# }
  75. char *dmabufdest1 = NULL;2 z8 c0 @8 \0 s+ Z- x
  76. char *dmabufdest2 = NULL;
    * Y: Y- Y1 o. \* X8 f5 X
  77. 9 @  f7 l( [4 f( y3 e$ h8 ^
  78. static int acnt = 512;
    * y! w' s! f4 k  r. _- P( y
  79. static int bcnt = 8;7 _- [, I* o) B  C
  80. static int ccnt = 8;* X8 G3 r+ w$ j- z) t5 b2 V: y, T

  81. - F5 S& x. B% f& {2 o
  82. module_param(acnt, int, S_IRUGO);  L* {9 p+ p. P7 [2 G, Y. P  R7 T3 S
  83. module_param(bcnt, int, S_IRUGO);, n; T3 V9 _6 {* T- a, I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 o. _, D! V. A% ?3 L: J. u" Z) e1 f' u
" C4 X7 [( p5 R; A- H& W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& p8 B' w9 c6 r$ [% d7 G, A
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( {7 S% _. D+ y8 f; a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 w( E7 D6 l) J2 `- y7 m7 ~' f! A6 N- w8 U9 ]

+ l0 ~1 p! {+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 07:25 , Processed in 0.040431 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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