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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 }: [% `: o# J$ _
  1. [code]EDMA sample test application3 ]% p4 b* V' }/ N. F7 v, w4 B
  2. /*& t! k- W9 g- }
  3. * edma_test.c6 y9 y1 C- y' Z# z7 [- b9 p$ T
  4. *
    & G! E) I) D' b% W4 ^# N
  5. * brief  EDMA3 Test Application6 C1 i: x7 }( T; G- r
  6. *; h" z- T7 R: H3 U
  7. *   This file contains EDMA3 Test code.; s2 J& w2 e! A, @: d7 N
  8. *1 Q. C4 ]* c* `) W' _) J! ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) P! Q  k; E4 g% q1 ^8 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O& B0 d6 }; t  b8 n) H' m
  11. *         TO CHANGE.$ N9 m& E7 u0 C! }% j, k5 o
  12. *! S9 }6 l8 J# o- |- ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ E# f; I7 Z+ w* K
  14. *
    7 V5 Y8 {& |1 i5 J+ U  {
  15. * This program is free software; you can redistribute it and/or
    % C2 h9 \# i1 ?- A& @5 a
  16. * modify it under the terms of the GNU General Public License as) |0 Z* S+ b; L; r: @" Y4 m
  17. * published by the Free Software Foundation version 2.; p# o8 [1 y9 o+ V
  18. *7 p; p: M% a5 Y& [% m2 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 A" J% \& f2 U' c
  20. * kind, whether express or implied; without even the implied warranty
    ! k3 G$ \% K& I# H! R: `2 y- k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! p8 S5 f9 s$ a' F1 \( g  u, F
  22. * GNU General Public License for more details.# `+ u3 r1 o" x: E+ V/ F0 T9 ?
  23. */
      Z4 B3 u. x, Y, f

  24. 6 A4 e2 r( H! C7 q2 O
  25. #include <linux/module.h>9 m& S7 O2 _+ y/ y
  26. #include <linux/init.h>
    . G+ @3 o3 e: L  o- Q+ t
  27. #include <linux/errno.h>' y% {" n- o( X$ u6 W4 Z: t7 Y
  28. #include <linux/types.h>
    $ A* a) w. f+ [& p8 @
  29. #include <linux/interrupt.h>
    ( Z: T! {: F7 b5 Z
  30. #include <asm/io.h>' X# @/ U6 k1 ]* s" B0 s6 S
  31. #include <linux/moduleparam.h>
    # B5 [" p# @6 t7 b
  32. #include <linux/sysctl.h>% I# [7 E; q* q4 C- g1 U
  33. #include <linux/mm.h>
    ( Y* d/ X, a& g* t! U, J! c! P
  34. #include <linux/dma-mapping.h>
    % J6 O2 _, s5 ?3 _1 p" h
  35. 8 m  j6 K( i5 Y* e
  36. #include <mach/memory.h>
    & g' O+ m, |4 B# {: |! ^" e
  37. #include <mach/hardware.h>
    ( D( l5 {8 J6 v* r! F2 M
  38. #include <mach/irqs.h>
    & Z: _" _$ i6 `3 l$ Y1 g2 q6 M' K
  39. #include <asm/hardware/edma.h>( w4 E- V* ?6 V! T2 o6 x2 N

  40. + z9 S1 d, ], O  H6 z
  41. #undef EDMA3_DEBUG) y# N  [& R) H: g
  42. /*#define EDMA3_DEBUG*/
    7 v) K) D% z; B* j
  43. ) k2 m/ `  a) t# ]4 F
  44. #ifdef EDMA3_DEBUG
    4 p4 [; [" X/ I" A* F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      `3 s7 @. n, t0 d) p6 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ G! ]1 `2 h" x& }2 P- C/ Z* X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ r0 B  {8 m7 J& f  U& j: @
  48. #else/ b, Y0 Z4 N3 M/ J/ x
  49. #define DMA_PRINTK( x... )- o) D3 t* K3 M( C& o5 l
  50. #define DMA_FN_IN
      ^0 ^9 b# q- m+ [' E5 {
  51. #define DMA_FN_OUT
    ) I* @& b# H5 B
  52. #endif2 u  A5 G' e! O4 Q0 U
  53. 5 `7 ^! X) B/ W. O  G( b+ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 n; y7 i: R' n9 x+ F& K" j5 @) @# h
  55. #define STATIC_SHIFT                3
    $ }6 ]& H6 v( \& X
  56. #define TCINTEN_SHIFT               20
    3 j$ m2 f9 E# S" `; @, \# m
  57. #define ITCINTEN_SHIFT              21
    " h$ Q1 M  T+ F6 O
  58. #define TCCHEN_SHIFT                22
    ; i1 ~4 f' Z1 U' E/ S/ T8 U+ i/ G
  59. #define ITCCHEN_SHIFT               23
    6 T6 \5 n+ {+ n
  60. # e: p9 s$ [) R: q  k) m0 X/ P
  61. static volatile int irqraised1 = 0;
    ' h' L4 E9 O" v+ C* ]1 t' S
  62. static volatile int irqraised2 = 0;
    5 D* c$ g  K8 q4 O" G
  63. 8 q/ W& }2 P; O, _& ]8 ^. H/ B5 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ?4 r6 }  L- y& X# g* t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T9 c) W5 Y" J9 R3 Z9 {' A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ?2 |& Q  l5 ?" E' J7 U! C
  67. / W+ B/ p# v& W, {5 r" |  ~4 U" U: {
  68. dma_addr_t dmaphyssrc1 = 0;# z. q9 j4 _  m2 ~
  69. dma_addr_t dmaphyssrc2 = 0;) d% A/ a9 }4 X8 `% g  F
  70. dma_addr_t dmaphysdest1 = 0;0 n9 y: \& q7 U; Z. K; g' B
  71. dma_addr_t dmaphysdest2 = 0;. z1 a% i: O* }; ]

  72. * I& T* c9 I! B, _1 H3 L- D7 ~0 z
  73. char *dmabufsrc1 = NULL;
    . _  i8 R) K. r% a7 @& s
  74. char *dmabufsrc2 = NULL;
    5 @; i7 K& K9 ^' }
  75. char *dmabufdest1 = NULL;
    , \; I; f) h9 s  t* ^/ ]
  76. char *dmabufdest2 = NULL;
    1 l, F, l/ c- H

  77. / S( X3 [, d& s8 c" C8 }
  78. static int acnt = 512;) n; c1 Q7 M( t1 {! A; P$ s1 a
  79. static int bcnt = 8;
    + J* J2 b' i+ G" V. U# o
  80. static int ccnt = 8;
    / `. e; H; S. f. _  B* B1 b' p1 L
  81. + f0 Y! }0 V# g- s* q' Q0 `. l
  82. module_param(acnt, int, S_IRUGO);2 Z* ^# }0 [7 i5 ^) ]
  83. module_param(bcnt, int, S_IRUGO);; l; J  m0 W4 ?) r) P3 y& B# _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: K4 Z5 Y" P/ [2 l+ o) e
+ M6 D. z6 c! t) E2 B. g- @; W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: i) K8 r; i# E! A8 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i+ p( y  |; i& X  ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B" U' w/ d" A: D: Q3 t
' V1 D/ B3 k# y( p1 N2 v2 T4 C6 y0 k3 b$ T4 @  B/ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-20 03:17 , Processed in 0.037005 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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