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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " {# g! H- c# C. n3 ]. y, p
  1. [code]EDMA sample test application1 ]6 D( `1 f( a4 w+ D9 q) |; R
  2. /*& _5 Z$ ^/ W' p- W
  3. * edma_test.c: G/ g0 w. v8 o+ l8 V& l: ~3 B
  4. */ F: b! }- ^/ v+ R; P$ J- H( g0 H
  5. * brief  EDMA3 Test Application
      N- ^8 ^  ~+ |
  6. *
    . s& Q, z$ c+ R) B2 y& S+ u% r
  7. *   This file contains EDMA3 Test code.
    ; p6 N) q8 @1 b& `
  8. *
    - h+ N5 V3 O& d; s% f+ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ {; t; q: D6 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# O2 y" ]0 w' k$ _
  11. *         TO CHANGE.+ f, C$ i7 f0 U
  12. *; L5 ~3 f5 {9 ?# U* W/ }  D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % _7 X: u$ k: g3 n$ a: E, N  ?) X
  14. *
    3 p3 P/ o; M2 h4 H2 o: l
  15. * This program is free software; you can redistribute it and/or
    4 a. z8 U& E) b- v) L) f4 I
  16. * modify it under the terms of the GNU General Public License as- ~, A4 `" x' z; e" ?; k: \; {% ^
  17. * published by the Free Software Foundation version 2.  c! N- v1 P& i1 S5 N9 v9 y3 i
  18. *
    % w$ R* p7 W3 N9 m- Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b' \2 ^% u* }2 e3 ^5 I$ x7 X9 p
  20. * kind, whether express or implied; without even the implied warranty
    0 i, y, K. i; B4 x5 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( K% U2 Z5 }# C, J3 J' e4 L, J
  22. * GNU General Public License for more details." V. R& x0 u* g2 q
  23. */
    6 |2 I7 p6 {, f& W  P

  24. 7 C6 m6 E5 `* R
  25. #include <linux/module.h>
    ) v4 t4 a* ]% x7 K3 c& C
  26. #include <linux/init.h>* ]# G$ u2 f! O4 c! r! U, k) b/ `
  27. #include <linux/errno.h>% Q/ X# W0 F4 n7 O1 `* `
  28. #include <linux/types.h>1 T4 N# K+ W7 S
  29. #include <linux/interrupt.h>; H1 `1 ~& W# Z( F) m
  30. #include <asm/io.h>$ n( Y, W$ G6 d: |8 R
  31. #include <linux/moduleparam.h>
    ( Y: j" A; H7 a8 Q. C
  32. #include <linux/sysctl.h>; j) j" q* u. M/ I! q
  33. #include <linux/mm.h>* Q. ^% _* A1 ~# C. v) e
  34. #include <linux/dma-mapping.h>
    9 R2 o. N. I6 c1 e( ]9 Z! E( W

  35. - N- R& d& m0 y
  36. #include <mach/memory.h>0 ~9 h4 ]* w- L7 V& r3 b
  37. #include <mach/hardware.h>! ^7 v. R. O: V- s* d0 }! u
  38. #include <mach/irqs.h>  E' o; k9 S+ f+ g$ j
  39. #include <asm/hardware/edma.h>9 W0 M/ R7 X+ C

  40. 2 l5 q& g: m& z3 D# E
  41. #undef EDMA3_DEBUG
    4 y* M; @) I- k4 o( [2 I
  42. /*#define EDMA3_DEBUG*/
    $ g4 U0 e* ?' m! F6 ]- Q: T8 {3 z
  43. ; ~& z, K  x& E
  44. #ifdef EDMA3_DEBUG
    # |+ B% ^! p2 F) K/ }' ~9 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 A8 O9 h/ B6 B* R3 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + F9 S% i* M+ U8 Q  j; o; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; B- B3 Y$ b. Q, I" v
  48. #else
    5 t8 x- t7 |0 T; y$ L( C
  49. #define DMA_PRINTK( x... )2 u$ [2 i) I! E
  50. #define DMA_FN_IN
    : d- o) B- \3 j* n5 P5 Q
  51. #define DMA_FN_OUT1 Y  O" [; k; Q- `
  52. #endif' y- v5 V" p4 Z# i& s
  53. 2 s$ {0 X* X; _1 {! S6 I/ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 a, G5 {4 x3 u1 w1 u5 U
  55. #define STATIC_SHIFT                3, z0 A0 J, u" ^" C3 P4 m4 h/ R
  56. #define TCINTEN_SHIFT               20. d5 [; k; G! H$ y. k3 n) b8 a
  57. #define ITCINTEN_SHIFT              21! B0 p) u' `6 P3 O2 T1 T
  58. #define TCCHEN_SHIFT                22
    ; {/ m/ f; x0 \7 e
  59. #define ITCCHEN_SHIFT               23
    5 X, z# E5 W! A- i6 i
  60. 0 |; t/ }! Y1 x0 y
  61. static volatile int irqraised1 = 0;
    ; l# h& q, |+ z# o
  62. static volatile int irqraised2 = 0;" g6 r$ _& x" V) n. e
  63. 4 x3 |7 I  o9 Z# b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 G* v2 N/ n5 x! @9 O) I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |+ h4 y9 M$ m' w2 H+ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; N) A/ E: r5 ^; M

  67.   z# x7 _6 ?0 v) u: D
  68. dma_addr_t dmaphyssrc1 = 0;
    9 l! @) D" |. Z- x5 c* M
  69. dma_addr_t dmaphyssrc2 = 0;
      P1 g# Q- J9 q9 A
  70. dma_addr_t dmaphysdest1 = 0;
    2 z4 @8 U5 q8 T3 g0 b1 x" }/ Q
  71. dma_addr_t dmaphysdest2 = 0;  R  b  K5 q3 ?

  72. 2 J# d* U3 r0 ^. u5 U, E
  73. char *dmabufsrc1 = NULL;
    ! p* ^2 M9 m9 v% e' U( j2 B! z
  74. char *dmabufsrc2 = NULL;* K1 E9 Q1 w" s- s) O- V
  75. char *dmabufdest1 = NULL;
    4 l2 C# J) l$ @2 e& V+ Q  I( y% K
  76. char *dmabufdest2 = NULL;
    ) ~& o8 z( S8 V& _

  77. # L" o3 C% t* u! Q
  78. static int acnt = 512;' o, J7 s% D# k* Z3 B, ~
  79. static int bcnt = 8;) U' i5 Y9 p! t5 K  U" f
  80. static int ccnt = 8;6 x# u" i% _- x: F3 @4 J

  81. - O. X1 X' x* l# k/ c" S9 r( L: {
  82. module_param(acnt, int, S_IRUGO);$ d0 T+ y8 e% B( [; _" J8 f* y5 }4 d
  83. module_param(bcnt, int, S_IRUGO);
      j# w; F: z: J( G: _$ i5 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 g1 _8 S$ U; R8 N8 d0 f4 ?9 f7 \

- G- p( G, h" p9 x# d+ ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; R% [9 s2 j- J# l3 \+ a2 h2 Tarm-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 ^6 K6 _  O$ t7 F$ B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [1 Y8 a" }+ c& y: p
5 |2 h' u1 J& |+ I& h5 K) B

; f# |; y8 i/ P/ Z* f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 06:54 , Processed in 0.040550 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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