OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . ^9 Q; Q* a' P$ c# O. p/ J
  1. [code]EDMA sample test application& U- d. O# F. p6 Q% m+ B+ _
  2. /*9 S6 O2 U$ K; x/ y& l
  3. * edma_test.c9 h! n3 i; C/ o- z: T5 t9 Y
  4. *) l6 R: \$ _5 a# V! `: e
  5. * brief  EDMA3 Test Application
    ! `# z+ M, D8 _. _
  6. *
    ; q) T. V/ X4 e# A: v* e) |2 A
  7. *   This file contains EDMA3 Test code.
    ) l+ R3 {& U" t' j1 K* O
  8. *7 }7 a- x  g  D4 ?- f& m5 O+ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # V9 [# C% H# e" V* g& P! _) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ?$ K- z+ Z! T+ `
  11. *         TO CHANGE.
    * G3 x) r. v/ Z/ @( e) J
  12. *0 k6 P- N; R( ^8 N' g4 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( O- G+ a4 R/ }# A% s3 H
  14. *( y( M" j. f7 v, x# e' U
  15. * This program is free software; you can redistribute it and/or
    % H7 s" J4 K% l9 c
  16. * modify it under the terms of the GNU General Public License as& o! V' \3 l' D4 P* d# Z& F
  17. * published by the Free Software Foundation version 2.: g0 O9 Z% G5 x" N7 b
  18. *
    " C+ b. Z; b# c7 C$ T, T% \: c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 n- W8 t5 N3 u2 N$ @6 G' t
  20. * kind, whether express or implied; without even the implied warranty
    * Y: W7 G# ^  ?! N, f8 ?# o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- W- B. v2 o4 c& z
  22. * GNU General Public License for more details.
    # H* @2 r% G9 C9 }
  23. */5 `, R0 V  p- N% X+ _

  24.   ~2 A( V& q1 N" V# F9 l7 J
  25. #include <linux/module.h>6 K3 F" g# u8 W4 S. T4 y4 {) ]
  26. #include <linux/init.h>0 z  l0 A) ^" y: J
  27. #include <linux/errno.h>: ?8 |$ v9 Y, ]% h
  28. #include <linux/types.h>! L( K; n/ u  i
  29. #include <linux/interrupt.h>1 \" m6 O  d$ B2 z5 O
  30. #include <asm/io.h>
    ( W( [6 n- ~2 }( l" A+ I7 M
  31. #include <linux/moduleparam.h>
    7 o, B; r" W* J+ N) P
  32. #include <linux/sysctl.h>
    9 C! k/ ~" m3 Y1 M" M: N+ c
  33. #include <linux/mm.h>; d, x- }7 Z( g5 W: f
  34. #include <linux/dma-mapping.h>
    * d8 E3 B% j/ D: w. T7 k; A

  35. ' V+ x; L! {" i- B) k
  36. #include <mach/memory.h>
    ( U8 b3 o2 H# S% {: s
  37. #include <mach/hardware.h>
    ' V5 l& Q! M, l1 L/ L. y
  38. #include <mach/irqs.h>1 w4 X3 C, G  s, J
  39. #include <asm/hardware/edma.h>
    4 v% I$ n4 `& e* |9 @
  40. : h# I5 o0 X- h& R/ e: ^( Q
  41. #undef EDMA3_DEBUG
    % B" O6 w% [4 V6 t& z* S' E2 Z
  42. /*#define EDMA3_DEBUG*/4 Z7 S/ E- J5 ~, ~6 t1 `

  43. 1 O. O  X5 y$ A  _' l/ f
  44. #ifdef EDMA3_DEBUG$ v; N0 x0 O: K# V) U3 L; _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; C2 g. }! h5 W# t# X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; A/ p5 t9 w' v: p) S- O* L3 k9 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * o9 \$ |9 o$ m+ j9 d
  48. #else* T6 }* Z6 s4 W& t  U7 N
  49. #define DMA_PRINTK( x... )
    , w3 p' ?* q! n' D: Y. {/ O4 e$ P
  50. #define DMA_FN_IN
    5 M7 _2 N! t3 {
  51. #define DMA_FN_OUT
    5 `$ `$ G( U0 z1 C! E1 n
  52. #endif
    , V) ^: F& r: A: {
  53. / ~) b- z  o" ^; T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / g8 ?: I3 ~2 ~4 i8 m: [. I
  55. #define STATIC_SHIFT                35 D6 U: ~5 q0 W3 @
  56. #define TCINTEN_SHIFT               20  C2 a6 ?# U; G/ N
  57. #define ITCINTEN_SHIFT              213 c' r7 ?  ^* F+ ?& B" ^* N* N% N
  58. #define TCCHEN_SHIFT                22/ q  ?: e* E- j. N5 Q5 c4 i
  59. #define ITCCHEN_SHIFT               23
      n) t, V% \8 H! h+ l: W

  60. & |2 y8 N" j6 H6 ^6 x8 c0 Y/ s  t
  61. static volatile int irqraised1 = 0;
    ! Z3 y& J) G* H5 M5 A* g; [
  62. static volatile int irqraised2 = 0;
    9 p- L1 w/ }) z- e; `% N) V% {2 T) }

  63. ) X; G2 f7 S2 u) N: b0 M% H, j. @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      P; ^! F% {1 f, J! q0 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J: r2 t6 ^% A9 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( R+ Z! Y  E9 r7 L& h
  67. ( ?" T' b# A. s4 u' Z" K
  68. dma_addr_t dmaphyssrc1 = 0;2 x) x2 G# E" {- H3 n1 U* {1 u
  69. dma_addr_t dmaphyssrc2 = 0;
    ' d6 `% @' D2 o& S
  70. dma_addr_t dmaphysdest1 = 0;
    : T5 z. ^5 k9 A4 T  X* [
  71. dma_addr_t dmaphysdest2 = 0;0 b9 Q9 E  d  O4 t( H
  72. : }( C- F) x/ r/ z- f2 }) p; d) {
  73. char *dmabufsrc1 = NULL;
    $ v, `! y6 y2 l1 V. r1 M/ b+ a  u
  74. char *dmabufsrc2 = NULL;8 r1 m+ H- ?2 t/ e" H7 ^: [2 H
  75. char *dmabufdest1 = NULL;' ^  r8 m# G2 O6 |( V
  76. char *dmabufdest2 = NULL;/ o) L1 `1 U3 U' G2 W  a& g; m3 _

  77. " h8 u0 M% C! S2 i' X
  78. static int acnt = 512;
    : ^0 r" P6 r( H* i& t* F
  79. static int bcnt = 8;3 y- g+ G  @/ Y2 [
  80. static int ccnt = 8;
    8 m; t- M* N3 s5 V7 Q

  81. 8 m9 v) q, m& K
  82. module_param(acnt, int, S_IRUGO);: ]5 q# }; V. n& g9 U
  83. module_param(bcnt, int, S_IRUGO);. y& \4 ]& @2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 j& p1 l4 z. f, D4 r6 c& Q, B
& l* Y& U' W" m5 Q% L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' y9 @2 M0 s- ~9 f2 G! garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E" k: T6 f/ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I, T) l8 _, o" l0 u& K! l4 }

8 b; S: w1 D) L. h* Y2 b5 v  U0 O. I1 h4 f6 _2 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 17:26 , Processed in 0.042204 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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