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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ B+ v+ {" D9 u: [% M1 K6 |
  1. [code]EDMA sample test application- L, y. ^2 V0 ~- `6 ~8 d6 Z) N
  2. /*
    2 Q) x- ^: ~( E/ G0 o, m( n* W8 x
  3. * edma_test.c
    ! p9 l$ \% y5 a+ m- n% U1 U" u; c
  4. *
    4 g, y4 o- J/ A: i$ m- I5 M
  5. * brief  EDMA3 Test Application9 j( H& F  O3 ]# ^9 R
  6. *
    - Y( r! X$ n6 q+ ?5 Q
  7. *   This file contains EDMA3 Test code.: P5 P: n% Y2 c0 m
  8. *
    " T, Z, i! W* x, t5 v  ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; u, a/ f/ O5 \* k% X" M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 }+ T" w' B7 S0 s: T3 r% Y! v
  11. *         TO CHANGE./ V( I  k8 T. \. }+ g' A# |! c
  12. *
    : ]1 _3 W( i6 D6 @& \$ ^0 Z, q' m( L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / A0 }% D2 |% y
  14. *
      {& R" `6 _3 \1 m' x& O
  15. * This program is free software; you can redistribute it and/or
    # J# f; v9 t4 k: c
  16. * modify it under the terms of the GNU General Public License as
    . |& m7 Q' M2 N7 W6 s/ X
  17. * published by the Free Software Foundation version 2.4 x' ]$ Z! ^4 A# o  P9 E
  18. *& X8 h( l: w* |5 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ |9 Y* N7 k7 y7 a: p1 c% s
  20. * kind, whether express or implied; without even the implied warranty
    ) U( B* K: ]: E2 ^; b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- H2 ^/ T* h- b1 w
  22. * GNU General Public License for more details./ V; w5 x; [; u9 }5 p0 A2 H: M: W
  23. */2 o0 l* j' a7 x- o% z
  24. / b+ Y+ Z! c5 _# W  P' F! K" R
  25. #include <linux/module.h>
    7 \; {* n: K3 y
  26. #include <linux/init.h>
    0 ~/ G9 N* p) a5 T
  27. #include <linux/errno.h>
    " V1 o% P, W- n* d  M
  28. #include <linux/types.h>
    # }" m. p; D5 p, U. j7 x: }8 d1 H
  29. #include <linux/interrupt.h>+ {: z& x1 I2 d( Z0 E, J4 ^1 r! {
  30. #include <asm/io.h>: _. Q7 ^  O) E. m% ?
  31. #include <linux/moduleparam.h>
    / d* n5 z1 _2 M# T  ~) j/ M
  32. #include <linux/sysctl.h>
    2 t. _" r# J  i$ {* G
  33. #include <linux/mm.h>% _+ |0 I. T& s- }
  34. #include <linux/dma-mapping.h>
    + e% U( g' h% W( i, j4 @: v
  35. 7 ~# E9 Y+ i* U. Q
  36. #include <mach/memory.h>
    1 [) S( e- t7 l$ K( Q. J
  37. #include <mach/hardware.h>
    6 Q0 ?3 q# o2 {, t
  38. #include <mach/irqs.h>+ Y- `- U( y; B; F1 }: z
  39. #include <asm/hardware/edma.h>! c) n1 c: C" l4 h, O+ x# ?1 B

  40. 6 V- A- O$ C; N) v5 G
  41. #undef EDMA3_DEBUG
    : U3 A; f2 Y3 ]& I  j8 N; x
  42. /*#define EDMA3_DEBUG*/0 ?! l0 ~3 m5 ~: {

  43. 3 p5 j7 z  ]. H% K4 }0 K4 `  ?! p
  44. #ifdef EDMA3_DEBUG( t) X7 d3 K/ [$ k& _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% _1 l2 l! r$ h5 T, K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 w6 N$ c9 w9 J8 I+ j+ O# A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 G5 L  ^2 ^- M4 ~8 Z
  48. #else
    5 x0 i7 F; `6 u7 o  Y) t* w6 I
  49. #define DMA_PRINTK( x... ). U* }0 u$ x8 M1 I- u/ ?  t9 I
  50. #define DMA_FN_IN
    5 F* |. e4 `3 x! ]% ~/ _
  51. #define DMA_FN_OUT
    ( _8 f% l5 q0 i6 D+ U9 v
  52. #endif
    2 M8 d/ l* v+ L4 b
  53. 1 s. T. m8 K: V. b/ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! J6 w7 {( G4 r5 \5 O+ }. F3 q+ @
  55. #define STATIC_SHIFT                3
    0 \' K( U2 J. g$ u' _0 X' m
  56. #define TCINTEN_SHIFT               20
    5 i' V1 s  J% x) A9 W
  57. #define ITCINTEN_SHIFT              21& |6 p  [: u: ~; a: w* l2 C' E1 e
  58. #define TCCHEN_SHIFT                22
    . _  E$ i- b& f2 e
  59. #define ITCCHEN_SHIFT               23
    ; s' o1 B1 }8 v) g5 h
  60. & A# I7 Y5 W- k8 w) n' a* [1 J
  61. static volatile int irqraised1 = 0;
      d/ O8 N+ ^/ N0 x5 v1 s* g
  62. static volatile int irqraised2 = 0;
    2 Z- s: Y/ |4 C( E2 H" P' F
  63. 9 j( j0 d; r) G, r0 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 A2 A+ V5 S* p" W, E9 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* k( M8 m, L6 N; B5 B4 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y" G! f! r0 }1 w  y( G

  67. 4 K( b7 |! T9 T4 \4 h( b2 p, u' r0 E; c7 W
  68. dma_addr_t dmaphyssrc1 = 0;2 D# T" N1 t0 f" u4 h9 ^
  69. dma_addr_t dmaphyssrc2 = 0;4 Q, V: b' }' c
  70. dma_addr_t dmaphysdest1 = 0;- _  E6 ]/ R, C2 A& \' |
  71. dma_addr_t dmaphysdest2 = 0;
    ; {9 w) Q" `+ m9 k, V
  72. # f; F: n) y& l# r) Q
  73. char *dmabufsrc1 = NULL;9 l; K- D: }) I7 W4 r
  74. char *dmabufsrc2 = NULL;0 R2 E" [) N, v: G. Y- |! S$ k4 R, F
  75. char *dmabufdest1 = NULL;: b0 u8 W" d0 B/ I% f+ Z* G
  76. char *dmabufdest2 = NULL;% A  v3 s3 ^3 K- k+ ~9 L3 [

  77. # o6 V& i2 z- t8 O% b
  78. static int acnt = 512;
    4 Q% R0 W- c  j4 k
  79. static int bcnt = 8;
    ; H) P2 f7 }* i2 \
  80. static int ccnt = 8;
    ' c' l: O8 X- G5 M
  81. 7 G% R; c; o) O) q) u! ^
  82. module_param(acnt, int, S_IRUGO);5 l+ V3 V0 P8 M$ F; G
  83. module_param(bcnt, int, S_IRUGO);
    * u$ V# E2 Z6 E  N- ]% R' }: |( o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. s* v5 p; U; M8 T( j6 I: [& C
% N) m- t2 I9 d: x$ b9 R6 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& F' J" \  \/ D9 `& I4 `/ i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 A! o) X( O+ z! h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B0 r) U4 y, o- J

( i# e6 G" d0 s3 M
9 H, [& `& a* h4 |+ e6 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 13:39 , Processed in 0.039781 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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