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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 r, R( B9 L6 @
  1. [code]EDMA sample test application- j' X* `+ D& b) y- J  c+ X
  2. /*
    0 Q( q5 ]9 t. {0 O
  3. * edma_test.c# M0 I. O" G' m7 M! C: ?6 k5 E
  4. *
    4 ?$ _9 [7 h; G# k
  5. * brief  EDMA3 Test Application
    - |+ G% t- |& c" [
  6. *
    , k; c6 b, B/ z; h2 R
  7. *   This file contains EDMA3 Test code.
    ! x. n7 Y. [# I( V
  8. *
    4 f8 Q, n6 S) i( m8 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e( B2 n. }3 p# i3 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T3 v1 Q9 I+ u3 F) E( @: |/ a  P
  11. *         TO CHANGE.
    / i5 e( k* f) F3 r! d' q5 T. Q
  12. *6 x; u6 N  g; {; D7 O! L, ?1 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      ?# ?3 o% y- g+ H. C
  14. *
    ; H5 N& M6 e- h. ^, X) n
  15. * This program is free software; you can redistribute it and/or6 w) W# e& Y. P; N' J3 A
  16. * modify it under the terms of the GNU General Public License as
    ! ?* d9 F, {4 Y5 x) F$ H) u; p+ R4 [
  17. * published by the Free Software Foundation version 2.1 z& r/ m5 H' O2 S1 g
  18. *7 R* g& O* u) o! ~. L+ r  T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 Q) }; a0 A* g) E! P1 D
  20. * kind, whether express or implied; without even the implied warranty; R& w, Z8 s! a+ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ L1 O4 h) a  `1 }8 J
  22. * GNU General Public License for more details.
    # P; f1 }# v6 q4 b! R
  23. */4 w8 W2 X7 C3 F
  24. 8 j9 ^+ Y/ D. Y
  25. #include <linux/module.h>
    ; d) j. g" G& [
  26. #include <linux/init.h>& D) w! }# _$ F
  27. #include <linux/errno.h>0 B5 ]8 j% `4 }/ r; I# _
  28. #include <linux/types.h>
    - W+ n% p; a7 |. G! Y% {
  29. #include <linux/interrupt.h>* j- t. N8 k4 f$ ?
  30. #include <asm/io.h>1 z, a8 T# @' @8 x! @3 `
  31. #include <linux/moduleparam.h>
    % C/ @7 [$ u7 e1 D
  32. #include <linux/sysctl.h>
    , p6 Q; J) Z, o/ j
  33. #include <linux/mm.h>+ F/ j& I' z+ R
  34. #include <linux/dma-mapping.h>- ]' L/ J  ~/ _

  35. # Q' n; l# N7 a
  36. #include <mach/memory.h>! A7 n& v1 Y# `% E
  37. #include <mach/hardware.h>
    2 o2 z; U* n* i2 W% c) A; a
  38. #include <mach/irqs.h>
    . ?6 D  V9 E$ F" R5 L
  39. #include <asm/hardware/edma.h>
    7 h2 c7 s& ?5 T1 u

  40. * K5 [' B% z! Z2 b
  41. #undef EDMA3_DEBUG# j: U: o: t1 J: I- _8 _3 g
  42. /*#define EDMA3_DEBUG*/
    4 D# E, M5 c: |
  43. " ^4 t' u8 n" k( [
  44. #ifdef EDMA3_DEBUG
    ! [9 `. \% v8 z" X2 `. R# g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 a1 z5 W( m+ ^2 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' O$ j( e5 q4 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ~# I) H+ @7 L
  48. #else
    ( f. `$ u* _% ]# Q2 n. q- F$ t
  49. #define DMA_PRINTK( x... )
    ( j2 X* K7 S- J" Z+ L
  50. #define DMA_FN_IN9 C: X' N: [! f" k
  51. #define DMA_FN_OUT" O5 z+ \& c" S5 l
  52. #endif7 P& o3 [1 S5 T* Y! I
  53. 5 T6 {$ T6 d/ W& X6 B% c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & m/ |* ]) r: Z; x- o; [
  55. #define STATIC_SHIFT                3$ [6 `9 P, k% M$ m. a% o* ]% h
  56. #define TCINTEN_SHIFT               20
    & F2 P; ~0 x6 E7 Y5 `8 S# V
  57. #define ITCINTEN_SHIFT              214 f' V% C( \2 N) J
  58. #define TCCHEN_SHIFT                225 c1 T+ x7 S7 ?9 n0 U4 c. W
  59. #define ITCCHEN_SHIFT               237 F- Y5 v  V- Y: L7 n3 ~/ l

  60. 5 m# L. O0 _$ M! w" C' @& k
  61. static volatile int irqraised1 = 0;
    " H5 @, O# }" Z4 {2 x
  62. static volatile int irqraised2 = 0;
    $ o1 s0 ]5 P( X# ^7 o
  63. 8 l; Y% S% c% P; r+ U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m  i1 y' [3 ^& ^+ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P! B# b5 W1 |0 }: V; C5 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L3 u- R8 F0 G: W* m+ A# \
  67. ) F! p9 Q& A% {/ e0 |3 G
  68. dma_addr_t dmaphyssrc1 = 0;; h2 T4 [% Q4 U" x( v5 Y, A0 `; }
  69. dma_addr_t dmaphyssrc2 = 0;6 ~4 h* v( p% {0 D5 d
  70. dma_addr_t dmaphysdest1 = 0;( [; {; I6 U; f3 |! v9 U
  71. dma_addr_t dmaphysdest2 = 0;; ]) @% f; s$ a# l# [7 ]+ ^

  72. % ?# {! K% I1 m. k6 U
  73. char *dmabufsrc1 = NULL;; i: A% K- i0 r( Z2 q9 K7 V4 S
  74. char *dmabufsrc2 = NULL;
    ( d9 w% V" |) W
  75. char *dmabufdest1 = NULL;9 l0 S  `( a. H* _( k" n1 r- W. v
  76. char *dmabufdest2 = NULL;& O& e4 A2 c; T; J" Z% J
  77. % g2 N  |% {5 a3 Y9 B: V2 E
  78. static int acnt = 512;5 E( r2 X2 Y% T$ n7 {6 s* s# X! _
  79. static int bcnt = 8;
    7 n1 e/ B  r* n+ G
  80. static int ccnt = 8;
      U5 ]- w3 ^3 ?, C8 X% s

  81. 4 k" f/ [0 n& l1 v7 e
  82. module_param(acnt, int, S_IRUGO);& b/ z5 m: G) ?& y8 Q
  83. module_param(bcnt, int, S_IRUGO);
    5 N3 X: O1 t9 K9 W8 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' r9 p& E1 I! J: D$ h  F/ l4 r6 ^0 S7 Y+ D$ B, ]9 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; Y' i3 }: H/ e* x
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 H# ^& p& a' d! H9 ]  y1 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  |- P  Y  Z$ `; D1 ~
2 E: J% e$ ^3 o7 K0 j. i" @
& d1 v# L8 ~1 ~/ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 05:05 , Processed in 0.037003 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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