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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 d& G1 A! y8 h% t
  1. [code]EDMA sample test application- K/ d2 i6 }2 m, C$ \# c% d
  2. /*
    # ]; r+ f9 u( B& p+ k9 E1 B/ P
  3. * edma_test.c7 T. \" ~; A. z3 U
  4. *
    # s. P3 N* H- i3 c' T2 Y
  5. * brief  EDMA3 Test Application
    ' g+ @8 N( R: P( M+ Z1 L% u
  6. *' F2 h1 Q6 y* Q8 J
  7. *   This file contains EDMA3 Test code.
    - Y, G' o3 ^# i( n5 Q
  8. *; ]% q/ `8 Q4 ]2 a7 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ q5 ~$ e6 n( a% S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# n) }% k7 W. P9 c: I8 X
  11. *         TO CHANGE.
    8 B/ E: o* e  v  H
  12. */ I4 j& y; ], j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , Y8 x4 W6 m7 I! m! k
  14. */ {% t: E/ K2 ~+ J+ |" u
  15. * This program is free software; you can redistribute it and/or' `, \& ~- t, O; ~- ]
  16. * modify it under the terms of the GNU General Public License as( p) j8 f  S1 h/ [4 c' \
  17. * published by the Free Software Foundation version 2./ X4 {, M  b  |& L  [  o
  18. *
    ( A6 Y- l9 I  X* b! J4 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 W3 z+ v* k5 \2 y9 b# O
  20. * kind, whether express or implied; without even the implied warranty. b$ w# b4 ]( `0 x8 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # H$ p9 m; z+ }/ S/ v4 J
  22. * GNU General Public License for more details.
    8 v  y4 }* Z7 U
  23. */
    & o% }: x( X, X- O( x# X8 b

  24. 7 s* z; Z- b. M
  25. #include <linux/module.h>
    " v+ A, x; |' @9 Y/ x, d7 a
  26. #include <linux/init.h>; t+ _) I3 `3 ]; u
  27. #include <linux/errno.h>2 |  Z5 F6 D9 W: R8 P% r1 l9 L7 k
  28. #include <linux/types.h>
    9 Q1 U- j# T7 s" C, p( O0 n
  29. #include <linux/interrupt.h>$ `# I" \! c$ d- ~/ @
  30. #include <asm/io.h>
    1 k% I! L$ u" i& s
  31. #include <linux/moduleparam.h>
    4 f/ V: \( u& A
  32. #include <linux/sysctl.h>! d9 a2 O& P' W4 q
  33. #include <linux/mm.h>
    ! H# H9 T$ n1 V$ r2 l/ S2 _2 E
  34. #include <linux/dma-mapping.h>
    % M2 Y  }- Q$ U) k4 w, ^5 w% Y8 K- k

  35.   Q7 M. h( I3 A) E
  36. #include <mach/memory.h>% }9 P7 F0 d: M+ z* j3 T0 h5 N) J
  37. #include <mach/hardware.h>
    ! }! {5 M2 ?2 E& |) [) A8 ^4 I2 ]- S
  38. #include <mach/irqs.h>
    + G0 @6 {4 M, T) G+ V
  39. #include <asm/hardware/edma.h>5 J% H4 _" W) [0 D% j& O

  40. 3 S+ s  ^( a- n5 \. y
  41. #undef EDMA3_DEBUG& D5 c- n' A1 K% Z- W$ y
  42. /*#define EDMA3_DEBUG*/
    9 A: \3 m5 E4 y" J2 F  p
  43.   w# a* u/ Y- G
  44. #ifdef EDMA3_DEBUG. @+ l! T5 Z9 i7 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P1 x9 F* s$ H  q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / A  r# e7 r8 ^9 a/ a" [5 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & K6 O9 H' g; L+ x/ ?9 j, |
  48. #else
    4 d8 \3 I8 ?* Q" Q7 K4 y5 l% g
  49. #define DMA_PRINTK( x... )
    ! j( h* n! [# ~3 y3 \$ k# T
  50. #define DMA_FN_IN! s  k* k2 v4 _5 P& A. B+ C
  51. #define DMA_FN_OUT
    ' x9 \# a% t/ m8 v. p  j3 [
  52. #endif( r7 A3 Y% N0 Q' S4 K! W4 E7 v

  53. / u/ ^5 x5 ~$ g- L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ \3 t. Z2 o0 a3 F# ?0 t
  55. #define STATIC_SHIFT                3
    $ m% |  s0 [+ }% l! |+ e
  56. #define TCINTEN_SHIFT               200 O$ s7 r: `/ @" b# N- |  F7 d
  57. #define ITCINTEN_SHIFT              21
      y! b) r$ }: U/ [, K9 E; o0 y
  58. #define TCCHEN_SHIFT                22" E4 a: v8 g- P: u1 b1 Y! k
  59. #define ITCCHEN_SHIFT               23
    " E* D3 g5 n" x8 D9 w& a0 ?% c8 Y, ?* v
  60. $ E6 t5 f4 q+ u' P( h) t9 x
  61. static volatile int irqraised1 = 0;: I$ ~5 L; {- U; ~
  62. static volatile int irqraised2 = 0;: @& d) J1 T# ?, n+ l7 @
  63. 7 G$ }' h8 U$ c* d5 [- ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |- [' }. U, U* b/ ~% e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b$ @. n7 V% f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ~! [! A; g. x" t

  67. 7 Z* k6 D  g! J  h8 R4 C
  68. dma_addr_t dmaphyssrc1 = 0;
    / D4 t2 b" j: o0 p  z6 ]  o
  69. dma_addr_t dmaphyssrc2 = 0;3 A0 c8 N% d" E+ y8 k
  70. dma_addr_t dmaphysdest1 = 0;6 m' z$ x3 l" B
  71. dma_addr_t dmaphysdest2 = 0;
    , h9 w% B4 w7 O8 c
  72. 3 w: _) V4 h6 m
  73. char *dmabufsrc1 = NULL;
    : M( C' G9 l0 W  F- w. O
  74. char *dmabufsrc2 = NULL;6 m. N" f! z; S; k
  75. char *dmabufdest1 = NULL;) }+ X0 s4 L/ I( }7 E/ c0 T
  76. char *dmabufdest2 = NULL;0 U, D  d4 S2 L: z+ D& g9 j- \
  77.   }, _4 S0 E2 N
  78. static int acnt = 512;
    ; a6 \. r& h; ~  G7 B6 e. i
  79. static int bcnt = 8;
    5 V+ \; \$ S! p, W6 M
  80. static int ccnt = 8;
    : d/ ~; w7 B: Z0 m
  81. 6 o+ y* Q  ~8 b* I2 e
  82. module_param(acnt, int, S_IRUGO);$ q; T% W1 }& y$ q3 ~: X: x# F
  83. module_param(bcnt, int, S_IRUGO);
    & j" Y2 V7 B4 D- B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( g2 H5 J4 s  h9 A* o/ Z
& M% G) M/ D% E+ t: Q7 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m$ ?$ A$ \9 M' d- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( c8 Y$ @, U9 P$ N; x9 n2 p7 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 b; y0 [9 Y; Y

2 @4 u/ x) R! j9 n! p: K' w3 p
& {, W- U- b. ?( Z! z4 q, z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 04:12 , Processed in 0.044891 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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