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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 z* _; H5 g3 D% ?( ^; L9 v
  1. [code]EDMA sample test application0 k0 ~& e+ i  k' R8 G
  2. /*
    . U- Q" ^2 @5 d; g" ~
  3. * edma_test.c
    6 G, H- M+ `* b8 Y6 L' d# L
  4. *) O0 K2 \& j5 w/ p3 x9 g7 l) o
  5. * brief  EDMA3 Test Application$ L! t2 u6 q% X" }% v3 k, d3 P" |
  6. *
    ! R% I4 u. x/ L. K( Q! g0 V( j3 V
  7. *   This file contains EDMA3 Test code.
    ' e) p3 n6 a7 a: V5 d
  8. ** K; z1 d/ s" y! a1 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ?; u" ]: \* l8 w% ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 J  J# T  z% s5 \2 I, }
  11. *         TO CHANGE.
    8 x/ j/ }6 |' {8 Q2 i: k
  12. *
    3 u9 A( d- J0 a2 q5 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) R0 O; _) V9 J6 _0 o! `& B/ k& ?0 d
  14. *8 ]$ c: _$ [8 x( j: |  T1 K
  15. * This program is free software; you can redistribute it and/or
    6 J8 R2 O+ ^8 n' z$ D
  16. * modify it under the terms of the GNU General Public License as4 e6 L7 c; v2 S: z. n& |
  17. * published by the Free Software Foundation version 2.# m- k5 Q# f  h, }. l7 F
  18. *
    % t( D5 K: N6 S& V  u6 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ w) C; o- l* j; Q. [7 q; |" f3 n
  20. * kind, whether express or implied; without even the implied warranty
      d8 L6 r; h6 \# T) q0 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; k: k" ]0 J3 O. Q5 A* V. Z
  22. * GNU General Public License for more details.
    / g" Z: r- Q! N! ]
  23. */  y, n2 E4 T5 b  n# F8 d

  24. 9 O, C0 [7 P: R! T  Y# @4 b
  25. #include <linux/module.h>) Z, s. w! H+ D7 J5 a2 G1 {  E& r
  26. #include <linux/init.h>
    ; O! E$ x; ]5 F" X
  27. #include <linux/errno.h>
    5 W& H  p% A- N) l7 e& ?
  28. #include <linux/types.h>2 u* ?, i/ Q$ z7 r! ?
  29. #include <linux/interrupt.h>
    ! W& Z2 I1 I+ X! h
  30. #include <asm/io.h>
    . T  Z  ]( e# e/ v
  31. #include <linux/moduleparam.h>
    4 C# Z; `2 ]+ a' k3 f0 S
  32. #include <linux/sysctl.h>
    % J9 Q9 h2 c  I: `  i% V
  33. #include <linux/mm.h>
    ' ?  x7 j$ {% g. V0 k! ^) ^4 }" S
  34. #include <linux/dma-mapping.h>
    7 G  Z& a6 y' {& V8 U
  35. ( I3 I) S" g2 b
  36. #include <mach/memory.h>) \0 c& a2 y4 c# x2 `  `) l. q9 i
  37. #include <mach/hardware.h>& \0 ~) `% h; K0 W* n
  38. #include <mach/irqs.h>4 X% C9 g2 R6 j4 b# K8 P
  39. #include <asm/hardware/edma.h>
    8 d& [+ S7 u  Z- I
  40. ! f6 A( [! r1 H, g8 w1 T5 N
  41. #undef EDMA3_DEBUG
    2 D7 y; {0 A6 s- h3 E- F
  42. /*#define EDMA3_DEBUG*/
    6 s/ j% U9 I# ?1 h3 m* i
  43. - E' r6 x* n3 y1 D4 \, g
  44. #ifdef EDMA3_DEBUG" u$ M' [. ?( b9 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 G8 d% q. e# O2 S/ T! C7 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; u  F+ k. J8 E6 x2 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); V4 I, m: f, v& E! o/ e
  48. #else
    4 L1 y. @" w( D7 l# i' W9 _# J
  49. #define DMA_PRINTK( x... )
    : s% W+ a- x% t. `
  50. #define DMA_FN_IN! U" h8 d: T$ \, J
  51. #define DMA_FN_OUT; y; `( J4 U' S& N  a- D
  52. #endif
    ; Z5 z$ A% V7 {0 r6 e; o
  53. + s  U* `) y0 e, a; M: O" O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - Z( O% H5 d2 t5 t
  55. #define STATIC_SHIFT                34 H: Y! X- W7 T: h( U: f
  56. #define TCINTEN_SHIFT               20
    - z5 M% {  T3 q8 k
  57. #define ITCINTEN_SHIFT              21
    ) u4 N! r8 b: J3 R0 x9 u
  58. #define TCCHEN_SHIFT                227 D, }* b3 r2 f3 |" X
  59. #define ITCCHEN_SHIFT               237 L- {  ^3 e" {9 H) F4 k' j7 ~6 {

  60. 3 F1 p* ?! f  q: a- t# z( G4 E( l9 [
  61. static volatile int irqraised1 = 0;
    6 \5 H) b* _. \6 A
  62. static volatile int irqraised2 = 0;4 x3 l4 v! B6 T( i- |2 n! h5 b6 p

  63. % Q/ l0 S3 @. @. _. T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m! L* R* w" P7 H3 {* [5 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ?- Q: G. A0 O2 r% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 B- S* }7 d0 z; Y1 U! d, `
  67. $ ?% B: W3 ?1 u; X
  68. dma_addr_t dmaphyssrc1 = 0;3 h+ |) }! c4 Z% J0 W/ N; O5 j& o! r: T
  69. dma_addr_t dmaphyssrc2 = 0;5 l) X$ L) b% J7 C. S8 o
  70. dma_addr_t dmaphysdest1 = 0;4 T) @% m* P. T. b
  71. dma_addr_t dmaphysdest2 = 0;7 M/ m3 K1 e6 o: Q3 T+ I/ ]
  72. $ g- n7 a$ |& g& |1 a
  73. char *dmabufsrc1 = NULL;7 C# [' l( Z( N0 o
  74. char *dmabufsrc2 = NULL;
    5 C3 b5 u0 I2 P4 u) R* n$ N& q
  75. char *dmabufdest1 = NULL;
    / G+ Z3 w) @% ~$ y$ v
  76. char *dmabufdest2 = NULL;
    / U! A( f; N2 F  i) X* p' [

  77. # Z7 v& f/ B# H" ~3 B3 l
  78. static int acnt = 512;) b, e, z% D$ h1 V: f" D* e
  79. static int bcnt = 8;
    5 _* [; I' w6 |
  80. static int ccnt = 8;
    6 p- N$ m  W7 E2 C6 r4 W" g' Q
  81. $ d2 B! [2 L+ p9 U- X" Y& e
  82. module_param(acnt, int, S_IRUGO);' }  ^7 r! w% M
  83. module_param(bcnt, int, S_IRUGO);
    3 x% f/ x) ]6 \  w' Q- B" y) c4 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 ~' a1 X! e# W2 |+ G' \
% E- M& S% M2 D8 `9 B9 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ n; G5 `. c2 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 I. _3 J3 G2 a8 V. Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" T* p9 G, F3 s) X
. T2 R- M  D4 W3 ?2 ?' G2 F% W
  S0 }7 T' Q: \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 19:54 , Processed in 0.039288 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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