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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, N4 ^8 P- K1 ~! t# |$ f2 A* e
  1. [code]EDMA sample test application7 l5 u' I/ N& S/ f  T& s6 s7 X5 K
  2. /*6 k0 {" s: c3 {% h: M
  3. * edma_test.c* V( b8 J$ h1 [5 J
  4. *  h$ _  d/ ~2 O. F. c7 t
  5. * brief  EDMA3 Test Application: X6 _6 ~( i- Y
  6. *
    2 `" O' |" H. D% L, h: D
  7. *   This file contains EDMA3 Test code.2 P% g' [# F" J# l: m4 J
  8. *
    - `; C, y7 [* {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e1 J: W# f# ~2 Q* i* N& \' n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 z0 k2 E2 \" Q7 P( u; H
  11. *         TO CHANGE.
    ; W$ e6 Y' V5 C; s0 r/ w  r& }! ^
  12. *
    # u5 h" K1 Z" m9 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- e! {8 }- p! H+ I1 X
  14. *" n" S6 H/ e& Q6 C6 j' q7 }4 i! P
  15. * This program is free software; you can redistribute it and/or
    - P+ r$ S* G9 n! M
  16. * modify it under the terms of the GNU General Public License as) q! O, m# x& I1 U# N( b. s
  17. * published by the Free Software Foundation version 2./ D+ m) X$ B) y4 U: y
  18. *0 ?/ I0 S: z! p8 q. z/ k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ O- z- {9 ~# B4 I
  20. * kind, whether express or implied; without even the implied warranty0 k/ v- u% m6 I# O! U2 J; o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ b1 f0 p& E0 r% s* v5 L% B
  22. * GNU General Public License for more details.
    1 [( G0 L* s4 G% a8 c' K! r
  23. */3 e' O% o& K+ D5 O* b) o

  24. $ L* c" U9 }% W
  25. #include <linux/module.h>7 W7 L- {/ Y5 s7 U+ y
  26. #include <linux/init.h>3 L/ t  N. y! H5 b% T+ g: N; w
  27. #include <linux/errno.h>/ }: Z6 y$ h; Y* f9 n% J% D
  28. #include <linux/types.h>
    6 R. G1 H2 I3 Q9 U
  29. #include <linux/interrupt.h>
    / h& B1 L: Z# p2 g2 A
  30. #include <asm/io.h>
    0 Y* }6 U# _: e1 \! ?+ u* ^3 w
  31. #include <linux/moduleparam.h>
    # @9 V# f8 F. v( z+ A7 z3 M
  32. #include <linux/sysctl.h>5 y1 ^; e7 I7 ^8 E8 a3 `, P: L" c; P
  33. #include <linux/mm.h>
    , |# B* f& j4 A: C
  34. #include <linux/dma-mapping.h>- h/ m6 z4 M, T/ |; y
  35. ' B6 n5 L, s1 P. @
  36. #include <mach/memory.h># x  k0 g# D/ s, X+ r+ g0 t
  37. #include <mach/hardware.h>
    + c! l$ r0 C5 v) ~% w/ Y: X8 g
  38. #include <mach/irqs.h>
    , Y( Z- ]& q1 K  ?; T6 D3 A+ T
  39. #include <asm/hardware/edma.h>
    4 ^! ~( g3 R  T: ^8 g$ q" C9 _  `

  40. 8 @6 x: ~8 B3 M
  41. #undef EDMA3_DEBUG
    * m( j. b0 l3 @% b, Q
  42. /*#define EDMA3_DEBUG*/, c4 A$ e- X; Q( G0 k
  43. 9 U) r6 j8 K: b6 [
  44. #ifdef EDMA3_DEBUG8 ]; G! q3 ?: J* ?7 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]% D! H0 [3 r) q. M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& m$ [" V3 K( E2 }+ f/ V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 `2 p4 X9 j" T5 |% M! o
  48. #else
      S% h( O  |% X7 G
  49. #define DMA_PRINTK( x... )8 t# g! `! {) [" Y) I7 n# \" G
  50. #define DMA_FN_IN: j# W* @( }6 I
  51. #define DMA_FN_OUT* i; j  n7 ]4 J# x5 R9 Y/ H5 t: l
  52. #endif
    " C5 f. c) L) u
  53. " M9 t! L: n4 P7 I% O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& k# A1 l3 }* t  M$ |% ^
  55. #define STATIC_SHIFT                30 I% A( B* O0 O* S: {6 A' a
  56. #define TCINTEN_SHIFT               20
    ' n' N% i5 h; {2 u5 S; \# a6 X
  57. #define ITCINTEN_SHIFT              21  z9 R7 d' \  ]& y7 A
  58. #define TCCHEN_SHIFT                22+ k+ P9 K) ]8 h2 U! P( W
  59. #define ITCCHEN_SHIFT               23$ A* H2 M, T8 o

  60. 4 J& N, v: a8 K  o, a  a
  61. static volatile int irqraised1 = 0;' N( A# k, L9 q( o, ~& u
  62. static volatile int irqraised2 = 0;
    1 x" ~; S; s; @$ I* j

  63. % W4 n3 s0 @  {1 K7 d* c# p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; d9 V: c8 Z9 ^1 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % E5 N' ]7 C& a) v+ C% F! j/ V5 G5 L' T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T- y$ @9 k! r( U) }/ }3 ]! K3 s

  67. 6 f' b8 D# `' m! v0 j6 D
  68. dma_addr_t dmaphyssrc1 = 0;# A  ~, F% ?" t6 E' T
  69. dma_addr_t dmaphyssrc2 = 0;
    $ U7 G8 S9 x( v& d
  70. dma_addr_t dmaphysdest1 = 0;( }% B" v7 ^8 P3 j
  71. dma_addr_t dmaphysdest2 = 0;
    - @5 w5 |; Y3 g5 {8 W% p  B
  72.   U7 D, z- d7 J8 q" |  T2 B
  73. char *dmabufsrc1 = NULL;
    ' z: C. x# m# W7 V4 w% s) f
  74. char *dmabufsrc2 = NULL;
    : a. _- }$ L' ?
  75. char *dmabufdest1 = NULL;
    . B* j) R# s. }& a, @2 S$ a& d" Q
  76. char *dmabufdest2 = NULL;( b- w' j/ `( {% P7 t. s0 D

  77. - v& m0 E% E( V4 \
  78. static int acnt = 512;! Q, i7 C9 H2 U
  79. static int bcnt = 8;8 n4 |) Q4 l; r, U( R& f
  80. static int ccnt = 8;
    4 W2 o' C! L3 c6 d8 O
  81. 7 `; M+ n. T; `& j
  82. module_param(acnt, int, S_IRUGO);
    $ E: q4 K  q9 m" |- X/ M
  83. module_param(bcnt, int, S_IRUGO);1 t* a* z1 C# |, @5 ~& [& O4 T* u3 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) C4 T( M/ W& l
6 ]$ R7 L0 d% _- k( z& n) E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' L' M9 h; @/ M' Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p" j0 T) |$ a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 d7 s& M/ i7 g1 K9 U) K! N. X: r  W/ i; g2 c1 B  M
5 ?, @) S# x4 G" L5 x9 t& I8 k+ z2 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 05:16 , Processed in 0.037453 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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