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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B; C2 a5 P: t5 G% M' c. i# J
  1. [code]EDMA sample test application
    - H& `9 o) Q+ X
  2. /*
    6 f" F3 Z8 x1 G: T5 b
  3. * edma_test.c
    3 w6 P  w. }" M& W, \4 q0 W! ~
  4. *6 Y3 j/ H6 a/ v. T' H- u* C8 ^
  5. * brief  EDMA3 Test Application. r; I" p/ d* p) s2 V
  6. *
    2 s% t# l$ O4 d% v& H) R
  7. *   This file contains EDMA3 Test code.+ y2 d0 s4 [) n/ g) i) V2 ~! M; J$ U
  8. *
    4 m  Q) w& O4 U9 l) R$ L% A$ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % q/ W1 M2 `: t. Q) o) V; ^  j1 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) B% V( R; p$ d2 q5 H
  11. *         TO CHANGE.4 b5 Q0 J- Z7 \
  12. *1 `# F' Q5 T  _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & m1 X7 m1 {9 @+ U" u! b
  14. *
    4 D/ q  P/ \: p3 R+ P9 ]
  15. * This program is free software; you can redistribute it and/or* F) t3 |+ L, y# U% {
  16. * modify it under the terms of the GNU General Public License as
    1 X4 y  R4 o" s& I! N
  17. * published by the Free Software Foundation version 2.4 S% |! q5 B- ^
  18. *
    ! Q9 }/ x! ^: c1 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 Q8 F( j. y0 C2 Z9 [( g6 W6 Q& \
  20. * kind, whether express or implied; without even the implied warranty+ ]2 A+ h* ~9 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: n  r; L; [! ~; h2 {/ h
  22. * GNU General Public License for more details.
    3 i9 B5 ?: i  S4 b
  23. */: @$ M4 b, E* r. t2 D; R3 p

  24. . N. Q: C. g* k: M( z# v
  25. #include <linux/module.h>/ V, q# E  r( ^9 M! S- j' n
  26. #include <linux/init.h>) z$ b+ ?0 p. p. |. U& m) o2 {
  27. #include <linux/errno.h>
    ( a% X# X! J* P/ g1 k
  28. #include <linux/types.h>
    2 o* \0 {8 a2 m1 c( Z4 ?
  29. #include <linux/interrupt.h>: m' o, f& U" B# O! n, O0 R7 }
  30. #include <asm/io.h>5 l' S- ?7 H3 r. w  l
  31. #include <linux/moduleparam.h>
    $ A& ~3 f  F2 J, w* S' a+ ^
  32. #include <linux/sysctl.h>
    ; i8 @& _9 l- N& x) U& b/ Q' @
  33. #include <linux/mm.h>
    8 o5 s0 d% T  Y! I( ~) A0 c6 s
  34. #include <linux/dma-mapping.h>& n/ a( b8 U5 S1 [/ _

  35. 8 v  @; R9 l) D
  36. #include <mach/memory.h>0 k9 Z* |6 K3 m: f1 r" I( x, q; ~1 G
  37. #include <mach/hardware.h>4 C# t5 o$ B6 b0 a& X8 p. f
  38. #include <mach/irqs.h>" g% s" e" n- f6 s4 l
  39. #include <asm/hardware/edma.h>
    6 d. Z4 W/ k# [

  40. 1 Z0 v9 B$ A, ^2 A: ]% J4 d; |
  41. #undef EDMA3_DEBUG) P/ {9 ~# H9 B3 k
  42. /*#define EDMA3_DEBUG*/4 k& L, b0 L! ^6 Y, V  h

  43. 4 n' A' |7 d, P
  44. #ifdef EDMA3_DEBUG* E) g& G( z9 e3 s0 ~) w/ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m9 a0 i0 Y9 K4 k( l( z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 F# F( l9 t# q. u$ p+ j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; G, H% W. t! N: S0 k
  48. #else4 H4 g4 N& D+ l- g' |' H! a: A- Q
  49. #define DMA_PRINTK( x... )
    5 I2 g* G4 f2 \! R- P
  50. #define DMA_FN_IN& Z5 ]: F/ M, [1 O$ x5 H: j; W
  51. #define DMA_FN_OUT
    2 G. O$ B, k3 e: e
  52. #endif: r( x2 @9 f4 r0 m0 q) h$ C: H
  53. : B) E. G& O1 H+ S$ l. T3 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# i* L( i/ V5 w$ A$ U3 d
  55. #define STATIC_SHIFT                3, O) {! ^( l2 {) `1 N% E
  56. #define TCINTEN_SHIFT               20
    6 G, Z( @  p  R8 {  C& Q
  57. #define ITCINTEN_SHIFT              21) y$ w+ ?/ \& r# G* e
  58. #define TCCHEN_SHIFT                22  D7 b& y: Y" K' f
  59. #define ITCCHEN_SHIFT               234 P/ c. [) J' N& ^- \2 g
  60. 3 g/ d! V# n5 [5 t6 S$ ^; G
  61. static volatile int irqraised1 = 0;
    + \5 t, l& R2 Z: c8 M
  62. static volatile int irqraised2 = 0;
    + ^1 O9 [( V+ u; L- ?0 F, R3 a0 q
  63. - p5 g" ?4 Z  a9 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _8 |) {9 K4 I+ F" B$ J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 q4 Z1 E- E. u/ q2 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % _( O8 @5 w+ t
  67. & c- l9 R2 t, x' e
  68. dma_addr_t dmaphyssrc1 = 0;
    0 P. l2 l- Z$ Q, O& Y* ?: j2 X
  69. dma_addr_t dmaphyssrc2 = 0;
    1 ?! W, B! a  r! V) ?
  70. dma_addr_t dmaphysdest1 = 0;
    8 w+ q6 p2 v4 S5 `8 U- w
  71. dma_addr_t dmaphysdest2 = 0;
    ; A/ V- ^$ i8 c6 T* q
  72. " ^+ Y( F! A% a# B# \' O
  73. char *dmabufsrc1 = NULL;
    + ?8 C( ^8 w. Z' h5 `
  74. char *dmabufsrc2 = NULL;
    " `) n% D9 x- B
  75. char *dmabufdest1 = NULL;
    8 u5 L( c; i9 @- b9 n; k9 v
  76. char *dmabufdest2 = NULL;* @  W& t! Q! b7 X/ t

  77. - G; a' k. M* u- j  W0 H
  78. static int acnt = 512;; S5 R. ~; \+ G* ^$ V
  79. static int bcnt = 8;1 j  H; q$ M2 Q: u
  80. static int ccnt = 8;0 k) D8 a$ `# @0 B8 J
  81. ' |" S/ s- K/ f# ?$ I
  82. module_param(acnt, int, S_IRUGO);& n9 G' f; f1 Q& o* [
  83. module_param(bcnt, int, S_IRUGO);8 F+ \* C. `: _. t3 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% v% ?- \% Q3 P% G

( d7 J5 z* M* K9 }6 ?' j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( M" d1 B6 e5 d  z# ~  {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E5 ?, j& t9 L" h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, N4 b" J% z  u2 n

# j0 W! ~; K: v- I7 r1 y6 O; `
9 \1 e+ q7 S3 H0 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 13:43 , Processed in 0.038750 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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