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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * y: y& c6 W& q
  1. [code]EDMA sample test application# I3 ?# N/ O) e% E% G, w
  2. /*
    5 w5 T- P& v2 P
  3. * edma_test.c: K- l/ J  O( [! Q* J
  4. *
    7 {* S0 |# w- v( J
  5. * brief  EDMA3 Test Application
    + J  r& i* n+ W8 B
  6. */ y/ ]; }8 `3 N9 z- A
  7. *   This file contains EDMA3 Test code.9 N! [# t7 y( y; f! R% A
  8. *
    / L# A+ n2 b3 H2 b% C1 E; T& y0 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  m/ k4 f, Q% J1 p& {+ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 a2 I/ O. t+ O) x6 [; j4 |3 `
  11. *         TO CHANGE.
    + g5 p# R& K. d& u+ Q
  12. *
    4 q8 _' q' L" D3 v2 ~9 n4 [$ z& v, k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K% B# Q0 z2 V. E, B+ X; f2 M
  14. *
    4 G6 @# R& i% r: ^
  15. * This program is free software; you can redistribute it and/or7 B) k+ T4 G0 D+ U# f& J* V
  16. * modify it under the terms of the GNU General Public License as
    ' e; G" y# q+ y
  17. * published by the Free Software Foundation version 2.5 ~+ C" z) c1 S& [5 z; u- I  e
  18. *
    7 H/ g8 F- h- N& U$ d, t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r0 ^8 Y$ g# m$ i) H' x8 `% V
  20. * kind, whether express or implied; without even the implied warranty
    + K# H! P( J6 W0 u0 S) z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 ]9 y! @3 Y, L3 Q
  22. * GNU General Public License for more details.
    ' ^, A4 W) G) U. N" V/ x$ R, ?
  23. */
    * w! A9 Y. W7 N; M! \# U
  24. 2 F1 s. ]( x6 f% Y
  25. #include <linux/module.h>7 t' m9 C( u  w5 C$ l4 j( v6 m* z& Y
  26. #include <linux/init.h>& t/ ^( Z0 U) r3 h) g
  27. #include <linux/errno.h>& z* _/ Q4 E. h- L7 e% a* W  p
  28. #include <linux/types.h>6 Y# N+ E6 F" B' n4 \( }$ f0 b; }- }
  29. #include <linux/interrupt.h>
    ( l* A; q$ i0 y0 a% x) ^. L
  30. #include <asm/io.h>
    3 A7 u* f, ?( g* V6 b  l' C5 B
  31. #include <linux/moduleparam.h>
    ) `, O9 w+ b+ G/ k& l
  32. #include <linux/sysctl.h>
    / U# x9 a  I) X6 ?' f: o
  33. #include <linux/mm.h>
    ( @, Q4 R6 J9 T- ]2 a# S0 I% p
  34. #include <linux/dma-mapping.h>1 K; L8 h4 {: H4 t5 I

  35. ) W* i* y% a0 T/ z( x3 i4 F
  36. #include <mach/memory.h>, g6 K6 q7 D4 R. Y: U$ A/ {
  37. #include <mach/hardware.h>( f' g0 `# [$ Q5 H
  38. #include <mach/irqs.h>) o1 J+ u: c4 y4 p' L
  39. #include <asm/hardware/edma.h>
    ! s2 N' D# q" e2 j0 ~

  40. # u# O7 g+ g  D) s, t- M
  41. #undef EDMA3_DEBUG7 O# E0 s1 r) f
  42. /*#define EDMA3_DEBUG*/' {- V9 @0 A0 J6 @$ e+ Y0 g* T* c
  43. # `3 M& V" r# @5 @
  44. #ifdef EDMA3_DEBUG7 v, E1 \4 D/ c7 |8 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 I/ q. E9 t. s7 u, X4 H5 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- G& D* F) M( Q8 e5 y, C: D" S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % Q6 a  I# F8 l# X2 j5 K6 W
  48. #else6 Q' F- h$ H2 b7 A1 n! p
  49. #define DMA_PRINTK( x... )+ g- |( x$ I% D: v) t( {
  50. #define DMA_FN_IN
    6 q9 w; J7 o6 J- `& R
  51. #define DMA_FN_OUT& Z( w8 ]6 q, y
  52. #endif
    ) j) U. }& a3 I; N7 S6 g

  53. + v3 y( N( ?0 Z1 m6 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 x1 `/ @. U. `! j5 w+ n
  55. #define STATIC_SHIFT                34 w) y& {) r7 U; \8 |$ k! e
  56. #define TCINTEN_SHIFT               202 {. Y- g" p) }3 P- U- x, F
  57. #define ITCINTEN_SHIFT              21( J& f4 k3 e6 z% M" q
  58. #define TCCHEN_SHIFT                224 `( i& N( S3 c6 r
  59. #define ITCCHEN_SHIFT               23- X8 m: m! N  \+ d* B/ t, K; n# `9 V
  60. % c2 o# k* ]& _
  61. static volatile int irqraised1 = 0;
    0 y+ |# E# g% Q6 o
  62. static volatile int irqraised2 = 0;9 [. w  V0 W4 ?! N+ z- \! E& S

  63. : Z6 F+ b: E/ u4 ~9 w2 h1 N. n  G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~9 m  k! w- d+ n8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 M7 b& e) w# k- p! s& A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 L, B) l, @: k6 {0 W4 {$ [9 x* _) ]

  67. " \9 z6 u+ i# `9 W. L! s
  68. dma_addr_t dmaphyssrc1 = 0;* i) e1 y; h" z8 Y: ?( i# l  Y
  69. dma_addr_t dmaphyssrc2 = 0;4 Z# q3 c3 m1 @9 T/ a: l$ Q
  70. dma_addr_t dmaphysdest1 = 0;7 |: w  l: }& o( {* P
  71. dma_addr_t dmaphysdest2 = 0;1 U- c' F# x6 |2 l. r# W' E  A( y" _% \
  72. ( Q/ |9 B" x" q0 _/ ?+ H  J
  73. char *dmabufsrc1 = NULL;0 C  m- r! V* |' h0 ^
  74. char *dmabufsrc2 = NULL;5 Y% d5 l. q1 d2 d7 N- @
  75. char *dmabufdest1 = NULL;" M8 `3 j7 `( y# {: `
  76. char *dmabufdest2 = NULL;, H! M! P) N7 ]3 a% E0 p# {! D
  77. 6 H& @. e7 |6 `3 s  W+ Q
  78. static int acnt = 512;
    . C: H2 Y; z7 B* `( g6 J& T" |# Y
  79. static int bcnt = 8;# [8 \) y& A+ L& j
  80. static int ccnt = 8;
      K8 U( s  x, h: s

  81. ; w: C; S/ l, E' w0 @2 h- L
  82. module_param(acnt, int, S_IRUGO);$ J# {* D2 Q, ^  K) {1 [
  83. module_param(bcnt, int, S_IRUGO);# L1 B) e3 v& V5 h, y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 z! @! |0 r& s

3 e. O( T! V- K5 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \5 B* w- c6 }* J: C- {; o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 s3 y  n1 [$ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 u, c" C6 }5 O; W5 K
3 H8 V9 r' o2 v$ m' O$ H: v
9 x# \. y: t) a6 l7 ~1 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 05:10 , Processed in 0.041935 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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