OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m5 ]& w( C% _; ~, V/ H* C# P
  1. [code]EDMA sample test application
    5 j6 X, U4 A1 n9 w: {* S0 k% p
  2. /*
    . A5 z/ ]+ V. T: m! a# k
  3. * edma_test.c- |$ u0 D6 Y( P" z2 ?
  4. *# [( l" B/ C, n' B
  5. * brief  EDMA3 Test Application
    8 q: T, D  ?. d& Z; M
  6. *- v3 E. N, `% a& L4 k9 ~
  7. *   This file contains EDMA3 Test code.; o/ N. N: S: W9 p* E
  8. *2 r5 s2 x- c" W$ D7 l- x* r3 y) n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" b- p! u/ j: W8 M9 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' T: E$ h3 v* G; g
  11. *         TO CHANGE.9 I( G& @0 [, Y* M
  12. *1 t. @7 m, z( q  d0 x6 u% C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" p, u* `% S9 e/ U
  14. *( d# v9 U6 Z. S3 V/ @
  15. * This program is free software; you can redistribute it and/or- B& ]0 S( ~* o4 R( }
  16. * modify it under the terms of the GNU General Public License as
    4 [+ g: n. y0 _
  17. * published by the Free Software Foundation version 2.
    / X3 m/ G: v2 g
  18. *; P8 L& m1 o+ N$ z) [0 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 {: {3 b+ `" K6 d6 q8 y( M( T
  20. * kind, whether express or implied; without even the implied warranty& ]$ Q0 q- j& @7 f& ]0 v# b0 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- X6 U. \4 x  v
  22. * GNU General Public License for more details.
    + q  a) p, V# }, Q5 k
  23. */' }5 g( b7 S$ h( w( G8 K

  24. % d+ V+ M5 b$ O
  25. #include <linux/module.h>
    " u+ X% v( M+ E( U% i3 d, d% y
  26. #include <linux/init.h>9 ~+ l8 l# b9 D- f& R/ L% L7 P
  27. #include <linux/errno.h>
    $ h9 l+ x) ~3 t/ h
  28. #include <linux/types.h>
    - f6 d, x) e8 |0 K( q
  29. #include <linux/interrupt.h>
    ; I7 L* R% B6 H0 P
  30. #include <asm/io.h>+ z* Y# m1 {* ]& A
  31. #include <linux/moduleparam.h>
    8 @% C1 W  o3 Y4 ]+ E5 ]/ `
  32. #include <linux/sysctl.h>5 p5 S; U% l% N7 |2 Q3 s
  33. #include <linux/mm.h>; P/ B; Z! _4 O/ X! z7 M
  34. #include <linux/dma-mapping.h>- {5 T) ~  ~8 R5 t

  35. % c" h8 H" v- o2 Q4 J
  36. #include <mach/memory.h>) u& J5 l7 d% o- W9 S- L. {. E
  37. #include <mach/hardware.h>; y$ d' \7 i6 h! u( G
  38. #include <mach/irqs.h>
      r& g7 n7 T: v  w
  39. #include <asm/hardware/edma.h>. f; Y- j/ `( z! y; \& H0 v0 E3 d
  40. 5 T% K  ?: M1 T9 F" D/ Z) \
  41. #undef EDMA3_DEBUG
    5 o" i% S; G& y* I. _, y, Q8 w
  42. /*#define EDMA3_DEBUG*/
    ' V* _* C8 o2 i2 X2 [* F  \

  43. " ]5 [" [0 k; I
  44. #ifdef EDMA3_DEBUG% V, M6 r; u# x8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % x1 k2 u. {9 T0 ]* k5 k% z; u1 |$ X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 h" e. e0 F5 \* B* Q- x2 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K* Q/ X9 ?( K; a0 `
  48. #else
    / H& B8 r8 |- O( m3 R3 e3 U, G
  49. #define DMA_PRINTK( x... )7 [# H) b# L: A$ I; d7 T" l
  50. #define DMA_FN_IN- {" N7 T  b( L' p7 Z! _! X- K; J
  51. #define DMA_FN_OUT! {. F: U& V& K( K+ Q- x$ ^7 g% G! A
  52. #endif/ N! @1 A4 m8 t& x( P3 |
  53. 9 w( t. K" O# }$ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 Q! a. K6 ?3 j! A
  55. #define STATIC_SHIFT                3
    & C. n8 x0 K7 I/ V$ p
  56. #define TCINTEN_SHIFT               206 [8 u( e) g  V( O! ?  Y% |
  57. #define ITCINTEN_SHIFT              21
    ; F" L& U; t- o! Z6 L: y" D
  58. #define TCCHEN_SHIFT                22
    3 X% c9 g& F9 K7 X5 \% K3 n% B
  59. #define ITCCHEN_SHIFT               23' u) O0 L  u& G" j# h  n2 l
  60. & o' m& N# i% w! d9 X3 J9 s5 J; l
  61. static volatile int irqraised1 = 0;
    ; l. B" _: \. \$ h3 V
  62. static volatile int irqraised2 = 0;
    " A: l7 U( y5 F- `1 {2 U  f; j

  63. + y3 ?$ X7 ?7 C) V: D/ ]3 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 M+ y' Y' \1 U8 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  r9 v3 }! z. E6 z) t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - b  `  j* t4 R4 b" s) S

  67. 2 f- K; L7 }1 c% k3 g4 y( y
  68. dma_addr_t dmaphyssrc1 = 0;2 @& ]# |5 v; k0 I3 H1 h
  69. dma_addr_t dmaphyssrc2 = 0;
    : D' w1 `* k5 v8 ^# L
  70. dma_addr_t dmaphysdest1 = 0;/ _' V) I; k& g  U
  71. dma_addr_t dmaphysdest2 = 0;4 U  W9 a! {" i
  72. ( D5 M" O( j- ~
  73. char *dmabufsrc1 = NULL;3 D$ P* ^# @0 u0 E% N
  74. char *dmabufsrc2 = NULL;7 p# Y5 R3 B, K7 @  {8 d
  75. char *dmabufdest1 = NULL;( U& H9 y- v" s1 p; s' `
  76. char *dmabufdest2 = NULL;4 G, c0 i0 l' U/ L

  77. % \0 v' }) M/ J! m& X* ~
  78. static int acnt = 512;
    5 z$ f. x  _! ]9 |2 O" [
  79. static int bcnt = 8;. B" [+ S) E0 q9 e& I( [9 [
  80. static int ccnt = 8;7 X* N( f" [+ U5 u, X; U# P

  81. . V, }; K: I: P2 x
  82. module_param(acnt, int, S_IRUGO);/ W) A7 u9 P/ L
  83. module_param(bcnt, int, S_IRUGO);9 O( M, k4 x9 R0 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  t; s" ?. R. }! P: S! n" l4 U

) j* n( X* T+ s8 w& q, p* g6 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. E# j8 t0 L: S; _( b+ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  |0 f4 i+ Z8 j, g; F* @" D2 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N7 v* J6 D% L& c
9 h  F! f4 `) \1 W" \/ p
) G' {/ a$ }  W' [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 04:33 , Processed in 0.041369 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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