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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d1 N8 O4 H; A2 }  ~& a# I% @
  1. [code]EDMA sample test application
    3 h2 h/ g$ P/ I8 T3 E* \
  2. /*! |/ v# P# [7 O! |+ }
  3. * edma_test.c
    # E+ B; f- Q, D; k  l0 T: M
  4. *8 B( N+ o) G0 x" U& ?
  5. * brief  EDMA3 Test Application& r1 m/ m! N  a( _
  6. *: N& i6 A- x7 O; ]( M7 m6 W7 L, m, Q
  7. *   This file contains EDMA3 Test code.: @4 V3 t0 s( F, z- a( o1 ?
  8. *
    6 W9 t( z  e2 n4 r: C0 z" U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' [  X3 u/ l( |7 U5 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ F% b# f! W0 L+ J/ D1 Q
  11. *         TO CHANGE.
    1 V" t9 a3 [; r8 s! g9 Q
  12. *
    4 w5 z. A+ V9 [" y- p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* i! z1 @; f7 }& W' R
  14. ** _1 [; U7 k. v) f7 t$ o
  15. * This program is free software; you can redistribute it and/or' A+ c, Q% H5 b9 J$ o, E$ X+ }
  16. * modify it under the terms of the GNU General Public License as
    * w: }* @6 O. o, W# U+ p5 C
  17. * published by the Free Software Foundation version 2.
    8 {4 _+ R! G4 h0 u: \& i7 z8 m
  18. *: D; n% I( }- ^9 K4 k0 [- Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 F8 ~! h. z+ d# W( M  m
  20. * kind, whether express or implied; without even the implied warranty2 i, J: I/ c! M7 F* J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; c' X- \: k" d& g7 A$ W/ C5 J* `  l
  22. * GNU General Public License for more details.
    ' O% @% a; W+ ^! l
  23. */) z, q$ V5 S9 W. ?1 S

  24. & }) z$ X# l- Q$ F
  25. #include <linux/module.h>" d6 {; i* _5 T6 ^& @4 t$ c
  26. #include <linux/init.h>* F. O6 S' F' \2 D
  27. #include <linux/errno.h>8 a" |, k# O( Z: |& W
  28. #include <linux/types.h>
    0 @* @" P! U8 h) I: y, `
  29. #include <linux/interrupt.h>9 @+ [: G) E% u# H$ E  g3 C
  30. #include <asm/io.h>
    6 {4 x. z4 ?8 m" R& X
  31. #include <linux/moduleparam.h>8 `& J1 B8 I3 U' V
  32. #include <linux/sysctl.h>
    8 l" [( v3 \* B  G- }  t
  33. #include <linux/mm.h>
    % J" a1 g. v$ `( @
  34. #include <linux/dma-mapping.h>6 ]+ ~; @+ q8 g! _2 {
  35. 1 e: M4 h' O& M
  36. #include <mach/memory.h>6 @+ ~6 ?8 @5 g2 F2 D5 N1 W" i* P
  37. #include <mach/hardware.h>2 H$ q  @4 C& @# n! C
  38. #include <mach/irqs.h>3 P% w. h5 Q8 h$ q0 h; q
  39. #include <asm/hardware/edma.h>  H4 r. W# c5 q
  40. ) M( w6 R/ f2 f4 c
  41. #undef EDMA3_DEBUG
    / _( S6 T* r' X. O: l) b4 c
  42. /*#define EDMA3_DEBUG*/4 O4 ?% `8 X! ]4 Y1 j/ G6 R
  43. # C' G+ l" ?9 O4 G
  44. #ifdef EDMA3_DEBUG' W5 i4 [1 o1 O) M* e1 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ^- U) k- K. [- D) u+ H9 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ^5 n* W  d& S. p$ b# x4 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r9 f, h; I" @& a# w
  48. #else
    7 k; b' N2 b1 {  m7 Z  v. Y8 V2 a
  49. #define DMA_PRINTK( x... )  w$ ~) _1 R$ E7 i
  50. #define DMA_FN_IN
    : y% ^  \9 B* \1 Q  V+ G
  51. #define DMA_FN_OUT
    / n( S4 L* L0 l9 f
  52. #endif
    . P8 O. c6 J+ w8 B, F) {
  53. 2 }$ `% @# l1 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ?+ U3 R# `4 z' ]
  55. #define STATIC_SHIFT                3, L4 R3 f$ i( b# [
  56. #define TCINTEN_SHIFT               20
    8 f7 A- [$ V- j- n
  57. #define ITCINTEN_SHIFT              21
    9 y* q: U5 l# B8 Y% p) ]/ f  b
  58. #define TCCHEN_SHIFT                228 d3 k" U! D5 j& {: o
  59. #define ITCCHEN_SHIFT               238 x4 |4 ?8 w& Z' V

  60. % h. b& W) l  c" O
  61. static volatile int irqraised1 = 0;
    ) x" S4 O9 t8 D1 E" Y6 a) t, |
  62. static volatile int irqraised2 = 0;
      F# l. r$ v& J$ k1 B. H
  63. + W5 Y5 t( w, V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * j- U( i$ d. H" v; ]. D& V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h0 B! y) B) y1 ~) `5 G" R# P+ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % p! H8 m$ x% J

  67. 3 f1 _; S5 N4 F8 d# x
  68. dma_addr_t dmaphyssrc1 = 0;- P0 l# p' `! }4 n, w5 \" ~0 C& I$ N
  69. dma_addr_t dmaphyssrc2 = 0;2 X  _! h; g5 g, A' _; |& w
  70. dma_addr_t dmaphysdest1 = 0;
    / [. j5 C# i+ p1 I( W' x
  71. dma_addr_t dmaphysdest2 = 0;
    0 K3 [: W. y8 B0 [& r% _& u

  72. 5 ?2 P' T% e( O6 Y0 X
  73. char *dmabufsrc1 = NULL;2 j  `- A* M3 n* B8 n; x
  74. char *dmabufsrc2 = NULL;: B0 H, A' A6 `$ s" v  c
  75. char *dmabufdest1 = NULL;( J: j% A! n: m  x+ q) N
  76. char *dmabufdest2 = NULL;6 I' u# Q' R0 C8 K6 y; u1 N$ W
  77. 9 w( y8 d3 I9 }; e+ R' P/ w, q
  78. static int acnt = 512;
    ( T% b+ L# z& e. m
  79. static int bcnt = 8;  U4 N' E# B! b! L# j3 J
  80. static int ccnt = 8;" x3 q) v. J) K

  81. 1 O2 h7 V) z+ Z0 l7 b, P
  82. module_param(acnt, int, S_IRUGO);( I' S# J. @) T7 t2 D$ r' t5 H
  83. module_param(bcnt, int, S_IRUGO);6 s( N. m1 N* J4 ]/ c# M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. o+ B; E2 R4 [, t- D9 a+ T

* o6 ?$ |$ g/ |4 N; Z$ ^: i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Z0 m+ P  j2 E: @6 u& i
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 S0 T2 G% d+ G* r( I: E5 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 q0 r: V( a  G" \& c
$ `- c* D; T0 ?$ m
' }8 x( [% C0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 20:52 , Processed in 0.039852 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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