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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   l8 Z* r& J2 {% k, v, w; s
  1. [code]EDMA sample test application
    4 s8 s9 Z/ i5 A2 k
  2. /** d( Z. v, u8 Q3 ~3 F; d" d
  3. * edma_test.c
    - p  Y  @6 |( G4 N3 H
  4. *
    ' L) \8 E1 h2 [2 X- Y% E: b
  5. * brief  EDMA3 Test Application
    4 D. X8 `' r5 R+ \4 G5 @8 _
  6. *
    & A& [% k* m. z" Y- B) Y/ [5 k
  7. *   This file contains EDMA3 Test code.& C1 A9 ]) d/ E1 z7 s' V
  8. *
    & O- S) F4 [( M0 W: S5 x8 q* M" u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( }! N7 Q( m0 H$ T* I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      n8 u5 [' n5 J! E( t* z& i8 M2 J) Q
  11. *         TO CHANGE.
      z: Q: u2 F% Y5 C0 s2 f1 p% e
  12. *
    . u# k; I5 v- T) V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; |2 N% j6 t' Q
  14. *
    . Y: A1 J7 l8 L$ c4 |+ x0 Q
  15. * This program is free software; you can redistribute it and/or
    - n0 v% Q  _& C# I
  16. * modify it under the terms of the GNU General Public License as( h' x8 j" j1 ]) L4 j
  17. * published by the Free Software Foundation version 2.
    6 Y' C" r% d3 }& X- }" N
  18. *% a8 q4 P7 Z" q6 p7 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & x+ c, V- q/ s' V: K( N6 B
  20. * kind, whether express or implied; without even the implied warranty
    ! [1 o7 o! a$ F* E, W- i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 L2 d7 q% Q! F1 w  u; h$ S
  22. * GNU General Public License for more details.; E: l( w4 n5 H( _6 L9 g- r
  23. */# M5 o1 O" V, H" _! G3 G- d3 F! l
  24. 8 d  j% Z# ^! ?6 Z- h' C- l
  25. #include <linux/module.h>
    7 _6 E2 R/ R: R$ M- _! j
  26. #include <linux/init.h>
    ( x0 q5 h  R5 b1 A$ L: @: x
  27. #include <linux/errno.h>
    , Q5 c5 O, j: w) d" a
  28. #include <linux/types.h>
    * a- o7 S, q  m" N
  29. #include <linux/interrupt.h>) W. `% W) ~& t: s+ t/ |
  30. #include <asm/io.h>
    . y0 W% ^' n( j3 `
  31. #include <linux/moduleparam.h>
    6 O" b, j: w) P, D
  32. #include <linux/sysctl.h>
    & S! F3 s. T# M) V% N. ?
  33. #include <linux/mm.h>
    4 O: q3 u9 B) z! w# m0 p/ }( O! X
  34. #include <linux/dma-mapping.h>
    + x/ f% `- ^% O$ U( F

  35. ) X8 l4 D1 g' v. o. x6 H3 S
  36. #include <mach/memory.h>2 j2 i0 H7 I& {9 Z0 l. l/ F" H
  37. #include <mach/hardware.h>0 F" T1 z8 F! g, e
  38. #include <mach/irqs.h>/ ~$ d( G; `$ @3 R
  39. #include <asm/hardware/edma.h>2 ?5 Z" Q3 X) d# P
  40. ! m! d- V, b( G" X. g
  41. #undef EDMA3_DEBUG7 E9 Q0 A1 d4 {8 K" q' D6 O" S
  42. /*#define EDMA3_DEBUG*/
    % R& H0 ^0 H7 ~1 Q, n5 O
  43. . d+ w1 A- A  `1 `
  44. #ifdef EDMA3_DEBUG$ G# [! o$ h$ o* s0 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! z0 Z) v  T( s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  [9 q# W0 V1 v* m( G* ~7 q9 C. o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & v. c, p9 J0 s0 W" K1 C+ z
  48. #else4 }. \5 P* }- U: j5 o( B
  49. #define DMA_PRINTK( x... )% ]! F# T' @  G1 N6 g6 Z6 m
  50. #define DMA_FN_IN2 C6 M( [! Z* s$ @7 k
  51. #define DMA_FN_OUT
    & p+ x- X! Z& o/ ~: Q1 D# f) R
  52. #endif( r6 o7 A( X8 Q7 `. f& y9 U2 h
  53. , R& C7 F* x3 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # M% w" U, ]6 X7 M
  55. #define STATIC_SHIFT                3
    $ l& _' j; a5 Q! e: U. j
  56. #define TCINTEN_SHIFT               206 W! L- C- S6 \- `; F) [1 d5 m
  57. #define ITCINTEN_SHIFT              215 Q7 B: L' J: l0 [" n3 ?
  58. #define TCCHEN_SHIFT                22) ]% Y4 E! J: S
  59. #define ITCCHEN_SHIFT               237 u0 p% |& J/ K1 t- ^

  60. ' i* J  K7 |6 G
  61. static volatile int irqraised1 = 0;
    2 s, G; t  F% ~9 v2 J
  62. static volatile int irqraised2 = 0;# B; v* m2 u/ e6 h1 G+ A

  63. . _5 }" i. P1 y- K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E; {1 G) P, B% S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c0 b, I. K* P! {" M' q, O' E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . [9 h# Y- f3 T! Y7 }: I

  67. " q$ g& l) ^8 Y5 d9 N8 r
  68. dma_addr_t dmaphyssrc1 = 0;) D, `' r, d; E, ], y. d
  69. dma_addr_t dmaphyssrc2 = 0;
    3 L2 z' ^  p5 {
  70. dma_addr_t dmaphysdest1 = 0;
    ( t' i; `3 F) ^6 f9 P: n; z
  71. dma_addr_t dmaphysdest2 = 0;
    3 G5 c$ U0 D" E( g6 z
  72. ! z0 B1 o8 f" U) M: }- [, A
  73. char *dmabufsrc1 = NULL;
    7 i$ f. w+ u- }* }
  74. char *dmabufsrc2 = NULL;
    : O9 M4 _- E5 d' n. o& \
  75. char *dmabufdest1 = NULL;3 g& H1 `& B) }: F( ]# _! {
  76. char *dmabufdest2 = NULL;1 {- `; _/ s. m. c
  77. - K' Q/ R8 _. Y$ g/ L( I* G
  78. static int acnt = 512;) X9 C8 E* B6 I6 F$ L4 d- A
  79. static int bcnt = 8;4 u- R5 d0 F: ?; c; y+ ]3 a
  80. static int ccnt = 8;8 P. |7 o  H& c" E$ ]+ c

  81. : A2 ]$ v  ^1 ?/ R$ j
  82. module_param(acnt, int, S_IRUGO);! b2 T' L# L6 n8 S* b9 s
  83. module_param(bcnt, int, S_IRUGO);& S4 p9 ^  Z# g- y6 t7 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& T* M! F/ {9 N6 h) P4 G2 a" q% }) J' N. r( p0 f, Z3 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 V: i) _9 l# g4 p) W4 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 r$ ?* d' S1 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 R0 p% c2 Q9 E  }! X& o( N

0 u4 l+ o/ S- t% @& e7 p5 z
# u/ t" w# g( B$ D8 m" T6 q' E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 14:30 , Processed in 0.040653 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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