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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ U" c7 W' p+ ~* g" p2 i& \/ F
  1. [code]EDMA sample test application
    / m4 M- V- S9 G0 O) x
  2. /*
    , ], @; D- l' r1 ?' p7 E' ^+ H
  3. * edma_test.c
    5 r" N- j: c: Y7 |' e
  4. *% W2 D1 E6 Z( N9 g& w$ G
  5. * brief  EDMA3 Test Application
    0 \( D/ \' V" q9 W
  6. *
    7 d1 W* J, J: B$ q. O; m/ O- n# G
  7. *   This file contains EDMA3 Test code.* ^3 G, g$ V0 n% z* q
  8. *
    ! R0 k! `- Y, F! F  C7 \; Y" u! _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T5 ]% i% i7 o2 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' u  i! `8 J) |* D  `
  11. *         TO CHANGE.
    4 p' y. y; O8 U5 s3 k
  12. *7 C" L' C* u- ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( B5 v3 [# O) \$ I
  14. *" Q( ]6 z; g* e+ B
  15. * This program is free software; you can redistribute it and/or
    : M& e- K8 I6 U+ X3 `- X; n
  16. * modify it under the terms of the GNU General Public License as
    1 f5 G, Y3 \  n9 F. y
  17. * published by the Free Software Foundation version 2.1 j' ^, C7 Y/ ]9 I% ]8 b
  18. *
    & r+ h" v3 N& J3 U3 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : v$ K0 {$ O9 k* k
  20. * kind, whether express or implied; without even the implied warranty6 y; w! e& u4 ?. \5 a, p3 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: B9 |$ f9 U# Q; V+ v7 e
  22. * GNU General Public License for more details.1 L9 F5 V, y3 u2 b: f, i
  23. */& }# ~+ [$ b' x, q
  24. 3 u6 `" ~4 h; C" {
  25. #include <linux/module.h>
    ) ~* o( `9 C% y. B# [# q5 ?
  26. #include <linux/init.h>
    ' J3 U2 P& T3 E4 s& J
  27. #include <linux/errno.h>7 e( ?  ^5 W5 v: I* R* c" t/ s
  28. #include <linux/types.h>
    / h  J8 V8 Z0 @+ L7 Z$ y) \0 A
  29. #include <linux/interrupt.h>4 A6 f2 `, f4 w/ P. Q
  30. #include <asm/io.h>& Q4 U" L6 f# ?
  31. #include <linux/moduleparam.h>% \! g- W  v. d4 L9 s4 k; j1 x
  32. #include <linux/sysctl.h>
    : m! S  J5 ]" M( Z9 D4 k3 J
  33. #include <linux/mm.h>
    9 G& X, F2 m9 ~8 K) i( m
  34. #include <linux/dma-mapping.h>
    $ N  r/ r2 E+ {0 m' U
  35. + `5 i. p+ E, T, {  s, A
  36. #include <mach/memory.h># r9 |( A9 B' b
  37. #include <mach/hardware.h>
    " K) |$ s: o0 v- j
  38. #include <mach/irqs.h>
    2 D( s2 p  z+ z, \' [. J
  39. #include <asm/hardware/edma.h>$ ^/ x6 m, ^8 V; f. t0 ~1 c
  40. ( y7 B$ V8 w4 H3 V
  41. #undef EDMA3_DEBUG9 L# W9 n$ T* D0 R
  42. /*#define EDMA3_DEBUG*/1 _8 u3 L* Z! p

  43. " A: _) ~6 X1 p: y1 C
  44. #ifdef EDMA3_DEBUG! k7 i) r9 ^5 @+ s, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  G: N1 p  c( U4 u) F3 w" l# D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # x9 ^/ j4 }9 `$ S  h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @+ C' b7 f* h0 W9 f4 J9 X
  48. #else
    + }& X( a. w3 p& E
  49. #define DMA_PRINTK( x... )6 n6 H, M% e6 ^, p% @: P/ L
  50. #define DMA_FN_IN" t$ J7 Y& ^9 |4 U! w1 e( U
  51. #define DMA_FN_OUT
    " M4 J6 P/ N8 F# `; _/ t
  52. #endif, J! M6 l3 [5 y* z
  53. % ]& k* J' X" L' ]5 G6 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 m+ u& e: A. c1 p: L5 Z- a
  55. #define STATIC_SHIFT                3
    8 O2 c" Y) \; V* {7 ^. Q7 c) O" M
  56. #define TCINTEN_SHIFT               20) M/ W2 d: Q/ `$ c
  57. #define ITCINTEN_SHIFT              21: Z% J; ?1 Q* O6 S- M! H& U
  58. #define TCCHEN_SHIFT                229 b% }; R9 q3 h$ C* y0 m" ~" a
  59. #define ITCCHEN_SHIFT               23- `4 U, G- ^0 L7 d) R2 F2 f
  60. / @' C' B5 K; z& e: b7 ?9 y% ^
  61. static volatile int irqraised1 = 0;, W1 L# I( j- O( O/ n, ~& S
  62. static volatile int irqraised2 = 0;6 W3 c3 k1 H# R6 a7 [. {! `( j

  63. ! R0 E6 S: L7 I2 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , b; E8 U( R1 ~6 i, `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  B1 `, o6 h% Q; I7 r  K& W, D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ]! V: e" `" B( C+ I. u2 O! S' P& H
  67. ; @# J+ s1 J! z; A1 K5 k+ e
  68. dma_addr_t dmaphyssrc1 = 0;
    # S  o# ?! @. ~2 u- }
  69. dma_addr_t dmaphyssrc2 = 0;
    ) z  l2 S- l0 k; P( `. ^0 u) R5 k1 L
  70. dma_addr_t dmaphysdest1 = 0;/ b2 ]# H( E4 r% }/ j) f4 e: V
  71. dma_addr_t dmaphysdest2 = 0;$ a6 z, h7 W1 e4 f. x
  72. / b5 p; [3 s6 k. V, Q( L+ R
  73. char *dmabufsrc1 = NULL;1 f2 d& J( `6 e9 e: k7 B% q
  74. char *dmabufsrc2 = NULL;* ]+ L, J) W& w& E' |9 G1 c1 j* H
  75. char *dmabufdest1 = NULL;( z. Z4 }1 b7 k$ K1 `
  76. char *dmabufdest2 = NULL;
    : @7 N; C* ]: A& B  z! K

  77. 1 U/ C/ [7 v- E4 C- i# b2 L9 Z
  78. static int acnt = 512;3 E9 P! v; ^! `& [5 n. B
  79. static int bcnt = 8;
    - N, x! P1 G. l
  80. static int ccnt = 8;
    3 F: d9 M+ U- F

  81. # m' l% W9 `+ F
  82. module_param(acnt, int, S_IRUGO);
    ) N' p3 ?( R% g! g4 G8 e# ]
  83. module_param(bcnt, int, S_IRUGO);& U, M- a5 W$ Q4 i$ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ V1 t# x+ k& L$ f" V, m$ H9 A
! q1 n3 g& w% d. `! o0 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 b9 V! Q# M7 F/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h8 g+ M# b: J1 _# _8 K) k! Q7 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- O+ p. X+ d& H! `$ ~2 U
* T6 e- @( ~6 ~4 p$ G# b

. }  u6 p! N$ d* V2 v4 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 06:38 , Processed in 0.039369 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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