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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' w! I5 z' ~. P1 m+ |- w+ f) ?0 w
  1. [code]EDMA sample test application5 t5 X. G( P& t3 F$ ]. }  T' s" ~
  2. /*
    6 _0 i! Q2 R' r3 J( G  P
  3. * edma_test.c& q) r2 j7 v! }! h! d8 B# r
  4. *8 K7 _6 ]0 ^+ C# s2 W4 m5 A$ W5 f5 X
  5. * brief  EDMA3 Test Application: [6 B+ j' R% I7 n% q! e
  6. *
    0 Y4 S1 V& j# T( f. ~
  7. *   This file contains EDMA3 Test code.
    1 P% Y  Z. f3 L3 I8 ]* z# f# v
  8. *
    ; P+ B4 b: r& a5 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; `$ C5 E+ |! i, J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : h9 G8 P4 f/ A( Y
  11. *         TO CHANGE.
    # }9 j" G0 |- C+ q  P- {. S( N
  12. *
    & ?. x5 r% J" a. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' r( G/ z' G+ s/ e, }  l) d' j
  14. *3 O* d8 @( `# m7 z& S
  15. * This program is free software; you can redistribute it and/or
    9 X1 K+ U- I8 g
  16. * modify it under the terms of the GNU General Public License as/ z' @' b4 o0 y0 j
  17. * published by the Free Software Foundation version 2.
    2 K0 Z* _: o. r5 T2 G" i& n: `
  18. *; p# E. Z8 T: M! Z" n* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ^) M% l3 n- r1 o5 K) w  G
  20. * kind, whether express or implied; without even the implied warranty  r! D. T% x. b# R% b- ]- s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # C$ `: L# t- _5 B4 b2 z% w
  22. * GNU General Public License for more details., f1 d) }; E0 v' [
  23. */
    # T- X$ c5 J' C

  24. ! z6 H" U8 L: M  V7 T* U
  25. #include <linux/module.h>5 f4 O  d9 p9 W: }3 w" \
  26. #include <linux/init.h>  D% c* F; W+ P" A4 u% i6 e3 T
  27. #include <linux/errno.h>4 t3 {$ V; V' N. [4 g$ \  F+ d
  28. #include <linux/types.h>
      Q1 X% q+ C2 J' D' ^3 u/ @4 E
  29. #include <linux/interrupt.h>- d1 X8 O3 r- }& y9 w) I2 E+ P
  30. #include <asm/io.h>
    3 O/ p' {+ o$ v# y
  31. #include <linux/moduleparam.h>
    + S: O' U! T  ^6 u8 \
  32. #include <linux/sysctl.h>
    ! }6 K5 O8 s; t% m
  33. #include <linux/mm.h>
    2 g5 k: L% M1 p! V: ~! Z
  34. #include <linux/dma-mapping.h>
    , J' ~& Z7 N# A0 O, }) g* w' Z

  35. 4 @, d7 [5 T' L
  36. #include <mach/memory.h>. \& _$ h" D% z) H4 m# W) H0 ?
  37. #include <mach/hardware.h>  ~( D+ J0 _4 [. m
  38. #include <mach/irqs.h>
    ( R0 E6 Z$ C$ H0 b1 u: V  L
  39. #include <asm/hardware/edma.h>
    8 m% z9 ^7 l3 F
  40. / M( t& ]! U) b: m( l) v
  41. #undef EDMA3_DEBUG
    ; k% {: u9 \* u
  42. /*#define EDMA3_DEBUG*/4 X  R2 ]1 N; \4 e2 n0 D, a
  43. + }" n9 z) M4 x: f5 F+ i, Q  X4 y( ?
  44. #ifdef EDMA3_DEBUG
    . N. P$ M1 V" D; D! u2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * k7 i9 w5 _3 |# }( K& u. _, q4 S, P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 N! p! L  ?2 m6 }1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]) S) z& J8 W
  48. #else
    1 @1 y9 P9 f3 u: S4 l5 x6 @0 c9 h+ A
  49. #define DMA_PRINTK( x... )
    ) q# R6 b5 \+ B' h( I
  50. #define DMA_FN_IN4 P8 v! P/ N8 [' x- S6 P( @
  51. #define DMA_FN_OUT
    , A/ k! H" C9 |+ z% c
  52. #endif
    3 Y+ ^# G" J' A1 ^9 ^* S
  53. ( a& j" x/ o; `3 B& V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), M  D/ J+ D) [4 W, a
  55. #define STATIC_SHIFT                3
    ! ?, k6 [6 J# u1 Y
  56. #define TCINTEN_SHIFT               20
    6 v' k; f6 l$ I0 J, c2 }) v
  57. #define ITCINTEN_SHIFT              21
    ' M' e- Y* b( K% e. k4 j
  58. #define TCCHEN_SHIFT                22& g1 [! d  t: O* g) b2 ]( H
  59. #define ITCCHEN_SHIFT               23
    5 \5 p3 ]7 g  _' O4 P( i
  60. 1 B# a6 z# J* z: j/ J3 o: @) R
  61. static volatile int irqraised1 = 0;6 e. n  S- w9 M' t, D6 q
  62. static volatile int irqraised2 = 0;2 q+ r; ^! j/ w$ e
  63. 9 ]4 C7 B; j1 p2 u# a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p# c0 Q7 P. {/ [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b8 q" r7 M4 c3 {8 z' W6 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ~5 z' A4 `) R2 m6 \% n$ a
  67. " N# P* b2 }7 \5 t, V1 l  H
  68. dma_addr_t dmaphyssrc1 = 0;
    ) o" S  w* V' W' U
  69. dma_addr_t dmaphyssrc2 = 0;
    ( v1 T/ P  o, r9 m. d5 Y
  70. dma_addr_t dmaphysdest1 = 0;
    2 ~6 U$ @/ {9 L2 Y1 r
  71. dma_addr_t dmaphysdest2 = 0;
    $ z4 F2 H, ]; A, R
  72. & s* n+ }, f/ j# S
  73. char *dmabufsrc1 = NULL;( z$ V2 N( d2 B" W" \* `
  74. char *dmabufsrc2 = NULL;# c' P- {5 k) N
  75. char *dmabufdest1 = NULL;( l; J! w7 S/ e3 E9 O
  76. char *dmabufdest2 = NULL;
    ! y" R6 U" {$ n! A/ f

  77. 4 p0 L: p& I; n! a$ r7 d+ x0 v
  78. static int acnt = 512;! ?" z) ~( P1 h" i0 U
  79. static int bcnt = 8;
    8 V% [; G  l; e) h
  80. static int ccnt = 8;
    ) o' ]2 A5 s, v+ }/ h

  81. * s' F9 w; B, k
  82. module_param(acnt, int, S_IRUGO);) \# S0 ], K% [+ Z
  83. module_param(bcnt, int, S_IRUGO);0 o5 T3 V) w  h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- m1 x' v" z5 @  J' h7 p/ d2 W  P7 H( A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, g8 o" [9 b9 ?+ n1 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' c* q, Q6 o) ^- q/ C  T0 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 e. v7 w% x  m0 p: {
) r9 A" V2 Y6 O
" m( E+ i0 G" |3 p# V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 03:39 , Processed in 0.046016 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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