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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ]( M" i8 Z! y" I+ X; }
  1. [code]EDMA sample test application
    $ i8 Q, t+ ~  k$ u! }, Z# B0 b
  2. /*
    : E; R. L' J5 E, ~$ }2 \8 T5 v( W3 E
  3. * edma_test.c7 e1 J  Q2 t8 \( m) L: l! h
  4. *. B7 [- c6 H/ B" h
  5. * brief  EDMA3 Test Application0 C" G! q" x0 j% W- T8 V; V+ Y
  6. *
    & }( o+ Y0 }; n+ I% R
  7. *   This file contains EDMA3 Test code.$ f+ }( P8 M. A& j, k7 q$ p9 m
  8. *
    ; L' d* w  `0 p: K! r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o$ W9 I7 Q# Q& W, c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( o6 m( D/ }" ^
  11. *         TO CHANGE.
    + {2 a: |, s& s  l2 A, s
  12. *
    % t" w1 Y2 _  ?; V9 l1 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 U) l- }. Z% y
  14. *
    8 c; @4 e+ D* x, P  X
  15. * This program is free software; you can redistribute it and/or4 H# r1 m# T) Y( j1 C
  16. * modify it under the terms of the GNU General Public License as
    1 }" }2 S; `! L0 a. Q1 B
  17. * published by the Free Software Foundation version 2.
    : F; e( O/ k; I$ f( [. @
  18. *
    + m  E8 ^# N+ J6 d7 j6 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 X1 N- J1 Y9 R; @9 x& t9 ^
  20. * kind, whether express or implied; without even the implied warranty5 U0 F4 R0 U0 p' T$ \, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 \) ~" A' T# D, I! y
  22. * GNU General Public License for more details.7 R+ V/ i* z! l8 R4 n9 l; j3 X
  23. */
    + \0 j5 ^& C. }% h& g
  24.   {! @" Y. N4 [/ ?" {9 T. C
  25. #include <linux/module.h>- Q  {4 E7 @! }+ J1 {, A
  26. #include <linux/init.h>6 [* n) F: @. s8 K% x9 a. E' Z3 s
  27. #include <linux/errno.h>
    1 B" k9 Q* h8 S( P9 T7 n, N8 h
  28. #include <linux/types.h>
    ! P' I; u6 w! Z% y4 F3 E7 D2 I3 f
  29. #include <linux/interrupt.h>
    ! n8 U5 D$ I$ `! a& `, S0 [
  30. #include <asm/io.h>
      f7 ~3 {' S9 t/ v# r
  31. #include <linux/moduleparam.h># R8 h/ `) \: W" ^" B9 @, X
  32. #include <linux/sysctl.h>
    / Y! t5 F9 J. y, C* q
  33. #include <linux/mm.h>
      C) R0 R" ~* o* n+ O
  34. #include <linux/dma-mapping.h>- J8 |/ u6 d5 Y- Y  ~" Q& a

  35. " I' l' C9 j! A- S
  36. #include <mach/memory.h>
    0 c- q" O* j" V) p, i
  37. #include <mach/hardware.h>6 o" B$ u8 t% o1 L
  38. #include <mach/irqs.h>* F4 [2 ?  r( r
  39. #include <asm/hardware/edma.h>$ h4 o' v4 V8 \/ C6 w

  40. - s1 O5 c- `$ z- J- O$ j& _
  41. #undef EDMA3_DEBUG4 U. f/ S, r7 {. b+ C
  42. /*#define EDMA3_DEBUG*/3 m& K" S( x: |
  43. . i- V. I4 N3 N% h, E7 D
  44. #ifdef EDMA3_DEBUG$ C; W1 y( i( m- l6 _2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 R6 B& O: F2 }; e% H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  b; e8 H; }( x# ?* K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # O+ n4 C9 U7 O& j. z! f, o
  48. #else/ B2 H0 @' y% f5 s7 `9 C( ^
  49. #define DMA_PRINTK( x... )
    , f1 h( I, f: C
  50. #define DMA_FN_IN
    ) U; V3 Y$ d1 S5 c" h9 D- V5 k
  51. #define DMA_FN_OUT
    # o7 B) A4 ]9 ~! _0 j
  52. #endif" r" i. X9 Q' R1 z8 |

  53. 7 X5 D! A5 T0 Q3 B+ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / K4 r- B3 @. B1 C
  55. #define STATIC_SHIFT                39 C# n8 |. a3 C9 X* Q$ d8 E
  56. #define TCINTEN_SHIFT               202 n: u4 m9 v' _/ o/ m
  57. #define ITCINTEN_SHIFT              217 S3 z1 c1 Y1 l& l
  58. #define TCCHEN_SHIFT                22
    ( P* }8 y) |& @7 ~0 k& n1 c
  59. #define ITCCHEN_SHIFT               238 M5 r0 U7 t4 c( G
  60. 3 v8 N7 o! ?" J# v7 [
  61. static volatile int irqraised1 = 0;
    / ~$ V3 g: }' ~5 C
  62. static volatile int irqraised2 = 0;
    1 m$ ~0 f0 f; `  w, k& I0 n5 i1 G
  63.   Q5 {9 v& \! Z/ i, q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . y. f) j' t$ c0 L; t; }. A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e) Z' I4 j# ]! H$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V  d* g( P( w% i

  67. # o0 {; L5 O# ?/ e
  68. dma_addr_t dmaphyssrc1 = 0;
    , o' K) Z5 r: h; q# O' V* ^3 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    # @' }# m: W* x. w
  70. dma_addr_t dmaphysdest1 = 0;3 A9 W/ j+ ]/ B9 Q; d' N8 x* f6 d
  71. dma_addr_t dmaphysdest2 = 0;5 Q2 w4 i0 R: x' ]

  72. 7 y/ [' g- [$ b
  73. char *dmabufsrc1 = NULL;
    3 Z. k4 T2 ]& \0 t  w9 Q: M- K
  74. char *dmabufsrc2 = NULL;1 [9 r: ?0 s0 t0 f$ n6 @, w6 k
  75. char *dmabufdest1 = NULL;# M8 {) L; g: x1 B2 Z+ Q
  76. char *dmabufdest2 = NULL;
    . `% ]" M+ \7 K5 v+ i

  77. : c- ?* }& i5 e8 ^% t5 l- v9 b5 i
  78. static int acnt = 512;
    1 M, z  F* t2 n+ f: h9 }
  79. static int bcnt = 8;8 F) V$ x4 o' Q1 z, S2 O( b/ s6 O
  80. static int ccnt = 8;
    4 E! U0 a' x. T+ I/ e2 o$ ^
  81. 2 [  ?2 U8 N( b+ m
  82. module_param(acnt, int, S_IRUGO);7 _  R4 G& U) X  U- X7 A
  83. module_param(bcnt, int, S_IRUGO);$ l% ]$ @2 o" G5 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 Z7 H: n- R& `0 n$ w
3 j. E" q7 l5 g7 |3 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. g7 W) ~0 _' p! u! G8 ?* |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- n: l# m7 c( e5 n/ ]  n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Y6 |% w" t5 G8 Z
2 Z- p+ y4 M/ f' i

- H- k- x: t" J- R' |5 E  [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 03:05 , Processed in 0.039147 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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