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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 t% G2 l- d1 L5 ^, }9 m% B) X: v
  1. [code]EDMA sample test application% X& I* P, u1 @" b, q
  2. /*- F; x. J$ S/ ~) b6 j7 d; u5 h
  3. * edma_test.c
    . M! t. B3 c# `5 r$ H0 S$ y: H5 z, ~
  4. *2 |6 z+ [: ]: M
  5. * brief  EDMA3 Test Application
    . b2 ^! A3 m( p2 J8 c9 V$ D, a& C
  6. *
    : J/ _( I& }( v0 N% w4 y, e
  7. *   This file contains EDMA3 Test code.
    3 p2 @: J: I# V
  8. *
    5 n; D8 }) m6 @* @# t0 q0 l3 ]6 Y' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 k5 c: U0 l3 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 r; l$ t- h/ z7 P, K1 F
  11. *         TO CHANGE.9 o" i$ l' F) |- K8 d/ n8 }2 F
  12. *$ u: ~8 f# `  f; T& p/ k/ l1 \7 {5 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 |+ j/ a6 S, Z! s+ o) _) H& J6 p9 Z
  14. *
    4 K/ l# {/ ?# X$ ]7 O
  15. * This program is free software; you can redistribute it and/or2 Y2 B2 M4 N4 ^, `* Z! j
  16. * modify it under the terms of the GNU General Public License as
    " {! m: x% V% o: }. q
  17. * published by the Free Software Foundation version 2.9 c: l3 @6 R* |0 W- B
  18. *" r! o( i, J# y+ k$ j  i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 @, S& D6 m0 B  K
  20. * kind, whether express or implied; without even the implied warranty7 g  R: N& R  [% z, z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' W' l0 B5 l7 |, E# x6 `
  22. * GNU General Public License for more details.
    / R. A- ?6 o" H
  23. */
    & Q! y/ l% Y6 h' Z
  24. / y: A  N& ]9 N; u% J" {
  25. #include <linux/module.h>
    ) S- F+ {( u5 |2 }5 e4 N
  26. #include <linux/init.h>/ F  j! M% Q7 F) w' x3 |
  27. #include <linux/errno.h>, o' G! H* H5 ]  \$ K5 ~
  28. #include <linux/types.h>8 i0 e% n  Z4 |. ]( \4 Q
  29. #include <linux/interrupt.h>1 H0 c- H; p8 m1 P
  30. #include <asm/io.h>0 [  V- p; W3 M, P) P# r
  31. #include <linux/moduleparam.h>
    & y0 c3 ]$ t- e% f& M" @0 U
  32. #include <linux/sysctl.h>
    , G* O1 p& f# C: F
  33. #include <linux/mm.h>
    ( k8 L4 l4 B; Q
  34. #include <linux/dma-mapping.h>
      m+ |: L9 q  b! v

  35. ! `  j# f% y" S. |( t
  36. #include <mach/memory.h>
    $ y% G! D: v4 q! t; j5 y; `5 a
  37. #include <mach/hardware.h>  ~4 ]4 E" ^5 H" o+ o3 y* Z% X! x2 U% K
  38. #include <mach/irqs.h>
    6 |, S9 t$ T% I6 R1 R3 l
  39. #include <asm/hardware/edma.h>+ I7 n2 ^( A* {
  40.   k- C1 S( F1 u& @" b
  41. #undef EDMA3_DEBUG
    8 J" U) U- K8 W  G6 G+ S$ k$ A
  42. /*#define EDMA3_DEBUG*/
    ) k# |) f* v8 b' |5 _

  43. : [: v! F% E( g4 v8 J
  44. #ifdef EDMA3_DEBUG9 T1 `% f7 ^9 y9 k8 [5 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; }# J! j" a% x  K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + r9 @. E5 ]9 h+ W! n. c& Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). n9 a. F; s3 @( h! x1 B
  48. #else+ Z1 }& w' D% Q+ l! g# X* i5 U
  49. #define DMA_PRINTK( x... ). Z: W  I7 J$ m8 n* j
  50. #define DMA_FN_IN) n! U( R$ F9 E0 L# I
  51. #define DMA_FN_OUT* |3 J( z+ ^, m/ }  x& ?
  52. #endif4 Z( H+ g6 ^& u( |6 l

  53. # e1 t+ v4 x! q" X* r& K7 U8 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 {1 L6 n* [& z  {. B2 Q6 w0 l
  55. #define STATIC_SHIFT                3
    9 h( J8 Z+ H5 w/ k6 Q
  56. #define TCINTEN_SHIFT               20, Q: s/ G$ q8 w' u
  57. #define ITCINTEN_SHIFT              21
    " ]5 V5 B  n" }3 l
  58. #define TCCHEN_SHIFT                22
    ) `4 I. b: q- @4 Z9 ^
  59. #define ITCCHEN_SHIFT               23
    & f7 T" J  t, d1 B6 o3 M

  60. 7 J5 E1 u' E- `  [
  61. static volatile int irqraised1 = 0;/ H; |/ ?$ V' H4 v* q4 L! p
  62. static volatile int irqraised2 = 0;- b  G& g5 A) W% F  j- f+ W
  63. ; i; L$ w) x* G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # g0 c4 ]; N* g& a; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 i3 A0 k5 K2 G: N9 S% J$ H. B: C9 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * h5 I8 u0 B7 I0 f! C0 O8 N4 T& V

  67. * f$ v2 j4 X& q, {8 R
  68. dma_addr_t dmaphyssrc1 = 0;: D& c- k6 w' c! d, ^+ N
  69. dma_addr_t dmaphyssrc2 = 0;
    ; x; i- X4 H2 O( [6 Q0 M- O4 E8 u) Q
  70. dma_addr_t dmaphysdest1 = 0;" }* q* ~' X% v2 Z6 w, ]3 m
  71. dma_addr_t dmaphysdest2 = 0;4 U9 S2 }; T9 h1 o: J
  72. + N7 `; m+ K- _+ k$ e( ?, m
  73. char *dmabufsrc1 = NULL;  x( }1 Z+ H( ^& Y' B# y
  74. char *dmabufsrc2 = NULL;- }0 P8 ^" e5 W# ?- M
  75. char *dmabufdest1 = NULL;
    / y. ^6 v8 G) o
  76. char *dmabufdest2 = NULL;
    7 A5 G% l2 s8 j4 s2 `0 g& r
  77. 2 T' c! Q5 V2 ]1 Z! F
  78. static int acnt = 512;4 ~+ D8 |1 c  x: ~/ V6 g& v
  79. static int bcnt = 8;, G! x* U9 A- M1 n
  80. static int ccnt = 8;
    8 x- D4 |/ d3 v6 P  O; r

  81. 6 @) O6 H' [/ u! ?! {
  82. module_param(acnt, int, S_IRUGO);' x5 |! }% w& k
  83. module_param(bcnt, int, S_IRUGO);
    " i/ p; ^- K5 _5 W9 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 o2 \5 K  ^! c* H$ ?
4 ^& P% V+ |* K. w6 U5 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, I0 i- W$ l* \7 N: ~( |- ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! @6 C  [4 u: U# O$ B7 T% O! x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t5 a9 U1 C' [% m* s+ O, q
1 Z7 P1 e, y& X1 I$ R* h6 h* X
/ a0 O6 F0 x4 ~' h7 Z  m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 11:31 , Processed in 0.041213 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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