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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; _0 o6 T& B- Q4 \2 L
  1. [code]EDMA sample test application% |6 G  O: \% k( R
  2. /*
    1 U: _: l+ \& {3 W) n, x  y
  3. * edma_test.c9 M3 W* g- d; L; P' }2 l1 w  i3 b
  4. *! R4 x) [' q' e& |$ n( b
  5. * brief  EDMA3 Test Application2 o% s2 F6 W" C  [+ S$ q
  6. *) N7 g/ W+ S; X& K0 y! I! A* ^
  7. *   This file contains EDMA3 Test code.
    : M; }  k5 V& N5 a" |; ]9 }
  8. *( _/ i) D. z" c2 M& b$ a2 ^8 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) i) ?$ _2 I5 y- v% n: r# c5 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; _: n8 L5 n6 m0 u; p* `* A
  11. *         TO CHANGE.* Y1 b' \0 n$ x4 x7 l. p& g+ h! e
  12. *
    + c: N5 K8 V6 j; y: m9 K; Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / I/ U: s4 U$ s+ y( q
  14. *
    - G- ~. h4 k0 m; r. z; `
  15. * This program is free software; you can redistribute it and/or
      |0 s- e/ v$ g# C
  16. * modify it under the terms of the GNU General Public License as
    6 O7 G1 Z$ F* f  r" k8 h
  17. * published by the Free Software Foundation version 2.
    # C& a0 G5 Z$ x: t% b% H6 c2 x
  18. *. a$ h# p8 [/ y3 m' y5 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % \: f1 S- ~) X% w# W3 `
  20. * kind, whether express or implied; without even the implied warranty* E" T* ^9 V; t2 N. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 f* ]3 H, f- l+ A) m9 Y# [
  22. * GNU General Public License for more details.: B: h% S, U8 ]
  23. */
    2 _6 _' E% P# D) X& j

  24. 8 M: T# J; s; y$ M
  25. #include <linux/module.h>
    : @/ V( U+ m9 v
  26. #include <linux/init.h>
    " g5 t- m( M" A
  27. #include <linux/errno.h>
    / t& R/ O* V. I. Z2 J
  28. #include <linux/types.h>
    ! k' i$ \3 |2 \$ M
  29. #include <linux/interrupt.h>
    8 I. T* K6 o5 }, R$ \) L9 C7 o
  30. #include <asm/io.h>
    5 O* L4 F) P8 Q# Q6 x6 ^& J
  31. #include <linux/moduleparam.h>* g0 @" ~3 X& V, G
  32. #include <linux/sysctl.h>9 E. P% G) E3 `1 f, s6 O0 P
  33. #include <linux/mm.h>$ P+ `) t6 Z, K5 f% z, p
  34. #include <linux/dma-mapping.h>7 y( @: n- r3 N
  35. 3 D4 G  Y3 S1 |% I+ `; B
  36. #include <mach/memory.h>) H1 B1 d% Y7 S2 h: `  `4 x' u9 m
  37. #include <mach/hardware.h>9 [8 p$ \: c/ u( c
  38. #include <mach/irqs.h>6 k- F+ b- @  ?& V$ j8 z
  39. #include <asm/hardware/edma.h>
    6 @. J" Z0 j' }0 ?9 U' t/ n" X

  40. : A* G% g: ^0 D5 H* X. [7 R2 K
  41. #undef EDMA3_DEBUG6 J' b1 f5 ^. {1 K: z6 N
  42. /*#define EDMA3_DEBUG*/' e' y: Q. A" S  r/ J

  43. 2 [; u0 b; K/ H3 O# ^
  44. #ifdef EDMA3_DEBUG
    ' ?; g' d, l$ O5 z% W+ ?1 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( ^4 L" W5 J! c" M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& q+ h4 C( U2 P% j/ D0 O# {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % v: q8 t) X' Z' k0 }* c
  48. #else7 n6 x$ r  F. J) f  X
  49. #define DMA_PRINTK( x... )' y1 ~7 q' a9 n3 F: i# N4 @5 n7 Z8 N9 T
  50. #define DMA_FN_IN
    4 R! I' Q7 z7 L" J# v5 |9 L  a6 t
  51. #define DMA_FN_OUT! j: c' W  o1 a# g# ]
  52. #endif( O; W3 h  ~3 [( u+ Q8 `

  53. - J4 D0 w; k3 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ u. Z0 @+ e( \1 }; @) F# L$ j8 X
  55. #define STATIC_SHIFT                3
    1 Y3 d4 V, O# c* t. N
  56. #define TCINTEN_SHIFT               20, p  N. J# x* b9 }4 ^
  57. #define ITCINTEN_SHIFT              21  B+ d+ i' F$ R; W6 l* x
  58. #define TCCHEN_SHIFT                228 q+ N4 \$ X" |1 f
  59. #define ITCCHEN_SHIFT               23
    4 k+ A2 n0 S" w4 @0 P

  60. * U8 B6 \# X" |% L3 {5 v, X
  61. static volatile int irqraised1 = 0;
    8 h3 E) ?$ w0 i! ?- d4 _6 q
  62. static volatile int irqraised2 = 0;3 W1 N0 J; i# y/ X) L

  63. ( v  Y6 `- M; s% `) b% j; A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W# ?8 L. a- }8 l9 q5 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W. R+ }; V, c( m& L' k: Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u; I1 y4 ?, \( G; D

  67. 2 T" E/ `# T- G+ u2 ~) U& t4 s
  68. dma_addr_t dmaphyssrc1 = 0;
    + s4 O; ?/ U6 g  ^1 U2 I1 H& w% L
  69. dma_addr_t dmaphyssrc2 = 0;$ c$ x6 u3 B$ {$ e" c' ?8 B: y% }7 ^
  70. dma_addr_t dmaphysdest1 = 0;- J& P% d; B0 P) h# j: s( ^
  71. dma_addr_t dmaphysdest2 = 0;
    & e3 \. H, K- u6 Q; N2 e: t1 _1 ^
  72. & H  J5 U% [5 G# p9 A! O" Q  e
  73. char *dmabufsrc1 = NULL;
    & y3 D) W* K* a& R- S
  74. char *dmabufsrc2 = NULL;
    - I3 L$ X) @( Q1 G
  75. char *dmabufdest1 = NULL;
    $ i! P9 w& }  \5 b( a7 p1 P
  76. char *dmabufdest2 = NULL;
    7 c* a( `0 V) z6 L

  77. 3 x3 u' k# G1 I: N& o$ }
  78. static int acnt = 512;1 }2 y2 R. _' ?) p
  79. static int bcnt = 8;) a6 O3 O) ~" \* B" ^# T
  80. static int ccnt = 8;, n8 ~1 B6 E) B+ ^

  81. 3 d# O$ P& A+ u2 d6 q+ e: X* q9 c
  82. module_param(acnt, int, S_IRUGO);
    3 \% H# E' E3 n5 l9 h  _
  83. module_param(bcnt, int, S_IRUGO);
    / b0 b, L0 y) g! J, r# s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 T. i1 X8 N! g  s' l7 g* v
/ w' H- V' Z6 B& X8 D1 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" M0 x$ F* v3 W0 \1 S2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ m7 q' ]+ m( L: t! z2 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 @' u* _  E7 i4 W) G8 d) C( R5 ^) Z% m- K3 c  k
( W+ F0 t, D# c5 X# ~; c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 07:35 , Processed in 0.038106 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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