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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( @% v: B4 L. F' c$ j7 [+ N  e
  1. [code]EDMA sample test application
    , r) ]9 q  O0 {* ]+ b$ M
  2. /*3 E  S7 g* c0 ~2 `* i
  3. * edma_test.c
    - Q! I& _6 g/ j3 S
  4. *
    0 h2 |  ]7 X/ T9 P
  5. * brief  EDMA3 Test Application7 |0 p" g- J2 o- j
  6. *
    ; s5 r! K) `/ j
  7. *   This file contains EDMA3 Test code.( \& t1 ~4 O5 {, g
  8. *
    5 f6 {( Q6 s9 B/ Q3 H* w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: p9 O( h7 S! Z' Q0 c" K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 q  J0 o, B: f/ b+ A$ ?, _
  11. *         TO CHANGE.0 ]2 V( P, B2 a: N! F
  12. *
    3 R. F! E/ }3 n( a$ c& g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % _( B) k0 x! ^7 ?$ Q: G7 i( l
  14. *
    4 b# I! n" ^; Y4 _/ ?2 ]# @# [
  15. * This program is free software; you can redistribute it and/or4 W: {3 D, a$ B
  16. * modify it under the terms of the GNU General Public License as
    % B3 u, |) k/ {0 Y3 c" a' s
  17. * published by the Free Software Foundation version 2.
    # |/ G- e2 t( j! M8 E2 }0 a
  18. *9 h: V9 Q6 \: l# v* N4 q$ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; @6 z5 K6 }+ i$ K% a; ~; [
  20. * kind, whether express or implied; without even the implied warranty
    # G8 b0 H( F$ E# b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 V% k7 O) Q" J. V9 @
  22. * GNU General Public License for more details.
    % Q( l7 i) A$ v* G" t# n
  23. */3 _8 n( o3 _) }( I; d
  24. / P8 s* y6 @# e6 \4 ~
  25. #include <linux/module.h>
    1 a1 t4 _9 k6 L8 Y) `
  26. #include <linux/init.h>% @" @0 D- L7 U# ~- d2 \
  27. #include <linux/errno.h>9 I" S1 e% W+ q
  28. #include <linux/types.h>% `; X: X3 L& t' L
  29. #include <linux/interrupt.h>  Z+ h6 Z* O; N
  30. #include <asm/io.h>
    $ P* U/ n! F; r% C
  31. #include <linux/moduleparam.h>
    6 }) v% l4 W- v+ v& @5 [
  32. #include <linux/sysctl.h>4 f. t3 d: @! A# y& x' F, `
  33. #include <linux/mm.h>. D6 Q8 ^) g4 L" U3 }# A: ?/ H
  34. #include <linux/dma-mapping.h>
    9 S- i% l, C2 o1 I( p
  35. / Q. i# O, ^4 S0 i
  36. #include <mach/memory.h>5 S+ _9 j  Y  |% `
  37. #include <mach/hardware.h>$ N, P+ \0 t4 U3 K. k. X+ Y* r
  38. #include <mach/irqs.h>
    ' b, R, {) g/ U; J$ g
  39. #include <asm/hardware/edma.h>
    ) e7 a  y, x0 Y7 _/ G: `5 ^4 O1 l  f

  40. 4 S  U' m  i1 d7 r
  41. #undef EDMA3_DEBUG
    & _6 d9 t* [$ N6 q
  42. /*#define EDMA3_DEBUG*/. H; s+ t! B- r% _0 V- q$ x, Z

  43. 7 d+ m3 C' G9 G/ _% q' }( q  s* v7 ]0 P
  44. #ifdef EDMA3_DEBUG
    8 {3 `: I# G. s& ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 M! V7 {  K1 y& t% c% Z+ L2 S: ]0 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 {. [$ ]8 r2 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 s9 J. \; w" o% E0 c& U
  48. #else0 X4 Y9 }4 C' i2 @3 m
  49. #define DMA_PRINTK( x... )& X& S) t8 q  d0 h
  50. #define DMA_FN_IN$ \6 I8 @3 O: o  N. U+ T
  51. #define DMA_FN_OUT& H, J1 l) m& {/ m& S9 T
  52. #endif; y/ q. T$ j0 ~& v

  53. ' G( B. D- T' r2 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( m# J. n0 q: x; f# f
  55. #define STATIC_SHIFT                3+ h2 t" S/ ], U( \1 r0 |6 X
  56. #define TCINTEN_SHIFT               20
    & {( @! |1 g& }0 Z. Q! ^
  57. #define ITCINTEN_SHIFT              21# t* f( N# G; P
  58. #define TCCHEN_SHIFT                221 c  i* Q' O; r- I1 `  `1 g
  59. #define ITCCHEN_SHIFT               23
    2 {5 k7 }3 U" `$ y! J& y9 z
  60. 5 v1 Z2 i) @' M% d- V$ H
  61. static volatile int irqraised1 = 0;
    - o+ y2 J* F' \$ ^( E2 c
  62. static volatile int irqraised2 = 0;2 u0 X2 E2 x9 D: L2 o" }  U

  63. + k2 c. J6 `. m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^% }* m, K* U/ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 B3 l8 Z, [' D4 u: w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 k: s7 W$ B3 q- D7 p# x0 ?4 k

  67. 1 r7 r+ W% f  q; Y. K! L
  68. dma_addr_t dmaphyssrc1 = 0;( f4 {) c5 N! O6 @0 Y9 D2 d
  69. dma_addr_t dmaphyssrc2 = 0;" E5 a. B' m6 l& n& E/ ]
  70. dma_addr_t dmaphysdest1 = 0;0 r/ S4 Y9 G+ k# _/ L* V. @
  71. dma_addr_t dmaphysdest2 = 0;# ]  b5 i8 ~4 H) V$ q
  72.   I: j& R$ Z) _9 j. o( ?! T
  73. char *dmabufsrc1 = NULL;
    % i1 o9 c  U+ i
  74. char *dmabufsrc2 = NULL;( n% q5 g  u4 ~4 F4 v0 w& A
  75. char *dmabufdest1 = NULL;8 F. j( A# \1 E0 Q
  76. char *dmabufdest2 = NULL;5 c. b* g1 w; }! I4 b# `; J
  77. 7 c! h+ z# j3 K; I, b0 m( r
  78. static int acnt = 512;8 C* Q6 \& p) a1 {' j# w( j: J
  79. static int bcnt = 8;) y; t" i) `$ D+ Y3 p5 z5 X
  80. static int ccnt = 8;
    # Y# _2 W' U8 ^4 y9 F# R1 ^9 D

  81. + ?1 @. Z& `) N1 _! P  D$ M, ^
  82. module_param(acnt, int, S_IRUGO);6 u+ E* n7 ~- R% n" s0 n& z! G
  83. module_param(bcnt, int, S_IRUGO);
    0 f5 l7 e& u; u" }* y3 a2 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  [  c$ I6 c  w7 n2 s7 X0 g% S3 y9 `, d' s4 U% T  c2 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, y( }, R4 N0 H/ F  ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  w' y  j( V3 R. w$ r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ E" d' w* j8 E( J. k
6 Q" P% p% O4 g- x5 u$ V4 ~
3 n% E9 }1 b" m2 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 23:57 , Processed in 0.039092 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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