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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! {9 u' H# M, X( n9 L
  1. [code]EDMA sample test application. M3 {% @, c+ n
  2. /*
    * `- U3 z# m; m* S6 X+ \
  3. * edma_test.c
    ( U% ^0 e4 l1 r3 k* |- ]
  4. ** O, s' u7 g# [& v
  5. * brief  EDMA3 Test Application+ v+ A: ^  v( a' C  S" R
  6. *& c1 d% Y* _- l/ a
  7. *   This file contains EDMA3 Test code.
    7 B) o4 H8 ^2 {' t+ J0 M
  8. *
    , f! `/ L) ~* Y' m. m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ j  M8 y& |+ {: V; m5 R% g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 B+ t% R  A: s% S/ r/ d! t
  11. *         TO CHANGE.) e  z  i4 U4 j
  12. *+ h3 B, g' X) N9 \) S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 q1 R, C3 r. K* H
  14. *7 e% u/ {1 e' o- s, {" b" c. t
  15. * This program is free software; you can redistribute it and/or
    ' ^& u# s# x8 K3 c* [, z' C; L, H
  16. * modify it under the terms of the GNU General Public License as4 c2 [' ^! X6 m7 Y/ q
  17. * published by the Free Software Foundation version 2.
    * s" P+ U+ T0 L; I; h9 o  ~
  18. *
    6 r- w  K, r' B% M, I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 V" F8 r" y) m6 G( ~. `. e7 T
  20. * kind, whether express or implied; without even the implied warranty
    # N/ [' O/ b2 ^: {' J5 k' [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 p/ a! d! ~6 J% y
  22. * GNU General Public License for more details.- R- K9 _- u. w) X7 L1 w" M6 Z6 w$ {
  23. */
    , d" h" B, D- I7 G1 ^# J

  24. ) y+ p+ J, j7 z7 @
  25. #include <linux/module.h>% U% S6 V0 @) l/ c1 F' ~+ O1 p
  26. #include <linux/init.h>
    6 @4 S8 L& ?9 g
  27. #include <linux/errno.h>' D* y! U0 n$ J9 e# x6 i6 m
  28. #include <linux/types.h>
    " ?. R4 e! [) Z  K9 A- g
  29. #include <linux/interrupt.h>
    9 v: a9 ?- z' \; @; A/ C6 ?+ F
  30. #include <asm/io.h>1 l+ k# |" f& C- ?. E+ ?
  31. #include <linux/moduleparam.h>
    + O3 n7 F% C- g
  32. #include <linux/sysctl.h>! _, \; C* h8 \
  33. #include <linux/mm.h>8 v+ e& e- u  s7 b! n0 W1 |6 H0 n% `
  34. #include <linux/dma-mapping.h>6 H& j$ C; ?) Y7 X& p% K. y$ f
  35. $ A4 W/ H6 ]2 v3 A
  36. #include <mach/memory.h>$ o4 m6 H, T- K- l0 d8 a( r
  37. #include <mach/hardware.h>, P' u) A. U# @4 s( I+ Q
  38. #include <mach/irqs.h>
    % {5 v+ y7 d: n! x4 j0 R4 |( j2 u$ d- a
  39. #include <asm/hardware/edma.h>
    3 \0 a$ G, E* @6 i5 W3 O
  40. 0 V3 R5 O" n& r: x
  41. #undef EDMA3_DEBUG' ?& Y: t' N8 ?5 s! m  Q( l: a+ @! U
  42. /*#define EDMA3_DEBUG*/
    1 H* `& d' ]7 c7 P8 C

  43. * X. G  M& E* N
  44. #ifdef EDMA3_DEBUG
    + v& i8 t7 ~; h# W) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 h' U. e9 ?/ l& W  G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 {) @# v% r5 \. X+ q& Q# V6 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 z( [8 X8 ^; s% r
  48. #else+ c( G: O' n) {' i1 |" ]
  49. #define DMA_PRINTK( x... )
      \# E. r8 E: }3 N. U
  50. #define DMA_FN_IN
    ' ~7 r4 a, \- j
  51. #define DMA_FN_OUT
    0 q8 b) i0 R" s& S# v7 i% T. s
  52. #endif  x4 |9 i+ |4 V$ \- L, c
  53. 9 i8 V4 |$ I2 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - V9 ?2 s: `1 ~/ y/ Y* K0 r$ j- g
  55. #define STATIC_SHIFT                34 X7 b7 P$ w) g6 d
  56. #define TCINTEN_SHIFT               20
    $ F7 Y) f% K5 v) @2 \; N6 @0 [/ u
  57. #define ITCINTEN_SHIFT              21; W3 \+ _: ], v8 a+ h
  58. #define TCCHEN_SHIFT                22- Y, M! c+ e' R! @' ]) l
  59. #define ITCCHEN_SHIFT               23
    2 z* K! U! i" `) I0 u8 _; L

  60. / A) K; [: O9 g$ X, Z; C  O  c) U$ ^
  61. static volatile int irqraised1 = 0;
    ) c) p3 ~* g1 _0 m7 m1 M
  62. static volatile int irqraised2 = 0;
    2 k- ?. D7 e( O5 k. z+ p8 c3 b# i

  63. : g" \8 t' C% P0 [2 Q) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s/ u7 l: }/ z: y- A5 @8 T6 H2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P. ]8 y$ {* T4 ^1 x6 B! F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }& r* k7 A" F* R% f8 w' Q
  67. ( }  L+ ~4 c6 v3 q4 U4 [0 U4 c& T
  68. dma_addr_t dmaphyssrc1 = 0;
    3 j6 L( P1 a; J, H+ g' T
  69. dma_addr_t dmaphyssrc2 = 0;0 a) Z, d# F; T/ V5 L/ _/ Y
  70. dma_addr_t dmaphysdest1 = 0;4 j  J8 g/ V. S5 p- Y, J
  71. dma_addr_t dmaphysdest2 = 0;
    - H7 ]- H- z( n! r
  72. ! \7 [# `4 c& y, \' h; [
  73. char *dmabufsrc1 = NULL;
    & M6 n5 g4 e6 u: h" A$ o( b
  74. char *dmabufsrc2 = NULL;
    & ^# R* ~( L, C
  75. char *dmabufdest1 = NULL;
    ) X* ?. A7 t: C2 f" T5 ^
  76. char *dmabufdest2 = NULL;
    # v7 l8 m" s5 H! ~
  77. 4 ^  g2 m. n8 @; m; g8 |. z: l
  78. static int acnt = 512;
      }) D( @( x, i- j' [
  79. static int bcnt = 8;. a( D: \/ S: W( A0 m& s
  80. static int ccnt = 8;* B: d" W! A3 t! w0 l

  81. 7 v" V0 u. F8 ^: D  `, |* o4 X
  82. module_param(acnt, int, S_IRUGO);* o7 ^9 z. z6 Q5 T3 b
  83. module_param(bcnt, int, S_IRUGO);' I! [, U1 K  x& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ~; D; j5 d2 A6 @0 j. t& n7 G8 p4 w3 G6 {, a( l: \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" q, v- t8 m; barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ h& l: W, K5 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ^& L5 K' z4 x$ \: ]/ U" Q: z( W7 A- p" ^
7 ?3 z/ m# I9 p2 t1 M8 H, h! i4 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 16:03 , Processed in 0.038656 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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