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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 c9 K: {8 n+ k9 }5 p; _
  1. [code]EDMA sample test application
    2 x- \, r% B, t
  2. /*' c1 e8 P1 K0 Z( p% `9 d
  3. * edma_test.c* x; P' l' @0 N. m! e! t8 Y. I
  4. *
    ' c2 M1 ?6 C0 _; P- F
  5. * brief  EDMA3 Test Application8 e& w- ?) H1 U8 i
  6. *
    . C' c6 b3 q, W5 C
  7. *   This file contains EDMA3 Test code., u, ]" G, C) w- v. z* _
  8. *' X( f* b7 \" K! T5 B+ d' s  e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " S5 C, r9 ?! R0 f: ?) q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 {( ^6 l- S; ?7 U1 w
  11. *         TO CHANGE.. L. S5 D1 T  _8 o8 D# h4 u3 t
  12. *
    5 D4 |3 {$ b: q* C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 t7 A' W, {! G, z, e6 D
  14. *
    " J; t0 _/ w3 `( ^8 k6 u5 f
  15. * This program is free software; you can redistribute it and/or
    4 n5 n; \2 M! r6 B
  16. * modify it under the terms of the GNU General Public License as
    : V% S: t  }7 ^( k+ [4 B
  17. * published by the Free Software Foundation version 2.
    ( C: x' T% O1 {* j5 N8 K
  18. *
    8 K! e! M3 J9 Z! v9 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 o: s6 @& j9 b" j2 h
  20. * kind, whether express or implied; without even the implied warranty
    1 d9 H6 [# M% ]& ~( Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' f6 p' ^' C/ l$ l
  22. * GNU General Public License for more details.
    4 |4 _  l3 N) e+ v+ u" V5 F
  23. */
    6 i/ H. G$ a- p  y; c! X. G5 \
  24. $ q. P$ ^% a8 k( ]
  25. #include <linux/module.h>
    # s/ a* D# y1 U$ r% Y
  26. #include <linux/init.h>
    0 f3 u4 c- Q" Z& b! _; m+ C
  27. #include <linux/errno.h>
    % f( b$ a0 k+ k  b# X
  28. #include <linux/types.h>" T8 a/ g  s$ \2 r: H
  29. #include <linux/interrupt.h>6 f* D4 D4 v# P' J0 M+ N. z
  30. #include <asm/io.h>) j5 q; G$ L3 \5 Z
  31. #include <linux/moduleparam.h>
    + {4 ]0 u6 u2 l% X' I
  32. #include <linux/sysctl.h>5 M. e/ K6 e/ o. ]* Q" T$ K% f# E1 B
  33. #include <linux/mm.h>
    ) M' F* }8 Z* c7 ^/ x/ }3 M
  34. #include <linux/dma-mapping.h>
    1 E8 m9 e1 M/ y
  35. + M8 N5 q, w% ~$ X3 q
  36. #include <mach/memory.h>
    ' T" L9 ~, P3 \! M" j8 b
  37. #include <mach/hardware.h>
    6 l* i7 Z% m+ T; Z
  38. #include <mach/irqs.h>
    ' K) [! o; W3 I4 {9 E' v
  39. #include <asm/hardware/edma.h>3 G$ a4 c6 H' I% ]
  40. * f# j: r/ `( o* r8 q1 ]$ p3 r. w
  41. #undef EDMA3_DEBUG
    ( v- T: j" D: ?5 q- S
  42. /*#define EDMA3_DEBUG*/) G5 _* s; Q1 n7 l5 z

  43. $ _, R( ?5 T4 O, Y& i
  44. #ifdef EDMA3_DEBUG; m9 |) k/ I0 z5 E( n: a* A% Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ]- ~8 x) {: z4 z, J& B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ I4 ]6 @' x- s- H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* J8 f4 h) Z+ ?
  48. #else) d  r  M. c" \# g
  49. #define DMA_PRINTK( x... )
    - g- q; F, h+ H' M
  50. #define DMA_FN_IN$ f' \/ d4 c9 R; V5 w
  51. #define DMA_FN_OUT. }" D! o4 g# K5 v4 D* Z
  52. #endif8 \1 [% T' a" m$ O( e* T
  53. 5 D  s( r. y/ c" z  {2 W% E4 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ q, @, L( T3 V) l; J
  55. #define STATIC_SHIFT                3" x3 I4 o. E% p
  56. #define TCINTEN_SHIFT               20
    3 b. O: E! D7 F' A& z0 y; g
  57. #define ITCINTEN_SHIFT              21# H/ s+ d3 f* H$ T* n1 m
  58. #define TCCHEN_SHIFT                228 G0 y% y# D* z+ y0 G8 p; r
  59. #define ITCCHEN_SHIFT               23
    8 M6 B. Q9 ]' G# G# n
  60. * y) V* }' Q  Z8 X* D
  61. static volatile int irqraised1 = 0;! f. U: {1 l, N' T4 }: a! ?9 I! D
  62. static volatile int irqraised2 = 0;: w+ z+ q: N8 l$ N7 m
  63. ' K0 e2 H* s$ d# W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; t- N0 g' ?# {/ K3 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 p3 X! h$ s/ {7 O- C- Y  ~) G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W  N- @( `6 Y

  67. ) \) D; E) h) g: W$ Z
  68. dma_addr_t dmaphyssrc1 = 0;
    1 K2 l+ J! K; p9 L, G- j3 e0 i
  69. dma_addr_t dmaphyssrc2 = 0;
    " d% ]$ a) Z7 A+ U* T! q5 a
  70. dma_addr_t dmaphysdest1 = 0;
    4 j2 }9 L0 P' [* D
  71. dma_addr_t dmaphysdest2 = 0;( Z! Z' C$ |; `# F' f/ r1 d3 p

  72. 7 x4 h* _' D- ?8 z& t
  73. char *dmabufsrc1 = NULL;# C0 c) i; @# ?( @! U
  74. char *dmabufsrc2 = NULL;* B4 l2 s: k) ^: ]& J( x6 G
  75. char *dmabufdest1 = NULL;
    ( m+ Z& K- i+ `" L) G! z5 z$ @
  76. char *dmabufdest2 = NULL;
    ' O" u6 b. ?% h2 C9 ]! @9 Z3 k- y

  77. ' l* n' R+ z, M1 q3 ?5 l
  78. static int acnt = 512;& z' U  I! w+ _5 V# k5 T
  79. static int bcnt = 8;( E& ?, \# K) }/ S2 {; L0 |6 ]) R
  80. static int ccnt = 8;
    ' U, D- B# F1 l" V' q9 `
  81. 6 s: M4 f8 `( k- Z. Y9 u( e( I2 e
  82. module_param(acnt, int, S_IRUGO);
    1 o  S8 f! D0 Q! Z. F$ y( i
  83. module_param(bcnt, int, S_IRUGO);7 z0 z7 N5 D* w# [1 L; g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( s% n8 y: T, _- x) ~* c
0 ?5 h  F# L: V/ w# o2 g9 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L5 k9 k5 L4 x) J! l7 q/ t6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 Y& W9 |( F, ~6 Y6 w, ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 s( p! K& _" G! c, H( T) d

& v, Y9 S+ }4 }% _9 J  o
7 ^0 u( K9 \& E$ R& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 06:12 , Processed in 0.036347 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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