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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: q! K) K' f. g9 x& [  Q8 ]% N
  1. [code]EDMA sample test application( ]& o6 g* F- C  m- D
  2. /*' o7 ~8 Y% q% G7 O, m
  3. * edma_test.c2 G+ E4 z8 o- ^1 a2 q9 U
  4. *$ |4 u0 `/ O0 y, T, g( g; C$ p& i
  5. * brief  EDMA3 Test Application3 _$ ]8 Y* n9 K  [
  6. *
    2 x' E8 W, e/ R* M) s! D$ p. n
  7. *   This file contains EDMA3 Test code., w. Y& R  a8 ^0 v+ n  H% q
  8. *
    1 ?2 v* h, C& A$ s2 ~/ R. G. |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H' ?0 _$ J+ o  \# }0 M. \: _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 b$ Q% R8 N+ S0 Z$ Y8 O" C, L
  11. *         TO CHANGE.% [5 [9 M+ y, ~% I- I' V
  12. *
    + K6 e+ I0 i( u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 ^0 N% B4 C, i5 i
  14. *5 n1 S/ T& [! ]( Y: [. L
  15. * This program is free software; you can redistribute it and/or( P+ c3 }( b$ G7 S) B/ V( h
  16. * modify it under the terms of the GNU General Public License as* s/ U% Y2 v0 K" b* @+ z( l! B/ ?* g6 K
  17. * published by the Free Software Foundation version 2.
    3 S* `+ X7 |* K* L  x3 u
  18. *" l+ l# o8 m4 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ ~. l* U  c) E% I/ Q9 ~, p; _- h8 J
  20. * kind, whether express or implied; without even the implied warranty8 j# y5 D( F9 G0 j# l7 A  ]* j6 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & V% _- O9 }" @% j$ N
  22. * GNU General Public License for more details.
    / w) V7 _. y% I* q% {! \0 K( y  \
  23. */
    , ]! |2 y" O( i# a9 _8 E' {# P

  24. 6 a! ^# z" [2 H3 o% d' p
  25. #include <linux/module.h>" A! S" _- T& h3 E8 j0 |+ e
  26. #include <linux/init.h>
    ; s0 }1 r/ d. {' O
  27. #include <linux/errno.h>
    5 G& P' z8 S+ ?8 n; A. Z  I
  28. #include <linux/types.h>& D# v0 m- \4 ~3 D) n6 i
  29. #include <linux/interrupt.h>- G0 f+ O( A7 o7 q  q7 e% u
  30. #include <asm/io.h>
    " \0 G7 M: `# K( F; q$ [* ^, K
  31. #include <linux/moduleparam.h>
    ; H7 o( ?8 h/ O
  32. #include <linux/sysctl.h>' p/ O, n$ t3 D  N; b1 y
  33. #include <linux/mm.h>
    . B/ V6 A: v" q) n( c
  34. #include <linux/dma-mapping.h>7 _6 \  L1 Y2 Q  G- q
  35. ( \% y' z$ I) h  e6 I; J
  36. #include <mach/memory.h>; D& a, Y( [1 a  w) Q  X
  37. #include <mach/hardware.h>
    ; t% L. S, r; }! v7 R% k) o/ L
  38. #include <mach/irqs.h>- B) l! K- v8 v3 R
  39. #include <asm/hardware/edma.h>; Z! M2 P' F4 ^6 U( l( g/ Z

  40. ) I% Y6 J! \/ U( K) z
  41. #undef EDMA3_DEBUG! K4 z7 o2 X) e0 s
  42. /*#define EDMA3_DEBUG*/
    * L/ G+ p, n6 |: P7 b
  43. 5 K9 _, {2 }6 D6 @/ [6 F
  44. #ifdef EDMA3_DEBUG! Q: d2 g2 c1 q# ~$ l5 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ]& {; u& K0 g3 T4 ^& q3 X* g. x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q" Z, \; i) a( {3 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 F: D1 H- F9 R6 J+ y9 L9 g! f% k
  48. #else7 u' x0 l4 \  W4 M
  49. #define DMA_PRINTK( x... )0 K* o' g/ u" b' _) l6 f
  50. #define DMA_FN_IN8 x" P& e5 t1 P8 `5 e" |
  51. #define DMA_FN_OUT
    $ _! u/ h; w0 ?
  52. #endif6 h$ d' e# B9 r# _: w7 [

  53. * J8 m# i3 S% h1 x& [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & R; K" ^" Y6 [, S6 U
  55. #define STATIC_SHIFT                3
    2 l  X  h% a( p. M; |4 p% O* H
  56. #define TCINTEN_SHIFT               20
    . @, H3 w* E& J, f- f( B. Y- a. ~" _
  57. #define ITCINTEN_SHIFT              213 d2 q; N: O& l* o7 h, u
  58. #define TCCHEN_SHIFT                22) Y$ S+ M0 }, e" S: D3 M$ W
  59. #define ITCCHEN_SHIFT               23$ i8 B& [/ ]% J1 x: I9 b

  60. / i6 C! b9 F. o# R1 @8 v
  61. static volatile int irqraised1 = 0;
    . D% s/ ]; }; S6 o8 c
  62. static volatile int irqraised2 = 0;
    % Q- L1 j6 U6 z! m- w0 v. N- w

  63. " n1 M( ]2 w! S& t% l6 ^, r0 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  L1 Y5 a3 i# A. p: _, \  k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * {. S, K& s$ e# ^0 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L8 _% E' D9 E5 g! H4 T8 h

  67. % G- P$ a0 e$ M! c- f1 {( d- u
  68. dma_addr_t dmaphyssrc1 = 0;
    * Q) y. n$ K- ~
  69. dma_addr_t dmaphyssrc2 = 0;% o# V/ B. W! i; C# i' n
  70. dma_addr_t dmaphysdest1 = 0;
    3 G+ P$ b8 Z, t% n# E
  71. dma_addr_t dmaphysdest2 = 0;
    0 n0 ?0 ?! n% p' b4 P: S1 ^
  72. + H: N( J8 Z( y6 L% _
  73. char *dmabufsrc1 = NULL;. E) {# |' {1 Q# o! @0 n8 \) a
  74. char *dmabufsrc2 = NULL;9 j. Z! ~; Y- \( F3 o7 P0 o# G" e
  75. char *dmabufdest1 = NULL;
    7 O+ F( ?' x+ M9 v
  76. char *dmabufdest2 = NULL;
    ! w2 `0 U, d' G7 a! d9 g
  77. + |0 d. `- K5 B  N6 l6 l- S# [
  78. static int acnt = 512;, R# O5 j- n, I6 `5 {+ x
  79. static int bcnt = 8;0 J$ |7 z7 _# c! t+ e
  80. static int ccnt = 8;
    , a4 K" J- w  R0 I% Y
  81. 0 l% d4 x5 G* P
  82. module_param(acnt, int, S_IRUGO);
    4 E1 e% {! G9 s7 f
  83. module_param(bcnt, int, S_IRUGO);4 ~' a. W6 A" i  `8 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& S7 [9 G; t% u, ]: b# b2 p0 U! r4 E6 \* @, J) \4 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @; j- x1 `- [/ D; e; v: T% aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% ~1 H5 v) G4 Z6 _  I8 y/ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 L* U$ q" E; S0 U) g1 q1 T- E
/ O% f( W% b1 |1 @4 c+ w7 b: L3 k
4 B- [1 m& X5 Y. @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 07:57 , Processed in 0.037762 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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