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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 U8 q9 z5 P/ s+ K6 U
  1. [code]EDMA sample test application
    1 l/ }: o- t& m) N, y  V4 E$ t$ b3 s
  2. /*# L9 [0 [) {/ f9 X
  3. * edma_test.c
    2 M+ D) K0 A) o
  4. */ z5 @" K4 X( U) n3 X
  5. * brief  EDMA3 Test Application
    " y+ k% v3 W$ ~& A
  6. *' A/ B  i" R7 V9 M
  7. *   This file contains EDMA3 Test code.
    & g2 P; {. x; `# q! H0 H
  8. *
    3 O$ |8 n# @4 _' T8 f* Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 z1 K$ h3 I: h- Z! W3 N; P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 T  ^8 u7 p1 r( W, S
  11. *         TO CHANGE.
    4 l* |- r) Y4 ?2 H. y) n
  12. *1 J5 c: v- n0 W, d$ {0 o$ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ^& h' F, \# t% s8 N% P' X" e
  14. *
    3 ^1 V/ S! v+ R/ C
  15. * This program is free software; you can redistribute it and/or4 S8 C7 S) d, z( A$ T
  16. * modify it under the terms of the GNU General Public License as
    + l' Z% W8 @  S2 c6 {
  17. * published by the Free Software Foundation version 2.3 d7 p/ U  T& @4 G2 l6 [- @
  18. *, x  ]7 F+ z  _2 w- l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z& G0 L' G* X8 ~
  20. * kind, whether express or implied; without even the implied warranty# N" A% o9 q& _2 A. P/ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 ~) x; M$ ]( {6 o
  22. * GNU General Public License for more details.
    2 b9 ]$ G9 X( b* U* j( h3 m
  23. */" P0 A- D! m& N+ @! o6 y3 Y
  24. # K9 T0 @( h- N( A* W' U; t
  25. #include <linux/module.h>
    " o" Q$ c7 z7 }8 A; R; i2 S- A$ g% A
  26. #include <linux/init.h>1 S; g  r% q8 q( r4 ~2 P% u/ \8 v
  27. #include <linux/errno.h>4 B, G4 k! l3 j
  28. #include <linux/types.h>
    ) i2 |6 Z. [3 S, C, O, T! ^
  29. #include <linux/interrupt.h>9 I, ~; Z+ c- _5 ~$ ~
  30. #include <asm/io.h>9 h. ~. `% R8 b( e! x1 F: [
  31. #include <linux/moduleparam.h>4 p  g8 v6 {; h+ |. g
  32. #include <linux/sysctl.h>4 e# `9 x1 _# n
  33. #include <linux/mm.h>% i: F4 k3 U5 g, k; |2 ?( e
  34. #include <linux/dma-mapping.h>3 t; ~0 A" @, A& g

  35. ; M) o3 }, X5 h; e2 V/ g- N0 ~* W0 R% \
  36. #include <mach/memory.h>
    5 y9 ^' q" Z4 S' X5 p0 y; x/ r
  37. #include <mach/hardware.h>
    4 }2 k9 b" ^( I3 ^% ]) Q% y
  38. #include <mach/irqs.h>, l6 e8 W+ x# z$ c' c9 c
  39. #include <asm/hardware/edma.h>/ Q* L1 n. q9 ?& |% Y
  40. / U( G5 s2 B! P' n( d7 y- z! p
  41. #undef EDMA3_DEBUG* I( U" C6 U3 K8 Z" o# h4 T; w% l
  42. /*#define EDMA3_DEBUG*/
    & N' V: E3 ]- Y: I

  43. ; }* U0 g2 ?. G7 Z0 s8 [
  44. #ifdef EDMA3_DEBUG
    4 a$ p! l5 \! K- u' U% n# s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) f* a5 m) A) f0 i: _$ K1 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 h9 m7 a" J# I7 w# i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K8 R  n9 r  z7 l& ^# ?' I7 G9 q
  48. #else
    ! I/ s2 \8 k4 s, L
  49. #define DMA_PRINTK( x... )
    & _& J/ K, q/ O
  50. #define DMA_FN_IN5 Y# r% W* W5 G0 R" C" K
  51. #define DMA_FN_OUT
    $ l* ], t- X/ b. f, F, @
  52. #endif# }& x8 q# L' Y* C! h
  53. 1 S2 l- x2 `4 E. X* ]7 l% l7 |* ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 V8 }) P0 J: M* H0 F
  55. #define STATIC_SHIFT                3) |! e: d2 N7 w; U  l" ?
  56. #define TCINTEN_SHIFT               20& o$ @9 w" t" a; O0 }# }
  57. #define ITCINTEN_SHIFT              219 q  O/ ?. `5 c) A6 w1 ]4 L: t
  58. #define TCCHEN_SHIFT                22
    ( M- q4 q2 O3 i# T1 ]! }& ?
  59. #define ITCCHEN_SHIFT               23* J5 z! T& U2 L* C/ z: E

  60. " u8 \/ m, y+ [* K. Q: X
  61. static volatile int irqraised1 = 0;9 S9 @: z4 c  ~+ s' f. L5 P
  62. static volatile int irqraised2 = 0;
    1 ^8 J: l* I0 A5 V, k& O

  63. + C. J! e% R# A1 Z$ U: R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 v7 M% b' H4 ]# m1 W3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' x" t) U1 E2 U0 m. M( C& T5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 [! l3 [2 x$ N
  67. 2 X$ ^! ~5 B3 ^. l
  68. dma_addr_t dmaphyssrc1 = 0;
    6 D, H! G* Z. C
  69. dma_addr_t dmaphyssrc2 = 0;5 V- Q. ^2 S: |
  70. dma_addr_t dmaphysdest1 = 0;
    # |& @& [& U( F5 C1 h# X3 ]/ f
  71. dma_addr_t dmaphysdest2 = 0;
    * W9 q- z3 V6 ~! n  o1 y

  72. , u& v8 P% @) U& N" K- {
  73. char *dmabufsrc1 = NULL;
    ' O& Y5 Y3 b' g, Z7 ~8 S- h& J( y
  74. char *dmabufsrc2 = NULL;
    9 n! I' e  J" q; ]
  75. char *dmabufdest1 = NULL;# g1 q  Y3 U' a7 @4 a$ Z3 y- U$ n) ?
  76. char *dmabufdest2 = NULL;+ x' o4 X4 T' m8 |7 u
  77. . d  _/ q6 y6 _+ @
  78. static int acnt = 512;
    0 t# j8 B9 x, [. I
  79. static int bcnt = 8;3 @! r# l9 y. N4 k7 N, P9 `
  80. static int ccnt = 8;
      w! ~: Y- A/ u: n

  81. 1 o: T  {" `0 x% A. T$ f$ I  U" D
  82. module_param(acnt, int, S_IRUGO);: |+ t$ N4 }! a) W. b( D9 ]9 L
  83. module_param(bcnt, int, S_IRUGO);) _, \! Q& C5 K: }$ k" @' Y. x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' w, d1 X5 u  ?) d

4 U- i6 S0 @6 \+ _+ H! h! q1 `( ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X6 |8 A, g2 u& Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& g: T4 G  V" n6 ?9 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 t3 f% B. @& Q7 U% a# E8 Q' c* }4 p% ]' {4 m
+ Z3 l% ~- A2 W' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 03:53 , Processed in 0.043792 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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