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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ?$ @2 v' `7 ~: X' P
  1. [code]EDMA sample test application
    " p) N( b. G" }: l3 k8 F4 ~
  2. /*
    + P8 k, Q4 O% U
  3. * edma_test.c5 _9 o  w9 M) T" p& t& M
  4. *
    ) e6 \. [5 Q9 w* @
  5. * brief  EDMA3 Test Application8 g" o( o/ V& e- C  i; o
  6. *
    * P/ O* ?8 z3 M7 |5 `" P
  7. *   This file contains EDMA3 Test code.5 p' c% R) B0 P) |
  8. *
    7 u* U+ [& Z8 a7 ~, F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , V2 E2 H: `; ~, o8 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. O7 l# I" F5 F( E
  11. *         TO CHANGE." p4 {+ i% C- y) }
  12. *
    6 y( Q" y: n7 t$ c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " R, f! J9 y$ u/ J1 b$ Y! b
  14. *+ o: c- N# `  N1 {! L& |- J
  15. * This program is free software; you can redistribute it and/or* r, B& O! i2 A) @- L2 A* ~- ~
  16. * modify it under the terms of the GNU General Public License as
    & _) ?: w3 w7 {6 W: a$ g
  17. * published by the Free Software Foundation version 2.3 \& L$ {6 Y) }" [* g; X
  18. *
    - t! q" |' ~6 [1 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ I7 e0 w6 P9 s
  20. * kind, whether express or implied; without even the implied warranty
    ( o" K* P4 p  `# m/ l# p9 F: @! r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & d5 b% b4 Y; ?7 ]; @9 b
  22. * GNU General Public License for more details.- E) x4 t9 P+ N; l
  23. */
    ' H: i, ^* Q6 q% a& \! b

  24. 9 ~6 w4 ^. z( o( r& l- m( r* g% I
  25. #include <linux/module.h>6 L* n) l  Z/ p2 \$ p* I$ v- [  W3 v, M
  26. #include <linux/init.h>
    % n( C; x. O' Z
  27. #include <linux/errno.h>5 P3 M: a/ Z, E% y
  28. #include <linux/types.h>' Y: g! \0 E7 }' t5 _+ b
  29. #include <linux/interrupt.h>
    % B8 B) @7 _; s. Y( m( Y- q: ^& i% w
  30. #include <asm/io.h>
    0 x/ e1 i0 N; E2 H% o
  31. #include <linux/moduleparam.h>: w  E1 ]# |0 Q# ^3 R- |  b6 Y
  32. #include <linux/sysctl.h>
    " @, V" H6 Y, T8 f, S1 M
  33. #include <linux/mm.h>
    * U- c# w. W5 Z5 h& D" f
  34. #include <linux/dma-mapping.h>
    6 W. ^" P5 X) o, s) O" n; L
  35. $ }! `. u& d0 o# e: C
  36. #include <mach/memory.h>4 m, W' |. B/ q5 G2 N% A1 Z" Q
  37. #include <mach/hardware.h>* u% w! t" D: o( P5 ]* Z
  38. #include <mach/irqs.h>
    $ X* D/ b2 T) P  ?# F. Z5 ^- C
  39. #include <asm/hardware/edma.h>
    7 U( k1 W; W0 O3 C& a5 W" ^, C* A

  40. & X6 \5 o/ X4 K" _5 i7 G/ Q" b3 F* k2 U
  41. #undef EDMA3_DEBUG
    ' a0 m. N5 n# C' u# I8 g& G# `) z
  42. /*#define EDMA3_DEBUG*/
    1 J$ D0 R) l0 i  V

  43. 7 W4 `8 N! s% B0 Q" c
  44. #ifdef EDMA3_DEBUG; o7 ?# }5 N1 N/ U) R/ Z) k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; {4 ~: j; L1 Z0 ]4 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F5 T* q- _$ A* I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); F1 E9 i, N, ~( B# C# |1 c. s, O) l
  48. #else/ K# z1 G: |/ T7 K+ q
  49. #define DMA_PRINTK( x... )7 x/ R8 G9 ~0 {( H
  50. #define DMA_FN_IN
    , Q+ A. n* J# o! Q, \, S
  51. #define DMA_FN_OUT
    8 j2 q% E- n  P7 @
  52. #endif4 Q3 ]9 x% {. _* ?3 {

  53. + ?9 `8 ]6 ]7 m. S9 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  g1 I' \5 P$ |
  55. #define STATIC_SHIFT                3) k  e" z( s9 j( S
  56. #define TCINTEN_SHIFT               20
    " C$ X( b! V4 l7 U6 S
  57. #define ITCINTEN_SHIFT              21
    - L6 m2 K( Y; s7 I5 K& b
  58. #define TCCHEN_SHIFT                22
    3 W% n4 O3 Q: o( }; O. |9 c
  59. #define ITCCHEN_SHIFT               23
    ' E+ h& j- P  T# @' k+ A
  60. 3 z$ J' Y! `4 i. Q! m4 O1 _8 _
  61. static volatile int irqraised1 = 0;; `+ e) X% ]# K% q
  62. static volatile int irqraised2 = 0;
    ; t9 I& x5 T# ^( C7 ]# n& E) o- z2 ?1 `
  63. " M: Q! j. I4 K+ \: `5 r' ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d9 L" n* {- T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ^+ F. G. \8 H) W4 }' f7 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s' [) F' r0 c- R" v. S. {
  67. . n# P+ u; O/ b6 q+ ]- |
  68. dma_addr_t dmaphyssrc1 = 0;
    4 m; l% f2 w# I
  69. dma_addr_t dmaphyssrc2 = 0;
    * f: B/ _( D7 b& x, H* s
  70. dma_addr_t dmaphysdest1 = 0;  V. ~3 |% n$ }- S: f
  71. dma_addr_t dmaphysdest2 = 0;8 C4 o0 x1 L6 I

  72. ( L7 C* b, R9 i& Q8 [9 u( @6 |
  73. char *dmabufsrc1 = NULL;- d+ p9 F* l. N8 f
  74. char *dmabufsrc2 = NULL;( F7 |8 Y. O, u; m5 p! u5 @4 m; j
  75. char *dmabufdest1 = NULL;+ Q/ h5 }6 D, s" F- @# \
  76. char *dmabufdest2 = NULL;
    ' e# T) h! ^9 i$ ^* C0 b1 G
  77. * `* c" \. a- ?) C4 m
  78. static int acnt = 512;
    6 f! s1 [6 z) a: \
  79. static int bcnt = 8;
    # e$ q3 k; _- V
  80. static int ccnt = 8;2 z4 P) O7 T9 U2 J# p% P; U0 d

  81. $ {( Y2 k" ~4 e* f# W3 i$ W; C
  82. module_param(acnt, int, S_IRUGO);
    ; T8 u5 ]( c  s5 S( V: q  p
  83. module_param(bcnt, int, S_IRUGO);/ X* b, g4 @) r- {" U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; w: Q/ c0 N2 H( d1 f
6 {& P6 a& G6 L3 k4 s" O! Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" k) T' D6 ]. r4 c1 K) l6 @1 V# {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* C8 O! S3 ~* L- z  ]5 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 i) a9 e6 D( k5 Q' ]4 I
) k$ A! j4 D2 G% R" ]; |- e  u8 C
2 n. U* H: U7 `; p( `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 14:03 , Processed in 0.056808 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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