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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # n) x0 m2 N( M; E. p
  1. [code]EDMA sample test application
    ) b* P1 r! o* K$ y" ^& C
  2. /*
    $ n( r# }8 p; i- q
  3. * edma_test.c) B3 l" U# C" }% T: C
  4. *& `, b3 B( w6 {/ l; F0 K. r/ F) k' j
  5. * brief  EDMA3 Test Application. a/ o$ m- V1 Y
  6. *
    ) \% T4 r8 W5 D9 Q, m; E* y
  7. *   This file contains EDMA3 Test code.! i7 N; S! ?; V+ a
  8. ** h  y3 ?7 W0 e# s. e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* h$ a( \  m% ~& u. p1 \) A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ~/ j7 U( E3 b$ p
  11. *         TO CHANGE.* O$ U) x9 x7 r) \% d& W
  12. *( k6 U2 ~) d" P$ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  a! u% z( V) w* t% Q- t8 @( M9 y
  14. *
    ! Y. z6 a: y% ~& l: |7 ?
  15. * This program is free software; you can redistribute it and/or
    5 F* \! S$ L, E; B
  16. * modify it under the terms of the GNU General Public License as) ^" }* K( c8 M9 d
  17. * published by the Free Software Foundation version 2.$ [$ S" o/ n" o9 G/ S- g: d  C9 Z
  18. *
    2 d+ }# z$ r. j$ y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' G- z% h8 m. q
  20. * kind, whether express or implied; without even the implied warranty- j/ s  H" N* A1 ]* |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 `% k8 F) Y. Y) o0 _
  22. * GNU General Public License for more details.( O" T, B5 R+ W: T6 D
  23. */) B, m- ]- @) w; y# o$ F
  24. 4 q% {( K" k1 Q6 a2 q* x2 @- E
  25. #include <linux/module.h>* ]# l- e2 k+ K/ ]2 a- G
  26. #include <linux/init.h>/ f* V* {  h& R0 d! b9 ~
  27. #include <linux/errno.h>
    + q* y, i* c6 m  Z% m
  28. #include <linux/types.h>
    - C6 q" v% z+ s3 A, c3 s5 A
  29. #include <linux/interrupt.h>' W8 ^% L+ h/ u  l9 F% S5 o
  30. #include <asm/io.h>
    % y; M( J! F6 ]+ |7 N
  31. #include <linux/moduleparam.h>& ~' B$ ^* X& P- K- n4 z
  32. #include <linux/sysctl.h>
    & x) @7 m! `0 b! d0 V/ U
  33. #include <linux/mm.h>: Q( w9 `5 j& k7 e5 ?1 c# n) K
  34. #include <linux/dma-mapping.h>
    1 O; i% r( _" W/ F" l! R
  35. % }/ ^% {7 T8 S  b
  36. #include <mach/memory.h>
    4 E' f3 w' n- q, D
  37. #include <mach/hardware.h>
    & O2 N* k9 z6 R$ e$ [, B
  38. #include <mach/irqs.h>
    ; i* u" A/ r# @; p5 A+ i3 z
  39. #include <asm/hardware/edma.h>
    * t( l9 k6 |: U2 z" h
  40. 2 @- [1 ^7 P9 @7 I4 K/ X) {1 |
  41. #undef EDMA3_DEBUG. }5 b$ ?* B9 C6 G" D! _8 P
  42. /*#define EDMA3_DEBUG*/: T$ j+ c% M" p8 t. a/ f! W
  43. * `: ]9 M# r& y3 k: k6 A/ V$ V
  44. #ifdef EDMA3_DEBUG
    . a0 Z% Z) Z! k1 n* \/ H1 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 M$ F9 b% q& R- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" o1 L9 @0 v" Q3 `( a8 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 O, s* Y' e7 L! _3 s( c
  48. #else
    6 h: v$ Q4 B. @4 ?% Q" k( y
  49. #define DMA_PRINTK( x... )
    ; t2 k7 N& N8 `7 b& h
  50. #define DMA_FN_IN6 v: Z4 k/ a4 [- o
  51. #define DMA_FN_OUT
    0 Y+ D5 b# d5 d
  52. #endif) h* b( _! R8 ]+ O5 Q, [
  53. - ~$ ~/ f) x8 N8 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# z4 R8 i( i" @; H
  55. #define STATIC_SHIFT                3
    * m/ z  p' S) b: J( t% t/ D/ l
  56. #define TCINTEN_SHIFT               20
    5 B* I6 t+ [. T
  57. #define ITCINTEN_SHIFT              21
    " Q5 t9 D" a5 b, k/ M* ~
  58. #define TCCHEN_SHIFT                22
    3 p5 K7 ?# ?8 S: P  t0 Y) x2 H
  59. #define ITCCHEN_SHIFT               23# S- E& S: o2 a) s

  60.   X9 ~- d/ s2 C+ ]6 D3 \0 Q0 ]
  61. static volatile int irqraised1 = 0;
    & s5 U, F* k! Y7 w) x
  62. static volatile int irqraised2 = 0;
    % ?& u; Z2 z9 v' @' a- l

  63. + m* B5 c6 U1 B, N' {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 o# }% ?% I. P3 a$ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 S$ g: L7 z8 v" E8 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 Z7 F, N( b) _/ x3 P

  67. * t0 o. V! V; w" {; ?, b
  68. dma_addr_t dmaphyssrc1 = 0;- W' ?  ~  ~0 r, w$ J0 ~2 t
  69. dma_addr_t dmaphyssrc2 = 0;
    ' W; l# g5 q8 C% Z! D1 W5 I
  70. dma_addr_t dmaphysdest1 = 0;
    ; z8 Z$ q8 `0 u8 i6 M1 T! Q
  71. dma_addr_t dmaphysdest2 = 0;
    / k. y2 M! d6 u3 K2 h! u

  72. ( {& R% \- m2 l% X
  73. char *dmabufsrc1 = NULL;0 E; D6 L' n- ~: K# o/ s  O7 |
  74. char *dmabufsrc2 = NULL;
    $ e! q1 _3 C- O4 e  E( B6 z' E' F
  75. char *dmabufdest1 = NULL;" A; U! u- n, m8 [! O% q  ?; H; d% m# E/ g
  76. char *dmabufdest2 = NULL;
    2 I! H8 r) U& b- c6 `/ b5 e7 k' h2 s+ D

  77. " k+ o+ z" G$ u! [3 M  e/ q9 K+ s
  78. static int acnt = 512;/ A- [/ E, b9 X6 t5 g* S9 j
  79. static int bcnt = 8;" u7 E% O" A' R/ v1 G" A
  80. static int ccnt = 8;
    " [1 Q/ g3 M- U" }
  81. + C) {; K  Q6 F2 O7 \
  82. module_param(acnt, int, S_IRUGO);, C* H1 t5 w0 ~
  83. module_param(bcnt, int, S_IRUGO);
    1 B6 l; g) V! y0 R4 _4 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ~. y0 B$ h7 x+ K. {
7 ]4 }" F8 e3 b: o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y4 h; q  @) ?% h( |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 o0 p# l; e: ~# H+ r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z/ s) L( j% _7 m+ g. Q
9 B+ p/ w: g0 o6 n  W5 h6 t4 `  M+ w2 v  ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 00:25 , Processed in 0.037196 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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