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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  N* C" y+ K9 P( N' s
  1. [code]EDMA sample test application
    ' C+ |+ `; I8 Z; f/ z
  2. /*
    : L/ }5 E: }9 y4 P5 z; v
  3. * edma_test.c
    # B4 V1 S" C& n# H4 G" G8 v
  4. *( s* L$ ]7 k; c" @3 x; e
  5. * brief  EDMA3 Test Application
    ' h6 b, t3 f; r$ i% B$ J+ J- a' A
  6. *# s2 {: f0 k  e3 d* ~. P
  7. *   This file contains EDMA3 Test code.' N/ B5 D; x; `- ^" Q
  8. *
    % G( H6 r- M) s$ |- ~  T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 y7 d- r. t4 n7 ~) y9 E0 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + E6 w2 ?0 t  J/ d0 S! ~
  11. *         TO CHANGE.# E  L/ h+ A8 n4 c2 s( D  ]+ k
  12. *: K  u7 l/ u7 p1 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 K4 I" W0 P% a/ K! H
  14. *2 O" v: [8 h3 k; A
  15. * This program is free software; you can redistribute it and/or
    $ t# W& Z4 [0 G
  16. * modify it under the terms of the GNU General Public License as/ e; x1 t6 R$ y, E8 ^
  17. * published by the Free Software Foundation version 2.2 C1 f8 L3 Y3 t1 a9 m  J
  18. *6 {5 h6 t2 X/ R" @5 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 ?2 [1 V$ B0 h3 Z
  20. * kind, whether express or implied; without even the implied warranty5 N& F! x8 n" x/ w/ \2 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 V( o) X6 \( A
  22. * GNU General Public License for more details.4 V6 U. l3 `' F6 u: V1 Z- T
  23. */, a$ b" s+ l5 N# Q  C3 b3 n. R, M

  24. - R/ i9 k& t6 T8 G
  25. #include <linux/module.h>
    / s; o  H& j8 K6 Y
  26. #include <linux/init.h>9 z' _, ~3 L+ ^6 Q2 x
  27. #include <linux/errno.h>% C" W6 S0 v* s' p1 W
  28. #include <linux/types.h>
    / Y5 M4 X( B$ R5 g
  29. #include <linux/interrupt.h>' V" s7 F5 d# F8 x4 T
  30. #include <asm/io.h>
    + D6 N- ?, I' U  N) L# Z! z, U* }
  31. #include <linux/moduleparam.h>
    % e  v0 S% F3 _
  32. #include <linux/sysctl.h>  I4 f; z2 F$ J
  33. #include <linux/mm.h>. s$ u) `+ U3 {: o, y) R
  34. #include <linux/dma-mapping.h>/ h# P  G, n' p& H
  35. . o0 z& _/ U- x6 c. W% X! {
  36. #include <mach/memory.h>
    7 R" V8 e; W6 j8 T2 a. o. G* w
  37. #include <mach/hardware.h>1 f5 H4 `1 w# S
  38. #include <mach/irqs.h>
    # c# N( @* X5 p1 v$ H, _6 k; M
  39. #include <asm/hardware/edma.h>
    . p/ s' v. r" I' u) W! a

  40. + |  U+ e. X5 ^/ P1 n! R- _$ A. G
  41. #undef EDMA3_DEBUG
    3 [% \2 |. O: b" _+ I' R
  42. /*#define EDMA3_DEBUG*/8 e/ m3 U. `- Z( t$ X
  43. ; S2 Q8 _' c7 }# J- z
  44. #ifdef EDMA3_DEBUG
    : u; \  \: j+ i2 [' K0 K- ^8 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g$ }( r3 O5 N0 `4 H. q; l) d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Q0 ], s& [8 D* y1 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' s" v1 C& e9 ^' P5 Z. |
  48. #else
    ; O% K9 i* {) M) ~
  49. #define DMA_PRINTK( x... )6 X0 Y, h' J) G7 G1 P% |, `
  50. #define DMA_FN_IN
    * V3 z, d5 C  x
  51. #define DMA_FN_OUT7 Q. w+ A$ w6 F, T/ |
  52. #endif
    / U% m6 Z: x' c+ [. f
  53. . K, i+ b- Q' s8 U2 P9 ]) V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # P/ x0 Y; X: H$ E
  55. #define STATIC_SHIFT                31 b4 f) A$ x- O& u! y# N
  56. #define TCINTEN_SHIFT               20* o: H2 K* Q6 W2 X5 ^3 }$ b
  57. #define ITCINTEN_SHIFT              21" ^" K/ ^! L7 G5 X) T& x) B
  58. #define TCCHEN_SHIFT                226 O! Q  h/ e1 f* k+ l1 A- ^& l
  59. #define ITCCHEN_SHIFT               23. U8 b% z' X+ I) t5 W; F" ?

  60. + ]6 V5 k3 `% o6 ~0 g! Z  Q
  61. static volatile int irqraised1 = 0;- m  N% r6 I) `" b6 R" L6 b
  62. static volatile int irqraised2 = 0;1 Q0 T6 o6 a) l
  63. 5 @  i* r# d* o9 t5 B1 T  Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W8 m  T2 |& _# \" |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . t0 U; h) ~2 p4 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 [- Y7 G+ z3 X( ~
  67. / q$ ?) t, s) @3 _2 g3 z
  68. dma_addr_t dmaphyssrc1 = 0;
    . _. A, y  W. `- v* Z" N1 S" k
  69. dma_addr_t dmaphyssrc2 = 0;
    " J. w9 q! l' O+ u
  70. dma_addr_t dmaphysdest1 = 0;
    2 H% \5 }! o: X8 {# U# V) @
  71. dma_addr_t dmaphysdest2 = 0;
    " v5 u# o9 L3 p0 x7 g( u$ E. o

  72. ; r% @/ j. L9 y% r4 k0 `8 A
  73. char *dmabufsrc1 = NULL;
    7 {9 U: M4 Z- Q9 D1 ?
  74. char *dmabufsrc2 = NULL;
    ) A) [6 ]- ^( b1 R/ {
  75. char *dmabufdest1 = NULL;
    ; f- |* M2 ^, L9 g9 E$ _
  76. char *dmabufdest2 = NULL;
    & m* a: u: D! U# g/ z2 T$ C

  77. 9 `; k) s7 @! _" |0 d
  78. static int acnt = 512;2 ~( Q5 P& M/ ?% p2 m
  79. static int bcnt = 8;" {: l+ q0 H1 Y7 f$ P% y0 Z
  80. static int ccnt = 8;+ `2 `: h  }1 n  W" g' A# m
  81. : w  P+ C8 l9 R4 Y/ H
  82. module_param(acnt, int, S_IRUGO);
    / U" L' n. j) y- z3 t. d) L
  83. module_param(bcnt, int, S_IRUGO);: }( R% k4 M8 T. w/ {; x  o% g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 w. b4 G; ], X! s- U
; |1 Y" A, P) g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b8 G% X9 i' r5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( y: S3 M" C' ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 z" {: t4 |% u* |% w

8 u+ l9 v9 Y9 W+ C7 z, A* V( E( N  m8 _  ~/ M" o% y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 03:02 , Processed in 0.046228 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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