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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 f% n1 N( ]' E3 }+ Q2 ]% e
  1. [code]EDMA sample test application
    # R4 r( L8 a( |
  2. /*
    5 X$ i* e$ v8 Y1 `1 w# C
  3. * edma_test.c) S$ Z  V; h; H+ a8 Z4 ]/ z: r. h
  4. *1 {: h  B) Q4 U" c9 ]9 [
  5. * brief  EDMA3 Test Application
    & H' {0 Q% B* \2 K
  6. *; d+ S, y; q& y
  7. *   This file contains EDMA3 Test code.8 X4 B2 _2 C3 U+ ^. l8 [# i) V
  8. *
      e& E9 {7 Z* \! d3 d8 \1 q+ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . O4 k9 t$ g  P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* s6 Q" p6 k& r, U% T6 v
  11. *         TO CHANGE.$ T# P! T- p$ ?5 g2 C9 l, U
  12. *
    & ^! ~% b2 `0 L1 I8 @6 X7 E1 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T' J% v; v1 F0 d& f( g  x
  14. *7 g, g5 i' k  ?0 \
  15. * This program is free software; you can redistribute it and/or
    , T! O1 R' M4 p  H( E8 S- b+ d
  16. * modify it under the terms of the GNU General Public License as
    " J5 m# j/ E3 m9 \8 L
  17. * published by the Free Software Foundation version 2.  L/ y  @0 @/ p, @1 J! O/ O. k
  18. *" D: V2 q& j  k. g& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 B# H/ f7 H! o- n) D# n, i9 g" V
  20. * kind, whether express or implied; without even the implied warranty
    1 W: |1 ?9 @, Z( R  U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; T' h8 ^! A! S! j
  22. * GNU General Public License for more details.  ?, g( h$ N, U" ^
  23. */$ b5 ~2 Z  V  S
  24. , d2 t/ M- [) p1 k9 t- b6 l/ I
  25. #include <linux/module.h># p, N, `7 h  [* ^' m( \2 m/ S0 U& s
  26. #include <linux/init.h>
    ! H! l4 s/ b, p
  27. #include <linux/errno.h>, x8 ^* o5 }) Z# n0 p/ b
  28. #include <linux/types.h>
    $ j0 z  |2 Q5 U, b8 e  }
  29. #include <linux/interrupt.h>
    . ?- T: Z3 W( B+ r
  30. #include <asm/io.h># l/ z8 B4 X" w3 Z/ R8 R
  31. #include <linux/moduleparam.h>
    ) k9 n$ k# C& B+ J+ N1 m" L$ K' I& ]
  32. #include <linux/sysctl.h>% d7 m% t2 X% R1 p1 r  p5 I& W
  33. #include <linux/mm.h>+ _. P- `; U3 R7 k" F# v/ v; Q$ [; x
  34. #include <linux/dma-mapping.h>
    ; z- ^) t6 f6 E$ x

  35. " `/ ?) \. q' j: n
  36. #include <mach/memory.h>
    0 F! A" l, f. |: \
  37. #include <mach/hardware.h>
    1 {8 D8 Z, F& a5 a! Z- \, R" K% D
  38. #include <mach/irqs.h>
    % h: L2 T* M1 _; K  r9 T; V8 R( c
  39. #include <asm/hardware/edma.h>3 N7 R4 X  `+ E
  40. 9 k9 }9 x8 e+ T: O) j( G% C
  41. #undef EDMA3_DEBUG
    4 p, W  T. s0 [1 q* Y) N5 ^; Z! [
  42. /*#define EDMA3_DEBUG*/
    ! S3 j4 u, }. r6 _

  43. + i& w  a! \/ J' H  R/ h& d! Q
  44. #ifdef EDMA3_DEBUG/ }; Y1 _) H: K& W! ]2 w/ q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / m- F( J, x  u2 v) @4 b/ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " X* M& @! X2 A: y! x2 U5 S+ w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ o+ H: n! w# K1 k" Q, T! G
  48. #else( k# O6 _3 V2 B+ F( k# L
  49. #define DMA_PRINTK( x... )& H, ]# J7 k! F
  50. #define DMA_FN_IN
    5 @! I7 F& Q) c5 Y- r8 w
  51. #define DMA_FN_OUT0 w; C% x" {4 F' E7 L0 _
  52. #endif- T% J; W0 J9 D/ U! F$ F5 t7 U

  53. ( P0 A* K! ?- [3 d- @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      B; `; |7 o# Q
  55. #define STATIC_SHIFT                3
    % q! P& L0 r+ @: _0 `
  56. #define TCINTEN_SHIFT               20' F1 Z' M+ V1 U6 K5 O
  57. #define ITCINTEN_SHIFT              21: f& E* \# ?+ `& o0 N. r
  58. #define TCCHEN_SHIFT                22
    0 V  S3 ]" m; x& x4 O
  59. #define ITCCHEN_SHIFT               23$ a+ r0 t4 K- ?( w
  60. # F# t5 E2 \8 d* R& b8 t) f1 F9 Z
  61. static volatile int irqraised1 = 0;
    7 o, `6 T/ K) O$ }
  62. static volatile int irqraised2 = 0;
    $ w0 c; F! ~5 Y" I) u7 e  H
  63. 8 @4 d! {! n) x& c: m) X3 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l; q5 R! v) M  [! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v& W, \! r( ?$ h/ V1 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H& B- `" p7 v' `& f
  67. ! K/ ?2 [8 U2 M1 s; K8 w1 q$ `# y; t
  68. dma_addr_t dmaphyssrc1 = 0;
    2 D0 o' \" `9 `; [& @7 T) I+ g
  69. dma_addr_t dmaphyssrc2 = 0;' p4 w  R2 Z" V8 R
  70. dma_addr_t dmaphysdest1 = 0;$ f8 z# n9 f5 m4 ~6 f# I5 p
  71. dma_addr_t dmaphysdest2 = 0;- Z; [! L8 E2 h" a$ @

  72. * T, Y3 c2 G9 D$ n: p
  73. char *dmabufsrc1 = NULL;4 H2 s5 ]: V2 o5 c) u
  74. char *dmabufsrc2 = NULL;
      l5 C% v" C, V9 C: ?8 |
  75. char *dmabufdest1 = NULL;# A8 K  f2 ?" _, d6 H
  76. char *dmabufdest2 = NULL;" P5 i! l' b3 z7 s2 i- L  X
  77. : T6 p% e# g7 E) [9 t9 k3 L- \
  78. static int acnt = 512;
    % V; g# ]( [- [
  79. static int bcnt = 8;7 d$ Q! [) w. Q! M
  80. static int ccnt = 8;7 q& l7 a) C$ K2 H0 ^

  81. 0 a. \3 P0 Y; p, t% a1 B. [
  82. module_param(acnt, int, S_IRUGO);/ \$ _3 O) e& _. I
  83. module_param(bcnt, int, S_IRUGO);% }5 Z7 v8 ]& j1 N& V% _  U9 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ y% @+ G* w* M2 o' l# T6 M/ f8 b  V- U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  e  I' ~* w+ u  W# c- p9 {5 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# X' ^' @5 j$ m/ ]/ m0 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 |. e2 m$ Z  K  L- Q! M, B
' K- x# E" \# d
) d2 i7 _0 T) ~& z% s7 M, N# @* V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 19:23 , Processed in 0.040786 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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