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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   u4 ?$ n+ {0 E1 `5 K
  1. [code]EDMA sample test application
    2 o8 k9 u9 r" q0 X1 \" O$ q% R
  2. /*
    9 ^0 @4 t; v0 Q1 _
  3. * edma_test.c1 `" J/ s# V% Q2 n9 z1 S  K" o4 J# @- J
  4. *
    2 T" T! {9 s) ?
  5. * brief  EDMA3 Test Application6 y: R' s: K+ `+ A0 W$ R. Q( |
  6. *
    + e5 |( j( r8 N1 c
  7. *   This file contains EDMA3 Test code." ], [$ a, x2 t- ^2 X! E& u: X
  8. *
    8 {5 y8 \; S* n! ~. X, W( ?' X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & \$ \' {8 G" @4 M) I3 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 F5 X: Z; A9 f; a) Q( R
  11. *         TO CHANGE.$ y3 v# ~* x) F- q
  12. *
    . ~5 y3 s  N9 b/ g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. o: j0 c+ H: {8 i% o, J+ g
  14. *
    8 `$ i- N5 B" Z+ J3 }, J
  15. * This program is free software; you can redistribute it and/or1 \! {1 \6 }  s9 I7 U% i
  16. * modify it under the terms of the GNU General Public License as
    / S+ t8 o& J; u4 c
  17. * published by the Free Software Foundation version 2., X2 M( z1 ]5 a8 F0 ^
  18. *4 J8 _1 a- M. l  v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + {, f# g) ]) I: |
  20. * kind, whether express or implied; without even the implied warranty6 ^- Z2 a7 @/ Y$ t- U% C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & u/ b: N) s* a, b6 C. R) }
  22. * GNU General Public License for more details.( v% ~2 ]  Z5 Z
  23. */
    3 O) m6 U9 i' B( a# A8 o0 Q2 b
  24. 9 q  r- L0 U, X( w  V# L. U
  25. #include <linux/module.h>
    . W, ]% [& Y2 U% F# ~9 U. n- k
  26. #include <linux/init.h>
    : Y, K  o/ i- H" g4 F9 p# ^
  27. #include <linux/errno.h>
    ) R4 ?; g5 ~) g  g+ B3 @% N
  28. #include <linux/types.h>+ J. U0 J, V+ R3 L& v
  29. #include <linux/interrupt.h>$ F2 ]) q0 X$ u
  30. #include <asm/io.h>
    . m, k3 F$ O- k" A- T4 C" ^) M
  31. #include <linux/moduleparam.h>5 n. I6 N# n, Z) ^# t3 L
  32. #include <linux/sysctl.h>: d+ m- b7 W' ~5 Y# R# r/ e' ]
  33. #include <linux/mm.h>/ W  S; U* p4 Y
  34. #include <linux/dma-mapping.h>
      D8 w) n7 d7 U7 r0 R# H

  35. 0 c" l5 i: D3 J8 [  S9 l5 m2 x, [
  36. #include <mach/memory.h>
    9 d, t4 z7 g, c9 U+ X
  37. #include <mach/hardware.h>: S& \5 u" I+ B" s
  38. #include <mach/irqs.h>3 B' d) w; A# u) p6 h
  39. #include <asm/hardware/edma.h>6 C5 f) X% V9 s6 F" f# p2 B+ Q; ^

  40. # e* f( {, }+ v; c
  41. #undef EDMA3_DEBUG
    * l) J* W4 A- j2 S: m% _5 _
  42. /*#define EDMA3_DEBUG*/) S( |+ O5 z% o1 |

  43. 8 y: z: W7 }6 b" q" x2 b
  44. #ifdef EDMA3_DEBUG
    3 v" G  O8 ]3 w7 B% _- h3 O$ ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" O) E9 `, ^+ _1 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 f  u9 `. ?- o8 V* [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). y( L1 U; r9 ]7 z' a; I! \
  48. #else% [) E4 U" S  r2 R- `6 j* |
  49. #define DMA_PRINTK( x... ): J4 B  s5 B* X/ {/ m7 r( N+ k7 H3 w
  50. #define DMA_FN_IN2 E# I' m, m4 g
  51. #define DMA_FN_OUT
    & K* I- b( k. ^* j; d
  52. #endif
    7 A: M0 p9 v+ t( V3 l% ]( ]
  53. 5 C) }- n' e! e/ D5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      o/ Z8 [4 o" F7 A1 \
  55. #define STATIC_SHIFT                3$ ?8 F3 c. f0 Q  q2 n4 R
  56. #define TCINTEN_SHIFT               20% A7 E* \9 @2 n" U
  57. #define ITCINTEN_SHIFT              21
    8 P, K( X& Q3 c/ {& @
  58. #define TCCHEN_SHIFT                22
    ( I: ^% Z+ d' w* p4 w, p* I& g, \/ H
  59. #define ITCCHEN_SHIFT               234 g% R, k" S3 J, o) Y/ Q8 K
  60. . W. z" k! M! n- T
  61. static volatile int irqraised1 = 0;
    & y* I# K4 b/ z/ k7 v( d( w! Z. d
  62. static volatile int irqraised2 = 0;
    0 z* h  a) x2 d6 g* V' B
  63. ' t/ o, Z; l6 o- m( O1 U; B1 H( k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( s8 W! {! I1 y, Y5 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i1 R, ^& ?2 I8 A# R# D6 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' }1 C0 A6 S! ~: H, f/ \

  67. 3 o  J, p# ]8 t, Z) W& w* i) C
  68. dma_addr_t dmaphyssrc1 = 0;
    6 @5 A) [, S- L; h7 `  Q1 Q
  69. dma_addr_t dmaphyssrc2 = 0;/ t' ?! W" }6 c6 O  d
  70. dma_addr_t dmaphysdest1 = 0;3 B4 h8 E% k8 i. k7 ~6 f8 C
  71. dma_addr_t dmaphysdest2 = 0;  x* U9 l9 D) J9 a4 H' N2 q3 g
  72. 6 y. H" T- J7 \; K- b3 H
  73. char *dmabufsrc1 = NULL;+ T& k2 Z5 S, Y$ k! {- s
  74. char *dmabufsrc2 = NULL;
    1 p( T3 n  V! a, \& T4 C
  75. char *dmabufdest1 = NULL;
    9 X' _8 z' L, d( b! W$ Y
  76. char *dmabufdest2 = NULL;
    8 {- E% c2 ~6 Y3 F

  77. 5 `$ {9 B9 C4 u
  78. static int acnt = 512;
    " z' w" k7 ^6 l/ e
  79. static int bcnt = 8;1 s$ w0 c3 B- X7 h; Y  t  \! y
  80. static int ccnt = 8;) ?: ^1 t  f& [) `

  81. 8 u; n2 o/ e: D8 X- }5 E  C2 {
  82. module_param(acnt, int, S_IRUGO);) G( E/ s9 d3 R
  83. module_param(bcnt, int, S_IRUGO);
    5 y) k1 u. j3 e- W0 Y2 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( k4 K6 C( x% l7 A3 v, p
: Z+ w, F* ^& I- F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 |  u2 n3 D* E+ U9 A5 ~7 ?/ H$ p4 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  v! _' ~5 J7 f2 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K3 J( L8 r* E% `
1 o& N# o- W) o- I

/ M+ @) N& c& t" h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 14:01 , Processed in 0.041032 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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