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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. h1 X' ^  u* _& {6 H: z' M8 M
  1. [code]EDMA sample test application) ~6 B  H, n& v9 e# ?+ u' i; k. ]7 t
  2. /*& [/ r) M$ j0 h! e6 {2 m$ B% L
  3. * edma_test.c4 U$ }+ {, C+ m, y# g
  4. *8 a* V0 F& w: N$ a
  5. * brief  EDMA3 Test Application
    & D8 G( G: |' [( @
  6. *
    5 X4 p+ M1 _% q, c& e0 S( }2 h
  7. *   This file contains EDMA3 Test code.( Y2 W# g6 w9 c2 \  z) s5 ^/ I
  8. *; t0 I2 x  ?+ w8 j$ z( K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x" I8 r$ C6 y. E, v6 V) K2 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B- i' Q" V& L' K4 |+ P
  11. *         TO CHANGE.: y- z3 I4 b- n
  12. *
    ! J+ X2 `( A& s; g) ~- `. B# Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 e8 K. s. C$ O9 f0 Q( }4 U; [
  14. *
    8 v  G& ^( b$ ~: [# w5 W# {. i; ^
  15. * This program is free software; you can redistribute it and/or' n! s' @2 z, N+ G1 I- r8 H
  16. * modify it under the terms of the GNU General Public License as) @# u) w; B1 ?# z. q4 V
  17. * published by the Free Software Foundation version 2., c1 `. g$ v2 n; S
  18. *
    / c( P1 Z& O& ^$ V. ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 ?1 z, L5 K# W& s4 `
  20. * kind, whether express or implied; without even the implied warranty4 Z9 `3 Y# c$ c; W) `* k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! j3 i8 j) x8 o$ {9 x8 k3 ?2 h
  22. * GNU General Public License for more details.
    " r* f9 ?* k5 j5 f! N2 z8 x, t* z8 d
  23. */0 d6 P; N: [9 i7 m9 o
  24. ; j5 G; P  [5 ^7 r8 P  {- o8 E, I
  25. #include <linux/module.h>
    2 a/ D, f1 \' W9 s
  26. #include <linux/init.h>
    . d2 j; T- p# x2 h
  27. #include <linux/errno.h>
    1 q' ~/ W6 q- g$ r) D
  28. #include <linux/types.h>
    # O# a, t0 w- s6 p  W7 }, _/ c; y
  29. #include <linux/interrupt.h>
    7 e. a! K/ B  ^! x5 w. Z% b- D
  30. #include <asm/io.h>% y* z  I# e1 j1 p9 I$ m, K- x
  31. #include <linux/moduleparam.h>( T! L! I; ?; X+ U
  32. #include <linux/sysctl.h>$ I- r- N7 `2 h( H
  33. #include <linux/mm.h>0 {: w! x" W/ c
  34. #include <linux/dma-mapping.h>
    ( t3 s0 I0 h/ J" z0 J6 j
  35. + ^6 `" W: U: O6 O
  36. #include <mach/memory.h>
    1 |$ q: k( S$ Z4 D: [8 L+ d$ A
  37. #include <mach/hardware.h>
    6 J! v- y; o: p" b  {1 N0 g% l& M- Y
  38. #include <mach/irqs.h>) y- I: w$ _. T9 h
  39. #include <asm/hardware/edma.h>: n5 T$ R' {, e: ?

  40. ; I$ N! V" X( z. E
  41. #undef EDMA3_DEBUG( ?; B0 D) I! t, c8 B! N
  42. /*#define EDMA3_DEBUG*/+ [8 c0 ~5 b2 e  z  |+ Y

  43. 8 k5 r) r  |0 K& c# [( m
  44. #ifdef EDMA3_DEBUG
    - O' ~; }; q! E9 z; w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 S; w' R, x  V7 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! d: z0 [+ a7 L2 }' L/ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O: g- z. q  e: R3 y  c+ W
  48. #else% f7 h% i& i( G; l% @
  49. #define DMA_PRINTK( x... )5 P+ c  u/ T8 r" y
  50. #define DMA_FN_IN2 N* f8 \: u# _
  51. #define DMA_FN_OUT
    2 P1 Z+ A! h$ T1 ^7 L0 C( O
  52. #endif1 s5 E  @' B# B% q; \7 M
  53. ( H: z2 C& a' L* W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 o' h/ V* J6 f/ H9 a8 Y% ~* H
  55. #define STATIC_SHIFT                3
    4 p& `0 b3 d  v, _, }* P
  56. #define TCINTEN_SHIFT               20
    3 n1 g. {8 E; g. W: _
  57. #define ITCINTEN_SHIFT              21
    ) N1 K, R! M. n* K8 I8 m4 X
  58. #define TCCHEN_SHIFT                22
    4 j2 ?; g2 c! M) J# F
  59. #define ITCCHEN_SHIFT               23
    4 ?, Y2 n1 ~( S4 a! o* O; x

  60. : j. h; }7 k3 y7 p
  61. static volatile int irqraised1 = 0;3 m6 j$ t6 |* e3 a" m
  62. static volatile int irqraised2 = 0;# h6 ^' H  z# o$ i+ m' t: e8 M

  63. + ~: D0 F. v. |! |& \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?# T0 J: a( d0 b; I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \2 T6 h6 ^, V  t2 x+ ?5 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?8 `! _1 \6 U# ^- J( q, Z! u' [8 E' d

  67. ; _' {/ _9 v( w+ g+ |
  68. dma_addr_t dmaphyssrc1 = 0;1 _' L, f; t' `# N% l
  69. dma_addr_t dmaphyssrc2 = 0;
    ! g' \! V( S3 K& j2 W+ P% a
  70. dma_addr_t dmaphysdest1 = 0;' l" F+ M) Q9 o. ~9 u* G
  71. dma_addr_t dmaphysdest2 = 0;
    9 z+ {: {9 p" ?+ \: S! A+ P

  72. + U) c' O% U3 P4 z7 a
  73. char *dmabufsrc1 = NULL;6 p. W) v. q  f8 |4 X
  74. char *dmabufsrc2 = NULL;2 v0 g" z, M: p
  75. char *dmabufdest1 = NULL;; q% s. H. b$ V0 I: n
  76. char *dmabufdest2 = NULL;- k. Y- O2 x: @

  77. $ x, C& s6 K7 M/ }( C5 H  {
  78. static int acnt = 512;
    ) V/ V7 S3 ]( ?8 g/ G! E
  79. static int bcnt = 8;4 R4 X' L( z% L0 v
  80. static int ccnt = 8;/ F5 H3 m: b4 c- o7 j6 ]. T/ r8 ^+ G
  81. 1 C; q" H7 b7 P  e9 M% O* y5 x6 ]) m
  82. module_param(acnt, int, S_IRUGO);
    ! E4 G9 S) J2 _0 c& k
  83. module_param(bcnt, int, S_IRUGO);; g  e0 I9 @4 m4 f% d! K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) a: s: l- I2 E" ]* h% ~' o: R
0 s; e& t" V, N$ j* d; G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 `  m& d1 h, w6 m% l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 i' V; ~1 L$ Z# ?- @8 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. M' V, v: Q, B- @3 C: f- \3 D: \, [  e  `' O$ A/ B/ O
. o7 S2 ]6 h# E# D0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 13:18 , Processed in 0.040420 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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