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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; v" T5 U1 z! u1 w" n6 n  n, M
  1. [code]EDMA sample test application0 j$ _  k5 {% X- @) [3 f7 |
  2. /*
    3 ]& {  y+ r3 h5 J& h
  3. * edma_test.c6 V; ]1 K  t4 X4 e+ o! Y( v* `! O
  4. *& ?* R3 ?2 f7 g( U. P# c4 r
  5. * brief  EDMA3 Test Application
    ( a# I$ x$ m. ?- ^3 h5 U: s
  6. *7 K8 `& u: D" R% N+ t
  7. *   This file contains EDMA3 Test code.
    ! O0 J- X8 d- T; T9 ?6 _0 I$ h0 C' R
  8. *
    / y: S, F0 C3 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 h- @+ w5 V! n% c7 n& L: i: B+ z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 A, ~  U$ K% b7 V, {
  11. *         TO CHANGE.
    ) _: A7 W# G( A* O5 h( G0 j
  12. *
    , y. H  N3 [1 g7 c, ?9 T, b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Y+ G3 \- T! `& A: F/ A' C" {- X# c0 f
  14. *
    9 s. ]7 [+ h- |- {
  15. * This program is free software; you can redistribute it and/or- g9 a6 y  l8 D2 W2 K
  16. * modify it under the terms of the GNU General Public License as3 d# e: b0 \7 e- Q/ n& ]
  17. * published by the Free Software Foundation version 2.
    ! ]% {8 m) a( Z7 y  l$ N
  18. *- j. q% K4 V0 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; x) O9 y- l! ~$ z3 V* W5 r
  20. * kind, whether express or implied; without even the implied warranty
    6 b: ]; I3 P; p, u2 J7 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 G: x) Y& E: @+ I
  22. * GNU General Public License for more details.( V( [# n8 u2 W8 w4 _
  23. */. u* ?$ O# l; s/ E( {4 Z
  24. % c/ A# G2 s% q2 f. K9 e9 L
  25. #include <linux/module.h>3 M4 G9 [8 o; z1 w. y$ g
  26. #include <linux/init.h>
      ~/ Q0 v% H0 }
  27. #include <linux/errno.h>
    / D5 P" M! N, B) i1 `. M' p3 R
  28. #include <linux/types.h>
    6 t" z# E' x9 {
  29. #include <linux/interrupt.h>
    ; y4 Z9 ]. ^6 @1 J  r2 ~
  30. #include <asm/io.h>" K, I7 m3 m; z! a
  31. #include <linux/moduleparam.h>
    1 l. o  E3 W; ?4 k) I- n* i1 P9 b
  32. #include <linux/sysctl.h>1 o+ p' `4 o5 C: A  T
  33. #include <linux/mm.h>
    " N+ B" i9 J: r$ B. h
  34. #include <linux/dma-mapping.h>/ }7 O1 T% ]) O6 o, Y7 I
  35. 8 E. S/ C( H4 I; _
  36. #include <mach/memory.h>8 X# w' L$ s6 ?
  37. #include <mach/hardware.h>
    ( {; x8 S( Q: Q$ s
  38. #include <mach/irqs.h>
    ' M7 @# V- m) U- ?( E4 {
  39. #include <asm/hardware/edma.h>9 d; w9 ]8 e2 _4 b6 r" x: v9 \

  40. 4 }9 C, p/ z% t9 l
  41. #undef EDMA3_DEBUG
    / W3 a) _6 \) m* ?& b4 m( i! g
  42. /*#define EDMA3_DEBUG*/  O) D2 t: x# Z- F1 I

  43. - M8 B8 ?, X9 |# U' M6 G3 J# p
  44. #ifdef EDMA3_DEBUG* X% s2 t4 m' w9 F5 B2 h) [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 I) a+ Q5 C! C/ u. ^# s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Q/ U- c5 F$ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 f# a1 w+ Q- N8 y. D; u+ T7 a
  48. #else. |0 G- C+ e, P: G5 N
  49. #define DMA_PRINTK( x... )
    + w) ]8 B4 c, s# P( W6 w# v
  50. #define DMA_FN_IN8 _5 @2 @8 M% x! }" s0 t4 w6 P) r
  51. #define DMA_FN_OUT
    . _+ ~) ?* w7 ~8 z! _: o/ @" u6 z
  52. #endif
    " v$ I. O. c2 ~
  53. . k. A- }0 J4 Y  t, h1 l4 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): E+ r  S9 A! |+ m; j
  55. #define STATIC_SHIFT                3
    4 b  l1 t$ L; z1 p" i" E6 t( K
  56. #define TCINTEN_SHIFT               203 X; T7 w' S! E" J! W
  57. #define ITCINTEN_SHIFT              21
    $ ?7 `  L( j) W, j, j! y
  58. #define TCCHEN_SHIFT                22# U, c5 E# o+ i+ M$ O% ]. v) E1 ^5 N
  59. #define ITCCHEN_SHIFT               23; m) }4 @; Q4 N

  60. 4 U# C8 ~" B& q' f
  61. static volatile int irqraised1 = 0;
    ; e2 V/ \- c5 d' r
  62. static volatile int irqraised2 = 0;+ d% ]3 g' }1 y1 t: J% B0 z

  63. , `. A) o# I! ]1 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( W! x* D2 @/ ]2 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O9 i) z0 K. n- L  ]0 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( e+ S" S9 J' g

  67. 9 I5 B5 e2 {5 M7 w! Y2 G
  68. dma_addr_t dmaphyssrc1 = 0;
      i: A4 l; R! U# m; Z  I
  69. dma_addr_t dmaphyssrc2 = 0;
    ; f2 @+ L4 ^- V1 D; A
  70. dma_addr_t dmaphysdest1 = 0;" N7 M  i# ?+ {2 R
  71. dma_addr_t dmaphysdest2 = 0;7 R9 }& E2 V( s
  72. 3 W, h' t/ c* h8 B
  73. char *dmabufsrc1 = NULL;% a5 m5 `! @# X# o
  74. char *dmabufsrc2 = NULL;/ H% _4 {4 U$ r0 _
  75. char *dmabufdest1 = NULL;
    7 r, ~- K+ O; C" I5 {: W
  76. char *dmabufdest2 = NULL;
    ' J# T3 K7 [" K
  77. 8 @/ q: M- v9 a. @' l8 s
  78. static int acnt = 512;
    + \) f0 b- f0 a9 c' g5 W5 X
  79. static int bcnt = 8;
    ; D% n% s  g5 O7 E
  80. static int ccnt = 8;( c$ N( B' c3 l
  81. ! |2 t; W4 W: s9 X/ N- E! c9 a8 F* N$ d. k
  82. module_param(acnt, int, S_IRUGO);
    / g! p" n9 [" y" X& `( O
  83. module_param(bcnt, int, S_IRUGO);% I( ~8 _4 L# k7 z) I. c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( `  ^4 t) ~; C3 y2 \3 a& e# \) `  g* J( |5 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 K! u% f  A' ]  H: y+ y- d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  o5 n' v+ l* o- Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 V# k* |. m- T7 o2 ]
0 Z" p; o3 w$ m! W9 b3 R  I0 ~, h
- K5 J7 V/ |* D. q  }' H/ H5 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 14:08 , Processed in 0.039936 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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