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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ^- ~% {+ |  _/ F4 y
  1. [code]EDMA sample test application1 S( H) f6 E2 Y8 B, l9 o! ^2 }
  2. /*
    , \+ o; U; c; ]& ]0 a( k
  3. * edma_test.c
    / P* c2 }# B' K0 G. \6 p0 }# i
  4. *7 n) I& k: C4 U, Y+ G
  5. * brief  EDMA3 Test Application
    0 _/ R5 c" [, U
  6. *6 ]) n- a- p2 U8 Q* ^
  7. *   This file contains EDMA3 Test code.+ c+ y. A. y% }. K
  8. *2 [( e) x7 V1 @5 E& d1 }% W3 p2 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) D/ I# r2 l. K! F/ }# g$ u4 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ j! F7 j- i4 ]- c
  11. *         TO CHANGE.
    # S( r$ T  o- s# c$ F+ }4 g5 i# A0 K! Y
  12. *
    3 B) o  `3 F# `) l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 G/ t7 }' d& e2 {2 b* A
  14. *
    3 d5 A6 P7 c- S" u+ G) u
  15. * This program is free software; you can redistribute it and/or
    3 L3 D8 B" r: J$ r5 d  ^
  16. * modify it under the terms of the GNU General Public License as
    6 L8 O8 ^+ b) [1 [% s
  17. * published by the Free Software Foundation version 2.! n9 d5 c3 z" O& a% d( o9 p( W9 F) E
  18. *  M; N% q( ~% ~: c* t- q" ?6 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 m3 ~' ^$ Y# ?" R1 U' V5 ~
  20. * kind, whether express or implied; without even the implied warranty
    4 j* i* ~" p8 G) B8 g6 j4 b, P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! j2 r9 H/ O2 ^% ?
  22. * GNU General Public License for more details.
    4 Z4 j/ _, r" J) M4 V
  23. */
    7 o9 }0 G: G, @3 t5 U' [/ A! z% J

  24. # ]5 `9 y; Z' M% n9 A& n. B* T
  25. #include <linux/module.h>) c+ v3 s0 z: d9 ~. \& y
  26. #include <linux/init.h>. H2 A- p* i% `& B# K- q
  27. #include <linux/errno.h>
    1 X+ B3 H2 C4 T; Z( j( B
  28. #include <linux/types.h>+ ^( [1 }. @1 Y2 _0 ~' [3 k
  29. #include <linux/interrupt.h>' p! T  E; E/ n# L* q, l# p
  30. #include <asm/io.h>
    / k  {, R% ?  k0 r" U3 T( d
  31. #include <linux/moduleparam.h>& I. }7 P$ K8 ?% \: r
  32. #include <linux/sysctl.h>" K! r& ~% R0 O$ j4 r+ J4 ?& Y
  33. #include <linux/mm.h>! U- [4 d6 K$ O" y9 b
  34. #include <linux/dma-mapping.h>! A+ p. X; g! B) e4 k

  35. * h0 P, T) j9 i2 S
  36. #include <mach/memory.h>
    # \6 m  l# R$ T, r9 u& {; l  ^+ I
  37. #include <mach/hardware.h>
    ( t3 r# n. {, P# t6 {! |" U! X0 B' k) E
  38. #include <mach/irqs.h>9 n, N% g5 ^# s: L. [7 M
  39. #include <asm/hardware/edma.h>
    3 n+ O& |0 k. ~' g$ p# N5 t1 c, N
  40. 3 e# P# s+ L& m1 r) M# J0 w
  41. #undef EDMA3_DEBUG- e2 B4 i! ?- G" f, U0 p
  42. /*#define EDMA3_DEBUG*/6 t- R  d. e' R4 @3 o! }$ y4 a
  43. : {! L7 p0 c3 L8 F# a
  44. #ifdef EDMA3_DEBUG
    . m" |; M% P* [, H* o; Q8 A/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). d- D9 g* U9 u; Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& F4 q4 D5 d) l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i( v; e) b1 d1 Z  ^
  48. #else' C, O9 Q! Q. n, O7 S; m
  49. #define DMA_PRINTK( x... )3 e9 U# ~- D$ Q
  50. #define DMA_FN_IN
    + c7 L. x* ~: M; O3 F3 D6 q
  51. #define DMA_FN_OUT) o& c3 U/ ]3 v& z3 O* `
  52. #endif5 o- v; B) q* f' Z5 X6 ~

  53. ( E: G6 v) u, D, E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 N* E: [# I0 m! {
  55. #define STATIC_SHIFT                3
    9 k. o- T  ]8 M7 d" W
  56. #define TCINTEN_SHIFT               20/ E) T5 M2 |" o  B. F2 i
  57. #define ITCINTEN_SHIFT              21
    % f7 Z! B9 H4 ~
  58. #define TCCHEN_SHIFT                22
    % ?1 B& F) f- e% M" W
  59. #define ITCCHEN_SHIFT               23
    0 b( l% c  u! s4 s

  60.   T& g! _! V6 \; }
  61. static volatile int irqraised1 = 0;0 D) P# e3 J2 k' L
  62. static volatile int irqraised2 = 0;
    2 D/ q/ h' `# P
  63. * ~9 f8 f3 ?  y- ?! L! W$ Z* I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r8 X% @; j3 n( X* l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O! s+ ^) m# H7 W1 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - o8 K7 {& ^7 W5 R, r5 K
  67. 0 J- H: `$ o2 K, S! b: X
  68. dma_addr_t dmaphyssrc1 = 0;& L" |) r5 W$ R# X! r4 n
  69. dma_addr_t dmaphyssrc2 = 0;
    # ?3 ~7 l5 y) l' O% g
  70. dma_addr_t dmaphysdest1 = 0;
    / h+ k% S* B5 K, E. r
  71. dma_addr_t dmaphysdest2 = 0;
    9 ^3 J: U- o' S$ m& ]2 ?
  72. : Y! L, q  q6 c0 N: Q3 C
  73. char *dmabufsrc1 = NULL;* j8 x  T" S* {$ h, l9 W& a
  74. char *dmabufsrc2 = NULL;
    ' _5 }; a# b0 `" b. s
  75. char *dmabufdest1 = NULL;
    % a# e* x/ ~# v9 S. ~
  76. char *dmabufdest2 = NULL;# v! i! p: t! B# ~
  77. 4 Z2 m; y! ~. V7 E+ j7 C
  78. static int acnt = 512;5 z; ~" s3 k+ n* A: b) J
  79. static int bcnt = 8;
    7 k: U5 v1 }4 K: N  Q1 t; N4 m
  80. static int ccnt = 8;
    ; s9 t% ~) {5 n

  81. " J( |- p' _' }2 c, Z# w! o8 V
  82. module_param(acnt, int, S_IRUGO);
    & }- R5 E' U' M! x; ]- \6 t
  83. module_param(bcnt, int, S_IRUGO);9 w$ U7 r/ x2 R9 ~2 K5 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 i- ]) w0 X! [. l. `* U

1 V9 y: W2 ]! g- `4 @# I: T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; y. f. z' X7 y* P/ P, qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 W/ Y- M, v3 i4 B2 t8 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ]; G0 e$ \# |9 Q! e. K% Z& b5 J5 U9 ?( z- ~3 @6 Z* X& t. @
5 {* f7 E# }% v1 I$ |9 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 12:22 , Processed in 0.059197 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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