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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& H  }2 A2 ]" p- D1 J8 c
  1. [code]EDMA sample test application
    4 \" Y, l/ [7 e9 Q0 [
  2. /*
    & `% r5 b# D, i3 B% O3 m
  3. * edma_test.c% C" i: @2 N' e
  4. *, i5 M7 i: J( l! F
  5. * brief  EDMA3 Test Application$ E: r# @, @+ m* `+ I. `; T
  6. *
    4 J9 l$ T9 F& ]6 Q; Z
  7. *   This file contains EDMA3 Test code.
    ; s% O3 l6 R7 {9 r  f
  8. *8 \8 b) u) j" g! s% ^8 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 e! s+ v3 W7 m7 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 O& T- v) B" [8 o
  11. *         TO CHANGE.5 i# v) B% v8 l% }- Q+ ?  \
  12. *3 X% `0 i7 B" d% j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - P$ R% E- @# d" B4 B; M
  14. *
    ; b7 z' B+ I' O* ]8 D8 L$ k1 P1 d% w
  15. * This program is free software; you can redistribute it and/or+ b  J) I. K0 b+ P6 A. I* X' u7 i
  16. * modify it under the terms of the GNU General Public License as2 W  E! H2 B; F5 B, s' \
  17. * published by the Free Software Foundation version 2.
    : `# ]9 z4 F- j- c, b" ?
  18. *
    - W8 b5 p7 i) R5 |9 Q% L9 _6 o2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W) h9 ?" i/ H& [* ^6 }7 M+ e
  20. * kind, whether express or implied; without even the implied warranty6 e1 X9 U  `) p  p. o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 g) U# A: w* R1 J6 w3 ^
  22. * GNU General Public License for more details.; g* \, B0 `0 W
  23. */( V% W) Z6 L9 l. X
  24. " |6 C/ \8 `2 f, K2 L- P7 \% m
  25. #include <linux/module.h>
    2 X) ~3 V6 j+ F( f  y" i
  26. #include <linux/init.h>
    3 \; J) Y# N, I4 m
  27. #include <linux/errno.h>
    7 `. f4 }. |& }& P; T
  28. #include <linux/types.h>  x) N, A. m3 C# O+ W; K
  29. #include <linux/interrupt.h>
    / M5 G3 @' s1 `4 l/ {6 G
  30. #include <asm/io.h>
    ) v& s, @6 @0 C* x2 m! |
  31. #include <linux/moduleparam.h>0 _% r/ D* O$ h. E
  32. #include <linux/sysctl.h>
    7 e8 n4 O. M/ a1 W% L# l
  33. #include <linux/mm.h>
    ) V! Q) |( o6 `" o, _2 s- H1 l
  34. #include <linux/dma-mapping.h>5 C% Z  Z# T( k9 P/ i0 B

  35. ' J6 h# [- E# R# a- h
  36. #include <mach/memory.h>: f" d; e* v  l: N
  37. #include <mach/hardware.h>% t/ }' a, j6 S( T4 u7 I
  38. #include <mach/irqs.h>
    & F. C# N9 D" F5 T( S$ e6 P6 H  b
  39. #include <asm/hardware/edma.h>
    " j* ?7 b; S+ |! M
  40. " F" m" K' k/ G# ]+ r% u1 M& `( d
  41. #undef EDMA3_DEBUG
    6 e. l' O5 Q5 R! X' d  z- _- b
  42. /*#define EDMA3_DEBUG*/
    ( C8 ?) \, l2 V! j

  43. ! q6 O3 b* A+ i( g$ _6 n2 X
  44. #ifdef EDMA3_DEBUG
    7 o$ q: h. h8 D! ^3 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 O, s' \8 |) F" ?- I/ W& E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 w9 C6 D" v* P) e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 e: R* t1 P' H0 I
  48. #else3 H4 |- c( }; h; ]
  49. #define DMA_PRINTK( x... )6 K! c. s, a* h5 J: [
  50. #define DMA_FN_IN) P6 x  [' c$ X2 S3 O, d8 x) E
  51. #define DMA_FN_OUT
    3 s, }/ N5 G+ S1 f
  52. #endif
    , _/ K, w; s$ _3 m. y

  53. " m' g2 e/ {0 K/ i7 U7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), j7 x$ t" ^: S, Z, o1 A- D
  55. #define STATIC_SHIFT                3
      m3 S: W  {  G( z/ i6 Z
  56. #define TCINTEN_SHIFT               20* Y3 f1 e/ L; K! H# M
  57. #define ITCINTEN_SHIFT              215 k7 a' T$ }; [# h+ Q
  58. #define TCCHEN_SHIFT                22
    + Y  p1 L8 Y. q* {0 w' L
  59. #define ITCCHEN_SHIFT               23
    ' n8 J; l( h( ^" e

  60. * O' I3 d' i' l- K
  61. static volatile int irqraised1 = 0;3 P4 n9 {7 u0 J) d
  62. static volatile int irqraised2 = 0;# r( a$ ?, v4 z" Z; N, {3 c, A( ~
  63. & X* L3 N) Y- Z4 t' X" g: p" t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 t; [. d9 t5 m" J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ^7 S" O& X3 F8 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k) |7 {6 C# n8 J4 \5 r
  67. 1 _- B( {: Y5 o4 e8 X) ^- J7 {
  68. dma_addr_t dmaphyssrc1 = 0;. H2 z$ I! C# T9 X. v
  69. dma_addr_t dmaphyssrc2 = 0;
    2 ]1 E7 M" e& E- h, R
  70. dma_addr_t dmaphysdest1 = 0;
    ! ~) S2 h6 k3 i) Y: i& G- n: L
  71. dma_addr_t dmaphysdest2 = 0;8 L) R' q0 Y# t1 R+ F

  72. ( J  }$ f6 @+ s
  73. char *dmabufsrc1 = NULL;: U$ ]; b' @: o' m3 V1 ^
  74. char *dmabufsrc2 = NULL;' Y" x4 }" X% p
  75. char *dmabufdest1 = NULL;9 f, Q' ?2 u* h8 I7 b6 G
  76. char *dmabufdest2 = NULL;
    : R. t/ w2 k0 X" D! g( y4 j" Z
  77.   s7 H% Q# D9 B9 E' t/ A" W. u9 n- g% Z( ~
  78. static int acnt = 512;
    1 c( |! |$ W8 u/ p. |
  79. static int bcnt = 8;1 k5 H  Y/ y/ f. ]( H( d' M
  80. static int ccnt = 8;. o$ l$ a' c7 F% E' R

  81. 7 K2 T$ [: K: ?' \- N  {8 B3 _
  82. module_param(acnt, int, S_IRUGO);' n0 u2 T( N0 M) G! S
  83. module_param(bcnt, int, S_IRUGO);6 Q2 K- b! h4 Y: a- |; S+ O8 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' s9 s7 x& _% k% k

, V# s* @0 `& a% E' j4 V) y% s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  `1 N6 W8 h+ B9 K  c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& H: X/ O9 L# B1 K$ a/ q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 O9 ]1 }! X; Q  l5 R6 x, f" @; G2 j  _

9 W. W% ?, o& |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 13:16 , Processed in 0.042784 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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