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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 j* ]0 J6 b( |# y. R  R
  1. [code]EDMA sample test application1 m" Y' d% t1 T/ \  Q6 J
  2. /*4 `7 G5 b( n5 M2 Z! Q3 I6 t/ h: s
  3. * edma_test.c
    # g; G' W: ?  |
  4. *
    * e2 F; X  O9 g1 V
  5. * brief  EDMA3 Test Application6 P- v9 H& Y! t, K4 ]. l
  6. *+ `" E( ^8 G5 l5 \. i5 @
  7. *   This file contains EDMA3 Test code.
    , g+ j- l8 `" g7 @: K- f  T
  8. *1 i* F) G$ v/ G. |: S. |8 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: r9 S$ X6 a+ p( l$ Q* C2 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 {/ T) ~8 b$ E+ L. U( b
  11. *         TO CHANGE.
    5 N) @' i" J+ m! p1 P- v
  12. *! N. _8 G! ]! ^3 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . H% E. Z4 B  m
  14. *
      {! c4 C9 Z8 R7 L  v
  15. * This program is free software; you can redistribute it and/or' M& F; ~. e3 j6 K/ q/ D6 x
  16. * modify it under the terms of the GNU General Public License as
    ! ~3 @7 p( G6 E0 r7 Z+ v3 w$ S2 Y/ S
  17. * published by the Free Software Foundation version 2.5 S6 |$ N/ U$ a9 ^. J
  18. *
    / Q: G$ T+ i  H9 h* ~, l* ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 A9 J3 X0 g' U4 M
  20. * kind, whether express or implied; without even the implied warranty
    / ^) x$ n+ ^2 m  x4 e* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! V' w. @  Z7 g
  22. * GNU General Public License for more details.' ^8 }6 I' y9 M1 e( ~
  23. */
    & ~8 s  k6 K4 e; u: i  |7 j* |
  24. % u  _+ f% R4 z/ q
  25. #include <linux/module.h>
    ( S  x! c5 `8 Y. |9 z/ _+ {
  26. #include <linux/init.h>" ^$ r! `- S. A  F
  27. #include <linux/errno.h>; j( ~" Q1 c" m% E, B
  28. #include <linux/types.h>1 W: z& }( R7 V; L
  29. #include <linux/interrupt.h>' N4 {- @$ q: O& d# S2 G
  30. #include <asm/io.h># ?2 X: }) l/ X; V' V
  31. #include <linux/moduleparam.h>* P; Z% \+ o7 K. n
  32. #include <linux/sysctl.h>
    9 L6 f: o5 M! k! ]. i/ X4 O: M
  33. #include <linux/mm.h>/ k% p( T3 T7 e5 F0 e0 q* S
  34. #include <linux/dma-mapping.h>7 }4 P9 B7 E: `1 c" {  U  g! ~( q

  35. ' D( K' w. }- _% K, [5 I$ Q% A$ h9 C
  36. #include <mach/memory.h>' B  W/ |, m) Y, a5 P1 S: x
  37. #include <mach/hardware.h>
    0 p' C, D* s9 V8 w3 b2 ]( a8 l
  38. #include <mach/irqs.h>
    * j6 {  r$ r  z+ h) G. c
  39. #include <asm/hardware/edma.h>
    : c/ N4 j' \% ^9 e- o1 Q
  40. 7 U) ^; r8 G+ h. B
  41. #undef EDMA3_DEBUG
    5 C4 E3 o0 I+ Z, i
  42. /*#define EDMA3_DEBUG*/& }) o8 l8 j  n" A  ]

  43. 6 Q+ d& ^% B' T, `/ L1 Q4 k
  44. #ifdef EDMA3_DEBUG
    % d% r; V, \% W5 b7 l* Z. W) {9 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( G" e( N8 u5 {* @1 _: b1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z/ k, Y3 _/ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ t+ a, Z  U$ R9 {! \: A
  48. #else0 V4 \. t. v$ }
  49. #define DMA_PRINTK( x... )
    & _) {3 |8 |% d' ~7 w2 f
  50. #define DMA_FN_IN7 L2 h. w1 c7 `
  51. #define DMA_FN_OUT9 D2 ]2 r7 M+ T4 t7 `3 X$ r0 A
  52. #endif
    3 O- v9 v+ m) O" p% g) d) l# t
  53. " P. q, E4 V) x' z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % i' I  ^4 f% W0 }2 _
  55. #define STATIC_SHIFT                3; ~. w5 w* |( D6 h6 S- _4 A4 a
  56. #define TCINTEN_SHIFT               20
      n8 Q' \" y& k
  57. #define ITCINTEN_SHIFT              21
    6 r3 a- x0 O6 |" r/ T7 {6 V
  58. #define TCCHEN_SHIFT                224 s% _8 S# ]  V3 {. A% v
  59. #define ITCCHEN_SHIFT               23- d8 d- ?2 Y/ Z! l, j3 t$ N8 v

  60. 8 M9 \  E9 \2 s! i) k
  61. static volatile int irqraised1 = 0;& S9 b- M# a1 \5 w% E+ }  M$ T
  62. static volatile int irqraised2 = 0;
    8 r$ N7 g( f' n
  63. % r, N. f. Y- l7 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 q! A4 W5 u$ }! n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L$ T2 U  d5 n8 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q% F* R: ?9 r9 W9 ?& e

  67. ( W, R1 x5 x! H4 z8 ^! s+ Q+ l
  68. dma_addr_t dmaphyssrc1 = 0;8 e8 w% Z( c, a2 G; z
  69. dma_addr_t dmaphyssrc2 = 0;, A0 P$ K$ a' H) F
  70. dma_addr_t dmaphysdest1 = 0;* b% T( S; ]+ u& F' X) i
  71. dma_addr_t dmaphysdest2 = 0;7 F  y$ E0 e$ j* c: V
  72. 3 u3 l" X) C% n" K9 B+ d) @; S3 e
  73. char *dmabufsrc1 = NULL;
    0 m  D& e! L+ o/ B
  74. char *dmabufsrc2 = NULL;
    7 q1 S' T2 q; K8 q8 f
  75. char *dmabufdest1 = NULL;
      T- U; c* T0 N
  76. char *dmabufdest2 = NULL;. g2 }& g% _. k7 O& u! R
  77. / k" F$ I5 k' o/ ]9 T6 `$ r
  78. static int acnt = 512;3 ?( W/ I9 m" e3 G$ E5 j+ k
  79. static int bcnt = 8;6 u+ N$ H: ]; o2 f' ], Z5 ?
  80. static int ccnt = 8;
    6 g: [/ K9 x, }5 X
  81. $ r6 N% W4 M+ e- S' |: v
  82. module_param(acnt, int, S_IRUGO);3 f) R3 G3 ~' R4 w: e9 C* M
  83. module_param(bcnt, int, S_IRUGO);
    4 A+ h1 a) a- o) C# t. N& f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) g  {( F: M. A" ~5 o! g8 R" ~2 O% A  ]* _& R* o, S9 r/ E" E( c) P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 B1 `# x: T$ v! ]( X+ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. r, ^/ z4 M$ {$ |* ]+ d8 I9 p  a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& [; R/ a- z& q  K( E
: Q; {& b+ x2 S$ e$ B3 I3 S

  q4 _7 ?/ J, L/ m: L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 07:28 , Processed in 0.040795 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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