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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- q1 `0 v$ V+ E  y) A1 y
  1. [code]EDMA sample test application
    6 Y; O. r. q" \! ~3 i( m
  2. /*7 P% |, D6 x  a
  3. * edma_test.c
    ( {, h$ G/ u- X
  4. *$ F% _9 {2 m6 C- R/ h
  5. * brief  EDMA3 Test Application0 i7 H& @8 U/ |( p
  6. *
    ( G9 i5 N' \8 {9 Z/ @9 Z4 I
  7. *   This file contains EDMA3 Test code.
    + g2 \2 ?, ]1 I7 q, }" z
  8. *
    0 D( ]" r# d; @6 u. i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 @3 u) {, U: K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  m6 A2 s+ U5 N9 y8 ~) ?' m/ S* ?
  11. *         TO CHANGE.6 K6 G9 Y' n+ ^- l0 v) H
  12. *
    3 C4 E- s3 c/ I2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # g* h0 E2 F$ u
  14. *
    ' K6 K  E& T1 z7 R
  15. * This program is free software; you can redistribute it and/or0 w* t8 d( F  `& [3 j
  16. * modify it under the terms of the GNU General Public License as& x3 S8 A* w0 [- J
  17. * published by the Free Software Foundation version 2.
    $ E. g# g5 J0 ]7 v4 R/ L
  18. *
    : U4 d* }( u/ u! s" Q8 |  T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! U( S9 G1 \" Y/ e( _
  20. * kind, whether express or implied; without even the implied warranty
    4 w1 B$ e, ^: Z( D! j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 m. m2 e& D% x7 h3 F/ x4 a
  22. * GNU General Public License for more details.3 U$ r: [! ?3 x' h
  23. */1 R& [" L5 W- `4 Z/ v3 n4 A

  24. ; v: C7 h6 ]7 m# O' a8 W/ }1 E
  25. #include <linux/module.h>
    # L. I% m- F# c% o* D
  26. #include <linux/init.h>4 ^8 Z, S3 u* N& U
  27. #include <linux/errno.h>- g; ~9 i! Q# s, q
  28. #include <linux/types.h>
    + R1 L+ o, o7 m1 j2 O( N9 Y6 U, |
  29. #include <linux/interrupt.h>
      i0 \! ]$ ^: R/ P  a( J! L+ w
  30. #include <asm/io.h>
    : {3 P0 e/ `/ z; t0 P# r& l( x/ u9 y7 W
  31. #include <linux/moduleparam.h>
    4 e. C' J2 N6 |
  32. #include <linux/sysctl.h>
    0 c" G3 f3 q9 h- |% G- X- \
  33. #include <linux/mm.h>
    8 N( X5 l2 P# |$ O, D. C+ R1 w5 v
  34. #include <linux/dma-mapping.h>
    ! U5 D5 E' N& T  ^

  35. ! a5 ?% p; X1 U7 b! l
  36. #include <mach/memory.h>( r" u. v1 q# ^2 A4 W: ?' d' K
  37. #include <mach/hardware.h>) w' S3 H1 H8 |9 {! a
  38. #include <mach/irqs.h>8 r) I& O! S/ V- O3 F
  39. #include <asm/hardware/edma.h>
    " t1 z: h/ k  U4 {' e* n" s; n
  40. 5 V  y+ s) ]. k1 Q
  41. #undef EDMA3_DEBUG
    8 H8 J, o: z6 F# P1 L
  42. /*#define EDMA3_DEBUG*/
    1 g/ @; ?+ M8 n& N* `

  43. 4 I% x. _1 n. y3 G; d
  44. #ifdef EDMA3_DEBUG5 D4 Y6 o* |7 I( p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , p4 |! p) E2 b+ n! b- f& y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " U/ N3 c. W# r- N; ?2 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 Y) {: G% x# Q" O' l
  48. #else
    8 {+ X2 e$ ]& k( r
  49. #define DMA_PRINTK( x... )6 M. g$ S, Q5 Z- S0 J$ W
  50. #define DMA_FN_IN
    - _. p  J9 m. V+ u/ L, U9 M
  51. #define DMA_FN_OUT
    . w# u# n* W7 o) ?: n9 `
  52. #endif, t* ]4 T) r2 ?  U8 Q

  53. , [/ F, s' I) e3 v# L( o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 C) w- S" e/ `7 U
  55. #define STATIC_SHIFT                39 ^5 V" E% t0 J0 V0 B
  56. #define TCINTEN_SHIFT               20# d+ {4 R2 n* P& H
  57. #define ITCINTEN_SHIFT              216 o. D: w9 {  P  O5 R& ~  C, P
  58. #define TCCHEN_SHIFT                22
    0 z- q+ S+ `* c0 W) k
  59. #define ITCCHEN_SHIFT               23$ G# f- n& s: m, G5 u
  60. / P3 Z; M8 E1 \* e6 h5 R( ?
  61. static volatile int irqraised1 = 0;
    : H+ a( c4 j5 w. p
  62. static volatile int irqraised2 = 0;# U6 p5 i4 e; M$ S# f
  63. : f1 d  Y4 ~+ i% `7 U" h. B  b9 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & W; d2 Z" i1 S5 z' W) [& Q$ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 c* |' d3 k/ R6 ]+ R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @* m3 S; {$ t% f* d/ x

  67. 6 y  R( l$ }0 }% `: v" m4 S
  68. dma_addr_t dmaphyssrc1 = 0;. K) m* L8 n2 w# C+ Z
  69. dma_addr_t dmaphyssrc2 = 0;# r6 L. w4 W7 A
  70. dma_addr_t dmaphysdest1 = 0;
    # \3 S9 s( S+ [+ v4 ~; W
  71. dma_addr_t dmaphysdest2 = 0;
    & j9 g: e8 q/ V1 }+ R
  72. + m& }+ R3 J! Z. C: [! _" v5 c5 q
  73. char *dmabufsrc1 = NULL;1 P. W: L# b9 z( `
  74. char *dmabufsrc2 = NULL;
    ) N4 G  N  ~9 D/ y6 Y$ w: m, K& s
  75. char *dmabufdest1 = NULL;1 ]' y5 n2 G, v  p4 [" S9 P2 r
  76. char *dmabufdest2 = NULL;
    . P$ x4 }9 b" ]6 K

  77. & N5 l% y) o; n: K3 m* Z' j5 \
  78. static int acnt = 512;5 t0 T/ H: [3 O' }; _6 n
  79. static int bcnt = 8;
    ! o, \1 I6 d6 ^1 _& \
  80. static int ccnt = 8;; [9 l$ g' |: h, G- r

  81. - d  y+ @8 ^: {) d' H8 T
  82. module_param(acnt, int, S_IRUGO);8 T" d2 H$ s9 j: Y4 b- s
  83. module_param(bcnt, int, S_IRUGO);$ w) i2 z# L7 w) E. \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: I& ~1 A- _7 z' S) |% p1 B& A0 T7 L8 }7 D/ Q' S) t9 c# J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" |# p. E7 l- g) s  H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  z$ P1 l7 s& n$ `! I7 U2 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 y& ], R! b* y- U# F( ~. v
0 `/ e- q9 {, H0 h' p0 m( C" C" e
7 e9 K2 @6 j  y3 R8 O; u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 05:49 , Processed in 0.040945 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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