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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 w5 o; E8 [* I- L! d
  1. [code]EDMA sample test application' q% x1 ?( O, K4 w1 ?
  2. /*. n, ^" b5 L) [( _; q3 n
  3. * edma_test.c
    ) V( @6 _' s5 y* C( _
  4. *
    ( Y8 w3 T# @4 @5 y8 n: |
  5. * brief  EDMA3 Test Application
    5 w* ]' }% e( S* `
  6. *; R: t* c1 X9 U4 R' Q# r8 q6 C
  7. *   This file contains EDMA3 Test code.: R7 F, n8 V8 @: r8 s; @6 |
  8. *
    . Q% l3 Z" B: |0 t, T$ g- t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  u# m( }) }- p7 @4 x/ A# t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o( B8 b/ N) n# p5 u! y) [' [6 i
  11. *         TO CHANGE.
    + D; t% y% a: g2 Y4 A. C% h
  12. *
    1 _+ ?5 h7 Y) p5 V9 q( D( Z) U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Z0 |* _) v& I4 Y# H: L
  14. *% x3 t' y5 ^3 X2 ^& @% n" P3 \
  15. * This program is free software; you can redistribute it and/or
    0 ^% ]$ f. \5 O% m
  16. * modify it under the terms of the GNU General Public License as
    , g! R% n8 |3 s
  17. * published by the Free Software Foundation version 2.
    & ?# @6 T. D0 d9 B5 o
  18. *% Z- r; G) m3 C7 m3 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: s7 ]& W1 b  t( L( }& }' ]# e
  20. * kind, whether express or implied; without even the implied warranty
    0 g3 E' @  h& x* X- d# \, m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. O2 y. `  d/ S* p. o3 x
  22. * GNU General Public License for more details.
      _( _- W1 s- i6 e& `, W4 w
  23. */1 X- e4 h/ d5 {. P

  24. 3 l: s3 z. {8 T+ S
  25. #include <linux/module.h>
      e/ h& b) a6 J9 o# V9 D
  26. #include <linux/init.h>/ F0 C6 c0 q) n- [
  27. #include <linux/errno.h>$ Z% H2 R" w: k% {. \: Z' N: `; f" V) k
  28. #include <linux/types.h>
    " ~4 }- G; E' r( k/ |1 o0 u1 n' |
  29. #include <linux/interrupt.h>' b& I0 R5 H7 g: K' Q& H
  30. #include <asm/io.h>
    $ S( C' i% h- d/ u$ s1 D0 \. \# O
  31. #include <linux/moduleparam.h>5 p5 g$ o$ {; I: R) V
  32. #include <linux/sysctl.h>  ]: h  ~2 B/ O' ?) a
  33. #include <linux/mm.h>2 W' L+ Y' D9 r( E' s- {! [
  34. #include <linux/dma-mapping.h>* Q8 t, S" z9 S" `

  35. 7 j) x; |) [  |$ r  J
  36. #include <mach/memory.h>2 e( T1 Z( S5 I9 R3 K* `
  37. #include <mach/hardware.h>
    * P7 G. k4 Z" t  C! _
  38. #include <mach/irqs.h>( N% g1 d2 T8 r1 g  A
  39. #include <asm/hardware/edma.h>5 p- a4 a( O1 u. B3 G
  40. * x8 C0 z* \6 ^( X8 j
  41. #undef EDMA3_DEBUG- J" ^" E# x% L7 i  V8 _5 _
  42. /*#define EDMA3_DEBUG*// Y: b# T1 U- r! Y
  43. / X; |+ a5 O6 ?/ e8 \& a
  44. #ifdef EDMA3_DEBUG
    , R0 x5 G: f; t! B1 v3 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 s3 S! Y# q5 Q5 t; }9 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' v4 V% W& Q/ c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& r5 x7 U7 W  d
  48. #else4 ~1 p3 B2 i0 M. a  i! a" k
  49. #define DMA_PRINTK( x... )
    # x/ j0 s* K1 D# e& ?
  50. #define DMA_FN_IN+ `% w2 B6 D5 W) T
  51. #define DMA_FN_OUT
    5 |' w4 Z" M+ ]! J! T
  52. #endif
    + t+ O- u2 p# a& D( ?7 _
  53. : U9 X, B1 `0 t3 u' g: v* b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 j7 `, u( X2 _" b" I, j0 a
  55. #define STATIC_SHIFT                3" K, T4 G. W* q
  56. #define TCINTEN_SHIFT               202 D; l! J. ]6 r/ |" }% Z
  57. #define ITCINTEN_SHIFT              21
    3 M. A" Y0 [4 E$ S
  58. #define TCCHEN_SHIFT                22, Y/ H7 n1 I( A' K4 v9 Y5 F3 J
  59. #define ITCCHEN_SHIFT               23
    $ {- v' Z* B4 a' y7 i4 k2 P

  60. ' X  G6 `2 Q2 s7 D# a
  61. static volatile int irqraised1 = 0;$ Z- r7 _3 k2 U. R
  62. static volatile int irqraised2 = 0;
    5 O9 d& i( T9 A+ w$ N4 }8 C$ c( I
  63. 7 D' r: g: y$ A( T4 c! b  ^7 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g: f' }% d& v6 G7 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 _2 K  J4 x" }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " {& v0 i* a7 i0 o1 ~& j5 e

  67. 6 {8 E' C- J! `+ L: z- M" a( [
  68. dma_addr_t dmaphyssrc1 = 0;3 f8 c, U+ O7 t
  69. dma_addr_t dmaphyssrc2 = 0;
    " v, s% O  u9 p$ w
  70. dma_addr_t dmaphysdest1 = 0;' {; u) `" T# F7 j: J
  71. dma_addr_t dmaphysdest2 = 0;
    ; V/ {/ N* y% F/ W) P9 S6 `* f& f( O; |
  72. 8 J$ Y! W+ ?( i$ e; l
  73. char *dmabufsrc1 = NULL;/ }* F: p3 `+ O5 Y+ l
  74. char *dmabufsrc2 = NULL;( K( X* m+ x, e% B0 h1 {( X: p
  75. char *dmabufdest1 = NULL;0 N8 \0 D3 U* C$ h  i
  76. char *dmabufdest2 = NULL;+ V, }9 D% a0 I3 q
  77. + G4 [/ ^0 _* h% S* P5 q
  78. static int acnt = 512;, v$ o" j8 s; z- t; {, T+ z
  79. static int bcnt = 8;
    7 x% {9 v' S$ K9 n$ z; W
  80. static int ccnt = 8;
    * x2 {6 [: j) T5 {- @
  81. $ f- T0 k! R9 @5 i# y) d1 t; o
  82. module_param(acnt, int, S_IRUGO);
    $ E/ w6 V/ p1 k$ K8 [- S6 n  p
  83. module_param(bcnt, int, S_IRUGO);, w! L, J, B' B6 L' r" ?, I: x3 _# {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( F3 X' K  q, Z( g% w0 _; |/ }/ [
' j7 z1 r1 u! K! }5 }9 r+ q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' K) m5 C% k3 B  o% t$ P4 s2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ a0 Z3 \( F/ X8 E/ e7 i# q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' l0 S' n& s* a# X7 {$ j
; h1 k$ b  ?7 ~: |
3 o. H1 e, N6 ~: d; u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 06:24 , Processed in 0.039853 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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