OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 z1 V- J5 T8 q- G7 A. O8 o
  1. [code]EDMA sample test application
    ' C& p2 Z8 n5 ?, c
  2. /*5 `% _; X1 ^$ o: ^4 ~. |. e
  3. * edma_test.c
    * B' |% A2 u' U8 @" F( d
  4. *+ |1 Q1 z( Z' T/ a- T. H
  5. * brief  EDMA3 Test Application
    * y; z% k1 `( l) k9 x5 `
  6. *
    , V+ u$ o) Y  [# ^
  7. *   This file contains EDMA3 Test code.
    ( ?7 y/ a6 E' A
  8. *
    ! Z, T% N# y& {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - g4 r5 D: o- }1 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      J, g0 X/ n( R- \" l
  11. *         TO CHANGE.
    1 B, |7 q2 K: A& G
  12. *
    " O6 g, D5 K! V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' |* c0 v" s) n
  14. *
    , C1 U. T3 Q& g! z4 t: q: w
  15. * This program is free software; you can redistribute it and/or
    8 X: S1 p6 q9 U% f+ C/ `
  16. * modify it under the terms of the GNU General Public License as2 i, z/ _$ b# ?; W) P* l: E* |
  17. * published by the Free Software Foundation version 2.8 v, E  m1 e  r0 M0 N
  18. *  S- B. b, k2 t6 u' U4 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W" i; n. ~* s5 a$ b
  20. * kind, whether express or implied; without even the implied warranty
    3 `! j+ w7 E  U7 N8 s0 N/ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 `/ W' {  n, v& l
  22. * GNU General Public License for more details.
    % E! e+ K, C4 f. B# v) m
  23. */
    % c3 S, D# n5 L% w8 a/ W

  24. ! |: P& N4 G: m
  25. #include <linux/module.h>4 ?$ C9 K& h8 k
  26. #include <linux/init.h>0 a+ B/ b8 F0 f. _4 a
  27. #include <linux/errno.h>
    5 M4 D9 B2 }- w, q  S
  28. #include <linux/types.h>2 W+ x; d7 Q  C" c1 C
  29. #include <linux/interrupt.h>+ S  M0 O7 I& M2 E0 _. e
  30. #include <asm/io.h>
    1 l' ]0 F' D1 a  ^! a; L6 X
  31. #include <linux/moduleparam.h>
    : A' _" n2 H9 \* y
  32. #include <linux/sysctl.h>
    * i6 ?, q) y5 c' h" j2 z8 E
  33. #include <linux/mm.h>
    ; v! I+ T3 J, {; L# _- d
  34. #include <linux/dma-mapping.h>
    $ V. N" l2 Y- |" @3 T2 f! o. c
  35.   _  ~" D/ R! U& F8 g- \/ G
  36. #include <mach/memory.h>
    0 V1 n! @- _  o+ m2 i# _1 ]8 y! f
  37. #include <mach/hardware.h>" v3 S4 A4 @, r. X% U; |
  38. #include <mach/irqs.h>
    ! ^5 ^  l7 y1 d) ?" H5 c
  39. #include <asm/hardware/edma.h>* v) w' a( _5 l% j- x# G! h3 S
  40. 1 k* s9 X# t* n# t* E
  41. #undef EDMA3_DEBUG. }6 z" t8 k! R! k% i8 l
  42. /*#define EDMA3_DEBUG*/3 e: f+ h. L- E$ r
  43. , d3 _' S5 ?" H( c' n" ?7 b
  44. #ifdef EDMA3_DEBUG4 p& Q1 l' O( [9 x3 Y+ G5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! [* q$ a) ~' q4 R1 g+ k" D$ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 L- h4 r3 T! U2 C$ ?3 y0 S: Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 d- _+ K: e  ~
  48. #else# z* w( b6 {3 t5 V5 W
  49. #define DMA_PRINTK( x... )
    / i5 ], u6 J/ p4 f" X! h
  50. #define DMA_FN_IN
    % A1 j5 W' @8 D" O5 v
  51. #define DMA_FN_OUT
    * Q# ~9 r$ Y  w& k% J( C5 M
  52. #endif+ `6 e5 {. W* n! `9 _

  53. 4 y- z8 r9 {; S- i7 M: x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 F/ {' F. n0 Q: {
  55. #define STATIC_SHIFT                3. e5 M0 K1 S3 q
  56. #define TCINTEN_SHIFT               20
    9 F; R6 F1 H2 P2 z
  57. #define ITCINTEN_SHIFT              21* Y" F. Q2 C9 l" b( g0 F8 u
  58. #define TCCHEN_SHIFT                228 [1 c& o# K* s( S1 J8 x; }
  59. #define ITCCHEN_SHIFT               234 A7 N3 L% l9 n" F/ P
  60. , i  Q, |% S/ l3 d, Q9 g0 R
  61. static volatile int irqraised1 = 0;) H/ b. {5 r7 x% F0 `. Q
  62. static volatile int irqraised2 = 0;
    4 p$ S, E1 [9 }8 h- E

  63. # V3 P: `7 l: [/ L# E* N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- N4 l8 \. ~) n5 U8 H& L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w6 w. R0 i5 R! k5 }9 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W) V  _% n/ i
  67. + ~, z4 M6 e- i- T
  68. dma_addr_t dmaphyssrc1 = 0;
    ; M: b+ a- z, M: K7 e1 H
  69. dma_addr_t dmaphyssrc2 = 0;. p8 L1 Z+ |; }4 O  H+ N
  70. dma_addr_t dmaphysdest1 = 0;7 {) P5 p5 j4 t9 p" m1 l# K6 V
  71. dma_addr_t dmaphysdest2 = 0;
    * Z! p  T* H; U) p
  72. - ]& Q8 V9 n- X
  73. char *dmabufsrc1 = NULL;
    $ C4 \+ S. X5 g$ p; k) z" \
  74. char *dmabufsrc2 = NULL;
    ) L3 e5 i, ~' L% l1 E
  75. char *dmabufdest1 = NULL;9 Y& t* a& \9 a8 `7 U! c2 ?
  76. char *dmabufdest2 = NULL;, b% Q: v" r3 J! _; I+ [
  77. 2 e8 g" b) x2 q9 K3 @
  78. static int acnt = 512;+ }! s8 @8 t- d3 q/ Y
  79. static int bcnt = 8;4 P' R0 Q& u: C
  80. static int ccnt = 8;
    ( Y, j1 J3 f- h# {3 w$ c

  81. 1 M- `" P( |  R" _, e# l
  82. module_param(acnt, int, S_IRUGO);
    5 z( M5 m' c) ], b. _% }. s
  83. module_param(bcnt, int, S_IRUGO);
    # P' X" |$ q8 ^- G# x- n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  w- O6 r# h" _1 }

; ]5 m. s( _3 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 T- M( @$ r: `* K; T/ c$ ^) narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& }6 _( S* n# {3 b, ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! L( Q, b. C, m! W' {! F( Z& _# ~$ b; s4 t2 j$ J3 U% _

; U" P$ p* d0 q2 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 22:02 , Processed in 0.035761 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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